From 7d36745a32f3c86270cf9895b713bc9dc15f9be4 Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 25 Jan 2024 15:23:25 +0000 Subject: [PATCH 01/54] feat: delete conflicting directorys for re-scaffolding --- app/app.go | 1140 - app/encoding.go | 35 - app/export.go | 204 - app/genesis.go | 21 - app/params/encoding.go | 16 - app/simulation_test.go | 501 - cmd/pocketd/cmd/config.go | 27 - cmd/pocketd/cmd/genaccounts.go | 192 - cmd/pocketd/cmd/root.go | 386 - cmd/pocketd/main.go | 24 - cmd/signals/on_exit.go | 24 - config.yml | 118 - docs/docs.go | 40 - docs/static/openapi.yml | 79362 ---------------- docs/template/index.tpl | 28 - docs/template/pkg/README.md | 88 - go.mod | 313 - go.sum | 2932 - proto/pocket/application/application.proto | 18 - proto/pocket/application/event.proto | 15 - proto/pocket/application/genesis.proto | 16 - proto/pocket/application/params.proto | 14 - proto/pocket/application/query.proto | 55 - proto/pocket/application/tx.proto | 51 - proto/pocket/gateway/gateway.proto | 13 - proto/pocket/gateway/genesis.proto | 16 - proto/pocket/gateway/params.proto | 12 - proto/pocket/gateway/query.proto | 55 - proto/pocket/gateway/tx.proto | 31 - proto/pocket/pocket/genesis.proto | 12 - proto/pocket/pocket/params.proto | 12 - proto/pocket/pocket/query.proto | 25 - proto/pocket/pocket/tx.proto | 7 - proto/pocket/service/genesis.proto | 14 - proto/pocket/service/params.proto | 17 - proto/pocket/service/query.proto | 25 - proto/pocket/service/relay.proto | 47 - proto/pocket/service/tx.proto | 30 - proto/pocket/session/genesis.proto | 12 - proto/pocket/session/params.proto | 12 - proto/pocket/session/query.proto | 46 - proto/pocket/session/session.proto | 33 - proto/pocket/session/tx.proto | 7 - proto/pocket/shared/service.proto | 66 - proto/pocket/shared/supplier.proto | 18 - proto/pocket/supplier/claim.proto | 16 - proto/pocket/supplier/genesis.proto | 16 - proto/pocket/supplier/params.proto | 13 - proto/pocket/supplier/proof.proto | 16 - proto/pocket/supplier/query.proto | 124 - proto/pocket/supplier/tx.proto | 63 - proto/pocket/tokenomics/genesis.proto | 13 - proto/pocket/tokenomics/params.proto | 28 - proto/pocket/tokenomics/query.proto | 30 - proto/pocket/tokenomics/tx.proto | 34 - testutil/keeper/application.go | 107 - testutil/keeper/gateway.go | 61 - testutil/keeper/pocket.go | 53 - testutil/keeper/service.go | 119 - testutil/keeper/session.go | 223 - testutil/keeper/supplier.go | 97 - testutil/keeper/tokenomics.go | 130 - testutil/network/config.go | 90 - testutil/network/interface.go | 34 - testutil/network/network.go | 364 - testutil/network/types.go | 66 - testutil/nullify/nullify.go | 57 - testutil/sample/sample.go | 28 - x/application/client/cli/helpers_test.go | 33 - x/application/client/cli/query.go | 33 - x/application/client/cli/query_application.go | 78 - .../client/cli/query_application_test.go | 139 - x/application/client/cli/query_params.go | 36 - x/application/client/cli/tx.go | 41 - .../client/cli/tx_delegate_to_gateway.go | 49 - .../client/cli/tx_delegate_to_gateway_test.go | 117 - .../client/cli/tx_stake_application.go | 66 - .../client/cli/tx_stake_application_test.go | 235 - .../client/cli/tx_undelegate_from_gateway.go | 49 - .../cli/tx_undelegate_from_gateway_test.go | 117 - .../client/cli/tx_unstake_application.go | 47 - .../client/cli/tx_unstake_application_test.go | 97 - .../config/application_configs_reader.go | 91 - .../config/application_configs_reader_test.go | 143 - x/application/client/config/errors.go | 11 - x/application/genesis.go | 29 - x/application/genesis_test.go | 54 - x/application/keeper/application.go | 64 - x/application/keeper/application_test.go | 86 - x/application/keeper/keeper.go | 57 - x/application/keeper/msg_server.go | 17 - .../keeper/msg_server_delegate_to_gateway.go | 70 - .../msg_server_delegate_to_gateway_test.go | 280 - .../keeper/msg_server_stake_application.go | 105 - .../msg_server_stake_application_test.go | 181 - x/application/keeper/msg_server_test.go | 24 - .../msg_server_undelegate_from_gateway.go | 63 - ...msg_server_undelegate_from_gateway_test.go | 257 - .../keeper/msg_server_unstake_application.go | 50 - .../msg_server_unstake_application_test.go | 81 - x/application/keeper/params.go | 17 - x/application/keeper/params_test.go | 19 - x/application/keeper/query.go | 7 - x/application/keeper/query_application.go | 59 - .../keeper/query_application_test.go | 127 - x/application/keeper/query_params.go | 20 - x/application/keeper/query_params_test.go | 22 - x/application/module.go | 150 - x/application/module_simulation.go | 157 - .../simulation/delegate_to_gateway.go | 32 - x/application/simulation/helpers.go | 15 - x/application/simulation/stake_application.go | 32 - .../simulation/undelegate_from_gateway.go | 32 - .../simulation/unstake_application.go | 32 - x/application/types/codec.go | 37 - x/application/types/errors.go | 22 - x/application/types/expected_keepers.go | 26 - x/application/types/genesis.go | 74 - x/application/types/genesis_test.go | 388 - x/application/types/key_application.go | 23 - x/application/types/keys.go | 19 - .../types/message_delegate_to_gateway.go | 57 - .../types/message_delegate_to_gateway_test.go | 56 - .../types/message_stake_application.go | 83 - .../types/message_stake_application_test.go | 172 - .../types/message_undelegate_from_gateway.go | 57 - .../message_undelegate_from_gateway_test.go | 56 - .../types/message_unstake_application.go | 45 - .../types/message_unstake_application_test.go | 46 - x/application/types/params.go | 46 - x/application/types/types.go | 1 - x/gateway/client/cli/helpers_test.go | 31 - x/gateway/client/cli/query.go | 33 - x/gateway/client/cli/query_gateway.go | 78 - x/gateway/client/cli/query_gateway_test.go | 142 - x/gateway/client/cli/query_params.go | 36 - x/gateway/client/cli/tx.go | 36 - x/gateway/client/cli/tx_stake_gateway.go | 61 - x/gateway/client/cli/tx_stake_gateway_test.go | 150 - x/gateway/client/cli/tx_unstake_gateway.go | 44 - .../client/cli/tx_unstake_gateway_test.go | 97 - x/gateway/client/config/errors.go | 10 - .../client/config/gateway_config_reader.go | 62 - .../config/gateway_config_reader_test.go | 83 - x/gateway/genesis.go | 29 - x/gateway/genesis_test.go | 39 - x/gateway/keeper/gateway.go | 64 - x/gateway/keeper/gateway_test.go | 76 - x/gateway/keeper/keeper.go | 51 - x/gateway/keeper/msg_server.go | 17 - x/gateway/keeper/msg_server_stake_gateway.go | 91 - .../keeper/msg_server_stake_gateway_test.go | 93 - x/gateway/keeper/msg_server_test.go | 24 - .../keeper/msg_server_unstake_gateway.go | 54 - .../keeper/msg_server_unstake_gateway_test.go | 74 - x/gateway/keeper/params.go | 17 - x/gateway/keeper/params_test.go | 19 - x/gateway/keeper/query.go | 7 - x/gateway/keeper/query_gateway.go | 59 - x/gateway/keeper/query_gateway_test.go | 127 - x/gateway/keeper/query_params.go | 20 - x/gateway/keeper/query_params_test.go | 22 - x/gateway/module.go | 150 - x/gateway/module_simulation.go | 111 - x/gateway/simulation/helpers.go | 15 - x/gateway/simulation/stake_gateway.go | 30 - x/gateway/simulation/unstake_gateway.go | 30 - x/gateway/types/codec.go | 31 - x/gateway/types/errors.go | 15 - x/gateway/types/expected_keepers.go | 20 - x/gateway/types/genesis.go | 53 - x/gateway/types/genesis_test.go | 171 - x/gateway/types/key_gateway.go | 23 - x/gateway/types/keys.go | 19 - x/gateway/types/message_stake_gateway.go | 66 - x/gateway/types/message_stake_gateway_test.go | 80 - x/gateway/types/message_unstake_gateway.go | 46 - .../types/message_unstake_gateway_test.go | 44 - x/gateway/types/params.go | 39 - x/gateway/types/types.go | 1 - x/pocket/client/cli/query.go | 31 - x/pocket/client/cli/query_params.go | 36 - x/pocket/client/cli/tx.go | 36 - x/pocket/genesis.go | 24 - x/pocket/genesis_test.go | 30 - x/pocket/keeper/keeper.go | 46 - x/pocket/keeper/msg_server.go | 17 - x/pocket/keeper/msg_server_test.go | 24 - x/pocket/keeper/params.go | 17 - x/pocket/keeper/params_test.go | 19 - x/pocket/keeper/query.go | 7 - x/pocket/keeper/query_params.go | 20 - x/pocket/keeper/query_params_test.go | 22 - x/pocket/module.go | 150 - x/pocket/module_simulation.go | 65 - x/pocket/simulation/helpers.go | 15 - x/pocket/types/codec.go | 24 - x/pocket/types/errors.go | 12 - x/pocket/types/expected_keepers.go | 18 - x/pocket/types/genesis.go | 24 - x/pocket/types/genesis_test.go | 42 - x/pocket/types/keys.go | 19 - x/pocket/types/params.go | 39 - x/pocket/types/types.go | 1 - x/service/client/cli/query.go | 31 - x/service/client/cli/query_params.go | 36 - x/service/client/cli/tx.go | 37 - x/service/client/cli/tx_add_service.go | 51 - x/service/client/cli/tx_add_service_test.go | 143 - x/service/genesis.go | 29 - x/service/genesis_test.go | 41 - x/service/keeper/keeper.go | 54 - x/service/keeper/msg_server.go | 17 - x/service/keeper/msg_server_add_service.go | 85 - .../keeper/msg_server_add_service_test.go | 199 - x/service/keeper/msg_server_test.go | 23 - x/service/keeper/params.go | 17 - x/service/keeper/params_test.go | 19 - x/service/keeper/query.go | 7 - x/service/keeper/query_params.go | 20 - x/service/keeper/query_params_test.go | 22 - x/service/keeper/service.go | 75 - x/service/keeper/service_test.go | 79 - x/service/module.go | 150 - x/service/module_simulation.go | 88 - x/service/simulation/add_service.go | 37 - x/service/simulation/helpers.go | 15 - x/service/types/codec.go | 29 - x/service/types/errors.go | 17 - x/service/types/expected_keepers.go | 24 - x/service/types/genesis.go | 40 - x/service/types/genesis_test.go | 94 - x/service/types/key_service.go | 23 - x/service/types/keys.go | 30 - x/service/types/message_add_service.go | 62 - x/service/types/message_add_service_test.go | 58 - x/service/types/params.go | 54 - x/service/types/relay.go | 57 - x/service/types/types.go | 1 - x/session/client/cli/helpers_test.go | 44 - x/session/client/cli/query.go | 33 - x/session/client/cli/query_get_session.go | 65 - .../client/cli/query_get_session_test.go | 197 - x/session/client/cli/query_params.go | 36 - x/session/client/cli/tx.go | 36 - x/session/genesis.go | 24 - x/session/genesis_test.go | 30 - x/session/keeper/keeper.go | 74 - x/session/keeper/msg_server.go | 17 - x/session/keeper/msg_server_test.go | 24 - x/session/keeper/params.go | 17 - x/session/keeper/params_test.go | 19 - x/session/keeper/query.go | 7 - x/session/keeper/query_get_session.go | 45 - x/session/keeper/query_get_session_test.go | 169 - x/session/keeper/query_params.go | 20 - x/session/keeper/query_params_test.go | 22 - x/session/keeper/session_hydrator.go | 306 - x/session/keeper/session_hydrator_test.go | 359 - x/session/module.go | 148 - x/session/module_simulation.go | 65 - x/session/simulation/helpers.go | 15 - x/session/types/codec.go | 24 - x/session/types/errors.go | 19 - x/session/types/expected_keepers.go | 29 - x/session/types/genesis.go | 24 - x/session/types/genesis_test.go | 42 - x/session/types/keys.go | 19 - x/session/types/params.go | 39 - x/session/types/query_get_session_request.go | 39 - x/session/types/types.go | 1 - x/shared/helpers/service.go | 86 - x/shared/helpers/service_configs.go | 81 - x/shared/helpers/service_test.go | 261 - x/shared/types/types.go | 3 - x/supplier/client/cli/flags.go | 7 - x/supplier/client/cli/helpers_test.go | 260 - x/supplier/client/cli/query.go | 33 - x/supplier/client/cli/query_claim.go | 172 - x/supplier/client/cli/query_claim_test.go | 284 - x/supplier/client/cli/query_params.go | 36 - x/supplier/client/cli/query_proof.go | 165 - x/supplier/client/cli/query_proof_test.go | 145 - x/supplier/client/cli/query_supplier.go | 78 - x/supplier/client/cli/query_supplier_test.go | 139 - x/supplier/client/cli/tx.go | 39 - x/supplier/client/cli/tx_create_claim.go | 68 - x/supplier/client/cli/tx_stake_supplier.go | 67 - .../client/cli/tx_stake_supplier_test.go | 297 - x/supplier/client/cli/tx_submit_proof.go | 65 - x/supplier/client/cli/tx_unstake_supplier.go | 42 - .../client/cli/tx_unstake_supplier_test.go | 97 - x/supplier/client/config/errors.go | 15 - .../client/config/supplier_configs_reader.go | 193 - .../config/supplier_configs_reader_test.go | 407 - x/supplier/genesis.go | 30 - x/supplier/genesis_test.go | 72 - x/supplier/keeper/claim.go | 160 - x/supplier/keeper/claim_test.go | 116 - x/supplier/keeper/keeper.go | 60 - x/supplier/keeper/msg_server.go | 17 - x/supplier/keeper/msg_server_create_claim.go | 75 - .../keeper/msg_server_create_claim_test.go | 132 - .../keeper/msg_server_stake_supplier.go | 106 - .../keeper/msg_server_stake_supplier_test.go | 236 - x/supplier/keeper/msg_server_submit_proof.go | 137 - x/supplier/keeper/msg_server_test.go | 24 - .../keeper/msg_server_unstake_supplier.go | 52 - .../msg_server_unstake_supplier_test.go | 90 - x/supplier/keeper/params.go | 17 - x/supplier/keeper/params_test.go | 19 - x/supplier/keeper/proof.go | 83 - x/supplier/keeper/proof_test.go | 78 - x/supplier/keeper/query.go | 7 - x/supplier/keeper/query_claim.go | 103 - x/supplier/keeper/query_claim_test.go | 234 - x/supplier/keeper/query_params.go | 20 - x/supplier/keeper/query_params_test.go | 22 - x/supplier/keeper/query_proof.go | 101 - x/supplier/keeper/query_proof_test.go | 192 - x/supplier/keeper/query_supplier.go | 61 - x/supplier/keeper/query_supplier_test.go | 127 - x/supplier/keeper/session.go | 83 - x/supplier/keeper/supplier.go | 66 - x/supplier/keeper/supplier_test.go | 94 - x/supplier/module.go | 150 - x/supplier/module_simulation.go | 157 - x/supplier/simulation/create_claim.go | 30 - x/supplier/simulation/helpers.go | 15 - x/supplier/simulation/stake_supplier.go | 31 - x/supplier/simulation/submit_proof.go | 30 - x/supplier/simulation/unstake_supplier.go | 30 - x/supplier/types/codec.go | 36 - x/supplier/types/errors.go | 26 - x/supplier/types/expected_keepers.go | 28 - x/supplier/types/genesis.go | 67 - x/supplier/types/genesis_test.go | 312 - x/supplier/types/key_claim.go | 39 - x/supplier/types/key_proof.go | 36 - x/supplier/types/key_supplier.go | 23 - x/supplier/types/keys.go | 32 - x/supplier/types/message_create_claim.go | 74 - x/supplier/types/message_create_claim_test.go | 109 - x/supplier/types/message_stake_supplier.go | 81 - .../types/message_stake_supplier_test.go | 299 - x/supplier/types/message_submit_proof.go | 77 - x/supplier/types/message_submit_proof_test.go | 102 - x/supplier/types/message_unstake_supplier.go | 45 - .../types/message_unstake_supplier_test.go | 44 - x/supplier/types/params.go | 39 - x/supplier/types/query_validation.go | 94 - x/supplier/types/types.go | 1 - x/tokenomics/client/cli/helpers_test.go | 32 - x/tokenomics/client/cli/query.go | 31 - x/tokenomics/client/cli/query_params.go | 36 - x/tokenomics/client/cli/tx.go | 37 - x/tokenomics/client/cli/tx_update_params.go | 59 - .../client/cli/tx_update_params_test.go | 68 - x/tokenomics/genesis.go | 24 - x/tokenomics/genesis_test.go | 30 - x/tokenomics/keeper/keeper.go | 75 - x/tokenomics/keeper/msg_server.go | 17 - x/tokenomics/keeper/msg_server_test.go | 24 - .../keeper/msg_server_update_params.go | 53 - .../keeper/msg_server_update_params_test.go | 137 - x/tokenomics/keeper/query.go | 7 - x/tokenomics/keeper/query_params.go | 20 - x/tokenomics/keeper/query_params_test.go | 31 - .../keeper/settle_session_accounting.go | 158 - x/tokenomics/module.go | 146 - x/tokenomics/module_simulation.go | 88 - x/tokenomics/simulation/helpers.go | 15 - x/tokenomics/simulation/update_params.go | 29 - x/tokenomics/types/codec.go | 31 - x/tokenomics/types/errors.go | 26 - x/tokenomics/types/expected_keepers.go | 35 - x/tokenomics/types/genesis.go | 24 - x/tokenomics/types/genesis_test.go | 53 - x/tokenomics/types/keys.go | 19 - x/tokenomics/types/message_update_params.go | 66 - .../types/message_update_params_test.go | 56 - x/tokenomics/types/params.go | 73 - x/tokenomics/types/types.go | 1 - 383 files changed, 109003 deletions(-) delete mode 100644 app/app.go delete mode 100644 app/encoding.go delete mode 100644 app/export.go delete mode 100644 app/genesis.go delete mode 100644 app/params/encoding.go delete mode 100644 app/simulation_test.go delete mode 100644 cmd/pocketd/cmd/config.go delete mode 100644 cmd/pocketd/cmd/genaccounts.go delete mode 100644 cmd/pocketd/cmd/root.go delete mode 100644 cmd/pocketd/main.go delete mode 100644 cmd/signals/on_exit.go delete mode 100644 config.yml delete mode 100644 docs/docs.go delete mode 100644 docs/static/openapi.yml delete mode 100644 docs/template/index.tpl delete mode 100644 docs/template/pkg/README.md delete mode 100644 go.mod delete mode 100644 go.sum delete mode 100644 proto/pocket/application/application.proto delete mode 100644 proto/pocket/application/event.proto delete mode 100644 proto/pocket/application/genesis.proto delete mode 100644 proto/pocket/application/params.proto delete mode 100644 proto/pocket/application/query.proto delete mode 100644 proto/pocket/application/tx.proto delete mode 100644 proto/pocket/gateway/gateway.proto delete mode 100644 proto/pocket/gateway/genesis.proto delete mode 100644 proto/pocket/gateway/params.proto delete mode 100644 proto/pocket/gateway/query.proto delete mode 100644 proto/pocket/gateway/tx.proto delete mode 100644 proto/pocket/pocket/genesis.proto delete mode 100644 proto/pocket/pocket/params.proto delete mode 100644 proto/pocket/pocket/query.proto delete mode 100644 proto/pocket/pocket/tx.proto delete mode 100644 proto/pocket/service/genesis.proto delete mode 100644 proto/pocket/service/params.proto delete mode 100644 proto/pocket/service/query.proto delete mode 100644 proto/pocket/service/relay.proto delete mode 100644 proto/pocket/service/tx.proto delete mode 100644 proto/pocket/session/genesis.proto delete mode 100644 proto/pocket/session/params.proto delete mode 100644 proto/pocket/session/query.proto delete mode 100644 proto/pocket/session/session.proto delete mode 100644 proto/pocket/session/tx.proto delete mode 100644 proto/pocket/shared/service.proto delete mode 100644 proto/pocket/shared/supplier.proto delete mode 100644 proto/pocket/supplier/claim.proto delete mode 100644 proto/pocket/supplier/genesis.proto delete mode 100644 proto/pocket/supplier/params.proto delete mode 100644 proto/pocket/supplier/proof.proto delete mode 100644 proto/pocket/supplier/query.proto delete mode 100644 proto/pocket/supplier/tx.proto delete mode 100644 proto/pocket/tokenomics/genesis.proto delete mode 100644 proto/pocket/tokenomics/params.proto delete mode 100644 proto/pocket/tokenomics/query.proto delete mode 100644 proto/pocket/tokenomics/tx.proto delete mode 100644 testutil/keeper/application.go delete mode 100644 testutil/keeper/gateway.go delete mode 100644 testutil/keeper/pocket.go delete mode 100644 testutil/keeper/service.go delete mode 100644 testutil/keeper/session.go delete mode 100644 testutil/keeper/supplier.go delete mode 100644 testutil/keeper/tokenomics.go delete mode 100644 testutil/network/config.go delete mode 100644 testutil/network/interface.go delete mode 100644 testutil/network/network.go delete mode 100644 testutil/network/types.go delete mode 100644 testutil/nullify/nullify.go delete mode 100644 testutil/sample/sample.go delete mode 100644 x/application/client/cli/helpers_test.go delete mode 100644 x/application/client/cli/query.go delete mode 100644 x/application/client/cli/query_application.go delete mode 100644 x/application/client/cli/query_application_test.go delete mode 100644 x/application/client/cli/query_params.go delete mode 100644 x/application/client/cli/tx.go delete mode 100644 x/application/client/cli/tx_delegate_to_gateway.go delete mode 100644 x/application/client/cli/tx_delegate_to_gateway_test.go delete mode 100644 x/application/client/cli/tx_stake_application.go delete mode 100644 x/application/client/cli/tx_stake_application_test.go delete mode 100644 x/application/client/cli/tx_undelegate_from_gateway.go delete mode 100644 x/application/client/cli/tx_undelegate_from_gateway_test.go delete mode 100644 x/application/client/cli/tx_unstake_application.go delete mode 100644 x/application/client/cli/tx_unstake_application_test.go delete mode 100644 x/application/client/config/application_configs_reader.go delete mode 100644 x/application/client/config/application_configs_reader_test.go delete mode 100644 x/application/client/config/errors.go delete mode 100644 x/application/genesis.go delete mode 100644 x/application/genesis_test.go delete mode 100644 x/application/keeper/application.go delete mode 100644 x/application/keeper/application_test.go delete mode 100644 x/application/keeper/keeper.go delete mode 100644 x/application/keeper/msg_server.go delete mode 100644 x/application/keeper/msg_server_delegate_to_gateway.go delete mode 100644 x/application/keeper/msg_server_delegate_to_gateway_test.go delete mode 100644 x/application/keeper/msg_server_stake_application.go delete mode 100644 x/application/keeper/msg_server_stake_application_test.go delete mode 100644 x/application/keeper/msg_server_test.go delete mode 100644 x/application/keeper/msg_server_undelegate_from_gateway.go delete mode 100644 x/application/keeper/msg_server_undelegate_from_gateway_test.go delete mode 100644 x/application/keeper/msg_server_unstake_application.go delete mode 100644 x/application/keeper/msg_server_unstake_application_test.go delete mode 100644 x/application/keeper/params.go delete mode 100644 x/application/keeper/params_test.go delete mode 100644 x/application/keeper/query.go delete mode 100644 x/application/keeper/query_application.go delete mode 100644 x/application/keeper/query_application_test.go delete mode 100644 x/application/keeper/query_params.go delete mode 100644 x/application/keeper/query_params_test.go delete mode 100644 x/application/module.go delete mode 100644 x/application/module_simulation.go delete mode 100644 x/application/simulation/delegate_to_gateway.go delete mode 100644 x/application/simulation/helpers.go delete mode 100644 x/application/simulation/stake_application.go delete mode 100644 x/application/simulation/undelegate_from_gateway.go delete mode 100644 x/application/simulation/unstake_application.go delete mode 100644 x/application/types/codec.go delete mode 100644 x/application/types/errors.go delete mode 100644 x/application/types/expected_keepers.go delete mode 100644 x/application/types/genesis.go delete mode 100644 x/application/types/genesis_test.go delete mode 100644 x/application/types/key_application.go delete mode 100644 x/application/types/keys.go delete mode 100644 x/application/types/message_delegate_to_gateway.go delete mode 100644 x/application/types/message_delegate_to_gateway_test.go delete mode 100644 x/application/types/message_stake_application.go delete mode 100644 x/application/types/message_stake_application_test.go delete mode 100644 x/application/types/message_undelegate_from_gateway.go delete mode 100644 x/application/types/message_undelegate_from_gateway_test.go delete mode 100644 x/application/types/message_unstake_application.go delete mode 100644 x/application/types/message_unstake_application_test.go delete mode 100644 x/application/types/params.go delete mode 100644 x/application/types/types.go delete mode 100644 x/gateway/client/cli/helpers_test.go delete mode 100644 x/gateway/client/cli/query.go delete mode 100644 x/gateway/client/cli/query_gateway.go delete mode 100644 x/gateway/client/cli/query_gateway_test.go delete mode 100644 x/gateway/client/cli/query_params.go delete mode 100644 x/gateway/client/cli/tx.go delete mode 100644 x/gateway/client/cli/tx_stake_gateway.go delete mode 100644 x/gateway/client/cli/tx_stake_gateway_test.go delete mode 100644 x/gateway/client/cli/tx_unstake_gateway.go delete mode 100644 x/gateway/client/cli/tx_unstake_gateway_test.go delete mode 100644 x/gateway/client/config/errors.go delete mode 100644 x/gateway/client/config/gateway_config_reader.go delete mode 100644 x/gateway/client/config/gateway_config_reader_test.go delete mode 100644 x/gateway/genesis.go delete mode 100644 x/gateway/genesis_test.go delete mode 100644 x/gateway/keeper/gateway.go delete mode 100644 x/gateway/keeper/gateway_test.go delete mode 100644 x/gateway/keeper/keeper.go delete mode 100644 x/gateway/keeper/msg_server.go delete mode 100644 x/gateway/keeper/msg_server_stake_gateway.go delete mode 100644 x/gateway/keeper/msg_server_stake_gateway_test.go delete mode 100644 x/gateway/keeper/msg_server_test.go delete mode 100644 x/gateway/keeper/msg_server_unstake_gateway.go delete mode 100644 x/gateway/keeper/msg_server_unstake_gateway_test.go delete mode 100644 x/gateway/keeper/params.go delete mode 100644 x/gateway/keeper/params_test.go delete mode 100644 x/gateway/keeper/query.go delete mode 100644 x/gateway/keeper/query_gateway.go delete mode 100644 x/gateway/keeper/query_gateway_test.go delete mode 100644 x/gateway/keeper/query_params.go delete mode 100644 x/gateway/keeper/query_params_test.go delete mode 100644 x/gateway/module.go delete mode 100644 x/gateway/module_simulation.go delete mode 100644 x/gateway/simulation/helpers.go delete mode 100644 x/gateway/simulation/stake_gateway.go delete mode 100644 x/gateway/simulation/unstake_gateway.go delete mode 100644 x/gateway/types/codec.go delete mode 100644 x/gateway/types/errors.go delete mode 100644 x/gateway/types/expected_keepers.go delete mode 100644 x/gateway/types/genesis.go delete mode 100644 x/gateway/types/genesis_test.go delete mode 100644 x/gateway/types/key_gateway.go delete mode 100644 x/gateway/types/keys.go delete mode 100644 x/gateway/types/message_stake_gateway.go delete mode 100644 x/gateway/types/message_stake_gateway_test.go delete mode 100644 x/gateway/types/message_unstake_gateway.go delete mode 100644 x/gateway/types/message_unstake_gateway_test.go delete mode 100644 x/gateway/types/params.go delete mode 100644 x/gateway/types/types.go delete mode 100644 x/pocket/client/cli/query.go delete mode 100644 x/pocket/client/cli/query_params.go delete mode 100644 x/pocket/client/cli/tx.go delete mode 100644 x/pocket/genesis.go delete mode 100644 x/pocket/genesis_test.go delete mode 100644 x/pocket/keeper/keeper.go delete mode 100644 x/pocket/keeper/msg_server.go delete mode 100644 x/pocket/keeper/msg_server_test.go delete mode 100644 x/pocket/keeper/params.go delete mode 100644 x/pocket/keeper/params_test.go delete mode 100644 x/pocket/keeper/query.go delete mode 100644 x/pocket/keeper/query_params.go delete mode 100644 x/pocket/keeper/query_params_test.go delete mode 100644 x/pocket/module.go delete mode 100644 x/pocket/module_simulation.go delete mode 100644 x/pocket/simulation/helpers.go delete mode 100644 x/pocket/types/codec.go delete mode 100644 x/pocket/types/errors.go delete mode 100644 x/pocket/types/expected_keepers.go delete mode 100644 x/pocket/types/genesis.go delete mode 100644 x/pocket/types/genesis_test.go delete mode 100644 x/pocket/types/keys.go delete mode 100644 x/pocket/types/params.go delete mode 100644 x/pocket/types/types.go delete mode 100644 x/service/client/cli/query.go delete mode 100644 x/service/client/cli/query_params.go delete mode 100644 x/service/client/cli/tx.go delete mode 100644 x/service/client/cli/tx_add_service.go delete mode 100644 x/service/client/cli/tx_add_service_test.go delete mode 100644 x/service/genesis.go delete mode 100644 x/service/genesis_test.go delete mode 100644 x/service/keeper/keeper.go delete mode 100644 x/service/keeper/msg_server.go delete mode 100644 x/service/keeper/msg_server_add_service.go delete mode 100644 x/service/keeper/msg_server_add_service_test.go delete mode 100644 x/service/keeper/msg_server_test.go delete mode 100644 x/service/keeper/params.go delete mode 100644 x/service/keeper/params_test.go delete mode 100644 x/service/keeper/query.go delete mode 100644 x/service/keeper/query_params.go delete mode 100644 x/service/keeper/query_params_test.go delete mode 100644 x/service/keeper/service.go delete mode 100644 x/service/keeper/service_test.go delete mode 100644 x/service/module.go delete mode 100644 x/service/module_simulation.go delete mode 100644 x/service/simulation/add_service.go delete mode 100644 x/service/simulation/helpers.go delete mode 100644 x/service/types/codec.go delete mode 100644 x/service/types/errors.go delete mode 100644 x/service/types/expected_keepers.go delete mode 100644 x/service/types/genesis.go delete mode 100644 x/service/types/genesis_test.go delete mode 100644 x/service/types/key_service.go delete mode 100644 x/service/types/keys.go delete mode 100644 x/service/types/message_add_service.go delete mode 100644 x/service/types/message_add_service_test.go delete mode 100644 x/service/types/params.go delete mode 100644 x/service/types/relay.go delete mode 100644 x/service/types/types.go delete mode 100644 x/session/client/cli/helpers_test.go delete mode 100644 x/session/client/cli/query.go delete mode 100644 x/session/client/cli/query_get_session.go delete mode 100644 x/session/client/cli/query_get_session_test.go delete mode 100644 x/session/client/cli/query_params.go delete mode 100644 x/session/client/cli/tx.go delete mode 100644 x/session/genesis.go delete mode 100644 x/session/genesis_test.go delete mode 100644 x/session/keeper/keeper.go delete mode 100644 x/session/keeper/msg_server.go delete mode 100644 x/session/keeper/msg_server_test.go delete mode 100644 x/session/keeper/params.go delete mode 100644 x/session/keeper/params_test.go delete mode 100644 x/session/keeper/query.go delete mode 100644 x/session/keeper/query_get_session.go delete mode 100644 x/session/keeper/query_get_session_test.go delete mode 100644 x/session/keeper/query_params.go delete mode 100644 x/session/keeper/query_params_test.go delete mode 100644 x/session/keeper/session_hydrator.go delete mode 100644 x/session/keeper/session_hydrator_test.go delete mode 100644 x/session/module.go delete mode 100644 x/session/module_simulation.go delete mode 100644 x/session/simulation/helpers.go delete mode 100644 x/session/types/codec.go delete mode 100644 x/session/types/errors.go delete mode 100644 x/session/types/expected_keepers.go delete mode 100644 x/session/types/genesis.go delete mode 100644 x/session/types/genesis_test.go delete mode 100644 x/session/types/keys.go delete mode 100644 x/session/types/params.go delete mode 100644 x/session/types/query_get_session_request.go delete mode 100644 x/session/types/types.go delete mode 100644 x/shared/helpers/service.go delete mode 100644 x/shared/helpers/service_configs.go delete mode 100644 x/shared/helpers/service_test.go delete mode 100644 x/shared/types/types.go delete mode 100644 x/supplier/client/cli/flags.go delete mode 100644 x/supplier/client/cli/helpers_test.go delete mode 100644 x/supplier/client/cli/query.go delete mode 100644 x/supplier/client/cli/query_claim.go delete mode 100644 x/supplier/client/cli/query_claim_test.go delete mode 100644 x/supplier/client/cli/query_params.go delete mode 100644 x/supplier/client/cli/query_proof.go delete mode 100644 x/supplier/client/cli/query_proof_test.go delete mode 100644 x/supplier/client/cli/query_supplier.go delete mode 100644 x/supplier/client/cli/query_supplier_test.go delete mode 100644 x/supplier/client/cli/tx.go delete mode 100644 x/supplier/client/cli/tx_create_claim.go delete mode 100644 x/supplier/client/cli/tx_stake_supplier.go delete mode 100644 x/supplier/client/cli/tx_stake_supplier_test.go delete mode 100644 x/supplier/client/cli/tx_submit_proof.go delete mode 100644 x/supplier/client/cli/tx_unstake_supplier.go delete mode 100644 x/supplier/client/cli/tx_unstake_supplier_test.go delete mode 100644 x/supplier/client/config/errors.go delete mode 100644 x/supplier/client/config/supplier_configs_reader.go delete mode 100644 x/supplier/client/config/supplier_configs_reader_test.go delete mode 100644 x/supplier/genesis.go delete mode 100644 x/supplier/genesis_test.go delete mode 100644 x/supplier/keeper/claim.go delete mode 100644 x/supplier/keeper/claim_test.go delete mode 100644 x/supplier/keeper/keeper.go delete mode 100644 x/supplier/keeper/msg_server.go delete mode 100644 x/supplier/keeper/msg_server_create_claim.go delete mode 100644 x/supplier/keeper/msg_server_create_claim_test.go delete mode 100644 x/supplier/keeper/msg_server_stake_supplier.go delete mode 100644 x/supplier/keeper/msg_server_stake_supplier_test.go delete mode 100644 x/supplier/keeper/msg_server_submit_proof.go delete mode 100644 x/supplier/keeper/msg_server_test.go delete mode 100644 x/supplier/keeper/msg_server_unstake_supplier.go delete mode 100644 x/supplier/keeper/msg_server_unstake_supplier_test.go delete mode 100644 x/supplier/keeper/params.go delete mode 100644 x/supplier/keeper/params_test.go delete mode 100644 x/supplier/keeper/proof.go delete mode 100644 x/supplier/keeper/proof_test.go delete mode 100644 x/supplier/keeper/query.go delete mode 100644 x/supplier/keeper/query_claim.go delete mode 100644 x/supplier/keeper/query_claim_test.go delete mode 100644 x/supplier/keeper/query_params.go delete mode 100644 x/supplier/keeper/query_params_test.go delete mode 100644 x/supplier/keeper/query_proof.go delete mode 100644 x/supplier/keeper/query_proof_test.go delete mode 100644 x/supplier/keeper/query_supplier.go delete mode 100644 x/supplier/keeper/query_supplier_test.go delete mode 100644 x/supplier/keeper/session.go delete mode 100644 x/supplier/keeper/supplier.go delete mode 100644 x/supplier/keeper/supplier_test.go delete mode 100644 x/supplier/module.go delete mode 100644 x/supplier/module_simulation.go delete mode 100644 x/supplier/simulation/create_claim.go delete mode 100644 x/supplier/simulation/helpers.go delete mode 100644 x/supplier/simulation/stake_supplier.go delete mode 100644 x/supplier/simulation/submit_proof.go delete mode 100644 x/supplier/simulation/unstake_supplier.go delete mode 100644 x/supplier/types/codec.go delete mode 100644 x/supplier/types/errors.go delete mode 100644 x/supplier/types/expected_keepers.go delete mode 100644 x/supplier/types/genesis.go delete mode 100644 x/supplier/types/genesis_test.go delete mode 100644 x/supplier/types/key_claim.go delete mode 100644 x/supplier/types/key_proof.go delete mode 100644 x/supplier/types/key_supplier.go delete mode 100644 x/supplier/types/keys.go delete mode 100644 x/supplier/types/message_create_claim.go delete mode 100644 x/supplier/types/message_create_claim_test.go delete mode 100644 x/supplier/types/message_stake_supplier.go delete mode 100644 x/supplier/types/message_stake_supplier_test.go delete mode 100644 x/supplier/types/message_submit_proof.go delete mode 100644 x/supplier/types/message_submit_proof_test.go delete mode 100644 x/supplier/types/message_unstake_supplier.go delete mode 100644 x/supplier/types/message_unstake_supplier_test.go delete mode 100644 x/supplier/types/params.go delete mode 100644 x/supplier/types/query_validation.go delete mode 100644 x/supplier/types/types.go delete mode 100644 x/tokenomics/client/cli/helpers_test.go delete mode 100644 x/tokenomics/client/cli/query.go delete mode 100644 x/tokenomics/client/cli/query_params.go delete mode 100644 x/tokenomics/client/cli/tx.go delete mode 100644 x/tokenomics/client/cli/tx_update_params.go delete mode 100644 x/tokenomics/client/cli/tx_update_params_test.go delete mode 100644 x/tokenomics/genesis.go delete mode 100644 x/tokenomics/genesis_test.go delete mode 100644 x/tokenomics/keeper/keeper.go delete mode 100644 x/tokenomics/keeper/msg_server.go delete mode 100644 x/tokenomics/keeper/msg_server_test.go delete mode 100644 x/tokenomics/keeper/msg_server_update_params.go delete mode 100644 x/tokenomics/keeper/msg_server_update_params_test.go delete mode 100644 x/tokenomics/keeper/query.go delete mode 100644 x/tokenomics/keeper/query_params.go delete mode 100644 x/tokenomics/keeper/query_params_test.go delete mode 100644 x/tokenomics/keeper/settle_session_accounting.go delete mode 100644 x/tokenomics/module.go delete mode 100644 x/tokenomics/module_simulation.go delete mode 100644 x/tokenomics/simulation/helpers.go delete mode 100644 x/tokenomics/simulation/update_params.go delete mode 100644 x/tokenomics/types/codec.go delete mode 100644 x/tokenomics/types/errors.go delete mode 100644 x/tokenomics/types/expected_keepers.go delete mode 100644 x/tokenomics/types/genesis.go delete mode 100644 x/tokenomics/types/genesis_test.go delete mode 100644 x/tokenomics/types/keys.go delete mode 100644 x/tokenomics/types/message_update_params.go delete mode 100644 x/tokenomics/types/message_update_params_test.go delete mode 100644 x/tokenomics/types/params.go delete mode 100644 x/tokenomics/types/types.go diff --git a/app/app.go b/app/app.go deleted file mode 100644 index 68f834d0b..000000000 --- a/app/app.go +++ /dev/null @@ -1,1140 +0,0 @@ -package app - -import ( - "encoding/json" - "fmt" - "io" - "os" - "path/filepath" - - // this line is used by starport scaffolding # stargate/app/moduleImport - - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmos "github.com/cometbft/cometbft/libs/os" - "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/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/runtime" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - 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/version" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - 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" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - "github.com/cosmos/cosmos-sdk/x/consensus" - consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - "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/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/group" - groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/cosmos-sdk/x/mint" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/params" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/cosmos/cosmos-sdk/x/slashing" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - appparams "github.com/pokt-network/poktroll/app/params" - "github.com/pokt-network/poktroll/docs" - applicationmodule "github.com/pokt-network/poktroll/x/application" - applicationmodulekeeper "github.com/pokt-network/poktroll/x/application/keeper" - applicationmoduletypes "github.com/pokt-network/poktroll/x/application/types" - gatewaymodule "github.com/pokt-network/poktroll/x/gateway" - gatewaymodulekeeper "github.com/pokt-network/poktroll/x/gateway/keeper" - gatewaymoduletypes "github.com/pokt-network/poktroll/x/gateway/types" - pocketmodule "github.com/pokt-network/poktroll/x/pocket" - pocketmodulekeeper "github.com/pokt-network/poktroll/x/pocket/keeper" - pocketmoduletypes "github.com/pokt-network/poktroll/x/pocket/types" - servicemodule "github.com/pokt-network/poktroll/x/service" - servicemodulekeeper "github.com/pokt-network/poktroll/x/service/keeper" - servicemoduletypes "github.com/pokt-network/poktroll/x/service/types" - sessionmodule "github.com/pokt-network/poktroll/x/session" - sessionmodulekeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessionmoduletypes "github.com/pokt-network/poktroll/x/session/types" - suppliermodule "github.com/pokt-network/poktroll/x/supplier" - suppliermodulekeeper "github.com/pokt-network/poktroll/x/supplier/keeper" - suppliermoduletypes "github.com/pokt-network/poktroll/x/supplier/types" - tokenomicsmodule "github.com/pokt-network/poktroll/x/tokenomics" - tokenomicsmodulekeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" - tokenomicsmoduletypes "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/spf13/cast" -) - -const ( - AccountAddressPrefix = "pokt" - Name = "pocket" - // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase - DenomuPOKT = "upokt" -) - -// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals - -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - // this line is used by starport scaffolding # stargate/app/govProposalHandlers - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - // this line is used by starport scaffolding # stargate/app/govProposalHandler - ) - - return govProposalHandlers -} - -var ( - // DefaultNodeHome default home directories for the application daemon - DefaultNodeHome string - - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - // TODO_DISCUSS: Should we rename all instances of `Validator` to `Sequencer`? - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic(getGovProposalHandlers()), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - solomachine.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - ica.AppModuleBasic{}, - vesting.AppModuleBasic{}, - consensus.AppModuleBasic{}, - pocketmodule.AppModuleBasic{}, - servicemodule.AppModuleBasic{}, - sessionmodule.AppModuleBasic{}, - applicationmodule.AppModuleBasic{}, - suppliermodule.AppModuleBasic{}, - gatewaymodule.AppModuleBasic{}, - tokenomicsmodule.AppModuleBasic{}, - // this line is used by starport scaffolding # stargate/app/moduleBasic - ) - - // module account permissions - maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - icatypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - suppliermoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - servicemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - applicationmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - gatewaymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - tokenomicsmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - // this line is used by starport scaffolding # stargate/app/maccPerms - } -) - -var ( - _ runtime.AppI = (*App)(nil) - _ servertypes.Application = (*App)(nil) -) - -func init() { - userHomeDir, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) -} - -// App extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. -type App struct { - *baseapp.BaseApp - - cdc *codec.LegacyAmino - appCodec codec.Codec - interfaceRegistry types.InterfaceRegistry - txConfig client.TxConfig - - invCheckPeriod uint - - // keys to access the substores - keys map[string]*storetypes.KVStoreKey - tkeys map[string]*storetypes.TransientStoreKey - memKeys map[string]*storetypes.MemoryStoreKey - - // keepers - AccountKeeper authkeeper.AccountKeeper - AuthzKeeper authzkeeper.Keeper - BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - EvidenceKeeper evidencekeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper - ICAHostKeeper icahostkeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper - GroupKeeper groupkeeper.Keeper - ConsensusParamsKeeper consensusparamkeeper.Keeper - - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - - PocketKeeper pocketmodulekeeper.Keeper - ServiceKeeper servicemodulekeeper.Keeper - SessionKeeper sessionmodulekeeper.Keeper - ApplicationKeeper applicationmodulekeeper.Keeper - SupplierKeeper suppliermodulekeeper.Keeper - - GatewayKeeper gatewaymodulekeeper.Keeper - - TokenomicsKeeper tokenomicsmodulekeeper.Keeper - // this line is used by starport scaffolding # stargate/app/keeperDeclaration - - // mm is the module manager - mm *module.Manager - - // sm is the simulation manager - sm *module.SimulationManager - configurator module.Configurator -} - -// New returns a reference to an initialized blockchain app -func New( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - loadLatest bool, - skipUpgradeHeights map[int64]bool, - homePath string, - invCheckPeriod uint, - encodingConfig appparams.EncodingConfig, - appOpts servertypes.AppOptions, - baseAppOptions ...func(*baseapp.BaseApp), -) *App { - appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - txConfig := encodingConfig.TxConfig - - bApp := baseapp.NewBaseApp( - Name, - logger, - db, - encodingConfig.TxConfig.TxDecoder(), - baseAppOptions..., - ) - bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetVersion(version.Version) - bApp.SetInterfaceRegistry(interfaceRegistry) - bApp.SetTxEncoder(txConfig.TxEncoder()) - - keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, authz.ModuleName, banktypes.StoreKey, stakingtypes.StoreKey, - crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, - feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey, - capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey, - pocketmoduletypes.StoreKey, - servicemoduletypes.StoreKey, - sessionmoduletypes.StoreKey, - applicationmoduletypes.StoreKey, - suppliermoduletypes.StoreKey, - gatewaymoduletypes.StoreKey, - tokenomicsmoduletypes.StoreKey, - // this line is used by starport scaffolding # stargate/app/storeKey - ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - - // TODO_BLOCKER(#322): Change this to `authtypes.NewModuleAddress(govtypes.ModuleName)` - // once we figure out the MVP for on-chain parameter governance. - pnfAddress := "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw" - authority := pnfAddress - - app := &App{ - BaseApp: bApp, - cdc: cdc, - appCodec: appCodec, - interfaceRegistry: interfaceRegistry, - txConfig: encodingConfig.TxConfig, - invCheckPeriod: invCheckPeriod, - keys: keys, - tkeys: tkeys, - memKeys: memKeys, - } - - app.ParamsKeeper = initParamsKeeper( - appCodec, - cdc, - keys[paramstypes.StoreKey], - tkeys[paramstypes.TStoreKey], - ) - - // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( - appCodec, - keys[upgradetypes.StoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - bApp.SetParamStore(&app.ConsensusParamsKeeper) - - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper( - appCodec, - keys[capabilitytypes.StoreKey], - memKeys[capabilitytypes.MemStoreKey], - ) - - // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - // this line is used by starport scaffolding # stargate/app/scopedKeeper - - // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper( - appCodec, - keys[authtypes.StoreKey], - authtypes.ProtoBaseAccount, - maccPerms, - sdk.Bech32PrefixAccAddr, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.AuthzKeeper = authzkeeper.NewKeeper( - keys[authz.ModuleName], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - ) - - app.BankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - keys[banktypes.StoreKey], - app.AccountKeeper, - app.BlockedModuleAccountAddrs(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, - keys[stakingtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.FeeGrantKeeper = feegrantkeeper.NewKeeper( - appCodec, - keys[feegrant.StoreKey], - app.AccountKeeper, - ) - - app.MintKeeper = mintkeeper.NewKeeper( - appCodec, - keys[minttypes.StoreKey], - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.DistrKeeper = distrkeeper.NewKeeper( - appCodec, - keys[distrtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, - cdc, - keys[slashingtypes.StoreKey], - app.StakingKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - app.CrisisKeeper = crisiskeeper.NewKeeper( - appCodec, - keys[crisistypes.StoreKey], - invCheckPeriod, - app.BankKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - groupConfig := group.DefaultConfig() - /* - Example of setting group params: - groupConfig.MaxMetadataLen = 1000 - */ - app.GroupKeeper = groupkeeper.NewKeeper( - keys[group.StoreKey], - appCodec, - app.MsgServiceRouter(), - app.AccountKeeper, - groupConfig, - ) - - app.UpgradeKeeper = upgradekeeper.NewKeeper( - skipUpgradeHeights, - keys[upgradetypes.StoreKey], - appCodec, - homePath, - app.BaseApp, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - // ... other modules keepers - - // Create IBC Keeper - app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], - app.GetSubspace(ibcexported.ModuleName), - app.StakingKeeper, - app.UpgradeKeeper, - scopedIBCKeeper, - ) - - // Create Transfer Keepers - app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, - keys[ibctransfertypes.StoreKey], - app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - scopedTransferKeeper, - ) - transferModule := transfer.NewAppModule(app.TransferKeeper) - transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) - - app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], - app.GetSubspace(icahosttypes.SubModuleName), - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.AccountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), - ) - icaControllerKeeper := icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], - app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee - app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), - ) - icaModule := ica.NewAppModule(&icaControllerKeeper, &app.ICAHostKeeper) - icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) - - // Create evidence Keeper for to register the IBC light client misbehaviour evidence route - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, - keys[evidencetypes.StoreKey], - app.StakingKeeper, - app.SlashingKeeper, - ) - // If evidence needs to be handled for the app, set routes in router here and seal - app.EvidenceKeeper = *evidenceKeeper - - govConfig := govtypes.DefaultConfig() - govKeeper := govkeeper.NewKeeper( - appCodec, - keys[govtypes.StoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.MsgServiceRouter(), - govConfig, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - govRouter := govv1beta1.NewRouter() - govRouter. - AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - govKeeper.SetLegacyRouter(govRouter) - - app.GovKeeper = *govKeeper.SetHooks( - govtypes.NewMultiGovHooks( - // register the governance hooks - ), - ) - - app.PocketKeeper = *pocketmodulekeeper.NewKeeper( - appCodec, - keys[pocketmoduletypes.StoreKey], - keys[pocketmoduletypes.MemStoreKey], - app.GetSubspace(pocketmoduletypes.ModuleName), - ) - pocketModule := pocketmodule.NewAppModule(appCodec, app.PocketKeeper, app.AccountKeeper, app.BankKeeper) - - app.ServiceKeeper = *servicemodulekeeper.NewKeeper( - appCodec, - keys[servicemoduletypes.StoreKey], - keys[servicemoduletypes.MemStoreKey], - app.GetSubspace(servicemoduletypes.ModuleName), - - app.BankKeeper, - ) - serviceModule := servicemodule.NewAppModule(appCodec, app.ServiceKeeper, app.AccountKeeper, app.BankKeeper) - - app.GatewayKeeper = *gatewaymodulekeeper.NewKeeper( - appCodec, - keys[gatewaymoduletypes.StoreKey], - keys[gatewaymoduletypes.MemStoreKey], - app.GetSubspace(gatewaymoduletypes.ModuleName), - - app.BankKeeper, - ) - gatewayModule := gatewaymodule.NewAppModule(appCodec, app.GatewayKeeper, app.AccountKeeper, app.BankKeeper) - - app.ApplicationKeeper = *applicationmodulekeeper.NewKeeper( - appCodec, - keys[applicationmoduletypes.StoreKey], - keys[applicationmoduletypes.MemStoreKey], - app.GetSubspace(applicationmoduletypes.ModuleName), - - app.BankKeeper, - app.AccountKeeper, - app.GatewayKeeper, - ) - applicationModule := applicationmodule.NewAppModule( - appCodec, - app.ApplicationKeeper, - app.AccountKeeper, - app.BankKeeper, - ) - - // TODO_TECHDEBT: Evaluate if this NB goes away after we upgrade to cosmos 0.5x - // NB: there is a circular dependency between the supplier and session keepers. - // Because the keepers are values (as opposed to pointers), they are copied - // when passed into their respective module constructor functions. For this - // reason, the existing pattern of ignite-generated keeper/module construction - // must be broken for these keepers and modules. - // - // Order of operations: - // 1. Construct supplier keeper - // 2. Construct session keeper - // 3. Provide session keeper to supplier keeper via custom #SupplySessionKeeper method. - // 4. Construct supplier module - // 5. Construct session module - app.SupplierKeeper = *suppliermodulekeeper.NewKeeper( - appCodec, - keys[suppliermoduletypes.StoreKey], - keys[suppliermoduletypes.MemStoreKey], - app.GetSubspace(suppliermoduletypes.ModuleName), - - app.BankKeeper, - ) - - app.SessionKeeper = *sessionmodulekeeper.NewKeeper( - appCodec, - keys[sessionmoduletypes.StoreKey], - keys[sessionmoduletypes.MemStoreKey], - app.GetSubspace(sessionmoduletypes.ModuleName), - - app.ApplicationKeeper, - app.SupplierKeeper, - ) - - app.SupplierKeeper.SupplySessionKeeper(app.SessionKeeper) - - supplierModule := suppliermodule.NewAppModule(appCodec, app.SupplierKeeper, app.AccountKeeper, app.BankKeeper) - sessionModule := sessionmodule.NewAppModule(appCodec, app.SessionKeeper, app.AccountKeeper, app.BankKeeper) - - app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper( - appCodec, - keys[tokenomicsmoduletypes.StoreKey], - keys[tokenomicsmoduletypes.MemStoreKey], - app.GetSubspace(tokenomicsmoduletypes.ModuleName), - app.BankKeeper, - app.ApplicationKeeper, - app.SupplierKeeper, - authority, - ) - tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper) - - // this line is used by starport scaffolding # stargate/app/keeperDefinition - - /**** IBC Routing ****/ - - // Sealing prevents other modules from creating scoped sub-keepers - app.CapabilityKeeper.Seal() - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := ibcporttypes.NewRouter() - ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). - AddRoute(ibctransfertypes.ModuleName, transferIBCModule) - // this line is used by starport scaffolding # ibc/app/router - app.IBCKeeper.SetRouter(ibcRouter) - - /**** Module Hooks ****/ - - // register hooks after all modules have been initialized - - app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - // insert staking hooks receivers here - app.DistrKeeper.Hooks(), - app.SlashingKeeper.Hooks(), - ), - ) - - /**** Module Options ****/ - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - // NOTE: Any module instantiated in the module manager that is later modified - // must be passed by reference here. - - app.mm = module.NewManager( - genutil.NewAppModule( - app.AccountKeeper, - app.StakingKeeper, - app.BaseApp.DeliverTx, - encodingConfig.TxConfig, - ), - auth.NewAppModule( - appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule( - appCodec, - app.AccountKeeper, - app.BankKeeper, - app.FeeGrantKeeper, - app.interfaceRegistry, - ), - groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - gov.NewAppModule( - appCodec, - &app.GovKeeper, - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(govtypes.ModuleName), - ), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule( - appCodec, - app.SlashingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(slashingtypes.ModuleName), - ), - distr.NewAppModule( - appCodec, - app.DistrKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(distrtypes.ModuleName), - ), - staking.NewAppModule( - appCodec, - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.GetSubspace(stakingtypes.ModuleName), - ), - upgrade.NewAppModule(app.UpgradeKeeper), - evidence.NewAppModule(app.EvidenceKeeper), - consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - ibc.NewAppModule(app.IBCKeeper), - params.NewAppModule(app.ParamsKeeper), - transferModule, - icaModule, - pocketModule, - serviceModule, - sessionModule, - applicationModule, - supplierModule, - gatewayModule, - tokenomicsModule, - // this line is used by starport scaffolding # stargate/app/appModule - - crisis.NewAppModule( - app.CrisisKeeper, - skipGenesisInvariants, - app.GetSubspace(crisistypes.ModuleName), - ), // always be last to make sure that it checks for all invariants and not only part of them - ) - - // During begin block slashing happens after distr.BeginBlocker so that - // there is nothing left over in the validator fee pool, so as to keep the - // CanWithdrawInvariant invariant. - // NOTE: staking module is required if HistoricalEntries param > 0 - app.mm.SetOrderBeginBlockers( - // upgrades should be run first - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/beginBlockers - ) - - app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/endBlockers - ) - - // 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. - genesisModuleOrder := []string{ - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - genutiltypes.ModuleName, - ibctransfertypes.ModuleName, - ibcexported.ModuleName, - icatypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - consensusparamtypes.ModuleName, - pocketmoduletypes.ModuleName, - servicemoduletypes.ModuleName, - sessionmoduletypes.ModuleName, - applicationmoduletypes.ModuleName, - suppliermoduletypes.ModuleName, - gatewaymoduletypes.ModuleName, - tokenomicsmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/initGenesis - } - app.mm.SetOrderInitGenesis(genesisModuleOrder...) - app.mm.SetOrderExportGenesis(genesisModuleOrder...) - - // Uncomment if you want to set a custom migration order here. - // app.mm.SetOrderMigrations(custom order) - - app.mm.RegisterInvariants(app.CrisisKeeper) - app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.mm.RegisterServices(app.configurator) - - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) - reflectionSvc, err := runtimeservices.NewReflectionService() - if err != nil { - panic(err) - } - reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) - - // create the simulation manager and define the order of the modules for deterministic simulations - overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule( - app.appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), - } - app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) - app.sm.RegisterStoreDecoders() - - // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memKeys) - - // initialize BaseApp - anteHandler, err := ante.NewAnteHandler( - ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - }, - ) - if err != nil { - panic(fmt.Errorf("failed to create AnteHandler: %w", err)) - } - - app.SetAnteHandler(anteHandler) - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) - app.SetEndBlocker(app.EndBlocker) - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) - } - } - - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - // this line is used by starport scaffolding # stargate/app/beforeInitReturn - - return app -} - -// Name returns the name of the App -func (app *App) Name() string { return app.BaseApp.Name() } - -// BeginBlocker application updates every begin block -func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) -} - -// EndBlocker application updates every end block -func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) -} - -// InitChainer application update at chain initialization -func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - var genesisState GenesisState - if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { - panic(err) - } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) - return app.mm.InitGenesis(ctx, app.appCodec, genesisState) -} - -// Configurator get app configurator -func (app *App) Configurator() module.Configurator { - return app.configurator -} - -// LoadHeight loads a particular height -func (app *App) LoadHeight(height int64) error { - return app.LoadVersion(height) -} - -// ModuleAccountAddrs returns all the app's module account addresses. -func (app *App) ModuleAccountAddrs() map[string]bool { - modAccAddrs := make(map[string]bool) - for acc := range maccPerms { - modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true - } - - return modAccAddrs -} - -// BlockedModuleAccountAddrs returns all the app's blocked module account -// addresses. -func (app *App) BlockedModuleAccountAddrs() map[string]bool { - modAccAddrs := app.ModuleAccountAddrs() - delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - - return modAccAddrs -} - -// LegacyAmino returns SimApp's amino codec. -// -// NOTE: This is solely to be used for testing purposes as it may be desirable -// for modules to register their own custom testing types. -func (app *App) LegacyAmino() *codec.LegacyAmino { - return app.cdc -} - -// AppCodec returns an app codec. -// -// NOTE: This is solely to be used for testing purposes as it may be desirable -// for modules to register their own custom testing types. -func (app *App) AppCodec() codec.Codec { - return app.appCodec -} - -// InterfaceRegistry returns an InterfaceRegistry -func (app *App) InterfaceRegistry() types.InterfaceRegistry { - return app.interfaceRegistry -} - -// TxConfig returns SimApp's TxConfig -func (app *App) TxConfig() client.TxConfig { - return app.txConfig -} - -// 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] -} - -// GetSubspace returns a param subspace for a given module name. -// -// NOTE: This is solely to be used for testing purposes. -func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) - return subspace -} - -// RegisterAPIRoutes registers all application module routes with the provided -// API server. -func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - // Register new tx routes from grpc-gateway. - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register node gRPC service for grpc-gateway. - nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register grpc-gateway routes for all modules. - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // register app's OpenAPI routes. - docs.RegisterOpenAPIService(Name, apiSvr.Router) -} - -// RegisterTxService implements the Application.RegisterTxService method. -func (app *App) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) -} - -// RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *App) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService( - clientCtx, - app.BaseApp.GRPCQueryRouter(), - app.interfaceRegistry, - app.Query, - ) -} - -// RegisterNodeService implements the Application.RegisterNodeService method. -func (app *App) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) -} - -// 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).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck - paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - paramsKeeper.Subspace(pocketmoduletypes.ModuleName) - paramsKeeper.Subspace(servicemoduletypes.ModuleName) - paramsKeeper.Subspace(sessionmoduletypes.ModuleName) - paramsKeeper.Subspace(applicationmoduletypes.ModuleName) - paramsKeeper.Subspace(suppliermoduletypes.ModuleName) - paramsKeeper.Subspace(gatewaymoduletypes.ModuleName) - paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName) - // this line is used by starport scaffolding # stargate/app/paramSubspace - - return paramsKeeper -} - -// SimulationManager returns the app SimulationManager -func (app *App) SimulationManager() *module.SimulationManager { - return app.sm -} - -// ModuleManager returns the app ModuleManager -func (app *App) ModuleManager() *module.Manager { - return app.mm -} diff --git a/app/encoding.go b/app/encoding.go deleted file mode 100644 index 3e32bee43..000000000 --- a/app/encoding.go +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - - "github.com/pokt-network/poktroll/app/params" -) - -// makeEncodingConfig creates an EncodingConfig for an amino based test configuration. -func makeEncodingConfig() params.EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) - - return params.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, - TxConfig: txCfg, - Amino: amino, - } -} - -// MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() params.EncodingConfig { - encodingConfig := makeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} diff --git a/app/export.go b/app/export.go deleted file mode 100644 index db240d2b6..000000000 --- a/app/export.go +++ /dev/null @@ -1,204 +0,0 @@ -package app - -import ( - "encoding/json" - "fmt" - "log" - - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - sdk "github.com/cosmos/cosmos-sdk/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// ExportAppStateAndValidators exports the state of the application for a genesis -// file. -func (app *App) ExportAppStateAndValidators( - forZeroHeight bool, - jailAllowedAddrs []string, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - - // We export at last height + 1, because that's the height at which - // Tendermint will start InitChain. - height := app.LastBlockHeight() + 1 - if forZeroHeight { - height = 0 - app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) - } - - genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) - appState, err := json.MarshalIndent(genState, "", " ") - if err != nil { - return servertypes.ExportedApp{}, err - } - - validators, err := staking.WriteValidators(ctx, app.StakingKeeper) - return servertypes.ExportedApp{ - AppState: appState, - Validators: validators, - Height: height, - ConsensusParams: app.BaseApp.GetConsensusParams(ctx), - }, err -} - -// prepForZeroHeightGenesis prepares for a fresh genesis -// -// NOTE zero height genesis is a temporary feature which will be deprecated -// in favour of export at a block height -func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { - applyAllowedAddrs := false - - // check if there is a allowed address list - if len(jailAllowedAddrs) > 0 { - applyAllowedAddrs = true - } - - allowedAddrsMap := make(map[string]bool) - - for _, addr := range jailAllowedAddrs { - _, err := sdk.ValAddressFromBech32(addr) - if err != nil { - log.Fatal(err) - } - allowedAddrsMap[addr] = true - } - - /* Just to be safe, assert the invariants on current state. */ - app.CrisisKeeper.AssertInvariants(ctx) - - /* Handle fee distribution state. */ - - // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) - return false - }) - - // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) - for _, delegation := range dels { - valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) - if err != nil { - panic(err) - } - - delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) - - _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) - } - - // clear validator slash events - app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) - - // clear validator historical rewards - app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) - - // set context height to zero - height := ctx.BlockHeight() - ctx = ctx.WithBlockHeight(0) - - // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.DistrKeeper.GetFeePool(ctx) - feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.DistrKeeper.SetFeePool(ctx, feePool) - - if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { - panic(err) - } - return false - }) - - // reinitialize all delegations - for _, del := range dels { - valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) - if err != nil { - panic(err) - } - delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) - - if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { - // never called as BeforeDelegationCreated always returns nil - panic(fmt.Errorf("error while incrementing period: %w", err)) - } - - if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil { - // never called as AfterDelegationModified always returns nil - panic(fmt.Errorf("error while creating a new delegation period record: %w", err)) - } - } - - // reset context height - ctx = ctx.WithBlockHeight(height) - - /* Handle staking state. */ - - // iterate through redelegations, reset creation height - app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { - for i := range red.Entries { - red.Entries[i].CreationHeight = 0 - } - app.StakingKeeper.SetRedelegation(ctx, red) - return false - }) - - // iterate through unbonding delegations, reset creation height - app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { - for i := range ubd.Entries { - ubd.Entries[i].CreationHeight = 0 - } - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - return false - }) - - // Iterate through validators by power descending, reset bond heights, and - // update bond intra-tx counters. - store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) - counter := int16(0) - - for ; iter.Valid(); iter.Next() { - addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.StakingKeeper.GetValidator(ctx, addr) - if !found { - panic("expected validator, not found") - } - - validator.UnbondingHeight = 0 - if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { - validator.Jailed = true - } - - app.StakingKeeper.SetValidator(ctx, validator) - counter++ - } - - if err := iter.Close(); err != nil { - app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err) - return - } - - _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) - if err != nil { - log.Fatal(err) - } - - /* Handle slashing state. */ - - // reset start height on signing infos - app.SlashingKeeper.IterateValidatorSigningInfos( - ctx, - func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { - info.StartHeight = 0 - app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) - return false - }, - ) -} diff --git a/app/genesis.go b/app/genesis.go deleted file mode 100644 index 5bf0c1da8..000000000 --- a/app/genesis.go +++ /dev/null @@ -1,21 +0,0 @@ -package app - -import ( - "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" -) - -// The genesis state of the blockchain is represented here as a map of raw json -// messages key'd by a identifier string. -// The identifier is used to determine which module genesis information belongs -// to so it may be appropriately routed during init chain. -// Within this application default genesis information is retrieved from -// the ModuleBasicManager which populates json from each BasicModule -// object provided to it during init. -type GenesisState map[string]json.RawMessage - -// NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) -} diff --git a/app/params/encoding.go b/app/params/encoding.go deleted file mode 100644 index 3d634abf1..000000000 --- a/app/params/encoding.go +++ /dev/null @@ -1,16 +0,0 @@ -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/simulation_test.go b/app/simulation_test.go deleted file mode 100644 index ee0ed33ad..000000000 --- a/app/simulation_test.go +++ /dev/null @@ -1,501 +0,0 @@ -package app_test - -import ( - "encoding/json" - "fmt" - "math/rand" - "os" - "runtime/debug" - "strings" - "testing" - "time" - - dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cosmos/cosmos-sdk/x/simulation" - simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/app" -) - -type storeKeysPrefixes struct { - A storetypes.StoreKey - B storetypes.StoreKey - Prefixes [][]byte -} - -// Get flags every time the simulator is run -func init() { - simcli.GetSimulatorFlags() -} - -// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of -// an IAVLStore for faster simulation speed. -func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { - bapp.SetFauxMerkleMode() -} - -// BenchmarkSimulation run the chain simulation -// Running using starport command: -// `starport chain simulate -v --numBlocks 200 --blockSize 50` -// Running as go benchmark test: -// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true` -func BenchmarkSimulation(b *testing.B) { - simcli.FlagSeedValue = time.Now().Unix() - simcli.FlagVerboseValue = true - simcli.FlagCommitValue = true - simcli.FlagEnabledValue = true - - config := simcli.NewConfigFromFlags() - config.ChainID = "mars-simapp" - db, dir, logger, _, err := simtestutil.SetupSimulation( - config, - "leveldb-bApp-sim", - "Simulation", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) - require.NoError(b, err, "simulation setup failed") - - b.Cleanup(func() { - require.NoError(b, db.Close()) - require.NoError(b, os.RemoveAll(dir)) - }) - - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = app.DefaultNodeHome - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(b, app.Name, bApp.Name()) - - // run randomized simulation - _, simParams, simErr := simulation.SimulateFromSeed( - b, - os.Stdout, - bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), - simulationtypes.RandomAccounts, - simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.ModuleAccountAddrs(), - config, - bApp.AppCodec(), - ) - - // export state and simParams before the simulation error is checked - err = simtestutil.CheckExportSimulation(bApp, config, simParams) - require.NoError(b, err) - require.NoError(b, simErr) - - if config.Commit { - simtestutil.PrintStats(db) - } -} - -func TestAppStateDeterminism(t *testing.T) { - if !simcli.FlagEnabledValue { - t.Skip("skipping application simulation") - } - - config := simcli.NewConfigFromFlags() - config.InitialBlockHeight = 1 - config.ExportParamsPath = "" - config.OnOperation = true - config.AllInvariants = true - - var ( - r = rand.New(rand.NewSource(time.Now().Unix())) - numSeeds = 3 - numTimesToRunPerSeed = 5 - appHashList = make([]json.RawMessage, numTimesToRunPerSeed) - appOptions = make(simtestutil.AppOptionsMap, 0) - ) - appOptions[flags.FlagHome] = app.DefaultNodeHome - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - for i := 0; i < numSeeds; i++ { - config.Seed = r.Int63() - - for j := 0; j < numTimesToRunPerSeed; j++ { - var logger log.Logger - if simcli.FlagVerboseValue { - logger = log.TestingLogger() - } else { - logger = log.NewNopLogger() - } - chainID := fmt.Sprintf("chain-id-%d-%d", i, j) - config.ChainID = chainID - - db := dbm.NewMemDB() - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - simcli.FlagPeriodValue, - app.MakeEncodingConfig(), - appOptions, - fauxMerkleModeOpt, - baseapp.SetChainID(chainID), - ) - - fmt.Printf( - "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", - config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - - _, _, err := simulation.SimulateFromSeed( - t, - os.Stdout, - bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), - simulationtypes.RandomAccounts, - simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.ModuleAccountAddrs(), - config, - bApp.AppCodec(), - ) - require.NoError(t, err) - - if config.Commit { - simtestutil.PrintStats(db) - } - - appHash := bApp.LastCommitID().Hash - appHashList[j] = appHash - - if j != 0 { - require.Equal( - t, string(appHashList[0]), string(appHashList[j]), - "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - } - } - } -} - -func TestAppImportExport(t *testing.T) { - config := simcli.NewConfigFromFlags() - config.ChainID = "mars-simapp-import" - - db, dir, logger, skip, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim", - "Simulation", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) - if skip { - t.Skip("skipping application import/export simulation") - } - require.NoError(t, err, "simulation setup failed") - - defer func() { - require.NoError(t, db.Close()) - require.NoError(t, os.RemoveAll(dir)) - }() - - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = app.DefaultNodeHome - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(t, app.Name, bApp.Name()) - - // run randomized simulation - _, simParams, simErr := simulation.SimulateFromSeed( - t, - os.Stdout, - bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), - simulationtypes.RandomAccounts, - simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.BlockedModuleAccountAddrs(), - config, - bApp.AppCodec(), - ) - require.NoError(t, simErr) - - // export state and simParams before the simulation error is checked - err = simtestutil.CheckExportSimulation(bApp, config, simParams) - require.NoError(t, err) - - if config.Commit { - simtestutil.PrintStats(db) - } - - fmt.Printf("exporting genesis...\n") - - exported, err := bApp.ExportAppStateAndValidators(false, []string{}, []string{}) - require.NoError(t, err) - - fmt.Printf("importing genesis...\n") - - newDB, newDir, _, _, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim-2", - "Simulation-2", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) - require.NoError(t, err, "simulation setup failed") - - defer func() { - require.NoError(t, newDB.Close()) - require.NoError(t, os.RemoveAll(newDir)) - }() - - newApp := app.New( - log.NewNopLogger(), - newDB, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(t, app.Name, bApp.Name()) - - var genesisState app.GenesisState - err = json.Unmarshal(exported.AppState, &genesisState) - require.NoError(t, err) - - defer func() { - if r := recover(); r != nil { - err := fmt.Sprintf("%v", r) - if !strings.Contains(err, "validator set is empty after InitGenesis") { - panic(r) - } - logger.Info("Skipping simulation as all validators have been unbonded") - logger.Info("err", err, "stacktrace", string(debug.Stack())) - } - }() - - ctxA := bApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight()}) - newApp.ModuleManager().InitGenesis(ctxB, bApp.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) - - fmt.Printf("comparing stores...\n") - - storeKeysPrefixes := []storeKeysPrefixes{ - {bApp.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, - { - bApp.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), - [][]byte{ - stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, - }, - }, // ordering may change but it doesn't matter - {bApp.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}}, - {bApp.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}}, - {bApp.GetKey(paramstypes.StoreKey), newApp.GetKey(paramstypes.StoreKey), [][]byte{}}, - {bApp.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, - {bApp.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, - {bApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, - } - - 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 different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) - } -} - -func TestAppSimulationAfterImport(t *testing.T) { - config := simcli.NewConfigFromFlags() - config.ChainID = "mars-simapp-after-import" - - db, dir, logger, skip, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim", - "Simulation", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) - if skip { - t.Skip("skipping application simulation after import") - } - require.NoError(t, err, "simulation setup failed") - - defer func() { - require.NoError(t, db.Close()) - require.NoError(t, os.RemoveAll(dir)) - }() - - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = app.DefaultNodeHome - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - bApp := app.New( - logger, - db, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - fauxMerkleModeOpt, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(t, app.Name, bApp.Name()) - - // run randomized simulation - stopEarly, simParams, simErr := simulation.SimulateFromSeed( - t, - os.Stdout, - bApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), - simulationtypes.RandomAccounts, - simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - bApp.BlockedModuleAccountAddrs(), - config, - bApp.AppCodec(), - ) - require.NoError(t, simErr) - - // export state and simParams before the simulation error is checked - err = simtestutil.CheckExportSimulation(bApp, config, simParams) - require.NoError(t, err) - - if config.Commit { - simtestutil.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 := bApp.ExportAppStateAndValidators(true, []string{}, []string{}) - require.NoError(t, err) - - fmt.Printf("importing genesis...\n") - - newDB, newDir, _, _, err := simtestutil.SetupSimulation( - config, - "leveldb-app-sim-2", - "Simulation-2", - simcli.FlagVerboseValue, - simcli.FlagEnabledValue, - ) - require.NoError(t, err, "simulation setup failed") - - defer func() { - require.NoError(t, newDB.Close()) - require.NoError(t, os.RemoveAll(newDir)) - }() - - newApp := app.New( - log.NewNopLogger(), - newDB, - nil, - true, - map[int64]bool{}, - app.DefaultNodeHome, - 0, - app.MakeEncodingConfig(), - appOptions, - fauxMerkleModeOpt, - baseapp.SetChainID(config.ChainID), - ) - require.Equal(t, app.Name, bApp.Name()) - - newApp.InitChain(abci.RequestInitChain{ - ChainId: config.ChainID, - AppStateBytes: exported.AppState, - }) - - _, _, err = simulation.SimulateFromSeed( - t, - os.Stdout, - newApp.BaseApp, - simtestutil.AppStateFn( - bApp.AppCodec(), - bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), - ), - simulationtypes.RandomAccounts, - simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config), - newApp.BlockedModuleAccountAddrs(), - config, - bApp.AppCodec(), - ) - require.NoError(t, err) -} diff --git a/cmd/pocketd/cmd/config.go b/cmd/pocketd/cmd/config.go deleted file mode 100644 index 1182b1159..000000000 --- a/cmd/pocketd/cmd/config.go +++ /dev/null @@ -1,27 +0,0 @@ -package cmd - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/app" -) - -// InitSDKConfig initializes the SDK's config with the appropriate parameters -// and prefixes so everything is named appropriately for Pocket Network. -// TODO_DISCUSS: Exporting publically for testing purposes only. -// Consider adding a helper per the discussion here: https://github.com/pokt-network/poktroll/pull/59#discussion_r1357816798 -func InitSDKConfig() { - // Set prefixes - accountPubKeyPrefix := app.AccountAddressPrefix + "pub" - validatorAddressPrefix := app.AccountAddressPrefix + "valoper" - validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" - consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" - consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" - - // Set and seal config - config := sdk.GetConfig() - config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) - config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) - config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) - config.Seal() -} diff --git a/cmd/pocketd/cmd/genaccounts.go b/cmd/pocketd/cmd/genaccounts.go deleted file mode 100644 index d5ec65337..000000000 --- a/cmd/pocketd/cmd/genaccounts.go +++ /dev/null @@ -1,192 +0,0 @@ -package cmd - -import ( - "bufio" - "encoding/json" - "errors" - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cobra" -) - -const ( - flagVestingStart = "vesting-start-time" - flagVestingEnd = "vesting-end-time" - flagVestingAmt = "vesting-amount" -) - -// AddGenesisAccountCmd returns add-genesis-account cobra Command. -func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", - Short: "Add a genesis account to genesis.json", - Long: `Add a genesis account to genesis.json. The provided account must specify -the account address or key name and a list of initial coins. If a key name is given, -the address will be looked up in the local Keybase. The list of initial tokens must -contain valid denominations. Accounts may optionally be supplied with vesting parameters. -`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - cdc := clientCtx.Codec - - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - coins, err := sdk.ParseCoinsNormalized(args[1]) - if err != nil { - return fmt.Errorf("failed to parse coins: %w", err) - } - - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - inBuf := bufio.NewReader(cmd.InOrStdin()) - keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend) - if err != nil { - return err - } - - // attempt to lookup address from Keybase if no address was provided - kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf, cdc) - if err != nil { - return err - } - - info, err := kb.Key(args[0]) - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - - addr, err = info.GetAddress() - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - } - - vestingStart, err := cmd.Flags().GetInt64(flagVestingStart) - if err != nil { - return err - } - vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd) - if err != nil { - return err - } - vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt) - if err != nil { - return err - } - - vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) - if err != nil { - return fmt.Errorf("failed to parse vesting amount: %w", err) - } - - // create concrete account type based on input parameters - var genAccount authtypes.GenesisAccount - - balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} - baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) - - if !vestingAmt.IsZero() { - baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) - - if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || - baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { - return errors.New("vesting amount cannot be greater than total amount") - } - - switch { - case vestingStart != 0 && vestingEnd != 0: - genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) - - case vestingEnd != 0: - genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) - - default: - return errors.New("invalid vesting parameters; must supply start and end time or end time") - } - } else { - genAccount = baseAccount - } - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) - - accs, err := authtypes.UnpackAccounts(authGenState.Accounts) - if err != nil { - return fmt.Errorf("failed to get accounts from any: %w", err) - } - - if accs.Contains(addr) { - return fmt.Errorf("cannot add account at existing address %s", addr) - } - - // Add the new account to the set of genesis accounts and sanitize the - // accounts afterwards. - accs = append(accs, genAccount) - accs = authtypes.SanitizeGenesisAccounts(accs) - - genAccs, err := authtypes.PackAccounts(accs) - if err != nil { - return fmt.Errorf("failed to convert accounts into any's: %w", err) - } - authGenState.Accounts = genAccs - - authGenStateBz, err := cdc.MarshalJSON(&authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[authtypes.ModuleName] = authGenStateBz - - bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState) - bankGenState.Balances = append(bankGenState.Balances, balances) - bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) - - bankGenStateBz, err := cdc.MarshalJSON(bankGenState) - if err != nil { - return fmt.Errorf("failed to marshal bank genesis state: %w", err) - } - - appState[banktypes.ModuleName] = bankGenStateBz - - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") - cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") - cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/cmd/pocketd/cmd/root.go b/cmd/pocketd/cmd/root.go deleted file mode 100644 index 55b7071fc..000000000 --- a/cmd/pocketd/cmd/root.go +++ /dev/null @@ -1,386 +0,0 @@ -package cmd - -import ( - "errors" - "io" - "os" - "path/filepath" - "strings" - - // this line is used by starport scaffolding # root/moduleImport - - dbm "github.com/cometbft/cometbft-db" - tmcfg "github.com/cometbft/cometbft/config" - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/debug" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/server" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cast" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - - // this line is used by starport scaffolding # root/moduleImport - - "github.com/pokt-network/poktroll/app" - appparams "github.com/pokt-network/poktroll/app/params" - appgateservercmd "github.com/pokt-network/poktroll/pkg/appgateserver/cmd" - relayercmd "github.com/pokt-network/poktroll/pkg/relayer/cmd" -) - -// NewRootCmd creates a new root command for a Cosmos SDK application -func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { - encodingConfig := app.MakeEncodingConfig() - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(app.DefaultNodeHome). - WithViper("") - - rootCmd := &cobra.Command{ - Use: app.Name + "d", - Short: "Start pocket node", - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // set the default command outputs - cmd.SetOut(cmd.OutOrStdout()) - cmd.SetErr(cmd.ErrOrStderr()) - initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) - if err != nil { - return err - } - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) - if err != nil { - return err - } - - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - customAppTemplate, customAppConfig := initAppConfig() - customTMConfig := initTendermintConfig() - return server.InterceptConfigsPreRunHandler( - cmd, customAppTemplate, customAppConfig, customTMConfig, - ) - }, - } - - initRootCmd(rootCmd, encodingConfig) - overwriteFlagDefaults(rootCmd, map[string]string{ - flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), - flags.FlagKeyringBackend: "test", - }) - - return rootCmd, encodingConfig -} - -// initTendermintConfig helps to override default Tendermint Config values. -// return tmcfg.DefaultConfig if no custom configuration is required for the application. -func initTendermintConfig() *tmcfg.Config { - cfg := tmcfg.DefaultConfig() - return cfg -} - -func initRootCmd( - rootCmd *cobra.Command, - encodingConfig appparams.EncodingConfig, -) { - // Set config - InitSDKConfig() - - gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) - rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), - genutilcli.MigrateGenesisCmd(), - genutilcli.GenTxCmd( - app.ModuleBasics, - encodingConfig.TxConfig, - banktypes.GenesisBalancesIterator{}, - app.DefaultNodeHome, - ), - genutilcli.ValidateGenesisCmd(app.ModuleBasics), - AddGenesisAccountCmd(app.DefaultNodeHome), - tmcli.NewCompletionCmd(rootCmd, true), - debug.Cmd(), - config.Cmd(), - // this line is used by starport scaffolding # root/commands - ) - - a := appCreator{ - encodingConfig, - } - - // add server commands - server.AddCommands( - rootCmd, - app.DefaultNodeHome, - a.newApp, - a.appExport, - addModuleInitFlags, - ) - - // add relayer command - rootCmd.AddCommand( - relayercmd.RelayerCmd(), - ) - - // add keybase, auxiliary RPC, query, and tx child commands - rootCmd.AddCommand( - rpc.StatusCommand(), - queryCommand(), - txCommand(), - keys.Commands(app.DefaultNodeHome), - ) - - // add the appgate server command - rootCmd.AddCommand( - appgateservercmd.AppGateServerCmd(), - ) -} - -// queryCommand returns the sub-command to send queries to the app -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetAccountCmd(), - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), - authcmd.QueryTxCmd(), - ) - - app.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -// txCommand returns the sub-command to send transactions to the app -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - ) - - app.ModuleBasics.AddTxCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) - // this line is used by starport scaffolding # root/arguments -} - -func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { - set := func(s *pflag.FlagSet, key, val string) { - if f := s.Lookup(key); f != nil { - f.DefValue = val - f.Value.Set(val) - } - } - for key, val := range defaults { - set(c.Flags(), key, val) - set(c.PersistentFlags(), key, val) - } - for _, c := range c.Commands() { - overwriteFlagDefaults(c, defaults) - } -} - -type appCreator struct { - encodingConfig appparams.EncodingConfig -} - -// newApp creates a new Cosmos SDK app -func (a appCreator) newApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - appOpts servertypes.AppOptions, -) servertypes.Application { - var cache sdk.MultiStorePersistentCache - - if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { - cache = store.NewCommitKVStoreCacheManager() - } - - skipUpgradeHeights := make(map[int64]bool) - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - - pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts) - if err != nil { - panic(err) - } - - homeDir := cast.ToString(appOpts.Get(flags.FlagHome)) - chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) - if chainID == "" { - // fallback to genesis chain-id - appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json")) - if err != nil { - panic(err) - } - - chainID = appGenesis.ChainID - } - - snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir) - if err != nil { - panic(err) - } - snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) - if err != nil { - panic(err) - } - - snapshotOptions := snapshottypes.NewSnapshotOptions( - cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), - cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), - ) - - return app.New( - logger, - db, - traceStore, - true, - skipUpgradeHeights, - cast.ToString(appOpts.Get(flags.FlagHome)), - cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), - a.encodingConfig, - appOpts, - baseapp.SetPruning(pruningOpts), - baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), - baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), - baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), - baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), - baseapp.SetInterBlockCache(cache), - baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), - baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), - baseapp.SetSnapshot(snapshotStore, snapshotOptions), - baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))), - baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))), - baseapp.SetChainID(chainID), - ) -} - -// appExport creates a new simapp (optionally at a given height) -func (a appCreator) appExport( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home not set") - } - - app := app.New( - logger, - db, - traceStore, - height == -1, // -1: no height provided - map[int64]bool{}, - homePath, - uint(1), - a.encodingConfig, - appOpts, - ) - - if height != -1 { - if err := app.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } - } - - return app.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) -} - -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // The following code snippet is just for reference. - - type CustomAppConfig struct { - serverconfig.Config - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = "0upokt" - - customAppConfig := CustomAppConfig{ - Config: *srvCfg, - } - customAppTemplate := serverconfig.DefaultConfigTemplate - - return customAppTemplate, customAppConfig -} diff --git a/cmd/pocketd/main.go b/cmd/pocketd/main.go deleted file mode 100644 index 25c7ebcef..000000000 --- a/cmd/pocketd/main.go +++ /dev/null @@ -1,24 +0,0 @@ -package main - -import ( - "os" - - "github.com/cosmos/cosmos-sdk/server" - svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" -) - -func main() { - rootCmd, _ := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - - default: - os.Exit(1) - } - } -} diff --git a/cmd/signals/on_exit.go b/cmd/signals/on_exit.go deleted file mode 100644 index 5b8625dd4..000000000 --- a/cmd/signals/on_exit.go +++ /dev/null @@ -1,24 +0,0 @@ -package signals - -import ( - "os" - "os/signal" - "syscall" -) - -// GoOnExitSignal calls the given callback when the process receives an interrupt -// or terminate signal. -func GoOnExitSignal(onInterrupt func()) { - go func() { - // Set up sigCh to receive when this process receives an interrupt or - // terminate signal. - sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM) - - // Block until we receive an interrupt or kill signal (OS-agnostic) - <-sigCh - - // Call the onInterrupt callback. - onInterrupt() - }() -} diff --git a/config.yml b/config.yml deleted file mode 100644 index d55021f8f..000000000 --- a/config.yml +++ /dev/null @@ -1,118 +0,0 @@ -version: 1 -build: - main: cmd/pocketd -accounts: - - name: faucet - mnemonic: "baby advance work soap slow exclude blur humble lucky rough teach wide chuckle captain rack laundry butter main very cannon donate armor dress follow" - coins: - - 999999999999999999upokt - # PNF represents the multisig address that acts on behalf of the DAO - - name: pnf - mnemonic: "crumble shrimp south strategy speed kick green topic stool seminar track stand rhythm almost bubble pet knock steel pull flag weekend country major blade" - coins: - - 69000000000000000000042upokt - - name: sequencer1 - mnemonic: "creek path rule retire evolve vehicle bargain champion roof whisper prize endorse unknown anchor fashion energy club sauce elder parent cotton old affair visa" - coins: - - 900000000000000upokt - - name: app1 - mnemonic: "mention spy involve verb exercise fiction catalog order agent envelope mystery text defy sing royal fringe return face alpha knife wonder vocal virus drum" - coins: - - 100000000upokt - - name: app2 - mnemonic: "material little labor strong search device trick amateur action crouch invite glide provide elite mango now paper sense found hamster neglect work install bulk" - coins: - - 200000000upokt - - name: app3 - mnemonic: "involve clean slab term real human green immune valid swing protect talk silent unique cart few ice era right thunder again drop among bounce" - coins: - - 300000000upokt - - name: supplier1 - mnemonic: "cool industry busy tumble funny relax error state height like board wing goat emerge visual idle never unveil announce hill primary okay spatial frog" - coins: - - 110000000upokt - - name: supplier2 - mnemonic: "peanut hen enroll meat legal have error input bulk later correct denial onion fossil wing excuse elephant object apology switch claim rare decide surface" - coins: - - 220000000upokt - - name: supplier3 - mnemonic: "client city senior tenant source soda spread buffalo shaft amused bar carbon keen off feel coral easily announce metal orphan sustain maple expand loop" - coins: - - 330000000upokt - - name: gateway1 - mnemonic: "salt iron goat also absorb depend involve agent apology between lift shy door left bulb arrange industry father jelly olive rifle return predict into" - coins: - - 100000000upokt - - name: gateway2 - mnemonic: "suffer wet jelly furnace cousin flip layer render finish frequent pledge feature economy wink like water disease final erase goat include apple state furnace" - coins: - - 200000000upokt - - name: gateway3 - mnemonic: "elder spatial erosion soap athlete tide subject recipe also awkward head pattern cart version beach usual oxygen confirm erupt diamond maze smooth census garment" - coins: - - 300000000upokt -faucet: - name: faucet - coins: - - 10000upokt -client: - typescript: - path: ts-client - hooks: - path: react/src/hooks - openapi: - path: docs/static/openapi.yml -validators: - - name: sequencer1 - bonded: 900000000upokt - config: - moniker: "sequencer1" - -# We can persist arbitrary genesis values via 1 to 1 mapping to genesis.json -genesis: - app_state: - mint: - params: - mint_denom: upokt - staking: - params: - bond_denom: upokt - crisis: - constant_fee: - amount: "10000" - denom: upokt - gov: - params: - min_deposit: - - amount: "10000" - denom: upokt - application: - params: - maxDelegatedGateways: 7 - applicationList: - - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 - delegatee_gateway_addresses: [] - service_configs: - - service: - id: anvil - name: "" - stake: - amount: "1000" - denom: upokt - supplier: - supplierList: - - address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj - services: - - endpoints: - - configs: [] - rpc_type: JSON_RPC - url: http://relayminers:8545 - service: - id: anvil - name: "" - stake: - amount: "1000" - denom: upokt - service: - params: - addServiceFee: 1000000000 diff --git a/docs/docs.go b/docs/docs.go deleted file mode 100644 index 1ba96c79d..000000000 --- a/docs/docs.go +++ /dev/null @@ -1,40 +0,0 @@ -package docs - -import ( - "embed" - httptemplate "html/template" - "net/http" - - "github.com/gorilla/mux" -) - -const ( - apiFile = "/static/openapi.yml" - indexFile = "template/index.tpl" -) - -//go:embed static -var Static embed.FS - -//go:embed template -var template embed.FS - -func RegisterOpenAPIService(appName string, rtr *mux.Router) { - rtr.Handle(apiFile, http.FileServer(http.FS(Static))) - rtr.HandleFunc("/", handler(appName)) -} - -// handler returns an http handler that servers OpenAPI console for an OpenAPI spec at specURL. -func handler(title string) http.HandlerFunc { - t, _ := httptemplate.ParseFS(template, indexFile) - - return func(w http.ResponseWriter, req *http.Request) { - t.Execute(w, struct { - Title string - URL string - }{ - title, - apiFile, - }) - } -} diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml deleted file mode 100644 index aec5c71d6..000000000 --- a/docs/static/openapi.yml +++ /dev/null @@ -1,79362 +0,0 @@ -swagger: '2.0' -info: - title: HTTP API Console - name: '' - description: '' -paths: - /cosmos/auth/v1beta1/account_info/{address}: - get: - summary: AccountInfo queries account info which is common to all account types. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosAuthV1Beta1AccountInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - info: - description: info is the account info which is represented by BaseAccount. - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - account_number: - type: string - format: uint64 - sequence: - type: string - format: uint64 - description: |- - QueryAccountInfoResponse is the Query/AccountInfo response type. - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address - description: address is the account address string. - in: path - required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/accounts: - get: - summary: Accounts returns all the existing accounts. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - - - Since: cosmos-sdk 0.43 - operationId: CosmosAuthV1Beta1Accounts - responses: - '200': - description: A successful response. - schema: - type: object - properties: - accounts: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: accounts are the existing accounts - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAccountsResponse is the response type for the Query/Accounts - RPC method. - - - Since: cosmos-sdk 0.43 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/auth/v1beta1/accounts/{address}: - get: - summary: Account returns account details based on address. - operationId: CosmosAuthV1Beta1Account - responses: - '200': - description: A successful response. - schema: - type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryAccountResponse is the response type for the Query/Account - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address - description: address defines the address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/address_by_id/{id}: - get: - summary: AccountAddressByID returns account address based on account number. - description: 'Since: cosmos-sdk 0.46.2' - operationId: CosmosAuthV1Beta1AccountAddressByID - responses: - '200': - description: A successful response. - schema: - type: object - properties: - account_address: - type: string - description: 'Since: cosmos-sdk 0.46.2' - title: >- - QueryAccountAddressByIDResponse is the response type for - AccountAddressByID rpc method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: id - description: |- - Deprecated, use account_id instead - - id is the account number of the address to be queried. This field - should have been an uint64 (like all account numbers), and will be - updated to uint64 in a future version of the auth query. - in: path - required: true - type: string - format: int64 - - name: account_id - description: |- - account_id is the account number of the address to be queried. - - Since: cosmos-sdk 0.47 - in: query - required: false - type: string - format: uint64 - tags: - - Query - /cosmos/auth/v1beta1/bech32: - get: - summary: Bech32Prefix queries bech32Prefix - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1Bech32Prefix - responses: - '200': - description: A successful response. - schema: - type: object - properties: - bech32_prefix: - type: string - description: >- - Bech32PrefixResponse is the response type for Bech32Prefix rpc - method. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/auth/v1beta1/bech32/{address_bytes}: - get: - summary: AddressBytesToString converts Account Address bytes to string - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1AddressBytesToString - responses: - '200': - description: A successful response. - schema: - type: object - properties: - address_string: - type: string - description: >- - AddressBytesToStringResponse is the response type for - AddressString rpc method. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address_bytes - in: path - required: true - type: string - format: byte - tags: - - Query - /cosmos/auth/v1beta1/bech32/{address_string}: - get: - summary: AddressStringToBytes converts Address string to bytes - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1AddressStringToBytes - responses: - '200': - description: A successful response. - schema: - type: object - properties: - address_bytes: - type: string - format: byte - description: >- - AddressStringToBytesResponse is the response type for AddressBytes - rpc method. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address_string - in: path - required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/module_accounts: - get: - summary: ModuleAccounts returns all the existing module accounts. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthV1Beta1ModuleAccounts - responses: - '200': - description: A successful response. - schema: - type: object - properties: - accounts: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryModuleAccountsResponse is the response type for the - Query/ModuleAccounts RPC method. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/auth/v1beta1/module_accounts/{name}: - get: - summary: ModuleAccountByName returns the module account info by module name - operationId: CosmosAuthV1Beta1ModuleAccountByName - responses: - '200': - description: A successful response. - schema: - type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryModuleAccountByNameResponse is the response type for the - Query/ModuleAccountByName RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: name - in: path - required: true - type: string - tags: - - Query - /cosmos/auth/v1beta1/params: - get: - summary: Params queries all parameters. - operationId: CosmosAuthV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - max_memo_characters: - type: string - format: uint64 - tx_sig_limit: - type: string - format: uint64 - tx_size_cost_per_byte: - type: string - format: uint64 - sig_verify_cost_ed25519: - type: string - format: uint64 - sig_verify_cost_secp256k1: - type: string - format: uint64 - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/authz/v1beta1/grants: - get: - summary: Returns list of `Authorization`, granted to the grantee by the granter. - operationId: CosmosAuthzV1Beta1Grants - responses: - '200': - description: A successful response. - schema: - type: object - properties: - grants: - type: array - items: - type: object - properties: - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - time when the grant will expire and will be pruned. If - null, then the grant - - doesn't have a time expiration (other conditions in - `authorization` - - may apply to invalidate the grant) - description: |- - Grant gives permissions to execute - the provide method with expiration time. - description: >- - authorizations is a list of grants granted for grantee by - granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGrantsResponse is the response type for the - Query/Authorizations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: granter - in: query - required: false - type: string - - name: grantee - in: query - required: false - type: string - - name: msg_type_url - description: >- - Optional, msg_type_url, when set, will query only grants matching - given msg type. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/authz/v1beta1/grants/grantee/{grantee}: - get: - summary: GranteeGrants returns a list of `GrantAuthorization` by grantee. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthzV1Beta1GranteeGrants - responses: - '200': - description: A successful response. - schema: - type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses - of the grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted to the grantee. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranteeGrantsResponse is the response type for the - Query/GranteeGrants RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: grantee - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/authz/v1beta1/grants/granter/{granter}: - get: - summary: GranterGrants returns list of `GrantAuthorization`, granted by granter. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosAuthzV1Beta1GranterGrants - responses: - '200': - description: A successful response. - schema: - type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses - of the grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranterGrantsResponse is the response type for the - Query/GranterGrants RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: granter - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/balances/{address}: - get: - summary: AllBalances queries the balance of all coins for a single account. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosBankV1Beta1AllBalances - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: balances is the balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllBalancesResponse is the response type for the - Query/AllBalances RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query balances for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/balances/{address}/by_denom: - get: - summary: Balance queries the balance of a single coin for a single account. - operationId: CosmosBankV1Beta1Balance - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QueryBalanceResponse is the response type for the Query/Balance - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query balances for. - in: path - required: true - type: string - - name: denom - description: denom is the coin denom to query balances for. - in: query - required: false - type: string - tags: - - Query - /cosmos/bank/v1beta1/denom_owners/{denom}: - get: - summary: >- - DenomOwners queries for all account addresses that own a particular - token - - denomination. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - - - Since: cosmos-sdk 0.46 - operationId: CosmosBankV1Beta1DenomOwners - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_owners: - type: array - items: - type: object - properties: - address: - type: string - description: >- - address defines the address that owns a particular - denomination. - balance: - description: >- - balance is the balance of the denominated coin for an - account. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DenomOwner defines structure representing an account that - owns or holds a - - particular denominated token. It contains the account - address and account - - balance of the denominated token. - - - Since: cosmos-sdk 0.46 - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDenomOwnersResponse defines the RPC response of a DenomOwners - RPC query. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: denom - description: >- - denom defines the coin denomination to query all account holders - for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/denoms_metadata: - get: - summary: |- - DenomsMetadata queries the client metadata for all registered coin - denominations. - operationId: CosmosBankV1Beta1DenomsMetadata - responses: - '200': - description: A successful response. - schema: - type: object - properties: - metadatas: - type: array - items: - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given - denom unit (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one - must - - raise the base_denom to in order to equal the - given DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a - DenomUnit of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: >- - aliases is a list of string aliases for the given - denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: >- - denom_units represents the list of DenomUnit's for a - given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit - with exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges - (eg: ATOM). This can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains - additional information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. - It's used to verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: |- - Metadata represents a struct that describes - a basic token. - description: >- - metadata provides the client information for all the - registered tokens. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDenomsMetadataResponse is the response type for the - Query/DenomsMetadata RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/denoms_metadata/{denom}: - get: - summary: DenomsMetadata queries the client metadata of a given coin denomination. - operationId: CosmosBankV1Beta1DenomMetadata - responses: - '200': - description: A successful response. - schema: - type: object - properties: - metadata: - description: >- - metadata describes and provides all the client information for - the requested token. - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom - unit (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one - must - - raise the base_denom to in order to equal the given - DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a - DenomUnit of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: >- - aliases is a list of string aliases for the given - denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: >- - denom_units represents the list of DenomUnit's for a given - coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit - with exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: - ATOM). This can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains - additional information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. - It's used to verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: >- - QueryDenomMetadataResponse is the response type for the - Query/DenomMetadata RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: denom - description: denom is the coin denom to query the metadata for. - in: path - required: true - type: string - tags: - - Query - /cosmos/bank/v1beta1/params: - get: - summary: Params queries the parameters of x/bank module. - operationId: CosmosBankV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status - (whether a denom is - - sendable). - description: >- - Deprecated: Use of SendEnabled in params is deprecated. - - For genesis, use the newly added send_enabled field in the - genesis object. - - Storage, lookup, and manipulation of this information is - now in the keeper. - - - As of cosmos-sdk 0.47, this only exists for backwards - compatibility of genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. - description: >- - QueryParamsResponse defines the response type for querying x/bank - parameters. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/bank/v1beta1/send_enabled: - get: - summary: SendEnabled queries for SendEnabled entries. - description: >- - This query only returns denominations that have specific SendEnabled - settings. - - Any denomination that does not have a specific setting will use the - default - - params.default_send_enabled, and will not be returned by this query. - - - Since: cosmos-sdk 0.47 - operationId: CosmosBankV1Beta1SendEnabled - responses: - '200': - description: A successful response. - schema: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status - (whether a denom is - - sendable). - pagination: - description: >- - pagination defines the pagination in the response. This field - is only - - populated if the denoms field in the request is empty. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QuerySendEnabledResponse defines the RPC response of a SendEnable - query. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: denoms - description: >- - denoms is the specific denoms you want look up. Leave empty to get - all entries. - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/spendable_balances/{address}: - get: - summary: >- - SpendableBalances queries the spendable balance of all coins for a - single - - account. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - - - Since: cosmos-sdk 0.46 - operationId: CosmosBankV1Beta1SpendableBalances - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: balances is the spendable balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QuerySpendableBalancesResponse defines the gRPC response structure - for querying - - an account's spendable balances. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query spendable balances for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/spendable_balances/{address}/by_denom: - get: - summary: >- - SpendableBalanceByDenom queries the spendable balance of a single denom - for - - a single account. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - - - Since: cosmos-sdk 0.47 - operationId: CosmosBankV1Beta1SpendableBalanceByDenom - responses: - '200': - description: A successful response. - schema: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySpendableBalanceByDenomResponse defines the gRPC response - structure for - - querying an account's spendable balance for a specific denom. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - description: address is the address to query balances for. - in: path - required: true - type: string - - name: denom - description: denom is the coin denom to query balances for. - in: query - required: false - type: string - tags: - - Query - /cosmos/bank/v1beta1/supply: - get: - summary: TotalSupply queries the total supply of all coins. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosBankV1Beta1TotalSupply - responses: - '200': - description: A successful response. - schema: - type: object - properties: - supply: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - title: supply is the supply of the coins - pagination: - description: |- - pagination defines the pagination in the response. - - Since: cosmos-sdk 0.43 - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryTotalSupplyResponse is the response type for the - Query/TotalSupply RPC - - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/bank/v1beta1/supply/by_denom: - get: - summary: SupplyOf queries the supply of a single coin. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosBankV1Beta1SupplyOf - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - description: amount is the supply of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySupplyOfResponse is the response type for the Query/SupplyOf - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: denom - description: denom is the coin denom to query balances for. - in: query - required: false - type: string - tags: - - Query - /cosmos/base/node/v1beta1/config: - get: - summary: Config queries for the operator configuration. - operationId: CosmosBaseNodeV1Beta1Config - responses: - '200': - description: A successful response. - schema: - type: object - properties: - minimum_gas_price: - type: string - description: >- - ConfigResponse defines the response structure for the Config gRPC - query. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Service - /cosmos/base/tendermint/v1beta1/abci_query: - get: - summary: >- - ABCIQuery defines a query handler that supports ABCI queries directly to - the - - application, bypassing Tendermint completely. The ABCI query must - contain - - a valid and supported path, including app, custom, p2p, and store. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosBaseTendermintV1Beta1ABCIQuery - responses: - '200': - description: A successful response. - schema: - type: object - properties: - code: - type: integer - format: int64 - log: - type: string - title: nondeterministic - info: - type: string - title: nondeterministic - index: - type: string - format: int64 - key: - type: string - format: byte - value: - type: string - format: byte - proof_ops: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle - root. The data could - - be arbitrary format, providing necessary data for - example neighbouring node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type - defined in Tendermint. - description: >- - ProofOps is Merkle proof defined by the list of ProofOps. - - - Note: This type is a duplicate of the ProofOps proto type - defined in Tendermint. - height: - type: string - format: int64 - codespace: - type: string - description: >- - ABCIQueryResponse defines the response structure for the ABCIQuery - gRPC query. - - - Note: This type is a duplicate of the ResponseQuery proto type - defined in - - Tendermint. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: data - in: query - required: false - type: string - format: byte - - name: path - in: query - required: false - type: string - - name: height - in: query - required: false - type: string - format: int64 - - name: prove - in: query - required: false - type: boolean - tags: - - Service - /cosmos/base/tendermint/v1beta1/blocks/latest: - get: - summary: GetLatestBlock returns the latest block. - operationId: CosmosBaseTendermintV1Beta1GetLatestBlock - responses: - '200': - description: A successful response. - schema: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing - on the order first. - - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer - address, formatted as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, - we convert it to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing - on the order first. - - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - description: >- - Block is tendermint type Block, with the Header proposer - address - - field converted to bech32 string. - description: >- - GetLatestBlockResponse is the response type for the - Query/GetLatestBlock RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Service - /cosmos/base/tendermint/v1beta1/blocks/{height}: - get: - summary: GetBlockByHeight queries block for given height. - operationId: CosmosBaseTendermintV1Beta1GetBlockByHeight - responses: - '200': - description: A successful response. - schema: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing - on the order first. - - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer - address, formatted as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, - we convert it to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing - on the order first. - - This means that block.AppHash does not include these - txs. - title: >- - Data contains the set of transactions included in the - block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed - message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or - commit vote from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a - validator signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a - block was committed by a set of - validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a - set of validators attempting to mislead a light - client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - description: >- - Block is tendermint type Block, with the Header proposer - address - - field converted to bech32 string. - description: >- - GetBlockByHeightResponse is the response type for the - Query/GetBlockByHeight RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - in: path - required: true - type: string - format: int64 - tags: - - Service - /cosmos/base/tendermint/v1beta1/node_info: - get: - summary: GetNodeInfo queries the current node info. - operationId: CosmosBaseTendermintV1Beta1GetNodeInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - default_node_info: - type: object - properties: - protocol_version: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - default_node_id: - type: string - listen_addr: - type: string - network: - type: string - version: - type: string - channels: - type: string - format: byte - moniker: - type: string - other: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - application_version: - type: object - properties: - name: - type: string - app_name: - type: string - version: - type: string - git_commit: - type: string - build_tags: - type: string - go_version: - type: string - build_deps: - type: array - items: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos_sdk_version: - type: string - title: 'Since: cosmos-sdk 0.43' - description: VersionInfo is the type for the GetNodeInfoResponse message. - description: >- - GetNodeInfoResponse is the response type for the Query/GetNodeInfo - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Service - /cosmos/base/tendermint/v1beta1/syncing: - get: - summary: GetSyncing queries node syncing. - operationId: CosmosBaseTendermintV1Beta1GetSyncing - responses: - '200': - description: A successful response. - schema: - type: object - properties: - syncing: - type: boolean - description: >- - GetSyncingResponse is the response type for the Query/GetSyncing - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Service - /cosmos/base/tendermint/v1beta1/validatorsets/latest: - get: - summary: GetLatestValidatorSet queries latest validator-set. - operationId: CosmosBaseTendermintV1Beta1GetLatestValidatorSet - responses: - '200': - description: A successful response. - schema: - type: object - properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetLatestValidatorSetResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Service - /cosmos/base/tendermint/v1beta1/validatorsets/{height}: - get: - summary: GetValidatorSetByHeight queries validator-set at a given height. - operationId: CosmosBaseTendermintV1Beta1GetValidatorSetByHeight - responses: - '200': - description: A successful response. - schema: - type: object - properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetValidatorSetByHeightResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - in: path - required: true - type: string - format: int64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Service - /cosmos/consensus/v1/params: - get: - summary: Params queries the parameters of x/consensus_param module. - operationId: CosmosConsensusV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: >- - params are the tendermint consensus params stored in the - consensus module. - - Please note that `params.version` is not populated in this - response, it is - - tracked separately in the x/upgrade module. - type: object - properties: - block: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - evidence: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: - MaxAgeDuration / {average block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" - or other similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes - that can be committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: >- - EvidenceParams determine how we handle evidence of - malfeasance. - validator: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: >- - ValidatorParams restrict the public key types validators - can use. - - NOTE: uses ABCI pubkey naming, not Amino names. - version: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - description: >- - QueryParamsResponse defines the response type for querying - x/consensus parameters. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/distribution/v1beta1/community_pool: - get: - summary: CommunityPool queries the community pool coins. - operationId: CosmosDistributionV1Beta1CommunityPool - responses: - '200': - description: A successful response. - schema: - type: object - properties: - pool: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: pool defines community pool's coins. - description: >- - QueryCommunityPoolResponse is the response type for the - Query/CommunityPool - - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards: - get: - summary: |- - DelegationTotalRewards queries the total rewards accrued by a each - validator. - operationId: CosmosDistributionV1Beta1DelegationTotalRewards - responses: - '200': - description: A successful response. - schema: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - validator_address: - type: string - reward: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - description: |- - DelegationDelegatorReward represents the properties - of a delegator's delegation reward. - description: rewards defines all the rewards accrued by a delegator. - total: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: total defines the sum of all the rewards. - description: |- - QueryDelegationTotalRewardsResponse is the response type for the - Query/DelegationTotalRewards RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/{validator_address}: - get: - summary: DelegationRewards queries the total rewards accrued by a delegation. - operationId: CosmosDistributionV1Beta1DelegationRewards - responses: - '200': - description: A successful response. - schema: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: rewards defines the rewards accrued by a delegation. - description: |- - QueryDelegationRewardsResponse is the response type for the - Query/DelegationRewards RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/validators: - get: - summary: DelegatorValidators queries the validators of a delegator. - operationId: CosmosDistributionV1Beta1DelegatorValidators - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validators: - type: array - items: - type: string - description: >- - validators defines the validators a delegator is delegating - for. - description: |- - QueryDelegatorValidatorsResponse is the response type for the - Query/DelegatorValidators RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address: - get: - summary: DelegatorWithdrawAddress queries withdraw address of a delegator. - operationId: CosmosDistributionV1Beta1DelegatorWithdrawAddress - responses: - '200': - description: A successful response. - schema: - type: object - properties: - withdraw_address: - type: string - description: withdraw_address defines the delegator address to query for. - description: |- - QueryDelegatorWithdrawAddressResponse is the response type for the - Query/DelegatorWithdrawAddress RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/params: - get: - summary: Params queries params of the distribution module. - operationId: CosmosDistributionV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - community_tax: - type: string - base_proposer_reward: - type: string - description: >- - Deprecated: The base_proposer_reward field is deprecated - and is no longer used - - in the x/distribution module's reward mechanism. - bonus_proposer_reward: - type: string - description: >- - Deprecated: The bonus_proposer_reward field is deprecated - and is no longer used - - in the x/distribution module's reward mechanism. - withdraw_addr_enabled: - type: boolean - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}: - get: - summary: >- - ValidatorDistributionInfo queries validator commission and - self-delegation rewards for validator - operationId: CosmosDistributionV1Beta1ValidatorDistributionInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - operator_address: - type: string - description: operator_address defines the validator operator address. - self_bond_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: self_bond_rewards defines the self delegations rewards. - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: commission defines the commission the validator received. - description: >- - QueryValidatorDistributionInfoResponse is the response type for - the Query/ValidatorDistributionInfo RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}/commission: - get: - summary: ValidatorCommission queries accumulated commission for a validator. - operationId: CosmosDistributionV1Beta1ValidatorCommission - responses: - '200': - description: A successful response. - schema: - type: object - properties: - commission: - description: commission defines the commission the validator received. - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - title: |- - QueryValidatorCommissionResponse is the response type for the - Query/ValidatorCommission RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}/outstanding_rewards: - get: - summary: ValidatorOutstandingRewards queries rewards of a validator address. - operationId: CosmosDistributionV1Beta1ValidatorOutstandingRewards - responses: - '200': - description: A successful response. - schema: - type: object - properties: - rewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - description: >- - ValidatorOutstandingRewards represents outstanding - (un-withdrawn) rewards - - for a validator inexpensive to track, allows simple sanity - checks. - description: >- - QueryValidatorOutstandingRewardsResponse is the response type for - the - - Query/ValidatorOutstandingRewards RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/distribution/v1beta1/validators/{validator_address}/slashes: - get: - summary: ValidatorSlashes queries slash events of a validator. - operationId: CosmosDistributionV1Beta1ValidatorSlashes - responses: - '200': - description: A successful response. - schema: - type: object - properties: - slashes: - type: array - items: - type: object - properties: - validator_period: - type: string - format: uint64 - fraction: - type: string - description: >- - ValidatorSlashEvent represents a validator slash event. - - Height is implicit within the store key. - - This is needed to calculate appropriate amount of staking - tokens - - for delegations which are withdrawn after a slash has - occurred. - description: slashes defines the slashes the validator received. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryValidatorSlashesResponse is the response type for the - Query/ValidatorSlashes RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: validator_address - description: validator_address defines the validator address to query for. - in: path - required: true - type: string - - name: starting_height - description: >- - starting_height defines the optional starting height to query the - slashes. - in: query - required: false - type: string - format: uint64 - - name: ending_height - description: >- - starting_height defines the optional ending height to query the - slashes. - in: query - required: false - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/evidence/v1beta1/evidence: - get: - summary: AllEvidence queries all evidence. - operationId: CosmosEvidenceV1Beta1AllEvidence - responses: - '200': - description: A successful response. - schema: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: evidence returns all evidences. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllEvidenceResponse is the response type for the - Query/AllEvidence RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/evidence/v1beta1/evidence/{hash}: - get: - summary: Evidence queries evidence based on evidence hash. - operationId: CosmosEvidenceV1Beta1Evidence - responses: - '200': - description: A successful response. - schema: - type: object - properties: - evidence: - description: evidence returns the requested evidence. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryEvidenceResponse is the response type for the Query/Evidence - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: hash - description: |- - hash defines the evidence hash of the requested evidence. - - Since: cosmos-sdk 0.47 - in: path - required: true - type: string - - name: evidence_hash - description: |- - evidence_hash defines the hash of the requested evidence. - Deprecated: Use hash, a HEX encoded string, instead. - in: query - required: false - type: string - format: byte - tags: - - Query - /cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}: - get: - summary: Allowance returns fee granted to the grantee by the granter. - operationId: CosmosFeegrantV1Beta1Allowance - responses: - '200': - description: A successful response. - schema: - type: object - properties: - allowance: - description: allowance is a allowance granted for grantee by granter. - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance - of their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an - allowance of another user's funds. - allowance: - description: >- - allowance can be any of basic, periodic, allowed fee - allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: >- - Grant is stored in the KVStore to record a grant with full - context - description: >- - QueryAllowanceResponse is the response type for the - Query/Allowance RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: granter - description: >- - granter is the address of the user granting an allowance of their - funds. - in: path - required: true - type: string - - name: grantee - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - in: path - required: true - type: string - tags: - - Query - /cosmos/feegrant/v1beta1/allowances/{grantee}: - get: - summary: Allowances returns all the grants for address. - operationId: CosmosFeegrantV1Beta1Allowances - responses: - '200': - description: A successful response. - schema: - type: object - properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance - of their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an - allowance of another user's funds. - allowance: - description: >- - allowance can be any of basic, periodic, allowed fee - allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: >- - Grant is stored in the KVStore to record a grant with full - context - description: allowances are allowance's granted for grantee by granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllowancesResponse is the response type for the - Query/Allowances RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: grantee - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/feegrant/v1beta1/issued/{granter}: - get: - summary: AllowancesByGranter returns all the grants given by an address - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosFeegrantV1Beta1AllowancesByGranter - responses: - '200': - description: A successful response. - schema: - type: object - properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance - of their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an - allowance of another user's funds. - allowance: - description: >- - allowance can be any of basic, periodic, allowed fee - allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: >- - Grant is stored in the KVStore to record a grant with full - context - description: allowances that have been issued by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllowancesByGranterResponse is the response type for the - Query/AllowancesByGranter RPC method. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: granter - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/params/{params_type}: - get: - summary: Params queries all parameters of the gov module. - operationId: CosmosGovV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - voting_params: - description: |- - Deprecated: Prefer to use `params` instead. - voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: |- - Deprecated: Prefer to use `params` instead. - deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - - months. - tally_params: - description: |- - Deprecated: Prefer to use `params` instead. - tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a - result to be - - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - - vetoed. Default value: 1/3. - params: - description: |- - params defines all the paramaters of x/gov module. - - Since: cosmos-sdk 0.47 - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a - result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value - that must be paid at proposal submission. - burn_vote_quorum: - type: boolean - title: burn deposits if a proposal does not meet quorum - burn_proposal_deposit_prevote: - type: boolean - title: burn deposits if the proposal does not enter voting period - burn_vote_veto: - type: boolean - title: burn deposits if quorum with vote type no_veto is met - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: params_type - description: >- - params_type defines which parameters to query for, can be one of - "voting", - - "tallying" or "deposit". - in: path - required: true - type: string - tags: - - Query - /cosmos/gov/v1/proposals: - get: - summary: Proposals queries all proposals based on given status. - operationId: CosmosGovV1Proposals - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain - at least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should - be in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, - for URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions - as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently - available in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods - of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL - and the unpack - - methods only use the fully qualified type name after - the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if - the proposal passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not - populated until the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: >- - abstain_count is the number of abstain votes on a - proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto - votes on a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: >- - metadata is any arbitrary metadata attached to the - proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: >- - Proposal defines the core field members of a governance - proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryProposalsResponse is the response type for the - Query/Proposals RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_status - description: |- - proposal_status defines the status of the proposals. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - in: query - required: false - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - - name: voter - description: voter defines the voter address for the proposals. - in: query - required: false - type: string - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}: - get: - summary: Proposal queries proposal details based on ProposalID. - operationId: CosmosGovV1Proposal - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposal: - description: proposal is the requested governance proposal. - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the - proposal passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not populated - until the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: >- - abstain_count is the number of abstain votes on a - proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes - on a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: >- - metadata is any arbitrary metadata attached to the - proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: >- - QueryProposalResponse is the response type for the Query/Proposal - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/deposits: - get: - summary: Deposits queries all deposits of a single proposal. - operationId: CosmosGovV1Deposits - responses: - '200': - description: A successful response. - schema: - type: object - properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to - an active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}: - get: - summary: >- - Deposit queries single deposit information based proposalID, - depositAddr. - operationId: CosmosGovV1Deposit - responses: - '200': - description: A successful response. - schema: - type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: path - required: true - type: string - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/tally: - get: - summary: TallyResult queries the tally of a proposal vote. - operationId: CosmosGovV1TallyResult - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: >- - abstain_count is the number of abstain votes on a - proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on - a proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/votes: - get: - summary: Votes queries votes of a given proposal. - operationId: CosmosGovV1Votes - responses: - '200': - description: A successful response. - schema: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - description: options is the weighted vote options. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - vote. - description: >- - Vote defines a vote on a governance proposal. - - A Vote consists of a proposal ID, the voter, and the vote - option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryVotesResponse is the response type for the Query/Votes RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}: - get: - summary: Vote queries voted information based on proposalID, voterAddr. - operationId: CosmosGovV1Vote - responses: - '200': - description: A successful response. - schema: - type: object - properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - description: options is the weighted vote options. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - vote. - description: >- - QueryVoteResponse is the response type for the Query/Vote RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter defines the voter address for the proposals. - in: path - required: true - type: string - tags: - - Query - /cosmos/gov/v1beta1/params/{params_type}: - get: - summary: Params queries all parameters of the gov module. - operationId: CosmosGovV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - voting_params: - description: voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - - months. - tally_params: - description: tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - format: byte - description: >- - Minimum percentage of total stake needed to vote for a - result to be - - considered valid. - threshold: - type: string - format: byte - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - format: byte - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - - vetoed. Default value: 1/3. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: params_type - description: >- - params_type defines which parameters to query for, can be one of - "voting", - - "tallying" or "deposit". - in: path - required: true - type: string - tags: - - Query - /cosmos/gov/v1beta1/proposals: - get: - summary: Proposals queries all proposals based on given status. - operationId: CosmosGovV1Beta1Proposals - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not - populated until the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: >- - abstain is the number of abstain votes on a - proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on - a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: >- - Proposal defines the core field members of a governance - proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryProposalsResponse is the response type for the - Query/Proposals RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_status - description: |- - proposal_status defines the status of the proposals. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - in: query - required: false - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - - name: voter - description: voter defines the voter address for the proposals. - in: query - required: false - type: string - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}: - get: - summary: Proposal queries proposal details based on ProposalID. - operationId: CosmosGovV1Beta1Proposal - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposal: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the - proposal. When - - querying a proposal via gRPC, this field is not populated - until the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: >- - voting_start_time is the starting time to vote on a - proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: >- - Proposal defines the core field members of a governance - proposal. - description: >- - QueryProposalResponse is the response type for the Query/Proposal - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits: - get: - summary: Deposits queries all deposits of a single proposal. - operationId: CosmosGovV1Beta1Deposits - responses: - '200': - description: A successful response. - schema: - type: object - properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to - an active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}: - get: - summary: >- - Deposit queries single deposit information based proposalID, - depositAddr. - operationId: CosmosGovV1Beta1Deposit - responses: - '200': - description: A successful response. - schema: - type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: >- - depositor defines the deposit addresses from the - proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: path - required: true - type: string - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/tally: - get: - summary: TallyResult queries the tally of a proposal vote. - operationId: CosmosGovV1Beta1TallyResult - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/votes: - get: - summary: Votes queries votes of a given proposal. - operationId: CosmosGovV1Beta1Votes - responses: - '200': - description: A successful response. - schema: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field - is set in queries - - if and only if `len(options) == 1` and that option has - weight 1. In all - - other cases, this field will default to - VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: >- - Vote defines a vote on a governance proposal. - - A Vote consists of a proposal ID, the voter, and the vote - option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryVotesResponse is the response type for the Query/Votes RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}: - get: - summary: Vote queries voted information based on proposalID, voterAddr. - operationId: CosmosGovV1Beta1Vote - responses: - '200': - description: A successful response. - schema: - type: object - properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is - set in queries - - if and only if `len(options) == 1` and that option has - weight 1. In all - - other cases, this field will default to - VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not - contain duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: >- - weight is the vote weight associated with the vote - option. - description: >- - WeightedVoteOption defines a unit of vote for vote - split. - - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: >- - QueryVoteResponse is the response type for the Query/Vote RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter defines the voter address for the proposals. - in: path - required: true - type: string - tags: - - Query - /cosmos/group/v1/group_info/{group_id}: - get: - summary: GroupInfo queries group info based on group id. - operationId: CosmosGroupV1GroupInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - info: - description: info is the GroupInfo of the group. - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members - weight is changed, - - or any member is added or removed this version is - incremented and will - - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: QueryGroupInfoResponse is the Query/GroupInfo response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: group_id - description: group_id is the unique ID of the group. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/group/v1/group_members/{group_id}: - get: - summary: GroupMembers queries members of a group by group id. - operationId: CosmosGroupV1GroupMembers - responses: - '200': - description: A successful response. - schema: - type: object - properties: - members: - type: array - items: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - member: - description: member is the member data. - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: >- - weight is the member's voting weight that should be - greater than 0. - metadata: - type: string - description: >- - metadata is any arbitrary metadata attached to the - member. - added_at: - type: string - format: date-time - description: >- - added_at is a timestamp specifying when a member was - added. - description: >- - GroupMember represents the relationship between a group and - a member. - description: members are the members of the group with given group_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupMembersResponse is the Query/GroupMembersResponse - response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: group_id - description: group_id is the unique ID of the group. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/group_policies_by_admin/{admin}: - get: - summary: GroupPoliciesByAdmin queries group policies by admin address. - operationId: CosmosGroupV1GroupPoliciesByAdmin - responses: - '200': - description: A successful response. - schema: - type: object - properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group - policy. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's - GroupPolicyInfo structure that - - would create a different result on a running proposal. - decision_policy: - description: >- - decision_policy specifies the group policy's decision - policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy - was created. - description: >- - GroupPolicyInfo represents the high-level on-chain - information for a group policy. - description: >- - group_policies are the group policies info with provided - admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByAdminResponse is the - Query/GroupPoliciesByAdmin response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: admin - description: admin is the admin address of the group policy. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/group_policies_by_group/{group_id}: - get: - summary: GroupPoliciesByGroup queries group policies by group id. - operationId: CosmosGroupV1GroupPoliciesByGroup - responses: - '200': - description: A successful response. - schema: - type: object - properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group - policy. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's - GroupPolicyInfo structure that - - would create a different result on a running proposal. - decision_policy: - description: >- - decision_policy specifies the group policy's decision - policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy - was created. - description: >- - GroupPolicyInfo represents the high-level on-chain - information for a group policy. - description: >- - group_policies are the group policies info associated with the - provided group. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByGroupResponse is the - Query/GroupPoliciesByGroup response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: group_id - description: group_id is the unique ID of the group policy's group. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/group_policy_info/{address}: - get: - summary: >- - GroupPolicyInfo queries group policy info based on account address of - group policy. - operationId: CosmosGroupV1GroupPolicyInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - info: - description: info is the GroupPolicyInfo of the group policy. - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group - policy. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's - GroupPolicyInfo structure that - - would create a different result on a running proposal. - decision_policy: - description: >- - decision_policy specifies the group policy's decision - policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy - was created. - description: >- - QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response - type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address - description: address is the account address of the group policy. - in: path - required: true - type: string - tags: - - Query - /cosmos/group/v1/groups: - get: - summary: Groups queries all groups in state. - description: 'Since: cosmos-sdk 0.47.1' - operationId: CosmosGroupV1Groups - responses: - '200': - description: A successful response. - schema: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members - weight is changed, - - or any member is added or removed this version is - incremented and will - - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: >- - GroupInfo represents the high-level on-chain information for - a group. - description: '`groups` is all the groups present in state.' - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryGroupsResponse is the Query/Groups response type. - - Since: cosmos-sdk 0.47.1 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/groups_by_admin/{admin}: - get: - summary: GroupsByAdmin queries groups by admin address. - operationId: CosmosGroupV1GroupsByAdmin - responses: - '200': - description: A successful response. - schema: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members - weight is changed, - - or any member is added or removed this version is - incremented and will - - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: >- - GroupInfo represents the high-level on-chain information for - a group. - description: groups are the groups info with the provided admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse - response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: admin - description: admin is the account address of a group's admin. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/groups_by_member/{address}: - get: - summary: GroupsByMember queries groups by member address. - operationId: CosmosGroupV1GroupsByMember - responses: - '200': - description: A successful response. - schema: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: >- - metadata is any arbitrary metadata to attached to the - group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members - weight is changed, - - or any member is added or removed this version is - incremented and will - - cause proposals based on older versions of this group to - fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group was - created. - description: >- - GroupInfo represents the high-level on-chain information for - a group. - description: groups are the groups info with the provided group member. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupsByMemberResponse is the Query/GroupsByMember response - type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address - description: address is the group member address. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/proposal/{proposal_id}: - get: - summary: Proposal queries a proposal based on proposal id. - operationId: CosmosGroupV1Proposal - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposal: - description: proposal is the proposal info. - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: >- - group_policy_address is the account address of group - policy. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the - proposal. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal was - submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at proposal - submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group - policy at proposal submission. - - When a decision policy is changed, existing proposals from - previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life - cycle of the proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes - for this - - proposal for each vote option. It is empty at submission, - and only - - populated after tallying, at voting period end or at - proposal execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting - must be done. - - Unless a successful MsgExec is called before (to execute a - proposal whose - - tally is successful before the voting period ends), - tallying will be done - - at this point, and the `final_tally_result`and `status` - fields will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal - execution. Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if - the proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: QueryProposalResponse is the Query/Proposal response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/group/v1/proposals/{proposal_id}/tally: - get: - summary: >- - TallyResult returns the tally result of a proposal. If the proposal is - - still in voting period, then this query computes the current tally - state, - - which might not be final. On the other hand, if the proposal is final, - - then it simply returns the `final_tally_result` state stored in the - - proposal itself. - operationId: CosmosGroupV1TallyResult - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - description: QueryTallyResultResponse is the Query/TallyResult response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique id of a proposal. - in: path - required: true - type: string - format: uint64 - tags: - - Query - /cosmos/group/v1/proposals_by_group_policy/{address}: - get: - summary: >- - ProposalsByGroupPolicy queries proposals based on account address of - group policy. - operationId: CosmosGroupV1ProposalsByGroupPolicy - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: >- - group_policy_address is the account address of group - policy. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the - proposal. - - the recommended format of the metadata is to be found - here: - - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal - was submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at - proposal submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group - policy at proposal submission. - - When a decision policy is changed, existing proposals - from previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life - cycle of the proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted - votes for this - - proposal for each vote option. It is empty at - submission, and only - - populated after tallying, at voting period end or at - proposal execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting - must be done. - - Unless a successful MsgExec is called before (to execute - a proposal whose - - tally is successful before the voting period ends), - tallying will be done - - at this point, and the `final_tally_result`and `status` - fields will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal - execution. Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain - at least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should - be in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, - for URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions - as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently - available in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods - of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL - and the unpack - - methods only use the fully qualified type name after - the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed - if the proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: >- - Proposal defines a group proposal. Any member of a group can - submit a proposal - - for a group policy to decide upon. - - A proposal consists of a set of `sdk.Msg`s that will be - executed if the proposal - - passes as well as some optional metadata associated with the - proposal. - description: proposals are the proposals with given group policy. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryProposalsByGroupPolicyResponse is the - Query/ProposalByGroupPolicy response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: address - description: >- - address is the account address of the group policy related to - proposals. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}: - get: - summary: VoteByProposalVoter queries a vote by proposal id and voter. - operationId: CosmosGroupV1VoteByProposalVoter - responses: - '200': - description: A successful response. - schema: - type: object - properties: - vote: - description: vote is the vote with given proposal_id and voter. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: >- - QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter - response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter is a proposal voter account address. - in: path - required: true - type: string - tags: - - Query - /cosmos/group/v1/votes_by_proposal/{proposal_id}: - get: - summary: VotesByProposal queries a vote by proposal id. - operationId: CosmosGroupV1VotesByProposal - responses: - '200': - description: A successful response. - schema: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: >- - submit_time is the timestamp when the vote was - submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes for given proposal_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryVotesByProposalResponse is the Query/VotesByProposal response - type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/group/v1/votes_by_voter/{voter}: - get: - summary: VotesByVoter queries a vote by voter. - operationId: CosmosGroupV1VotesByVoter - responses: - '200': - description: A successful response. - schema: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: >- - submit_time is the timestamp when the vote was - submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes by given voter. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesByVoterResponse is the Query/VotesByVoter response type. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: voter - description: voter is a proposal voter account address. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/mint/v1beta1/annual_provisions: - get: - summary: AnnualProvisions current minting annual provisions value. - operationId: CosmosMintV1Beta1AnnualProvisions - responses: - '200': - description: A successful response. - schema: - type: object - properties: - annual_provisions: - type: string - format: byte - description: >- - annual_provisions is the current minting annual provisions - value. - description: |- - QueryAnnualProvisionsResponse is the response type for the - Query/AnnualProvisions RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/mint/v1beta1/inflation: - get: - summary: Inflation returns the current minting inflation value. - operationId: CosmosMintV1Beta1Inflation - responses: - '200': - description: A successful response. - schema: - type: object - properties: - inflation: - type: string - format: byte - description: inflation is the current minting inflation value. - description: >- - QueryInflationResponse is the response type for the - Query/Inflation RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/mint/v1beta1/params: - get: - summary: Params returns the total set of minting parameters. - operationId: CosmosMintV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - mint_denom: - type: string - title: type of coin to mint - inflation_rate_change: - type: string - title: maximum annual change in inflation rate - inflation_max: - type: string - title: maximum inflation rate - inflation_min: - type: string - title: minimum inflation rate - goal_bonded: - type: string - title: goal of percent bonded atoms - blocks_per_year: - type: string - format: uint64 - title: expected blocks per year - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/nft/v1beta1/balance/{owner}/{class_id}: - get: - summary: >- - Balance queries the number of NFTs of a given class owned by the owner, - same as balanceOf in ERC721 - operationId: CosmosNftV1Beta1Balance - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - type: string - format: uint64 - title: >- - amount is the number of all NFTs of a given class owned by the - owner - title: >- - QueryBalanceResponse is the response type for the Query/Balance - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: owner - description: owner is the owner address of the nft - in: path - required: true - type: string - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/classes: - get: - summary: Classes queries all NFT classes - operationId: CosmosNftV1Beta1Classes - responses: - '200': - description: A successful response. - schema: - type: object - properties: - classes: - type: array - items: - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT - classification, similar to the contract address of - ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT - classification. Optional - symbol: - type: string - title: >- - symbol is an abbreviated name for nft classification. - Optional - description: - type: string - title: >- - description is a brief description of nft - classification. Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can - define schema for Class and NFT `Data` attributes. - Optional - uri_hash: - type: string - title: >- - uri_hash is a hash of the document pointed by uri. - Optional - data: - title: >- - data is the app specific metadata of the NFT class. - Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: Class defines the class of the nft type. - description: class defines the class of the nft type. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryClassesResponse is the response type for the Query/Classes - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/nft/v1beta1/classes/{class_id}: - get: - summary: Class queries an NFT class based on its id - operationId: CosmosNftV1Beta1Class - responses: - '200': - description: A successful response. - schema: - type: object - properties: - class: - description: class defines the class of the nft type. - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT - classification, similar to the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT - classification. Optional - symbol: - type: string - title: >- - symbol is an abbreviated name for nft classification. - Optional - description: - type: string - title: >- - description is a brief description of nft classification. - Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define - schema for Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: >- - uri_hash is a hash of the document pointed by uri. - Optional - data: - title: >- - data is the app specific metadata of the NFT class. - Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - QueryClassResponse is the response type for the Query/Class RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/nfts: - get: - summary: >- - NFTs queries all NFTs of a given class or owner,choose at least one of - the two, similar to tokenByIndex in - - ERC721Enumerable - operationId: CosmosNftV1Beta1NFTs - responses: - '200': - description: A successful response. - schema: - type: object - properties: - nfts: - type: array - items: - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the - contract address of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: NFT defines the NFT - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryNFTsResponse is the response type for the Query/NFTs RPC - methods - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: query - required: false - type: string - - name: owner - description: owner is the owner address of the nft - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/nft/v1beta1/nfts/{class_id}/{id}: - get: - summary: NFT queries an NFT based on its class and id. - operationId: CosmosNftV1Beta1NFT - responses: - '200': - description: A successful response. - schema: - type: object - properties: - nft: - title: owner is the owner address of the nft - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract - address of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: QueryNFTResponse is the response type for the Query/NFT RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - - name: id - description: id is a unique identifier of the NFT - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/owner/{class_id}/{id}: - get: - summary: >- - Owner queries the owner of the NFT based on its class and id, same as - ownerOf in ERC721 - operationId: CosmosNftV1Beta1Owner - responses: - '200': - description: A successful response. - schema: - type: object - properties: - owner: - type: string - title: owner is the owner address of the nft - title: >- - QueryOwnerResponse is the response type for the Query/Owner RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - - name: id - description: id is a unique identifier of the NFT - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/supply/{class_id}: - get: - summary: >- - Supply queries the number of NFTs from the given class, same as - totalSupply of ERC721. - operationId: CosmosNftV1Beta1Supply - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - type: string - format: uint64 - title: amount is the number of all NFTs from the given class - title: >- - QuerySupplyResponse is the response type for the Query/Supply RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - tags: - - Query - /cosmos/params/v1beta1/params: - get: - summary: |- - Params queries a specific parameter of a module, given its subspace and - key. - operationId: CosmosParamsV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - param: - description: param defines the queried parameter. - type: object - properties: - subspace: - type: string - key: - type: string - value: - type: string - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: subspace - description: subspace defines the module to query the parameter for. - in: query - required: false - type: string - - name: key - description: key defines the key of the parameter in the subspace. - in: query - required: false - type: string - tags: - - Query - /cosmos/params/v1beta1/subspaces: - get: - summary: >- - Subspaces queries for all registered subspaces and all keys for a - subspace. - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosParamsV1Beta1Subspaces - responses: - '200': - description: A successful response. - schema: - type: object - properties: - subspaces: - type: array - items: - type: object - properties: - subspace: - type: string - keys: - type: array - items: - type: string - description: >- - Subspace defines a parameter subspace name and all the keys - that exist for - - the subspace. - - - Since: cosmos-sdk 0.46 - description: >- - QuerySubspacesResponse defines the response types for querying for - all - - registered subspaces and all keys for a subspace. - - - Since: cosmos-sdk 0.46 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/slashing/v1beta1/params: - get: - summary: Params queries the parameters of slashing module - operationId: CosmosSlashingV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - type: object - properties: - signed_blocks_window: - type: string - format: int64 - min_signed_per_window: - type: string - format: byte - downtime_jail_duration: - type: string - slash_fraction_double_sign: - type: string - format: byte - slash_fraction_downtime: - type: string - format: byte - description: >- - Params represents the parameters used for by the slashing - module. - title: >- - QueryParamsResponse is the response type for the Query/Params RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /cosmos/slashing/v1beta1/signing_infos: - get: - summary: SigningInfos queries signing info of all validators - operationId: CosmosSlashingV1Beta1SigningInfos - responses: - '200': - description: A successful response. - schema: - type: object - properties: - info: - type: array - items: - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: >- - Height at which validator was first a candidate OR was - unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a - bonded - - in a block and may have signed a precommit or not. This - in conjunction with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to - liveness downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed - out of validator set). It is set - - once the validator commits an equivocation or for any - other configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for - monitoring their - - liveness activity. - title: info is the signing info of all validators - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QuerySigningInfosResponse is the response type for the - Query/SigningInfos RPC - - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/slashing/v1beta1/signing_infos/{cons_address}: - get: - summary: SigningInfo queries the signing info of given cons address - operationId: CosmosSlashingV1Beta1SigningInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - val_signing_info: - title: >- - val_signing_info is the signing info of requested val cons - address - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: >- - Height at which validator was first a candidate OR was - unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a - bonded - - in a block and may have signed a precommit or not. This in - conjunction with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to - liveness downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out - of validator set). It is set - - once the validator commits an equivocation or for any - other configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for - monitoring their - - liveness activity. - title: >- - QuerySigningInfoResponse is the response type for the - Query/SigningInfo RPC - - method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: cons_address - description: cons_address is the address to query signing info of - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/delegations/{delegator_addr}: - get: - summary: >- - DelegatorDelegations queries all delegations of a given delegator - address. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1DelegatorDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of - the delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of - the validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an - account. It is - - owned by one delegator, and is associated with the - voting power of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that - it contains a - - balance in addition to shares which is more suitable for - client responses. - description: >- - delegation_responses defines all the delegations' info of a - delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryDelegatorDelegationsResponse is response type for the - Query/DelegatorDelegations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations: - get: - summary: Redelegations queries redelegations of given address. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1Redelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - redelegation_responses: - type: array - items: - type: object - properties: - redelegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of - the delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation - source operator address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation - destination operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for - redelegation completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance - when redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of - destination-validator shares created by - redelegation. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding - has been stopped by external modules - description: >- - RedelegationEntry defines a redelegation object - with relevant metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular - delegator's redelegating bonds - - from a particular source validator to a particular - destination validator. - entries: - type: array - items: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for - redelegation completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance - when redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of - destination-validator shares created by - redelegation. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding - has been stopped by external modules - description: >- - RedelegationEntry defines a redelegation object - with relevant metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a - RedelegationEntry except that it - - contains a balance in addition to shares which is more - suitable for client - - responses. - description: >- - RedelegationResponse is equivalent to a Redelegation except - that its entries - - contain a balance in addition to shares which is more - suitable for client - - responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryRedelegationsResponse is response type for the - Query/Redelegations RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: src_validator_addr - description: src_validator_addr defines the validator address to redelegate from. - in: query - required: false - type: string - - name: dst_validator_addr - description: dst_validator_addr defines the validator address to redelegate to. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/unbonding_delegations: - get: - summary: >- - DelegatorUnbondingDelegations queries all unbonding delegations of a - given - - delegator address. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1DelegatorUnbondingDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time is the unix time for unbonding - completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially - scheduled to receive at completion. - balance: - type: string - description: >- - balance defines the tokens to receive at - completion. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has - been stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object - with relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's - unbonding bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryUnbondingDelegatorDelegationsResponse is response type for - the - - Query/UnbondingDelegatorDelegations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/validators: - get: - summary: |- - DelegatorValidators queries all validators info for given delegator - address. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1DelegatorValidators - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed - from bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for - the validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: >- - Validator defines a validator, together with the total - amount of the - - Validator's bond shares and their exchange rate to coins. - Slashing results in - - a decrease in the exchange rate, allowing correct - calculation of future - - undelegations without iterating over delegators. When coins - are delegated to - - this validator, the validator is credited with a delegation - whose number of - - bond shares is based on the amount of coins delegated - divided by the current - - exchange rate. Voting power can be calculated as total - bonded shares - - multiplied by exchange rate. - description: validators defines the validators' info of a delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryDelegatorValidatorsResponse is response type for the - Query/DelegatorValidators RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/{validator_addr}: - get: - summary: |- - DelegatorValidator queries validator info for given delegator validator - pair. - operationId: CosmosStakingV1Beta1DelegatorValidator - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from - bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates - to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: |- - QueryDelegatorValidatorResponse response type for the - Query/DelegatorValidator RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/historical_info/{height}: - get: - summary: HistoricalInfo queries the historical info for given height. - operationId: CosmosStakingV1Beta1HistoricalInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - hist: - description: hist defines the historical info at the given height. - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - valset: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the - validator's operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must - contain at least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name - should be in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, - for URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message - definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup - results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently - available in the official - - protobuf release, and it is not used for type - URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed - from bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature - (ex. UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height - at which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time - for the validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a - fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate - was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has - been stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: >- - Validator defines a validator, together with the total - amount of the - - Validator's bond shares and their exchange rate to - coins. Slashing results in - - a decrease in the exchange rate, allowing correct - calculation of future - - undelegations without iterating over delegators. When - coins are delegated to - - this validator, the validator is credited with a - delegation whose number of - - bond shares is based on the amount of coins delegated - divided by the current - - exchange rate. Voting power can be calculated as total - bonded shares - - multiplied by exchange rate. - description: >- - QueryHistoricalInfoResponse is response type for the - Query/HistoricalInfo RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - description: height defines at which height to query the historical info. - in: path - required: true - type: string - format: int64 - tags: - - Query - /cosmos/staking/v1beta1/params: - get: - summary: Parameters queries the staking parameters. - operationId: CosmosStakingV1Beta1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - unbonding_time: - type: string - description: unbonding_time is the time duration of unbonding. - max_validators: - type: integer - format: int64 - description: max_validators is the maximum number of validators. - max_entries: - type: integer - format: int64 - description: >- - max_entries is the max entries for either unbonding - delegation or redelegation (per pair/trio). - historical_entries: - type: integer - format: int64 - description: >- - historical_entries is the number of historical entries to - persist. - bond_denom: - type: string - description: bond_denom defines the bondable coin denomination. - min_commission_rate: - type: string - title: >- - min_commission_rate is the chain-wide minimum commission - rate that a validator can charge their delegators - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/staking/v1beta1/pool: - get: - summary: Pool queries the pool info. - operationId: CosmosStakingV1Beta1Pool - responses: - '200': - description: A successful response. - schema: - type: object - properties: - pool: - description: pool defines the pool info. - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: QueryPoolResponse is response type for the Query/Pool RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/staking/v1beta1/validators: - get: - summary: Validators queries all validators that match the given status. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1Validators - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed - from bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for - the validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - description: >- - Validator defines a validator, together with the total - amount of the - - Validator's bond shares and their exchange rate to coins. - Slashing results in - - a decrease in the exchange rate, allowing correct - calculation of future - - undelegations without iterating over delegators. When coins - are delegated to - - this validator, the validator is credited with a delegation - whose number of - - bond shares is based on the amount of coins delegated - divided by the current - - exchange rate. Voting power can be calculated as total - bonded shares - - multiplied by exchange rate. - description: validators contains all the queried validators. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryValidatorsResponse is response type for the Query/Validators - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: status - description: status enables to query for validators matching a given status. - in: query - required: false - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}: - get: - summary: Validator queries validator info for given validator address. - operationId: CosmosStakingV1Beta1Validator - responses: - '200': - description: A successful response. - schema: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from - bonded status or not. - status: - description: >- - status is the validator status - (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: >- - tokens define the delegated tokens (incl. - self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: >- - description defines the description terms for the - validator. - type: object - properties: - moniker: - type: string - description: >- - moniker defines a human-readable name for the - validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for - security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at - which this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates - to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared - minimum self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an - unbonding of this validator - title: >- - QueryValidatorResponse is response type for the Query/Validator - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/delegations: - get: - summary: ValidatorDelegations queries delegate info for given validator. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1ValidatorDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of - the delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of - the validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an - account. It is - - owned by one delegator, and is associated with the - voting power of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that - it contains a - - balance in addition to shares which is more suitable for - client responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: |- - QueryValidatorDelegationsResponse is response type for the - Query/ValidatorDelegations RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}: - get: - summary: Delegation queries delegate info for given validator delegator pair. - operationId: CosmosStakingV1Beta1Delegation - responses: - '200': - description: A successful response. - schema: - type: object - properties: - delegation_response: - description: >- - delegation_responses defines the delegation info of a - delegation. - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an - account. It is - - owned by one delegator, and is associated with the voting - power of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: >- - QueryDelegationResponse is response type for the Query/Delegation - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation: - get: - summary: |- - UnbondingDelegation queries unbonding info for given validator delegator - pair. - operationId: CosmosStakingV1Beta1UnbondingDelegation - responses: - '200': - description: A successful response. - schema: - type: object - properties: - unbond: - description: unbond defines the unbonding information of a delegation. - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time is the unix time for unbonding - completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially - scheduled to receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object - with relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - QueryDelegationResponse is response type for the - Query/UnbondingDelegation - - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: delegator_addr - description: delegator_addr defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/staking/v1beta1/validators/{validator_addr}/unbonding_delegations: - get: - summary: >- - ValidatorUnbondingDelegations queries unbonding delegations of a - validator. - description: >- - When called from another module, this query might consume a high amount - of - - gas if the pagination field is incorrectly set. - operationId: CosmosStakingV1Beta1ValidatorUnbondingDelegations - responses: - '200': - description: A successful response. - schema: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time is the unix time for unbonding - completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially - scheduled to receive at completion. - balance: - type: string - description: >- - balance defines the tokens to receive at - completion. - unbonding_id: - type: string - format: uint64 - title: >- - Incrementing id that uniquely identifies this - entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has - been stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object - with relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's - unbonding bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryValidatorUnbondingDelegationsResponse is response type for - the - - Query/ValidatorUnbondingDelegations RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: validator_addr - description: validator_addr defines the validator address to query for. - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /cosmos/tx/v1beta1/decode: - post: - summary: TxDecode decodes the transaction. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxDecode - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.TxDecodeResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: |- - TxDecodeRequest is the request type for the Service.TxDecode - RPC method. - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - description: |- - TxDecodeRequest is the request type for the Service.TxDecode - RPC method. - - Since: cosmos-sdk 0.47 - tags: - - Service - /cosmos/tx/v1beta1/decode/amino: - post: - summary: TxDecodeAmino decodes an Amino transaction from encoded bytes to JSON. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxDecodeAmino - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amino_json: - type: string - description: >- - TxDecodeAminoResponse is the response type for the - Service.TxDecodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: >- - TxDecodeAminoRequest is the request type for the - Service.TxDecodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - type: object - properties: - amino_binary: - type: string - format: byte - description: >- - TxDecodeAminoRequest is the request type for the - Service.TxDecodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - tags: - - Service - /cosmos/tx/v1beta1/encode: - post: - summary: TxEncode encodes the transaction. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxEncode - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the encoded transaction bytes. - description: |- - TxEncodeResponse is the response type for the - Service.TxEncode method. - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: |- - TxEncodeRequest is the request type for the Service.TxEncode - RPC method. - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.TxEncodeRequest' - tags: - - Service - /cosmos/tx/v1beta1/encode/amino: - post: - summary: TxEncodeAmino encodes an Amino transaction from JSON to encoded bytes. - description: 'Since: cosmos-sdk 0.47' - operationId: CosmosTxV1Beta1TxEncodeAmino - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amino_binary: - type: string - format: byte - description: >- - TxEncodeAminoResponse is the response type for the - Service.TxEncodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: >- - TxEncodeAminoRequest is the request type for the - Service.TxEncodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - in: body - required: true - schema: - type: object - properties: - amino_json: - type: string - description: >- - TxEncodeAminoRequest is the request type for the - Service.TxEncodeAmino - - RPC method. - - - Since: cosmos-sdk 0.47 - tags: - - Service - /cosmos/tx/v1beta1/simulate: - post: - summary: Simulate simulates executing a transaction for estimating gas usage. - operationId: CosmosTxV1Beta1Simulate - responses: - '200': - description: A successful response. - schema: - type: object - properties: - gas_info: - description: gas_info is the information about gas used in the simulation. - type: object - properties: - gas_wanted: - type: string - format: uint64 - description: >- - GasWanted is the maximum units of work we allow this tx to - perform. - gas_used: - type: string - format: uint64 - description: GasUsed is the amount of gas actually consumed. - result: - description: result is the result of the simulation. - type: object - properties: - data: - type: string - format: byte - description: >- - Data is any data returned from message or handler - execution. It MUST be - - length prefixed in order to separate data from multiple - message executions. - - Deprecated. This field is still populated, but prefer - msg_response instead - - because it also contains the Msg response typeURL. - log: - type: string - description: >- - Log contains the log information from message or handler - execution. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, - associated with an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx - and ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events contains a slice of Event objects that were emitted - during message - - or handler execution. - msg_responses: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - msg_responses contains the Msg handler responses type - packed in Anys. - - - Since: cosmos-sdk 0.46 - description: |- - SimulateResponse is the response type for the - Service.SimulateRPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: |- - SimulateRequest is the request type for the Service.Simulate - RPC method. - in: body - required: true - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.SimulateRequest' - tags: - - Service - /cosmos/tx/v1beta1/txs: - get: - summary: GetTxsEvent fetches txs by event. - operationId: CosmosTxV1Beta1GetTxsEvent - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetTxsEventResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: events - description: events is the list of transaction event type. - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: order_by - description: |2- - - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. - - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order - - ORDER_BY_DESC: ORDER_BY_DESC defines descending order - in: query - required: false - type: string - enum: - - ORDER_BY_UNSPECIFIED - - ORDER_BY_ASC - - ORDER_BY_DESC - default: ORDER_BY_UNSPECIFIED - - name: page - description: >- - page is the page number to query, starts at 1. If not provided, will - default to first page. - in: query - required: false - type: string - format: uint64 - - name: limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - tags: - - Service - post: - summary: BroadcastTx broadcast transaction. - operationId: CosmosTxV1Beta1BroadcastTx - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tx_response: - description: tx_response is the queried TxResponses. - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: >- - The output of the application's logger (raw string). May - be - - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where - the key and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where - all the attributes - - contain key/value pairs that are strings instead - of raw bytes. - description: >- - Events contains a slice of Event objects that were - emitted during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed - tx ABCI message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the - weighted median of - - the timestamps of the valid votes in the block.LastCommit. - For height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, - associated with an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx - and ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a - transaction. Note, - - these events include those emitted by processing all the - messages and those - - emitted from the ante. Whereas Logs contains the events, - with - - additional metadata, emitted only by processing the - messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: |- - BroadcastTxResponse is the response type for the - Service.BroadcastTx method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: body - description: >- - BroadcastTxRequest is the request type for the - Service.BroadcastTxRequest - - RPC method. - in: body - required: true - schema: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - mode: - type: string - enum: - - BROADCAST_MODE_UNSPECIFIED - - BROADCAST_MODE_BLOCK - - BROADCAST_MODE_SYNC - - BROADCAST_MODE_ASYNC - default: BROADCAST_MODE_UNSPECIFIED - description: >- - BroadcastMode specifies the broadcast mode for the - TxService.Broadcast RPC method. - - - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, - BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x - onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. - description: >- - BroadcastTxRequest is the request type for the - Service.BroadcastTxRequest - - RPC method. - tags: - - Service - /cosmos/tx/v1beta1/txs/block/{height}: - get: - summary: GetBlockWithTxs fetches a block with decoded txs. - description: 'Since: cosmos-sdk 0.45.2' - operationId: CosmosTxV1Beta1GetBlockWithTxs - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetBlockWithTxsResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - description: height is the height of the block to query. - in: path - required: true - type: string - format: int64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Service - /cosmos/tx/v1beta1/txs/{hash}: - get: - summary: GetTx fetches a tx by hash. - operationId: CosmosTxV1Beta1GetTx - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetTxResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: hash - description: hash is the tx hash to query, encoded as a hex string. - in: path - required: true - type: string - tags: - - Service - /cosmos/upgrade/v1beta1/applied_plan/{name}: - get: - summary: AppliedPlan queries a previously applied upgrade plan by its name. - operationId: CosmosUpgradeV1Beta1AppliedPlan - responses: - '200': - description: A successful response. - schema: - type: object - properties: - height: - type: string - format: int64 - description: height is the block height at which the plan was applied. - description: >- - QueryAppliedPlanResponse is the response type for the - Query/AppliedPlan RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: name - description: name is the name of the applied plan to query for. - in: path - required: true - type: string - tags: - - Query - /cosmos/upgrade/v1beta1/authority: - get: - summary: Returns the account with authority to conduct upgrades - description: 'Since: cosmos-sdk 0.46' - operationId: CosmosUpgradeV1Beta1Authority - responses: - '200': - description: A successful response. - schema: - type: object - properties: - address: - type: string - description: 'Since: cosmos-sdk 0.46' - title: QueryAuthorityResponse is the response type for Query/Authority - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/upgrade/v1beta1/current_plan: - get: - summary: CurrentPlan queries the current upgrade plan. - operationId: CosmosUpgradeV1Beta1CurrentPlan - responses: - '200': - description: A successful response. - schema: - type: object - properties: - plan: - description: plan is the current upgrade plan. - type: object - properties: - name: - type: string - description: >- - Sets the name for the upgrade. This name will be used by - the upgraded - - version of the software to apply any special "on-upgrade" - commands during - - the first BeginBlock method after the upgrade is applied. - It is also used - - to detect whether a software version can handle a given - upgrade. If no - - upgrade handler with this name has been set in the - software, it will be - - assumed that the software is out-of-date when the upgrade - Time or Height is - - reached and the software will exit. - time: - type: string - format: date-time - description: >- - Deprecated: Time based upgrades have been deprecated. Time - based upgrade logic - - has been removed from the SDK. - - If this field is not empty, an error will be thrown. - height: - type: string - format: int64 - description: The height at which the upgrade must be performed. - info: - type: string - title: >- - Any application specific upgrade info to be included - on-chain - - such as a git commit that validators could automatically - upgrade to - upgraded_client_state: - description: >- - Deprecated: UpgradedClientState field has been deprecated. - IBC upgrade logic has been - - moved to the IBC module in the sub module 02-client. - - If this field is not empty, an error will be thrown. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryCurrentPlanResponse is the response type for the - Query/CurrentPlan RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/upgrade/v1beta1/module_versions: - get: - summary: ModuleVersions queries the list of module versions from state. - description: 'Since: cosmos-sdk 0.43' - operationId: CosmosUpgradeV1Beta1ModuleVersions - responses: - '200': - description: A successful response. - schema: - type: object - properties: - module_versions: - type: array - items: - type: object - properties: - name: - type: string - title: name of the app module - version: - type: string - format: uint64 - title: consensus version of the app module - description: |- - ModuleVersion specifies a module and its consensus version. - - Since: cosmos-sdk 0.43 - description: >- - module_versions is a list of module names with their consensus - versions. - description: >- - QueryModuleVersionsResponse is the response type for the - Query/ModuleVersions - - RPC method. - - - Since: cosmos-sdk 0.43 - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: module_name - description: |- - module_name is a field to query a specific module - consensus version from state. Leaving this empty will - fetch the full list of module versions from state - in: query - required: false - type: string - tags: - - Query - /cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}: - get: - summary: >- - UpgradedConsensusState queries the consensus state that will serve - - as a trusted kernel for the next version of this chain. It will only be - - stored at the last height of this chain. - - UpgradedConsensusState RPC not supported with legacy querier - - This rpc is deprecated now that IBC has its own replacement - - (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) - operationId: CosmosUpgradeV1Beta1UpgradedConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - upgraded_consensus_state: - type: string - format: byte - title: 'Since: cosmos-sdk 0.43' - description: >- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState - - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: last_height - description: |- - last height of the current chain must be sent in request - as this is the height under which next consensus state is stored - in: path - required: true - type: string - format: int64 - tags: - - Query - /ibc/apps/interchain_accounts/controller/v1/owners/{owner}/connections/{connection_id}: - get: - summary: >- - InterchainAccount returns the interchain account address for a given - owner address on a given connection - operationId: IbcApplicationsInterchainAccountsControllerV1InterchainAccount - responses: - '200': - description: A successful response. - schema: - type: object - properties: - address: - type: string - description: >- - QueryInterchainAccountResponse the response type for the - Query/InterchainAccount RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: owner - in: path - required: true - type: string - - name: connection_id - in: path - required: true - type: string - tags: - - Query - /ibc/apps/interchain_accounts/controller/v1/params: - get: - summary: Params queries all parameters of the ICA controller submodule. - operationId: IbcApplicationsInterchainAccountsControllerV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - controller_enabled: - type: boolean - description: >- - controller_enabled enables or disables the controller - submodule. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/apps/interchain_accounts/host/v1/params: - get: - summary: Params queries all parameters of the ICA host submodule. - operationId: IbcApplicationsInterchainAccountsHostV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - host_enabled: - type: boolean - description: host_enabled enables or disables the host submodule. - allow_messages: - type: array - items: - type: string - description: >- - allow_messages defines a list of sdk message typeURLs - allowed to be executed on a host chain. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /ibc/apps/transfer/v1/channels/{channel_id}/ports/{port_id}/escrow_address: - get: - summary: >- - EscrowAddress returns the escrow address for a particular port and - channel id. - operationId: IbcApplicationsTransferV1EscrowAddress - responses: - '200': - description: A successful response. - schema: - type: object - properties: - escrow_address: - type: string - title: the escrow account address - description: >- - QueryEscrowAddressResponse is the response type of the - EscrowAddress RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: unique channel identifier - in: path - required: true - type: string - - name: port_id - description: unique port identifier - in: path - required: true - type: string - tags: - - Query - /ibc/apps/transfer/v1/denom_hashes/{trace}: - get: - summary: DenomHash queries a denomination hash information. - operationId: IbcApplicationsTransferV1DenomHash - responses: - '200': - description: A successful response. - schema: - type: object - properties: - hash: - type: string - description: hash (in hex format) of the denomination trace information. - description: >- - QueryDenomHashResponse is the response type for the - Query/DenomHash RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: trace - description: The denomination trace ([port_id]/[channel_id])+/[denom] - in: path - required: true - type: string - pattern: .+ - tags: - - Query - /ibc/apps/transfer/v1/denom_traces: - get: - summary: DenomTraces queries all denomination traces. - operationId: IbcApplicationsTransferV1DenomTraces - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_traces: - type: array - items: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used - for tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible - tokens and the - - source tracing information path. - description: denom_traces returns all denominations trace information. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryConnectionsResponse is the response type for the - Query/DenomTraces RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/apps/transfer/v1/denom_traces/{hash}: - get: - summary: DenomTrace queries a denomination trace information. - operationId: IbcApplicationsTransferV1DenomTrace - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_trace: - description: >- - denom_trace returns the requested denomination trace - information. - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used - for tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - QueryDenomTraceResponse is the response type for the - Query/DenomTrace RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: hash - description: >- - hash (in hex format) or denom (full denom with ibc prefix) of the - denomination trace information. - in: path - required: true - type: string - pattern: .+ - tags: - - Query - /ibc/apps/transfer/v1/denoms/{denom}/total_escrow: - get: - summary: >- - TotalEscrowForDenom returns the total amount of tokens in escrow based - on the denom. - operationId: IbcApplicationsTransferV1TotalEscrowForDenom - responses: - '200': - description: A successful response. - schema: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - QueryTotalEscrowForDenomResponse is the response type for - TotalEscrowForDenom RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: denom - in: path - required: true - type: string - pattern: .+ - tags: - - Query - /ibc/apps/transfer/v1/params: - get: - summary: Params queries all parameters of the ibc-transfer module. - operationId: IbcApplicationsTransferV1Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - send_enabled: - type: boolean - description: >- - send_enabled enables or disables all cross-chain token - transfers from this - - chain. - receive_enabled: - type: boolean - description: >- - receive_enabled enables or disables all cross-chain token - transfers to this - - chain. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/channel/v1/channels: - get: - summary: Channels queries all the IBC channels of a chain. - operationId: IbcCoreChannelV1Channels - responses: - '200': - description: A successful response. - schema: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: >- - State defines if a channel is in one of the following - states: - - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: >- - - ORDER_NONE_UNSPECIFIED: zero-value for channel - ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other - end of the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which - packets sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: >- - IdentifiedChannel defines a channel with additional port and - channel - - identifier fields. - description: list of stored channels of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryChannelsResponse is the response type for the Query/Channels - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}: - get: - summary: Channel queries an IBC Channel. - operationId: IbcCoreChannelV1Channel - responses: - '200': - description: A successful response. - schema: - type: object - properties: - channel: - title: channel associated with the request identifiers - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: >- - State defines if a channel is in one of the following - states: - - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other - end of the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which - packets sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - description: >- - Channel defines pipeline for exactly-once packet delivery - between specific - - modules on separate blockchains, which has at least one end - capable of - - sending packets and one end capable of receiving packets. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryChannelResponse is the response type for the Query/Channel - RPC method. - - Besides the Channel end, it includes a proof and the height from - which the - - proof was retrieved. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/client_state: - get: - summary: >- - ChannelClientState queries for the client state for the channel - associated - - with the provided channel identifiers. - operationId: IbcCoreChannelV1ChannelClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an - additional client - - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/consensus_state/revision/{revision_number}/height/{revision_height}: - get: - summary: |- - ChannelConsensusState queries for the consensus state for the channel - associated with the provided channel identifiers. - operationId: IbcCoreChannelV1ChannelConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state: - title: consensus state associated with the channel - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - client_id: - type: string - title: client ID associated with the consensus state - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: revision_number - description: revision number of the consensus state - in: path - required: true - type: string - format: uint64 - - name: revision_height - description: revision height of the consensus state - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/next_sequence: - get: - summary: >- - NextSequenceReceive returns the next receive sequence for a given - channel. - operationId: IbcCoreChannelV1NextSequenceReceive - responses: - '200': - description: A successful response. - schema: - type: object - properties: - next_sequence_receive: - type: string - format: uint64 - title: next sequence receive number - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QuerySequenceResponse is the request type for the - Query/QueryNextSequenceReceiveResponse RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_acknowledgements: - get: - summary: >- - PacketAcknowledgements returns all the packet acknowledgements - associated - - with a channel. - operationId: IbcCoreChannelV1PacketAcknowledgements - responses: - '200': - description: A successful response. - schema: - type: object - properties: - acknowledgements: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve - and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to - interpret this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketAcknowledgemetsResponse is the request type for the - Query/QueryPacketAcknowledgements RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: packet_commitment_sequences - description: list of packet sequences - in: query - required: false - type: array - items: - type: string - format: uint64 - collectionFormat: multi - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_acks/{sequence}: - get: - summary: PacketAcknowledgement queries a stored packet acknowledgement hash. - operationId: IbcCoreChannelV1PacketAcknowledgement - responses: - '200': - description: A successful response. - schema: - type: object - properties: - acknowledgement: - type: string - format: byte - title: packet associated with the request fields - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketAcknowledgementResponse defines the client query - response for a - - packet which also includes a proof and the height from which the - - proof was retrieved - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: sequence - description: packet sequence - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments: - get: - summary: |- - PacketCommitments returns all the packet commitments hashes associated - with a channel. - operationId: IbcCoreChannelV1PacketCommitments - responses: - '200': - description: A successful response. - schema: - type: object - properties: - commitments: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve - and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to - interpret this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketCommitmentsResponse is the request type for the - Query/QueryPacketCommitments RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments/{packet_ack_sequences}/unreceived_acks: - get: - summary: >- - UnreceivedAcks returns all the unreceived IBC acknowledgements - associated - - with a channel and sequences. - operationId: IbcCoreChannelV1UnreceivedAcks - responses: - '200': - description: A successful response. - schema: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived acknowledgement sequences - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryUnreceivedAcksResponse is the response type for the - Query/UnreceivedAcks RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: packet_ack_sequences - description: list of acknowledgement sequences - in: path - required: true - type: array - items: - type: string - format: uint64 - collectionFormat: csv - minItems: 1 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments/{packet_commitment_sequences}/unreceived_packets: - get: - summary: >- - UnreceivedPackets returns all the unreceived IBC packets associated with - a - - channel and sequences. - operationId: IbcCoreChannelV1UnreceivedPackets - responses: - '200': - description: A successful response. - schema: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived packet sequences - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryUnreceivedPacketsResponse is the response type for the - Query/UnreceivedPacketCommitments RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: packet_commitment_sequences - description: list of packet sequences - in: path - required: true - type: array - items: - type: string - format: uint64 - collectionFormat: csv - minItems: 1 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_commitments/{sequence}: - get: - summary: PacketCommitment queries a stored packet commitment hash. - operationId: IbcCoreChannelV1PacketCommitment - responses: - '200': - description: A successful response. - schema: - type: object - properties: - commitment: - type: string - format: byte - title: packet associated with the request fields - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketCommitmentResponse defines the client query response - for a packet - - which also includes a proof and the height from which the proof - was - - retrieved - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: sequence - description: packet sequence - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_receipts/{sequence}: - get: - summary: >- - PacketReceipt queries if a given packet sequence has been received on - the - - queried chain - operationId: IbcCoreChannelV1PacketReceipt - responses: - '200': - description: A successful response. - schema: - type: object - properties: - received: - type: boolean - title: success flag for if receipt exists - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketReceiptResponse defines the client query response for a - packet - - receipt which also includes a proof, and the height from which the - proof was - - retrieved - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: channel_id - description: channel unique identifier - in: path - required: true - type: string - - name: port_id - description: port unique identifier - in: path - required: true - type: string - - name: sequence - description: packet sequence - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/channel/v1/connections/{connection}/channels: - get: - summary: |- - ConnectionChannels queries all the channels associated with a connection - end. - operationId: IbcCoreChannelV1ConnectionChannels - responses: - '200': - description: A successful response. - schema: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: >- - State defines if a channel is in one of the following - states: - - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: >- - - ORDER_NONE_UNSPECIFIED: zero-value for channel - ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other - end of the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which - packets sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: >- - IdentifiedChannel defines a channel with additional port and - channel - - identifier fields. - description: list of channels associated with a connection. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionChannelsResponse is the Response type for the - Query/QueryConnectionChannels RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection - description: connection unique identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/client_states: - get: - summary: ClientStates queries all the IBC light clients of a chain. - operationId: IbcCoreClientV1ClientStates - responses: - '200': - description: A successful response. - schema: - type: object - properties: - client_states: - type: array - items: - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an - additional client - - identifier field. - description: list of stored ClientStates of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryClientStatesResponse is the response type for the - Query/ClientStates RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/client_states/{client_id}: - get: - summary: ClientState queries an IBC light client. - operationId: IbcCoreClientV1ClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - client_state: - title: client state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryClientStateResponse is the response type for the - Query/ClientState RPC - - method. Besides the client state, it includes a proof and the - height from - - which the proof was retrieved. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client state unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/client/v1/client_status/{client_id}: - get: - summary: Status queries the status of an IBC client. - operationId: IbcCoreClientV1ClientStatus - responses: - '200': - description: A successful response. - schema: - type: object - properties: - status: - type: string - description: >- - QueryClientStatusResponse is the response type for the - Query/ClientStatus RPC - - method. It returns the current status of the IBC client. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/client/v1/consensus_states/{client_id}: - get: - summary: |- - ConsensusStates queries all the consensus state associated with a given - client. - operationId: IbcCoreClientV1ConsensusStates - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_states: - type: array - items: - type: object - properties: - height: - title: consensus state height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each - height while keeping - - RevisionNumber the same. However some consensus - algorithms may choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as - the RevisionHeight - - gets reset - consensus_state: - title: consensus state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the - type of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's - path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the - binary all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available - in the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the - regular - - representation of the deserialized, embedded message, - with an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message - [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - ConsensusStateWithHeight defines a consensus state with an - additional height - - field. - title: consensus states associated with the identifier - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStatesResponse is the response type for the - Query/ConsensusStates RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/consensus_states/{client_id}/heights: - get: - summary: >- - ConsensusStateHeights queries the height of every consensus states - associated with a given client. - operationId: IbcCoreClientV1ConsensusStateHeights - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state_heights: - type: array - items: - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms - may choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - Height is a monotonically increasing data type - - that can be compared against another Height for the purposes - of updating and - - freezing clients - title: consensus state heights - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStateHeightsResponse is the response type for the - Query/ConsensusStateHeights RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/consensus_states/{client_id}/revision/{revision_number}/height/{revision_height}: - get: - summary: >- - ConsensusState queries a consensus state associated with a client state - at - - a given height. - operationId: IbcCoreClientV1ConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state: - title: >- - consensus state associated with the client identifier at the - given height - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryConsensusStateResponse is the response type for the - Query/ConsensusState - - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier - in: path - required: true - type: string - - name: revision_number - description: consensus state revision number - in: path - required: true - type: string - format: uint64 - - name: revision_height - description: consensus state revision height - in: path - required: true - type: string - format: uint64 - - name: latest_height - description: >- - latest_height overrrides the height field and queries the latest - stored - - ConsensusState - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/client/v1/params: - get: - summary: ClientParams queries all parameters of the ibc client submodule. - operationId: IbcCoreClientV1ClientParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - allowed_clients: - type: array - items: - type: string - description: >- - allowed_clients defines the list of allowed client state - types which can be created - - and interacted with. If a client type is removed from the - allowed clients list, usage - - of this client will be disabled until it is added again to - the list. - description: >- - QueryClientParamsResponse is the response type for the - Query/ClientParams RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/client/v1/upgraded_client_states: - get: - summary: UpgradedClientState queries an Upgraded IBC light client. - operationId: IbcCoreClientV1UpgradedClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - upgraded_client_state: - title: client state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - QueryUpgradedClientStateResponse is the response type for the - Query/UpgradedClientState RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/client/v1/upgraded_consensus_states: - get: - summary: UpgradedConsensusState queries an Upgraded IBC consensus state. - operationId: IbcCoreClientV1UpgradedConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - upgraded_consensus_state: - title: Consensus state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /ibc/core/connection/v1/client_connections/{client_id}: - get: - summary: |- - ClientConnections queries the connection paths associated with a client - state. - operationId: IbcCoreConnectionV1ClientConnections - responses: - '200': - description: A successful response. - schema: - type: object - properties: - connection_paths: - type: array - items: - type: string - description: slice of all the connection paths associated with a client. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was generated - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryClientConnectionsResponse is the response type for the - Query/ClientConnections RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: client_id - description: client identifier associated with a connection - in: path - required: true - type: string - tags: - - Query - /ibc/core/connection/v1/connections: - get: - summary: Connections queries all the IBC connections of a chain. - operationId: IbcCoreConnectionV1Connections - responses: - '200': - description: A successful response. - schema: - type: object - properties: - connections: - type: array - items: - type: object - properties: - id: - type: string - description: connection identifier. - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: >- - list of features compatible with the specified - identifier - description: >- - Version defines the versioning scheme used to - negotiate the IBC verison in - - the connection handshake. - title: >- - IBC version which can be utilised to determine encodings - or protocols for - - channels or packets utilising this connection - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain - associated with a given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty - chain associated with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will - be append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: delay period associated with this connection. - description: >- - IdentifiedConnection defines a connection with additional - connection - - identifier field. - description: list of stored connections of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryConnectionsResponse is the response type for the - Query/Connections RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/core/connection/v1/connections/{connection_id}: - get: - summary: Connection queries an IBC connection end. - operationId: IbcCoreConnectionV1Connection - responses: - '200': - description: A successful response. - schema: - type: object - properties: - connection: - title: connection associated with the request identifier - type: object - properties: - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: >- - list of features compatible with the specified - identifier - description: >- - Version defines the versioning scheme used to negotiate - the IBC verison in - - the connection handshake. - description: >- - IBC version which can be utilised to determine encodings - or protocols for - - channels or packets utilising this connection. - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain - associated with a given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty - chain associated with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: >- - delay period that must pass before a consensus state can - be used for - - packet-verification NOTE: delay period logic is only - implemented by some - - clients. - description: >- - ConnectionEnd defines a stateful object on a chain connected - to another - - separate one. - - NOTE: there must only be 2 defined ConnectionEnds to establish - - a connection between two chains. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryConnectionResponse is the response type for the - Query/Connection RPC - - method. Besides the connection end, it includes a proof and the - height from - - which the proof was retrieved. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection_id - description: connection unique identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/connection/v1/connections/{connection_id}/client_state: - get: - summary: |- - ConnectionClientState queries the client state associated with the - connection. - operationId: IbcCoreConnectionV1ConnectionClientState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type - of the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be - in a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can - optionally set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results - based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty - scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any - values in the form - - of utility functions or additional generated methods of - the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and - the unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will - yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a - custom JSON - - representation, that representation will be embedded - adding a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an - additional client - - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionClientStateResponse is the response type for the - Query/ConnectionClientState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection_id - description: connection identifier - in: path - required: true - type: string - tags: - - Query - /ibc/core/connection/v1/connections/{connection_id}/consensus_state/revision/{revision_number}/height/{revision_height}: - get: - summary: |- - ConnectionConsensusState queries the consensus state associated with the - connection. - operationId: IbcCoreConnectionV1ConnectionConsensusState - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consensus_state: - title: consensus state associated with the channel - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - client_id: - type: string - title: client ID associated with the consensus state - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height - while keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionConsensusStateResponse is the response type for the - Query/ConnectionConsensusState RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: connection_id - description: connection identifier - in: path - required: true - type: string - - name: revision_number - in: path - required: true - type: string - format: uint64 - - name: revision_height - in: path - required: true - type: string - format: uint64 - tags: - - Query - /ibc/core/connection/v1/params: - get: - summary: ConnectionParams queries all parameters of the ibc connection submodule. - operationId: IbcCoreConnectionV1ConnectionParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - max_expected_time_per_block: - type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to - enforce block delay. This parameter should reflect the - - largest amount of time that the chain might reasonably - take to produce the next block under normal operating - - conditions. A safe choice is 3-5x the expected time per - block. - description: >- - QueryConnectionParamsResponse is the response type for the - Query/ConnectionParams RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /pocket/application/application: - get: - operationId: PocketApplicationApplicationAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - application: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the application is - configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder than an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service - configuration the application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, - in a non-nullable slice - title: >- - Application defines the type used to store an on-chain - definition and state for an application - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pocket/application/application/{address}: - get: - summary: Queries a list of Application items. - operationId: PocketApplicationApplication - responses: - '200': - description: A successful response. - schema: - type: object - properties: - application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration - the application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, - in a non-nullable slice - title: >- - Application defines the type used to store an on-chain - definition and state for an application - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pocket/application/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketApplicationParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_delegated_gateways: - type: string - format: int64 - title: >- - The maximum number of gateways an application can delegate - trust to - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/gateway/gateway: - get: - operationId: PocketGatewayGatewayAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - gateway: - type: array - items: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pocket/gateway/gateway/{address}: - get: - summary: Queries a list of Gateway items. - operationId: PocketGatewayGateway - responses: - '200': - description: A successful response. - schema: - type: object - properties: - gateway: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pocket/gateway/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketGatewayParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/pocket/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketPocketParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/service/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketServiceParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - add_service_fee: - type: string - format: uint64 - description: |- - The amount of uPOKT required to add a new service. - This will be deducted from the signer's account balance, - and transferred to the pocket network foundation. - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/session/get_session: - get: - summary: Queries a list of GetSession items. - operationId: PocketSessionGetSession - responses: - '200': - description: A successful response. - schema: - type: object - properties: - session: - type: object - properties: - header: - title: The header of the session containing lightweight data - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values - using on-chain but is included in the header for - convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - description: >- - SessionHeader is a lightweight header for a session that - can be passed around. - - It is the minimal amount of data required to hydrate & - retrieve all data relevant to the session. - session_id: - type: string - title: A unique pseudoranom ID for this session - session_number: - type: string - format: int64 - title: The session number since genesis - num_blocks_per_session: - type: string - format: int64 - title: The number of blocks per session when this session started - application: - title: A fully hydrated application object this session is for - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the application is - configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder than an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service - configuration the application stakes for - title: >- - The list of services this appliccation is configured - to request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee - Gateways, in a non-nullable slice - suppliers: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an - amount. - - - NOTE: The amount field is an Int which implements - the custom method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the supplier is - configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with - some additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name - for the service - title: >- - TODO_TECHDEBT: Name is currently unused - but acts as a reminder than an optional - onchain representation of the service is - necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be - more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as - proto maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service - configuration the supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket - Network that provides RPC services. - title: >- - A fully hydrated set of servicers that are serving the - application - description: >- - Session is a fully hydrated session object that contains all - the information for the Session - - and its parcipants. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: application_address - description: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - in: query - required: false - type: string - - name: service.id - description: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - - - Unique identifier for the service - in: query - required: false - type: string - - name: service.name - description: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder than - an optional onchain representation of the service is necessary - - - (Optional) Semantic human readable name for the service - in: query - required: false - type: string - - name: block_height - description: The block height to query the session for - in: query - required: false - type: string - format: int64 - tags: - - Query - /pocket/session/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketSessionParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/supplier/claim/{session_id}/{supplier_address}: - get: - summary: Queries a list of Claim items. - operationId: PocketSupplierClaim - responses: - '200': - description: A successful response. - schema: - type: object - properties: - claim: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values - using on-chain but is included in the header for - convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims - pending to be proven - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: session_id - in: path - required: true - type: string - - name: supplier_address - in: path - required: true - type: string - tags: - - Query - /pocket/supplier/claims: - get: - operationId: PocketSupplierAllClaims - responses: - '200': - description: A successful response. - schema: - type: object - properties: - claim: - type: array - items: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: >- - The session header of the session that this claim is - for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above - values using on-chain but is included in the header - for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims - pending to be proven - description: 'TODO_IMPROVE: Rename to `Claims` (plural).' - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: supplier_address - in: query - required: false - type: string - - name: session_id - in: query - required: false - type: string - - name: session_end_height - in: query - required: false - type: string - format: uint64 - tags: - - Query - /pocket/supplier/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketSupplierParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query - /pocket/supplier/proof: - get: - operationId: PocketSupplierAllProofs - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proof: - type: array - items: - type: object - properties: - supplier_address: - type: string - session_header: - description: >- - The session header of the session that this claim is - for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above - values using on-chain but is included in the header - for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - closest_merkle_proof: - type: string - format: byte - description: >- - The serialized SMST proof from the `#ClosestProof()` - method. - description: 'TODO_IMPROVE: Rename to `Proofs` (plural).' - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - - name: supplier_address - in: query - required: false - type: string - - name: session_id - in: query - required: false - type: string - - name: session_end_height - in: query - required: false - type: string - format: uint64 - tags: - - Query - /pocket/supplier/proof/{session_id}/{supplier_address}: - get: - summary: Queries a list of Proof items. - operationId: PocketSupplierProof - responses: - '200': - description: A successful response. - schema: - type: object - properties: - proof: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values - using on-chain but is included in the header for - convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the - last block of the session - closest_merkle_proof: - type: string - format: byte - description: >- - The serialized SMST proof from the `#ClosestProof()` - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: session_id - in: path - required: true - type: string - - name: supplier_address - in: path - required: true - type: string - tags: - - Query - /pocket/supplier/supplier/{address}: - get: - summary: Queries a list of Supplier items. - operationId: PocketSupplierSupplier - responses: - '200': - description: A successful response. - schema: - type: object - properties: - supplier: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be - more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as - proto maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration - the supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pocket/supplier/suppliers: - get: - operationId: PocketSupplierSupplierAll - responses: - '200': - description: A successful response. - schema: - type: object - properties: - supplier: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder than an optional onchain - representation of the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be - more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as - proto maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration - the supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network - that provides RPC services. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pokt-network/poktroll/tokenomics/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PocketTokenomicsParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - compute_units_to_tokens_multiplier: - type: string - format: uint64 - description: >- - The amount of upokt that a compute unit should translate - to when settling a session. - - TODO_DOCUMENT(@Olshansk): Make sure to document the units - of this parameter (or the map) once finalized. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query -definitions: - cosmos.auth.v1beta1.AddressBytesToStringResponse: - type: object - properties: - address_string: - type: string - description: >- - AddressBytesToStringResponse is the response type for AddressString rpc - method. - - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.AddressStringToBytesResponse: - type: object - properties: - address_bytes: - type: string - format: byte - description: >- - AddressStringToBytesResponse is the response type for AddressBytes rpc - method. - - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.BaseAccount: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - account_number: - type: string - format: uint64 - sequence: - type: string - format: uint64 - description: >- - BaseAccount defines a base account type. It contains all the necessary - fields - - for basic account functionality. Any custom account type should extend - this - - type for additional functionality (e.g. vesting). - cosmos.auth.v1beta1.Bech32PrefixResponse: - type: object - properties: - bech32_prefix: - type: string - description: |- - Bech32PrefixResponse is the response type for Bech32Prefix rpc method. - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.auth.v1beta1.Params: - type: object - properties: - max_memo_characters: - type: string - format: uint64 - tx_sig_limit: - type: string - format: uint64 - tx_size_cost_per_byte: - type: string - format: uint64 - sig_verify_cost_ed25519: - type: string - format: uint64 - sig_verify_cost_secp256k1: - type: string - format: uint64 - description: Params defines the parameters for the auth module. - cosmos.auth.v1beta1.QueryAccountAddressByIDResponse: - type: object - properties: - account_address: - type: string - description: 'Since: cosmos-sdk 0.46.2' - title: >- - QueryAccountAddressByIDResponse is the response type for - AccountAddressByID rpc method - cosmos.auth.v1beta1.QueryAccountInfoResponse: - type: object - properties: - info: - description: info is the account info which is represented by BaseAccount. - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - account_number: - type: string - format: uint64 - sequence: - type: string - format: uint64 - description: |- - QueryAccountInfoResponse is the Query/AccountInfo response type. - - Since: cosmos-sdk 0.47 - cosmos.auth.v1beta1.QueryAccountResponse: - type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryAccountResponse is the response type for the Query/Account RPC - method. - cosmos.auth.v1beta1.QueryAccountsResponse: - type: object - properties: - accounts: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: accounts are the existing accounts - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAccountsResponse is the response type for the Query/Accounts RPC - method. - - - Since: cosmos-sdk 0.43 - cosmos.auth.v1beta1.QueryModuleAccountByNameResponse: - type: object - properties: - account: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryModuleAccountByNameResponse is the response type for the - Query/ModuleAccountByName RPC method. - cosmos.auth.v1beta1.QueryModuleAccountsResponse: - type: object - properties: - accounts: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - QueryModuleAccountsResponse is the response type for the - Query/ModuleAccounts RPC method. - - - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - max_memo_characters: - type: string - format: uint64 - tx_sig_limit: - type: string - format: uint64 - tx_size_cost_per_byte: - type: string - format: uint64 - sig_verify_cost_ed25519: - type: string - format: uint64 - sig_verify_cost_secp256k1: - type: string - format: uint64 - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.base.query.v1beta1.PageRequest: - type: object - properties: - key: - type: string - format: byte - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - offset: - type: string - format: uint64 - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - limit: - type: string - format: uint64 - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - count_total: - type: boolean - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in UIs. - - count_total is only respected when offset is used. It is ignored when - key - - is set. - reverse: - type: boolean - description: >- - reverse is set to true if results are to be returned in the descending - order. - - - Since: cosmos-sdk 0.43 - description: |- - message SomeRequest { - Foo some_parameter = 1; - PageRequest pagination = 2; - } - title: |- - PageRequest is to be embedded in gRPC request messages for efficient - pagination. Ex: - cosmos.base.query.v1beta1.PageResponse: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: |- - total is total number of results available if PageRequest.count_total - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - google.protobuf.Any: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a canonical - form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types that - they - - expect it to use in the context of Any. However, for URLs which use - the - - scheme `http`, `https`, or no scheme, one can optionally set up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along with - a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - google.rpc.Status: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - cosmos.authz.v1beta1.Grant: - type: object - properties: - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - time when the grant will expire and will be pruned. If null, then the - grant - - doesn't have a time expiration (other conditions in `authorization` - - may apply to invalidate the grant) - description: |- - Grant gives permissions to execute - the provide method with expiration time. - cosmos.authz.v1beta1.GrantAuthorization: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses of the grantee - and granter. - - It is used in genesis.proto and query.proto - cosmos.authz.v1beta1.MsgExecResponse: - type: object - properties: - results: - type: array - items: - type: string - format: byte - description: MsgExecResponse defines the Msg/MsgExecResponse response type. - cosmos.authz.v1beta1.MsgGrantResponse: - type: object - description: MsgGrantResponse defines the Msg/MsgGrant response type. - cosmos.authz.v1beta1.MsgRevokeResponse: - type: object - description: MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. - cosmos.authz.v1beta1.QueryGranteeGrantsResponse: - type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses of the - grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted to the grantee. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranteeGrantsResponse is the response type for the - Query/GranteeGrants RPC method. - cosmos.authz.v1beta1.QueryGranterGrantsResponse: - type: object - properties: - grants: - type: array - items: - type: object - properties: - granter: - type: string - grantee: - type: string - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - GrantAuthorization extends a grant with both the addresses of the - grantee and granter. - - It is used in genesis.proto and query.proto - description: grants is a list of grants granted by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGranterGrantsResponse is the response type for the - Query/GranterGrants RPC method. - cosmos.authz.v1beta1.QueryGrantsResponse: - type: object - properties: - grants: - type: array - items: - type: object - properties: - authorization: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - expiration: - type: string - format: date-time - title: >- - time when the grant will expire and will be pruned. If null, - then the grant - - doesn't have a time expiration (other conditions in - `authorization` - - may apply to invalidate the grant) - description: |- - Grant gives permissions to execute - the provide method with expiration time. - description: authorizations is a list of grants granted for grantee by granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGrantsResponse is the response type for the Query/Authorizations RPC - method. - cosmos.bank.v1beta1.DenomOwner: - type: object - properties: - address: - type: string - description: address defines the address that owns a particular denomination. - balance: - description: balance is the balance of the denominated coin for an account. - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DenomOwner defines structure representing an account that owns or holds a - particular denominated token. It contains the account address and account - balance of the denominated token. - - Since: cosmos-sdk 0.46 - cosmos.bank.v1beta1.DenomUnit: - type: object - properties: - denom: - type: string - description: denom represents the string name of the given denom unit (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' - with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - cosmos.bank.v1beta1.Input: - type: object - properties: - address: - type: string - coins: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Input models transaction input. - cosmos.bank.v1beta1.Metadata: - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom unit (e.g - uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given DenomUnit's - denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a DenomUnit of - 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: denom_units represents the list of DenomUnit's for a given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit with exponent - = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: ATOM). This - can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains additional - information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. It's used to - verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: |- - Metadata represents a struct that describes - a basic token. - cosmos.bank.v1beta1.MsgMultiSendResponse: - type: object - description: MsgMultiSendResponse defines the Msg/MultiSend response type. - cosmos.bank.v1beta1.MsgSendResponse: - type: object - description: MsgSendResponse defines the Msg/Send response type. - cosmos.bank.v1beta1.MsgSetSendEnabledResponse: - type: object - description: |- - MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.Output: - type: object - properties: - address: - type: string - coins: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Output models transaction outputs. - cosmos.bank.v1beta1.Params: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status (whether a - denom is - - sendable). - description: >- - Deprecated: Use of SendEnabled in params is deprecated. - - For genesis, use the newly added send_enabled field in the genesis - object. - - Storage, lookup, and manipulation of this information is now in the - keeper. - - - As of cosmos-sdk 0.47, this only exists for backwards compatibility of - genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. - cosmos.bank.v1beta1.QueryAllBalancesResponse: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: balances is the balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllBalancesResponse is the response type for the Query/AllBalances - RPC - - method. - cosmos.bank.v1beta1.QueryBalanceResponse: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QueryBalanceResponse is the response type for the Query/Balance RPC - method. - cosmos.bank.v1beta1.QueryDenomMetadataResponse: - type: object - properties: - metadata: - description: >- - metadata describes and provides all the client information for the - requested token. - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom unit - (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given - DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a DenomUnit - of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: denom_units represents the list of DenomUnit's for a given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit with - exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: ATOM). - This can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains additional - information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. It's used - to verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: >- - QueryDenomMetadataResponse is the response type for the - Query/DenomMetadata RPC - - method. - cosmos.bank.v1beta1.QueryDenomOwnersResponse: - type: object - properties: - denom_owners: - type: array - items: - type: object - properties: - address: - type: string - description: address defines the address that owns a particular denomination. - balance: - description: balance is the balance of the denominated coin for an account. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DenomOwner defines structure representing an account that owns or - holds a - - particular denominated token. It contains the account address and - account - - balance of the denominated token. - - - Since: cosmos-sdk 0.46 - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC - query. - - - Since: cosmos-sdk 0.46 - cosmos.bank.v1beta1.QueryDenomsMetadataResponse: - type: object - properties: - metadatas: - type: array - items: - type: object - properties: - description: - type: string - denom_units: - type: array - items: - type: object - properties: - denom: - type: string - description: >- - denom represents the string name of the given denom unit - (e.g uatom). - exponent: - type: integer - format: int64 - description: >- - exponent represents power of 10 exponent that one must - - raise the base_denom to in order to equal the given - DenomUnit's denom - - 1 denom = 10^exponent base_denom - - (e.g. with a base_denom of uatom, one can create a - DenomUnit of 'atom' with - - exponent = 6, thus: 1 atom = 10^6 uatom). - aliases: - type: array - items: - type: string - title: aliases is a list of string aliases for the given denom - description: |- - DenomUnit represents a struct that describes a given - denomination unit of the basic token. - title: denom_units represents the list of DenomUnit's for a given coin - base: - type: string - description: >- - base represents the base denom (should be the DenomUnit with - exponent = 0). - display: - type: string - description: |- - display indicates the suggested denom that should be - displayed in clients. - name: - type: string - description: 'Since: cosmos-sdk 0.43' - title: 'name defines the name of the token (eg: Cosmos Atom)' - symbol: - type: string - description: >- - symbol is the token symbol usually shown on exchanges (eg: - ATOM). This can - - be the same as the display. - - - Since: cosmos-sdk 0.43 - uri: - type: string - description: >- - URI to a document (on or off-chain) that contains additional - information. Optional. - - - Since: cosmos-sdk 0.46 - uri_hash: - type: string - description: >- - URIHash is a sha256 hash of a document pointed by URI. It's used - to verify that - - the document didn't change. Optional. - - - Since: cosmos-sdk 0.46 - description: |- - Metadata represents a struct that describes - a basic token. - description: >- - metadata provides the client information for all the registered - tokens. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDenomsMetadataResponse is the response type for the - Query/DenomsMetadata RPC - - method. - cosmos.bank.v1beta1.QueryParamsResponse: - type: object - properties: - params: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status (whether a - denom is - - sendable). - description: >- - Deprecated: Use of SendEnabled in params is deprecated. - - For genesis, use the newly added send_enabled field in the genesis - object. - - Storage, lookup, and manipulation of this information is now in - the keeper. - - - As of cosmos-sdk 0.47, this only exists for backwards - compatibility of genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. - description: >- - QueryParamsResponse defines the response type for querying x/bank - parameters. - cosmos.bank.v1beta1.QuerySendEnabledResponse: - type: object - properties: - send_enabled: - type: array - items: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status (whether a - denom is - - sendable). - pagination: - description: |- - pagination defines the pagination in the response. This field is only - populated if the denoms field in the request is empty. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QuerySendEnabledResponse defines the RPC response of a SendEnable query. - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse: - type: object - properties: - balance: - description: balance is the balance of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySpendableBalanceByDenomResponse defines the gRPC response structure - for - - querying an account's spendable balance for a specific denom. - - - Since: cosmos-sdk 0.47 - cosmos.bank.v1beta1.QuerySpendableBalancesResponse: - type: object - properties: - balances: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: balances is the spendable balances of all the coins. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QuerySpendableBalancesResponse defines the gRPC response structure for - querying - - an account's spendable balances. - - - Since: cosmos-sdk 0.46 - cosmos.bank.v1beta1.QuerySupplyOfResponse: - type: object - properties: - amount: - description: amount is the supply of the coin. - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC - method. - cosmos.bank.v1beta1.QueryTotalSupplyResponse: - type: object - properties: - supply: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: supply is the supply of the coins - pagination: - description: |- - pagination defines the pagination in the response. - - Since: cosmos-sdk 0.43 - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryTotalSupplyResponse is the response type for the Query/TotalSupply - RPC - - method - cosmos.bank.v1beta1.SendEnabled: - type: object - properties: - denom: - type: string - enabled: - type: boolean - description: |- - SendEnabled maps coin denom to a send_enabled status (whether a denom is - sendable). - cosmos.base.v1beta1.Coin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - cosmos.base.node.v1beta1.ConfigResponse: - type: object - properties: - minimum_gas_price: - type: string - description: ConfigResponse defines the response structure for the Config gRPC query. - cosmos.base.tendermint.v1beta1.ABCIQueryResponse: - type: object - properties: - code: - type: integer - format: int64 - log: - type: string - title: nondeterministic - info: - type: string - title: nondeterministic - index: - type: string - format: int64 - key: - type: string - format: byte - value: - type: string - format: byte - proof_ops: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle root. - The data could - - be arbitrary format, providing necessary data for example - neighbouring node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type defined - in Tendermint. - description: >- - ProofOps is Merkle proof defined by the list of ProofOps. - - - Note: This type is a duplicate of the ProofOps proto type defined in - Tendermint. - height: - type: string - format: int64 - codespace: - type: string - description: >- - ABCIQueryResponse defines the response structure for the ABCIQuery gRPC - query. - - - Note: This type is a duplicate of the ResponseQuery proto type defined in - - Tendermint. - cosmos.base.tendermint.v1beta1.Block: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, formatted - as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we convert it - to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from - the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block was - committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - description: |- - Block is tendermint type Block, with the Header proposer address - field converted to bech32 string. - cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, - formatted as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we - convert it to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - description: |- - Block is tendermint type Block, with the Header proposer address - field converted to bech32 string. - description: >- - GetBlockByHeightResponse is the response type for the - Query/GetBlockByHeight RPC method. - cosmos.base.tendermint.v1beta1.GetLatestBlockResponse: - type: object - properties: - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - title: 'Deprecated: please use `sdk_block` instead' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - sdk_block: - title: 'Since: cosmos-sdk 0.47' - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, - formatted as a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we - convert it to a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - description: |- - Block is tendermint type Block, with the Header proposer address - field converted to bech32 string. - description: >- - GetLatestBlockResponse is the response type for the Query/GetLatestBlock - RPC method. - cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse: - type: object - properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetLatestValidatorSetResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. - cosmos.base.tendermint.v1beta1.GetNodeInfoResponse: - type: object - properties: - default_node_info: - type: object - properties: - protocol_version: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - default_node_id: - type: string - listen_addr: - type: string - network: - type: string - version: - type: string - channels: - type: string - format: byte - moniker: - type: string - other: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - application_version: - type: object - properties: - name: - type: string - app_name: - type: string - version: - type: string - git_commit: - type: string - build_tags: - type: string - go_version: - type: string - build_deps: - type: array - items: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos_sdk_version: - type: string - title: 'Since: cosmos-sdk 0.43' - description: VersionInfo is the type for the GetNodeInfoResponse message. - description: >- - GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC - method. - cosmos.base.tendermint.v1beta1.GetSyncingResponse: - type: object - properties: - syncing: - type: boolean - description: >- - GetSyncingResponse is the response type for the Query/GetSyncing RPC - method. - cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse: - type: object - properties: - block_height: - type: string - format: int64 - validators: - type: array - items: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetValidatorSetByHeightResponse is the response type for the - Query/GetValidatorSetByHeight RPC method. - cosmos.base.tendermint.v1beta1.Header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in the - blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - description: >- - proposer_address is the original block proposer address, formatted as - a Bech32 string. - - In Tendermint, this type is `bytes`, but in the SDK, we convert it to - a Bech32 string - - for better UX. - - - original proposer of the block - description: Header defines the structure of a Tendermint block header. - cosmos.base.tendermint.v1beta1.Module: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos.base.tendermint.v1beta1.ProofOp: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle root. The data - could - - be arbitrary format, providing necessary data for example neighbouring - node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type defined in - Tendermint. - cosmos.base.tendermint.v1beta1.ProofOps: - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - description: >- - ProofOp defines an operation used for calculating Merkle root. The - data could - - be arbitrary format, providing necessary data for example - neighbouring node - - hash. - - - Note: This type is a duplicate of the ProofOp proto type defined in - Tendermint. - description: >- - ProofOps is Merkle proof defined by the list of ProofOps. - - - Note: This type is a duplicate of the ProofOps proto type defined in - Tendermint. - cosmos.base.tendermint.v1beta1.Validator: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - description: Validator is the type for the validator-set. - cosmos.base.tendermint.v1beta1.VersionInfo: - type: object - properties: - name: - type: string - app_name: - type: string - version: - type: string - git_commit: - type: string - build_tags: - type: string - go_version: - type: string - build_deps: - type: array - items: - type: object - properties: - path: - type: string - title: module path - version: - type: string - title: module version - sum: - type: string - title: checksum - title: Module is the type for VersionInfo - cosmos_sdk_version: - type: string - title: 'Since: cosmos-sdk 0.43' - description: VersionInfo is the type for the GetNodeInfoResponse message. - tendermint.crypto.PublicKey: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - tendermint.p2p.DefaultNodeInfo: - type: object - properties: - protocol_version: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - default_node_id: - type: string - listen_addr: - type: string - network: - type: string - version: - type: string - channels: - type: string - format: byte - moniker: - type: string - other: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - tendermint.p2p.DefaultNodeInfoOther: - type: object - properties: - tx_index: - type: string - rpc_address: - type: string - tendermint.p2p.ProtocolVersion: - type: object - properties: - p2p: - type: string - format: uint64 - block: - type: string - format: uint64 - app: - type: string - format: uint64 - tendermint.types.Block: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from - the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block was - committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - tendermint.types.BlockID: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - tendermint.types.BlockIDFlag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - tendermint.types.Commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - tendermint.types.CommitSig: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - tendermint.types.Data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the order - first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - tendermint.types.DuplicateVoteEvidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from validators - for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from validators - for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator signed two - conflicting votes. - tendermint.types.Evidence: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator signed two - conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, - - including all blockchain data structures and the rules - of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was committed by - a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of validators - attempting to mislead a light client. - tendermint.types.EvidenceList: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator signed - two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the - previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included in a - Commit. - description: >- - Commit contains the evidence that a block was - committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - tendermint.types.Header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in the - blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - tendermint.types.LightBlock: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - tendermint.types.LightClientAttackEvidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, - - including all blockchain data structures and the rules of - the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs from the previous - block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the signature is - for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a - set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use with - Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of validators - attempting to mislead a light client. - tendermint.types.PartSetHeader: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - tendermint.types.SignedHeader: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set of - validators. - tendermint.types.SignedMsgType: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - tendermint.types.Validator: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - tendermint.types.ValidatorSet: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: PublicKey defines the keys available for use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - tendermint.types.Vote: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: |- - SignedMsgType is a type of signed message in the consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: |- - Vote represents a prevote, precommit, or commit vote from validators for - consensus. - tendermint.version.Consensus: - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in the - blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - cosmos.consensus.v1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - cosmos.consensus.v1.QueryParamsResponse: - type: object - properties: - params: - description: >- - params are the tendermint consensus params stored in the consensus - module. - - Please note that `params.version` is not populated in this response, - it is - - tracked separately in the x/upgrade module. - type: object - properties: - block: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - evidence: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: MaxAgeDuration / - {average block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" or other - similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes that can - be committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: EvidenceParams determine how we handle evidence of malfeasance. - validator: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: |- - ValidatorParams restrict the public key types validators can use. - NOTE: uses ABCI pubkey naming, not Amino names. - version: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - description: >- - QueryParamsResponse defines the response type for querying x/consensus - parameters. - tendermint.types.BlockParams: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - tendermint.types.ConsensusParams: - type: object - properties: - block: - type: object - properties: - max_bytes: - type: string - format: int64 - title: |- - Max block size, in bytes. - Note: must be greater than 0 - max_gas: - type: string - format: int64 - title: |- - Max gas per block. - Note: must be greater or equal to -1 - description: BlockParams contains limits on the block size. - evidence: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: MaxAgeDuration / - {average block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" or other - similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes that can be - committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: EvidenceParams determine how we handle evidence of malfeasance. - validator: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: |- - ValidatorParams restrict the public key types validators can use. - NOTE: uses ABCI pubkey naming, not Amino names. - version: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - description: |- - ConsensusParams contains consensus critical parameters that determine the - validity of blocks. - tendermint.types.EvidenceParams: - type: object - properties: - max_age_num_blocks: - type: string - format: int64 - description: >- - Max age of evidence, in blocks. - - - The basic formula for calculating this is: MaxAgeDuration / {average - block - - time}. - max_age_duration: - type: string - description: >- - Max age of evidence, in time. - - - It should correspond with an app's "unbonding period" or other similar - - mechanism for handling [Nothing-At-Stake - - attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - max_bytes: - type: string - format: int64 - title: >- - This sets the maximum size of total evidence in bytes that can be - committed in a single block. - - and should fall comfortably under the max block bytes. - - Default is 1048576 or 1MB - description: EvidenceParams determine how we handle evidence of malfeasance. - tendermint.types.ValidatorParams: - type: object - properties: - pub_key_types: - type: array - items: - type: string - description: |- - ValidatorParams restrict the public key types validators can use. - NOTE: uses ABCI pubkey naming, not Amino names. - tendermint.types.VersionParams: - type: object - properties: - app: - type: string - format: uint64 - description: VersionParams contains the ABCI application version. - cosmos.crisis.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.crisis.v1beta1.MsgVerifyInvariantResponse: - type: object - description: MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. - cosmos.base.v1beta1.DecCoin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - cosmos.distribution.v1beta1.DelegationDelegatorReward: - type: object - properties: - validator_address: - type: string - reward: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: |- - DelegationDelegatorReward represents the properties - of a delegator's delegation reward. - cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse: - type: object - description: |- - MsgCommunityPoolSpendResponse defines the response to executing a - MsgCommunityPoolSpend message. - - Since: cosmos-sdk 0.47 - cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse: - type: object - description: >- - MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response - type. - cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse: - type: object - description: |- - MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response - type. - cosmos.distribution.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: 'Since: cosmos-sdk 0.46' - description: |- - MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward - response type. - cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: 'Since: cosmos-sdk 0.46' - description: |- - MsgWithdrawValidatorCommissionResponse defines the - Msg/WithdrawValidatorCommission response type. - cosmos.distribution.v1beta1.Params: - type: object - properties: - community_tax: - type: string - base_proposer_reward: - type: string - description: >- - Deprecated: The base_proposer_reward field is deprecated and is no - longer used - - in the x/distribution module's reward mechanism. - bonus_proposer_reward: - type: string - description: >- - Deprecated: The bonus_proposer_reward field is deprecated and is no - longer used - - in the x/distribution module's reward mechanism. - withdraw_addr_enabled: - type: boolean - description: Params defines the set of params for the distribution module. - cosmos.distribution.v1beta1.QueryCommunityPoolResponse: - type: object - properties: - pool: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: pool defines community pool's coins. - description: >- - QueryCommunityPoolResponse is the response type for the - Query/CommunityPool - - RPC method. - cosmos.distribution.v1beta1.QueryDelegationRewardsResponse: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: rewards defines the rewards accrued by a delegation. - description: |- - QueryDelegationRewardsResponse is the response type for the - Query/DelegationRewards RPC method. - cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - validator_address: - type: string - reward: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: |- - DelegationDelegatorReward represents the properties - of a delegator's delegation reward. - description: rewards defines all the rewards accrued by a delegator. - total: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: total defines the sum of all the rewards. - description: |- - QueryDelegationTotalRewardsResponse is the response type for the - Query/DelegationTotalRewards RPC method. - cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse: - type: object - properties: - validators: - type: array - items: - type: string - description: validators defines the validators a delegator is delegating for. - description: |- - QueryDelegatorValidatorsResponse is the response type for the - Query/DelegatorValidators RPC method. - cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse: - type: object - properties: - withdraw_address: - type: string - description: withdraw_address defines the delegator address to query for. - description: |- - QueryDelegatorWithdrawAddressResponse is the response type for the - Query/DelegatorWithdrawAddress RPC method. - cosmos.distribution.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - community_tax: - type: string - base_proposer_reward: - type: string - description: >- - Deprecated: The base_proposer_reward field is deprecated and is no - longer used - - in the x/distribution module's reward mechanism. - bonus_proposer_reward: - type: string - description: >- - Deprecated: The bonus_proposer_reward field is deprecated and is - no longer used - - in the x/distribution module's reward mechanism. - withdraw_addr_enabled: - type: boolean - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.distribution.v1beta1.QueryValidatorCommissionResponse: - type: object - properties: - commission: - description: commission defines the commission the validator received. - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - title: |- - QueryValidatorCommissionResponse is the response type for the - Query/ValidatorCommission RPC method - cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse: - type: object - properties: - operator_address: - type: string - description: operator_address defines the validator operator address. - self_bond_rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: self_bond_rewards defines the self delegations rewards. - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: commission defines the commission the validator received. - description: >- - QueryValidatorDistributionInfoResponse is the response type for the - Query/ValidatorDistributionInfo RPC method. - cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse: - type: object - properties: - rewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: >- - ValidatorOutstandingRewards represents outstanding (un-withdrawn) - rewards - - for a validator inexpensive to track, allows simple sanity checks. - description: |- - QueryValidatorOutstandingRewardsResponse is the response type for the - Query/ValidatorOutstandingRewards RPC method. - cosmos.distribution.v1beta1.QueryValidatorSlashesResponse: - type: object - properties: - slashes: - type: array - items: - type: object - properties: - validator_period: - type: string - format: uint64 - fraction: - type: string - description: |- - ValidatorSlashEvent represents a validator slash event. - Height is implicit within the store key. - This is needed to calculate appropriate amount of staking tokens - for delegations which are withdrawn after a slash has occurred. - description: slashes defines the slashes the validator received. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryValidatorSlashesResponse is the response type for the - Query/ValidatorSlashes RPC method. - cosmos.distribution.v1beta1.ValidatorAccumulatedCommission: - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: |- - ValidatorAccumulatedCommission represents accumulated commission - for a validator kept as a running counter, can be withdrawn at any time. - cosmos.distribution.v1beta1.ValidatorOutstandingRewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: |- - ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards - for a validator inexpensive to track, allows simple sanity checks. - cosmos.distribution.v1beta1.ValidatorSlashEvent: - type: object - properties: - validator_period: - type: string - format: uint64 - fraction: - type: string - description: |- - ValidatorSlashEvent represents a validator slash event. - Height is implicit within the store key. - This is needed to calculate appropriate amount of staking tokens - for delegations which are withdrawn after a slash has occurred. - cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse: - type: object - properties: - hash: - type: string - format: byte - description: hash defines the hash of the evidence. - description: MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. - cosmos.evidence.v1beta1.QueryAllEvidenceResponse: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: evidence returns all evidences. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllEvidenceResponse is the response type for the Query/AllEvidence - RPC - - method. - cosmos.evidence.v1beta1.QueryEvidenceResponse: - type: object - properties: - evidence: - description: evidence returns the requested evidence. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryEvidenceResponse is the response type for the Query/Evidence RPC - method. - cosmos.feegrant.v1beta1.Grant: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of their - funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse: - type: object - description: >- - MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response - type. - cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse: - type: object - description: >- - MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse - response type. - cosmos.feegrant.v1beta1.QueryAllowanceResponse: - type: object - properties: - allowance: - description: allowance is a allowance granted for grantee by granter. - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of their - funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - description: >- - QueryAllowanceResponse is the response type for the Query/Allowance RPC - method. - cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse: - type: object - properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of - their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - description: allowances that have been issued by the granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllowancesByGranterResponse is the response type for the - Query/AllowancesByGranter RPC method. - - - Since: cosmos-sdk 0.46 - cosmos.feegrant.v1beta1.QueryAllowancesResponse: - type: object - properties: - allowances: - type: array - items: - type: object - properties: - granter: - type: string - description: >- - granter is the address of the user granting an allowance of - their funds. - grantee: - type: string - description: >- - grantee is the address of the user being granted an allowance of - another user's funds. - allowance: - description: allowance can be any of basic, periodic, allowed fee allowance. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - title: Grant is stored in the KVStore to record a grant with full context - description: allowances are allowance's granted for grantee by granter. - pagination: - description: pagination defines an pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryAllowancesResponse is the response type for the Query/Allowances RPC - method. - cosmos.gov.v1.Deposit: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: |- - Deposit defines an amount deposited by an account address to an active - proposal. - cosmos.gov.v1.DepositParams: - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - description: DepositParams defines the params for deposits on governance proposals. - cosmos.gov.v1.MsgDepositResponse: - type: object - description: MsgDepositResponse defines the Msg/Deposit response type. - cosmos.gov.v1.MsgExecLegacyContentResponse: - type: object - description: >- - MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response - type. - cosmos.gov.v1.MsgSubmitProposalResponse: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. - cosmos.gov.v1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.gov.v1.MsgVoteResponse: - type: object - description: MsgVoteResponse defines the Msg/Vote response type. - cosmos.gov.v1.MsgVoteWeightedResponse: - type: object - description: MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - cosmos.gov.v1.Params: - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: |- - Minimum percentage of total stake needed to vote for a result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default value: - 0.5. - veto_threshold: - type: string - description: |- - Minimum value of Veto votes to Total votes ratio for proposal to be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value that must - be paid at proposal submission. - burn_vote_quorum: - type: boolean - title: burn deposits if a proposal does not meet quorum - burn_proposal_deposit_prevote: - type: boolean - title: burn deposits if the proposal does not enter voting period - burn_vote_veto: - type: boolean - title: burn deposits if quorum with vote type no_veto is met - description: |- - Params defines the parameters for the x/gov module. - - Since: cosmos-sdk 0.47 - cosmos.gov.v1.Proposal: - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the proposal - passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: |- - final_tally_result is the final tally result of the proposal. When - querying a proposal via gRPC, this field is not populated until the - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: Proposal defines the core field members of a governance proposal. - cosmos.gov.v1.ProposalStatus: - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - description: |- - ProposalStatus enumerates the valid statuses of a proposal. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - cosmos.gov.v1.QueryDepositResponse: - type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit RPC - method. - cosmos.gov.v1.QueryDepositsResponse: - type: object - properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to an - active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits RPC - method. - cosmos.gov.v1.QueryParamsResponse: - type: object - properties: - voting_params: - description: |- - Deprecated: Prefer to use `params` instead. - voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: |- - Deprecated: Prefer to use `params` instead. - deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - tally_params: - description: |- - Deprecated: Prefer to use `params` instead. - tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a result to - be - - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default - value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for proposal to - be - - vetoed. Default value: 1/3. - params: - description: |- - params defines all the paramaters of x/gov module. - - Since: cosmos-sdk 0.47 - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a result to - be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default - value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for proposal to - be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value that - must be paid at proposal submission. - burn_vote_quorum: - type: boolean - title: burn deposits if a proposal does not meet quorum - burn_proposal_deposit_prevote: - type: boolean - title: burn deposits if the proposal does not enter voting period - burn_vote_veto: - type: boolean - title: burn deposits if quorum with vote type no_veto is met - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.gov.v1.QueryProposalResponse: - type: object - properties: - proposal: - description: proposal is the requested governance proposal. - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the proposal - passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: >- - QueryProposalResponse is the response type for the Query/Proposal RPC - method. - cosmos.gov.v1.QueryProposalsResponse: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id defines the unique id of the proposal. - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages are the arbitrary messages to be executed if the - proposal passes. - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. - When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the proposal. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - proposer: - type: string - description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter - description: Proposal defines the core field members of a governance proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryProposalsResponse is the response type for the Query/Proposals RPC - method. - cosmos.gov.v1.QueryTallyResultResponse: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: >- - no_with_veto_count is the number of no with veto votes on a - proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally RPC - method. - cosmos.gov.v1.QueryVoteResponse: - type: object - properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - description: options is the weighted vote options. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the vote. - description: QueryVoteResponse is the response type for the Query/Vote RPC method. - cosmos.gov.v1.QueryVotesResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - description: options is the weighted vote options. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the vote. - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesResponse is the response type for the Query/Votes RPC method. - cosmos.gov.v1.TallyParams: - type: object - properties: - quorum: - type: string - description: |- - Minimum percentage of total stake needed to vote for a result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. Default value: - 0.5. - veto_threshold: - type: string - description: |- - Minimum value of Veto votes to Total votes ratio for proposal to be - vetoed. Default value: 1/3. - description: TallyParams defines the params for tallying votes on governance proposals. - cosmos.gov.v1.TallyResult: - type: object - properties: - yes_count: - type: string - description: yes_count is the number of yes votes on a proposal. - abstain_count: - type: string - description: abstain_count is the number of abstain votes on a proposal. - no_count: - type: string - description: no_count is the number of no votes on a proposal. - no_with_veto_count: - type: string - description: no_with_veto_count is the number of no with veto votes on a proposal. - description: TallyResult defines a standard tally for a governance proposal. - cosmos.gov.v1.Vote: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - description: options is the weighted vote options. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the vote. - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - cosmos.gov.v1.VoteOption: - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - description: >- - VoteOption enumerates the valid vote options for a given governance - proposal. - - - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. - - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - cosmos.gov.v1.VotingParams: - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - description: VotingParams defines the params for voting on governance proposals. - cosmos.gov.v1.WeightedVoteOption: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain duplicate - vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: WeightedVoteOption defines a unit of vote for vote split. - cosmos.gov.v1beta1.Deposit: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: |- - Deposit defines an amount deposited by an account address to an active - proposal. - cosmos.gov.v1beta1.DepositParams: - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - description: DepositParams defines the params for deposits on governance proposals. - cosmos.gov.v1beta1.MsgDepositResponse: - type: object - description: MsgDepositResponse defines the Msg/Deposit response type. - cosmos.gov.v1beta1.MsgSubmitProposalResponse: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. - cosmos.gov.v1beta1.MsgVoteResponse: - type: object - description: MsgVoteResponse defines the Msg/Vote response type. - cosmos.gov.v1beta1.MsgVoteWeightedResponse: - type: object - description: |- - MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. - - Since: cosmos-sdk 0.43 - cosmos.gov.v1beta1.Proposal: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: |- - final_tally_result is the final tally result of the proposal. When - querying a proposal via gRPC, this field is not populated until the - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: no_with_veto is the number of no with veto votes on a proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: Proposal defines the core field members of a governance proposal. - cosmos.gov.v1beta1.ProposalStatus: - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - description: |- - ProposalStatus enumerates the valid statuses of a proposal. - - - PROPOSAL_STATUS_UNSPECIFIED: PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - - PROPOSAL_STATUS_DEPOSIT_PERIOD: PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - period. - - PROPOSAL_STATUS_VOTING_PERIOD: PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - period. - - PROPOSAL_STATUS_PASSED: PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - passed. - - PROPOSAL_STATUS_REJECTED: PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - been rejected. - - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - failed. - cosmos.gov.v1beta1.QueryDepositResponse: - type: object - properties: - deposit: - description: deposit defines the requested deposit. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - QueryDepositResponse is the response type for the Query/Deposit RPC - method. - cosmos.gov.v1beta1.QueryDepositsResponse: - type: object - properties: - deposits: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - depositor: - type: string - description: depositor defines the deposit addresses from the proposals. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: amount to be deposited by depositor. - description: >- - Deposit defines an amount deposited by an account address to an - active - - proposal. - description: deposits defines the requested deposits. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryDepositsResponse is the response type for the Query/Deposits RPC - method. - cosmos.gov.v1beta1.QueryParamsResponse: - type: object - properties: - voting_params: - description: voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. Initial - value: 2 - - months. - tally_params: - description: tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - format: byte - description: >- - Minimum percentage of total stake needed to vote for a result to - be - - considered valid. - threshold: - type: string - format: byte - description: >- - Minimum proportion of Yes votes for proposal to pass. Default - value: 0.5. - veto_threshold: - type: string - format: byte - description: >- - Minimum value of Veto votes to Total votes ratio for proposal to - be - - vetoed. Default value: 1/3. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.gov.v1beta1.QueryProposalResponse: - type: object - properties: - proposal: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: Proposal defines the core field members of a governance proposal. - description: >- - QueryProposalResponse is the response type for the Query/Proposal RPC - method. - cosmos.gov.v1beta1.QueryProposalsResponse: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - content: - description: content is the proposal's content. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - status: - description: status defines the proposal status. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_DEPOSIT_PERIOD - - PROPOSAL_STATUS_VOTING_PERIOD - - PROPOSAL_STATUS_PASSED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_FAILED - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result is the final tally result of the proposal. - When - - querying a proposal via gRPC, this field is not populated until - the - - proposal's voting period has ended. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - submit_time: - type: string - format: date-time - description: submit_time is the time of proposal submission. - deposit_end_time: - type: string - format: date-time - description: deposit_end_time is the end time for deposition. - total_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: total_deposit is the total deposit on the proposal. - voting_start_time: - type: string - format: date-time - description: voting_start_time is the starting time to vote on a proposal. - voting_end_time: - type: string - format: date-time - description: voting_end_time is the end time of voting on a proposal. - description: Proposal defines the core field members of a governance proposal. - description: proposals defines all the requested governance proposals. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryProposalsResponse is the response type for the Query/Proposals RPC - method. - cosmos.gov.v1beta1.QueryTallyResultResponse: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: no_with_veto is the number of no with veto votes on a proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally RPC - method. - cosmos.gov.v1beta1.QueryVoteResponse: - type: object - properties: - vote: - description: vote defines the queried vote. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is set in - queries - - if and only if `len(options) == 1` and that option has weight 1. - In all - - other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: QueryVoteResponse is the response type for the Query/Vote RPC method. - cosmos.gov.v1beta1.QueryVotesResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is set - in queries - - if and only if `len(options) == 1` and that option has weight 1. - In all - - other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - description: votes defines the queried votes. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesResponse is the response type for the Query/Votes RPC method. - cosmos.gov.v1beta1.TallyParams: - type: object - properties: - quorum: - type: string - format: byte - description: |- - Minimum percentage of total stake needed to vote for a result to be - considered valid. - threshold: - type: string - format: byte - description: >- - Minimum proportion of Yes votes for proposal to pass. Default value: - 0.5. - veto_threshold: - type: string - format: byte - description: |- - Minimum value of Veto votes to Total votes ratio for proposal to be - vetoed. Default value: 1/3. - description: TallyParams defines the params for tallying votes on governance proposals. - cosmos.gov.v1beta1.TallyResult: - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: no_with_veto is the number of no with veto votes on a proposal. - description: TallyResult defines a standard tally for a governance proposal. - cosmos.gov.v1beta1.Vote: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal_id defines the unique id of the proposal. - voter: - type: string - description: voter is the voter address of the proposal. - option: - description: >- - Deprecated: Prefer to use `options` instead. This field is set in - queries - - if and only if `len(options) == 1` and that option has weight 1. In - all - - other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - options: - type: array - items: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain - duplicate vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - description: |- - options is the weighted vote options. - - Since: cosmos-sdk 0.43 - description: |- - Vote defines a vote on a governance proposal. - A Vote consists of a proposal ID, the voter, and the vote option. - cosmos.gov.v1beta1.VoteOption: - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - description: >- - VoteOption enumerates the valid vote options for a given governance - proposal. - - - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. - - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - cosmos.gov.v1beta1.VotingParams: - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - description: VotingParams defines the params for voting on governance proposals. - cosmos.gov.v1beta1.WeightedVoteOption: - type: object - properties: - option: - description: >- - option defines the valid vote options, it must not contain duplicate - vote options. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - weight: - type: string - description: weight is the vote weight associated with the vote option. - description: |- - WeightedVoteOption defines a unit of vote for vote split. - - Since: cosmos-sdk 0.43 - cosmos.group.v1.Exec: - type: string - enum: - - EXEC_UNSPECIFIED - - EXEC_TRY - default: EXEC_UNSPECIFIED - description: |- - Exec defines modes of execution of a proposal on creation or on new vote. - - - EXEC_UNSPECIFIED: An empty value means that there should be a separate - MsgExec request for the proposal to execute. - - EXEC_TRY: Try to execute the proposal immediately. - If the proposal is not allowed per the DecisionPolicy, - the proposal will still be open and could - be executed at a later point. - cosmos.group.v1.GroupInfo: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership structure - that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: GroupInfo represents the high-level on-chain information for a group. - cosmos.group.v1.GroupMember: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - member: - description: member is the member data. - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: >- - weight is the member's voting weight that should be greater than - 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - added_at: - type: string - format: date-time - description: added_at is a timestamp specifying when a member was added. - description: GroupMember represents the relationship between a group and a member. - cosmos.group.v1.GroupPolicyInfo: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the group policy. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group policy was created. - description: >- - GroupPolicyInfo represents the high-level on-chain information for a group - policy. - cosmos.group.v1.Member: - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: weight is the member's voting weight that should be greater than 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - added_at: - type: string - format: date-time - description: added_at is a timestamp specifying when a member was added. - description: |- - Member represents a group member with an account address, - non-zero weight, metadata and added_at timestamp. - cosmos.group.v1.MemberRequest: - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: weight is the member's voting weight that should be greater than 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - description: |- - MemberRequest represents a group member to be used in Msg server requests. - Contrary to `Member`, it doesn't have any `added_at` field - since this field cannot be set as part of requests. - cosmos.group.v1.MsgCreateGroupPolicyResponse: - type: object - properties: - address: - type: string - description: address is the account address of the newly created group policy. - description: MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. - cosmos.group.v1.MsgCreateGroupResponse: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the newly created group. - description: MsgCreateGroupResponse is the Msg/CreateGroup response type. - cosmos.group.v1.MsgCreateGroupWithPolicyResponse: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the newly created group with policy. - group_policy_address: - type: string - description: >- - group_policy_address is the account address of the newly created group - policy. - description: >- - MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response - type. - cosmos.group.v1.MsgExecResponse: - type: object - properties: - result: - description: result is the final result of the proposal execution. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - description: MsgExecResponse is the Msg/Exec request type. - cosmos.group.v1.MsgLeaveGroupResponse: - type: object - description: MsgLeaveGroupResponse is the Msg/LeaveGroup response type. - cosmos.group.v1.MsgSubmitProposalResponse: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - description: MsgSubmitProposalResponse is the Msg/SubmitProposal response type. - cosmos.group.v1.MsgUpdateGroupAdminResponse: - type: object - description: MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. - cosmos.group.v1.MsgUpdateGroupMembersResponse: - type: object - description: MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. - cosmos.group.v1.MsgUpdateGroupMetadataResponse: - type: object - description: >- - MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response - type. - cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse: - type: object - description: >- - MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin - response type. - cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse: - type: object - description: >- - MsgUpdateGroupPolicyDecisionPolicyResponse is the - Msg/UpdateGroupPolicyDecisionPolicy response type. - cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse: - type: object - description: >- - MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata - response type. - cosmos.group.v1.MsgVoteResponse: - type: object - description: MsgVoteResponse is the Msg/Vote response type. - cosmos.group.v1.MsgWithdrawProposalResponse: - type: object - description: MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. - cosmos.group.v1.Proposal: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: group_policy_address is the account address of group policy. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the proposal. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: submit_time is a timestamp specifying when a proposal was submitted. - group_version: - type: string - format: uint64 - description: |- - group_version tracks the version of the group at proposal submission. - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group policy at - proposal submission. - - When a decision policy is changed, existing proposals from previous - policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life cycle of the - proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes for this - - proposal for each vote option. It is empty at submission, and only - - populated after tallying, at voting period end or at proposal - execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting must be done. - - Unless a successful MsgExec is called before (to execute a proposal - whose - - tally is successful before the voting period ends), tallying will be - done - - at this point, and the `final_tally_result`and `status` fields will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal execution. Initial - value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if the proposal - passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: >- - Proposal defines a group proposal. Any member of a group can submit a - proposal - - for a group policy to decide upon. - - A proposal consists of a set of `sdk.Msg`s that will be executed if the - proposal - - passes as well as some optional metadata associated with the proposal. - cosmos.group.v1.ProposalExecutorResult: - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - description: |- - ProposalExecutorResult defines types of proposal executor results. - - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: An empty value is not allowed. - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN: We have not yet run the executor. - - PROPOSAL_EXECUTOR_RESULT_SUCCESS: The executor was successful and proposed action updated state. - - PROPOSAL_EXECUTOR_RESULT_FAILURE: The executor returned an error and proposed action didn't update state. - cosmos.group.v1.ProposalStatus: - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - description: |- - ProposalStatus defines proposal statuses. - - - PROPOSAL_STATUS_UNSPECIFIED: An empty value is invalid and not allowed. - - PROPOSAL_STATUS_SUBMITTED: Initial status of a proposal when submitted. - - PROPOSAL_STATUS_ACCEPTED: Final status of a proposal when the final tally is done and the outcome - passes the group policy's decision policy. - - PROPOSAL_STATUS_REJECTED: Final status of a proposal when the final tally is done and the outcome - is rejected by the group policy's decision policy. - - PROPOSAL_STATUS_ABORTED: Final status of a proposal when the group policy is modified before the - final tally. - - PROPOSAL_STATUS_WITHDRAWN: A proposal can be withdrawn before the voting start time by the owner. - When this happens the final status is Withdrawn. - cosmos.group.v1.QueryGroupInfoResponse: - type: object - properties: - info: - description: info is the GroupInfo of the group. - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership structure - that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented and - will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: QueryGroupInfoResponse is the Query/GroupInfo response type. - cosmos.group.v1.QueryGroupMembersResponse: - type: object - properties: - members: - type: array - items: - type: object - properties: - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - member: - description: member is the member data. - type: object - properties: - address: - type: string - description: address is the member's account address. - weight: - type: string - description: >- - weight is the member's voting weight that should be greater - than 0. - metadata: - type: string - description: metadata is any arbitrary metadata attached to the member. - added_at: - type: string - format: date-time - description: added_at is a timestamp specifying when a member was added. - description: >- - GroupMember represents the relationship between a group and a - member. - description: members are the members of the group with given group_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryGroupMembersResponse is the Query/GroupMembersResponse response type. - cosmos.group.v1.QueryGroupPoliciesByAdminResponse: - type: object - properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group policy. - - the recommended format of the metadata is to be found here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy was - created. - description: >- - GroupPolicyInfo represents the high-level on-chain information for a - group policy. - description: group_policies are the group policies info with provided admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin - response type. - cosmos.group.v1.QueryGroupPoliciesByGroupResponse: - type: object - properties: - group_policies: - type: array - items: - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: >- - metadata is any arbitrary metadata attached to the group policy. - - the recommended format of the metadata is to be found here: - - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy was - created. - description: >- - GroupPolicyInfo represents the high-level on-chain information for a - group policy. - description: >- - group_policies are the group policies info associated with the - provided group. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup - response type. - cosmos.group.v1.QueryGroupPolicyInfoResponse: - type: object - properties: - info: - description: info is the GroupPolicyInfo of the group policy. - type: object - properties: - address: - type: string - description: address is the account address of group policy. - group_id: - type: string - format: uint64 - description: group_id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group admin. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the group policy. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 - version: - type: string - format: uint64 - description: >- - version is used to track changes to a group's GroupPolicyInfo - structure that - - would create a different result on a running proposal. - decision_policy: - description: decision_policy specifies the group policy's decision policy. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - created_at: - type: string - format: date-time - description: >- - created_at is a timestamp specifying when a group policy was - created. - description: QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type. - cosmos.group.v1.QueryGroupsByAdminResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: groups are the groups info with the provided admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response - type. - cosmos.group.v1.QueryGroupsByMemberResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: groups are the groups info with the provided group member. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryGroupsByMemberResponse is the Query/GroupsByMember response type. - cosmos.group.v1.QueryGroupsResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 - title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will - - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: '`groups` is all the groups present in state.' - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryGroupsResponse is the Query/Groups response type. - - Since: cosmos-sdk 0.47.1 - cosmos.group.v1.QueryProposalResponse: - type: object - properties: - proposal: - description: proposal is the proposal info. - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: group_policy_address is the account address of group policy. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the proposal. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal was - submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at proposal - submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group policy at - proposal submission. - - When a decision policy is changed, existing proposals from - previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life cycle of the - proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes for - this - - proposal for each vote option. It is empty at submission, and only - - populated after tallying, at voting period end or at proposal - execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting must be - done. - - Unless a successful MsgExec is called before (to execute a - proposal whose - - tally is successful before the voting period ends), tallying will - be done - - at this point, and the `final_tally_result`and `status` fields - will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal execution. - Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if the - proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: QueryProposalResponse is the Query/Proposal response type. - cosmos.group.v1.QueryProposalsByGroupPolicyResponse: - type: object - properties: - proposals: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique id of the proposal. - group_policy_address: - type: string - description: group_policy_address is the account address of group policy. - metadata: - type: string - title: |- - metadata is any arbitrary metadata attached to the proposal. - the recommended format of the metadata is to be found here: - https://docs.cosmos.network/v0.47/modules/group#proposal-4 - proposers: - type: array - items: - type: string - description: proposers are the account addresses of the proposers. - submit_time: - type: string - format: date-time - description: >- - submit_time is a timestamp specifying when a proposal was - submitted. - group_version: - type: string - format: uint64 - description: >- - group_version tracks the version of the group at proposal - submission. - - This field is here for informational purposes only. - group_policy_version: - type: string - format: uint64 - description: >- - group_policy_version tracks the version of the group policy at - proposal submission. - - When a decision policy is changed, existing proposals from - previous policy - - versions will become invalid with the `ABORTED` status. - - This field is here for informational purposes only. - status: - description: >- - status represents the high level position in the life cycle of - the proposal. Initial value is Submitted. - type: string - enum: - - PROPOSAL_STATUS_UNSPECIFIED - - PROPOSAL_STATUS_SUBMITTED - - PROPOSAL_STATUS_ACCEPTED - - PROPOSAL_STATUS_REJECTED - - PROPOSAL_STATUS_ABORTED - - PROPOSAL_STATUS_WITHDRAWN - default: PROPOSAL_STATUS_UNSPECIFIED - final_tally_result: - description: >- - final_tally_result contains the sums of all weighted votes for - this - - proposal for each vote option. It is empty at submission, and - only - - populated after tallying, at voting period end or at proposal - execution, - - whichever happens first. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - voting_period_end: - type: string - format: date-time - description: >- - voting_period_end is the timestamp before which voting must be - done. - - Unless a successful MsgExec is called before (to execute a - proposal whose - - tally is successful before the voting period ends), tallying - will be done - - at this point, and the `final_tally_result`and `status` fields - will be - - accordingly updated. - executor_result: - description: >- - executor_result is the final result of the proposal execution. - Initial value is NotRun. - type: string - enum: - - PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - - PROPOSAL_EXECUTOR_RESULT_NOT_RUN - - PROPOSAL_EXECUTOR_RESULT_SUCCESS - - PROPOSAL_EXECUTOR_RESULT_FAILURE - default: PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of `sdk.Msg`s that will be executed if the - proposal passes. - title: - type: string - description: 'Since: cosmos-sdk 0.47' - title: title is the title of the proposal - summary: - type: string - description: 'Since: cosmos-sdk 0.47' - title: summary is a short summary of the proposal - description: >- - Proposal defines a group proposal. Any member of a group can submit - a proposal - - for a group policy to decide upon. - - A proposal consists of a set of `sdk.Msg`s that will be executed if - the proposal - - passes as well as some optional metadata associated with the - proposal. - description: proposals are the proposals with given group policy. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy - response type. - cosmos.group.v1.QueryTallyResultResponse: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - description: QueryTallyResultResponse is the Query/TallyResult response type. - cosmos.group.v1.QueryVoteByProposalVoterResponse: - type: object - properties: - vote: - description: vote is the vote with given proposal_id and voter. - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: >- - QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response - type. - cosmos.group.v1.QueryVotesByProposalResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes for given proposal_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesByProposalResponse is the Query/VotesByProposal response type. - cosmos.group.v1.QueryVotesByVoterResponse: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes by given voter. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: QueryVotesByVoterResponse is the Query/VotesByVoter response type. - cosmos.group.v1.TallyResult: - type: object - properties: - yes_count: - type: string - description: yes_count is the weighted sum of yes votes. - abstain_count: - type: string - description: abstain_count is the weighted sum of abstainers. - no_count: - type: string - description: no_count is the weighted sum of no votes. - no_with_veto_count: - type: string - description: no_with_veto_count is the weighted sum of veto. - description: TallyResult represents the sum of weighted votes for each vote option. - cosmos.group.v1.Vote: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. - cosmos.group.v1.VoteOption: - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - description: |- - VoteOption enumerates the valid vote options for a given proposal. - - - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will - return an error. - - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. - - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - cosmos.mint.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.mint.v1beta1.Params: - type: object - properties: - mint_denom: - type: string - title: type of coin to mint - inflation_rate_change: - type: string - title: maximum annual change in inflation rate - inflation_max: - type: string - title: maximum inflation rate - inflation_min: - type: string - title: minimum inflation rate - goal_bonded: - type: string - title: goal of percent bonded atoms - blocks_per_year: - type: string - format: uint64 - title: expected blocks per year - description: Params defines the parameters for the x/mint module. - cosmos.mint.v1beta1.QueryAnnualProvisionsResponse: - type: object - properties: - annual_provisions: - type: string - format: byte - description: annual_provisions is the current minting annual provisions value. - description: |- - QueryAnnualProvisionsResponse is the response type for the - Query/AnnualProvisions RPC method. - cosmos.mint.v1beta1.QueryInflationResponse: - type: object - properties: - inflation: - type: string - format: byte - description: inflation is the current minting inflation value. - description: |- - QueryInflationResponse is the response type for the Query/Inflation RPC - method. - cosmos.mint.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - mint_denom: - type: string - title: type of coin to mint - inflation_rate_change: - type: string - title: maximum annual change in inflation rate - inflation_max: - type: string - title: maximum inflation rate - inflation_min: - type: string - title: minimum inflation rate - goal_bonded: - type: string - title: goal of percent bonded atoms - blocks_per_year: - type: string - format: uint64 - title: expected blocks per year - description: QueryParamsResponse is the response type for the Query/Params RPC method. - cosmos.nft.v1beta1.Class: - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT classification, similar to - the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT classification. - Optional - symbol: - type: string - title: symbol is an abbreviated name for nft classification. Optional - description: - type: string - title: description is a brief description of nft classification. Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define schema for - Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri. Optional - data: - title: data is the app specific metadata of the NFT class. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: Class defines the class of the nft type. - cosmos.nft.v1beta1.MsgSendResponse: - type: object - description: MsgSendResponse defines the Msg/Send response type. - cosmos.nft.v1beta1.NFT: - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract address of - ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - cosmos.nft.v1beta1.QueryBalanceResponse: - type: object - properties: - amount: - type: string - format: uint64 - title: amount is the number of all NFTs of a given class owned by the owner - title: QueryBalanceResponse is the response type for the Query/Balance RPC method - cosmos.nft.v1beta1.QueryClassResponse: - type: object - properties: - class: - description: class defines the class of the nft type. - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT classification, - similar to the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT classification. - Optional - symbol: - type: string - title: symbol is an abbreviated name for nft classification. Optional - description: - type: string - title: description is a brief description of nft classification. Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define schema - for Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri. Optional - data: - title: data is the app specific metadata of the NFT class. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: QueryClassResponse is the response type for the Query/Class RPC method - cosmos.nft.v1beta1.QueryClassesResponse: - type: object - properties: - classes: - type: array - items: - type: object - properties: - id: - type: string - title: >- - id defines the unique identifier of the NFT classification, - similar to the contract address of ERC721 - name: - type: string - title: >- - name defines the human-readable name of the NFT classification. - Optional - symbol: - type: string - title: symbol is an abbreviated name for nft classification. Optional - description: - type: string - title: >- - description is a brief description of nft classification. - Optional - uri: - type: string - title: >- - uri for the class metadata stored off chain. It can define - schema for Class and NFT `Data` attributes. Optional - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri. Optional - data: - title: data is the app specific metadata of the NFT class. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: Class defines the class of the nft type. - description: class defines the class of the nft type. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: QueryClassesResponse is the response type for the Query/Classes RPC method - cosmos.nft.v1beta1.QueryNFTResponse: - type: object - properties: - nft: - title: owner is the owner address of the nft - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract address - of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: QueryNFTResponse is the response type for the Query/NFT RPC method - cosmos.nft.v1beta1.QueryNFTsResponse: - type: object - properties: - nfts: - type: array - items: - type: object - properties: - class_id: - type: string - title: >- - class_id associated with the NFT, similar to the contract - address of ERC721 - id: - type: string - title: id is a unique identifier of the NFT - uri: - type: string - title: uri for the NFT metadata stored off chain - uri_hash: - type: string - title: uri_hash is a hash of the document pointed by uri - data: - title: data is an app specific data of the NFT. Optional - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: NFT defines the NFT. - title: NFT defines the NFT - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: QueryNFTsResponse is the response type for the Query/NFTs RPC methods - cosmos.nft.v1beta1.QueryOwnerResponse: - type: object - properties: - owner: - type: string - title: owner is the owner address of the nft - title: QueryOwnerResponse is the response type for the Query/Owner RPC method - cosmos.nft.v1beta1.QuerySupplyResponse: - type: object - properties: - amount: - type: string - format: uint64 - title: amount is the number of all NFTs from the given class - title: QuerySupplyResponse is the response type for the Query/Supply RPC method - cosmos.params.v1beta1.ParamChange: - type: object - properties: - subspace: - type: string - key: - type: string - value: - type: string - description: |- - ParamChange defines an individual parameter change, for use in - ParameterChangeProposal. - cosmos.params.v1beta1.QueryParamsResponse: - type: object - properties: - param: - description: param defines the queried parameter. - type: object - properties: - subspace: - type: string - key: - type: string - value: - type: string - description: QueryParamsResponse is response type for the Query/Params RPC method. - cosmos.params.v1beta1.QuerySubspacesResponse: - type: object - properties: - subspaces: - type: array - items: - type: object - properties: - subspace: - type: string - keys: - type: array - items: - type: string - description: >- - Subspace defines a parameter subspace name and all the keys that - exist for - - the subspace. - - - Since: cosmos-sdk 0.46 - description: |- - QuerySubspacesResponse defines the response types for querying for all - registered subspaces and all keys for a subspace. - - Since: cosmos-sdk 0.46 - cosmos.params.v1beta1.Subspace: - type: object - properties: - subspace: - type: string - keys: - type: array - items: - type: string - description: |- - Subspace defines a parameter subspace name and all the keys that exist for - the subspace. - - Since: cosmos-sdk 0.46 - cosmos.slashing.v1beta1.MsgUnjailResponse: - type: object - title: MsgUnjailResponse defines the Msg/Unjail response type - cosmos.slashing.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.slashing.v1beta1.Params: - type: object - properties: - signed_blocks_window: - type: string - format: int64 - min_signed_per_window: - type: string - format: byte - downtime_jail_duration: - type: string - slash_fraction_double_sign: - type: string - format: byte - slash_fraction_downtime: - type: string - format: byte - description: Params represents the parameters used for by the slashing module. - cosmos.slashing.v1beta1.QueryParamsResponse: - type: object - properties: - params: - type: object - properties: - signed_blocks_window: - type: string - format: int64 - min_signed_per_window: - type: string - format: byte - downtime_jail_duration: - type: string - slash_fraction_double_sign: - type: string - format: byte - slash_fraction_downtime: - type: string - format: byte - description: Params represents the parameters used for by the slashing module. - title: QueryParamsResponse is the response type for the Query/Params RPC method - cosmos.slashing.v1beta1.QuerySigningInfoResponse: - type: object - properties: - val_signing_info: - title: val_signing_info is the signing info of requested val cons address - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: Height at which validator was first a candidate OR was unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a bonded - - in a block and may have signed a precommit or not. This in - conjunction with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to liveness - downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out of - validator set). It is set - - once the validator commits an equivocation or for any other - configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for monitoring - their - - liveness activity. - title: >- - QuerySigningInfoResponse is the response type for the Query/SigningInfo - RPC - - method - cosmos.slashing.v1beta1.QuerySigningInfosResponse: - type: object - properties: - info: - type: array - items: - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: Height at which validator was first a candidate OR was unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a bonded - - in a block and may have signed a precommit or not. This in - conjunction with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to liveness - downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out of - validator set). It is set - - once the validator commits an equivocation or for any other - configured misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for - monitoring their - - liveness activity. - title: info is the signing info of all validators - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QuerySigningInfosResponse is the response type for the Query/SigningInfos - RPC - - method - cosmos.slashing.v1beta1.ValidatorSigningInfo: - type: object - properties: - address: - type: string - start_height: - type: string - format: int64 - title: Height at which validator was first a candidate OR was unjailed - index_offset: - type: string - format: int64 - description: >- - Index which is incremented each time the validator was a bonded - - in a block and may have signed a precommit or not. This in conjunction - with the - - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. - jailed_until: - type: string - format: date-time - description: >- - Timestamp until which the validator is jailed due to liveness - downtime. - tombstoned: - type: boolean - description: >- - Whether or not a validator has been tombstoned (killed out of - validator set). It is set - - once the validator commits an equivocation or for any other configured - misbehiavor. - missed_blocks_counter: - type: string - format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. - description: >- - ValidatorSigningInfo defines a validator's signing info for monitoring - their - - liveness activity. - cosmos.staking.v1beta1.BondStatus: - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - description: |- - BondStatus is the status of a validator. - - - BOND_STATUS_UNSPECIFIED: UNSPECIFIED defines an invalid validator status. - - BOND_STATUS_UNBONDED: UNBONDED defines a validator that is not bonded. - - BOND_STATUS_UNBONDING: UNBONDING defines a validator that is unbonding. - - BOND_STATUS_BONDED: BONDED defines a validator that is bonded. - cosmos.staking.v1beta1.Commission: - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be used for - creating a validator. - type: object - properties: - rate: - type: string - description: rate is the commission rate charged to delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator can - ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - description: Commission defines commission parameters for a given validator. - cosmos.staking.v1beta1.CommissionRates: - type: object - properties: - rate: - type: string - description: rate is the commission rate charged to delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator can ever - charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the validator - commission, as a fraction. - description: >- - CommissionRates defines the initial commission rates to be used for - creating - - a validator. - cosmos.staking.v1beta1.Delegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - shares: - type: string - description: shares define the delegation shares received. - description: |- - Delegation represents the bond with tokens held by an account. It is - owned by one delegator, and is associated with the voting power of one - validator. - cosmos.staking.v1beta1.DelegationResponse: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - shares: - type: string - description: shares define the delegation shares received. - description: |- - Delegation represents the bond with tokens held by an account. It is - owned by one delegator, and is associated with the voting power of one - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: |- - DelegationResponse is equivalent to Delegation except that it contains a - balance in addition to shares which is more suitable for client responses. - cosmos.staking.v1beta1.Description: - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: security_contact defines an optional email for security contact. - details: - type: string - description: details define other optional details. - description: Description defines a validator description. - cosmos.staking.v1beta1.HistoricalInfo: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - valset: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, - as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort - or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing - results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation whose - number of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - description: >- - HistoricalInfo contains header and validator information for a given - block. - - It is stored as part of staking module's state, which persists the `n` - most - - recent HistoricalInfo - - (`n` is set by the staking module's `historical_entries` parameter). - cosmos.staking.v1beta1.MsgBeginRedelegateResponse: - type: object - properties: - completion_time: - type: string - format: date-time - description: MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. - cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse: - type: object - description: 'Since: cosmos-sdk 0.46' - title: MsgCancelUnbondingDelegationResponse - cosmos.staking.v1beta1.MsgCreateValidatorResponse: - type: object - description: MsgCreateValidatorResponse defines the Msg/CreateValidator response type. - cosmos.staking.v1beta1.MsgDelegateResponse: - type: object - description: MsgDelegateResponse defines the Msg/Delegate response type. - cosmos.staking.v1beta1.MsgEditValidatorResponse: - type: object - description: MsgEditValidatorResponse defines the Msg/EditValidator response type. - cosmos.staking.v1beta1.MsgUndelegateResponse: - type: object - properties: - completion_time: - type: string - format: date-time - description: MsgUndelegateResponse defines the Msg/Undelegate response type. - cosmos.staking.v1beta1.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - - Since: cosmos-sdk 0.47 - cosmos.staking.v1beta1.Params: - type: object - properties: - unbonding_time: - type: string - description: unbonding_time is the time duration of unbonding. - max_validators: - type: integer - format: int64 - description: max_validators is the maximum number of validators. - max_entries: - type: integer - format: int64 - description: >- - max_entries is the max entries for either unbonding delegation or - redelegation (per pair/trio). - historical_entries: - type: integer - format: int64 - description: historical_entries is the number of historical entries to persist. - bond_denom: - type: string - description: bond_denom defines the bondable coin denomination. - min_commission_rate: - type: string - title: >- - min_commission_rate is the chain-wide minimum commission rate that a - validator can charge their delegators - description: Params defines the parameters for the x/staking module. - cosmos.staking.v1beta1.Pool: - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: |- - Pool is used for tracking bonded and not-bonded token supply of the bond - denomination. - cosmos.staking.v1beta1.QueryDelegationResponse: - type: object - properties: - delegation_response: - description: delegation_responses defines the delegation info of a delegation. - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an account. It - is - - owned by one delegator, and is associated with the voting power of - one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - QueryDelegationResponse is response type for the Query/Delegation RPC - method. - cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an account. - It is - - owned by one delegator, and is associated with the voting power - of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that it - contains a - - balance in addition to shares which is more suitable for client - responses. - description: delegation_responses defines all the delegations' info of a delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryDelegatorDelegationsResponse is response type for the - Query/DelegatorDelegations RPC method. - cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding took - place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with - relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's unbonding - bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryUnbondingDelegatorDelegationsResponse is response type for the - Query/UnbondingDelegatorDelegations RPC method. - cosmos.staking.v1beta1.QueryDelegatorValidatorResponse: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's operator; - bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, as - a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum self - delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: |- - QueryDelegatorValidatorResponse response type for the - Query/DelegatorValidator RPC method. - cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, - as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort - or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing - results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation whose - number of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - description: validators defines the validators' info of a delegator. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryDelegatorValidatorsResponse is response type for the - Query/DelegatorValidators RPC method. - cosmos.staking.v1beta1.QueryHistoricalInfoResponse: - type: object - properties: - hist: - description: hist defines the historical info at the given height. - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - valset: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the - validator, as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from - bonded status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a - validator's delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. - UPort or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which - this validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to - be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been - stopped by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding - of this validator - description: >- - Validator defines a validator, together with the total amount of - the - - Validator's bond shares and their exchange rate to coins. - Slashing results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation - whose number of - - bond shares is based on the amount of coins delegated divided by - the current - - exchange rate. Voting power can be calculated as total bonded - shares - - multiplied by exchange rate. - description: >- - QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo - RPC - - method. - cosmos.staking.v1beta1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - unbonding_time: - type: string - description: unbonding_time is the time duration of unbonding. - max_validators: - type: integer - format: int64 - description: max_validators is the maximum number of validators. - max_entries: - type: integer - format: int64 - description: >- - max_entries is the max entries for either unbonding delegation or - redelegation (per pair/trio). - historical_entries: - type: integer - format: int64 - description: historical_entries is the number of historical entries to persist. - bond_denom: - type: string - description: bond_denom defines the bondable coin denomination. - min_commission_rate: - type: string - title: >- - min_commission_rate is the chain-wide minimum commission rate that - a validator can charge their delegators - description: QueryParamsResponse is response type for the Query/Params RPC method. - cosmos.staking.v1beta1.QueryPoolResponse: - type: object - properties: - pool: - description: pool defines the pool info. - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: QueryPoolResponse is response type for the Query/Pool RPC method. - cosmos.staking.v1beta1.QueryRedelegationsResponse: - type: object - properties: - redelegation_responses: - type: array - items: - type: object - properties: - redelegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation source - operator address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation - destination operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator - shares created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - RedelegationEntry defines a redelegation object with - relevant metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular delegator's - redelegating bonds - - from a particular source validator to a particular destination - validator. - entries: - type: array - items: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the - redelegation took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator - shares created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - RedelegationEntry defines a redelegation object with - relevant metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a RedelegationEntry - except that it - - contains a balance in addition to shares which is more - suitable for client - - responses. - description: >- - RedelegationResponse is equivalent to a Redelegation except that its - entries - - contain a balance in addition to shares which is more suitable for - client - - responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryRedelegationsResponse is response type for the Query/Redelegations - RPC - - method. - cosmos.staking.v1beta1.QueryUnbondingDelegationResponse: - type: object - properties: - unbond: - description: unbond defines the unbonding information of a delegation. - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding took - place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped - by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with - relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: |- - QueryDelegationResponse is response type for the Query/UnbondingDelegation - RPC method. - cosmos.staking.v1beta1.QueryValidatorDelegationsResponse: - type: object - properties: - delegation_responses: - type: array - items: - type: object - properties: - delegation: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - shares: - type: string - description: shares define the delegation shares received. - description: >- - Delegation represents the bond with tokens held by an account. - It is - - owned by one delegator, and is associated with the voting power - of one - - validator. - balance: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - description: >- - DelegationResponse is equivalent to Delegation except that it - contains a - - balance in addition to shares which is more suitable for client - responses. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: |- - QueryValidatorDelegationsResponse is response type for the - Query/ValidatorDelegations RPC method - cosmos.staking.v1beta1.QueryValidatorResponse: - type: object - properties: - validator: - description: validator defines the validator info. - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's operator; - bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, as - a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum self - delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - title: QueryValidatorResponse is response type for the Query/Validator RPC method - cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse: - type: object - properties: - unbonding_responses: - type: array - items: - type: object - properties: - delegator_address: - type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. - validator_address: - type: string - description: >- - validator_address is the bech32-encoded address of the - validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height is the height which the unbonding took - place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been - stopped by external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with - relevant metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: >- - UnbondingDelegation stores all of a single delegator's unbonding - bonds - - for a single validator in an time-ordered list. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryValidatorUnbondingDelegationsResponse is response type for the - Query/ValidatorUnbondingDelegations RPC method. - cosmos.staking.v1beta1.QueryValidatorsResponse: - type: object - properties: - validators: - type: array - items: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's - operator; bech encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, - as a Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort - or Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: >- - security_contact defines an optional email for security - contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the - validator to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum - self delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped - by external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of - this validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing - results in - - a decrease in the exchange rate, allowing correct calculation of - future - - undelegations without iterating over delegators. When coins are - delegated to - - this validator, the validator is credited with a delegation whose - number of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - description: validators contains all the queried validators. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - title: >- - QueryValidatorsResponse is response type for the Query/Validators RPC - method - cosmos.staking.v1beta1.Redelegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation source operator - address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation destination - operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation took - place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when redelegation - started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares created - by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular delegator's redelegating - bonds - - from a particular source validator to a particular destination validator. - cosmos.staking.v1beta1.RedelegationEntry: - type: object - properties: - creation_height: - type: string - format: int64 - description: creation_height defines the height which the redelegation took place. - completion_time: - type: string - format: date-time - description: completion_time defines the unix time for redelegation completion. - initial_balance: - type: string - description: initial_balance defines the initial balance when redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares created by - redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: RedelegationEntry defines a redelegation object with relevant metadata. - cosmos.staking.v1beta1.RedelegationEntryResponse: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation took - place. - completion_time: - type: string - format: date-time - description: completion_time defines the unix time for redelegation completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when redelegation - started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares created - by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a RedelegationEntry except that - it - - contains a balance in addition to shares which is more suitable for client - - responses. - cosmos.staking.v1beta1.RedelegationResponse: - type: object - properties: - redelegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_src_address: - type: string - description: >- - validator_src_address is the validator redelegation source - operator address. - validator_dst_address: - type: string - description: >- - validator_dst_address is the validator redelegation destination - operator address. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares - created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped - by external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - description: |- - entries are the redelegation entries. - - redelegation entries - description: >- - Redelegation contains the list of a particular delegator's - redelegating bonds - - from a particular source validator to a particular destination - validator. - entries: - type: array - items: - type: object - properties: - redelegation_entry: - type: object - properties: - creation_height: - type: string - format: int64 - description: >- - creation_height defines the height which the redelegation - took place. - completion_time: - type: string - format: date-time - description: >- - completion_time defines the unix time for redelegation - completion. - initial_balance: - type: string - description: >- - initial_balance defines the initial balance when - redelegation started. - shares_dst: - type: string - description: >- - shares_dst is the amount of destination-validator shares - created by redelegation. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped - by external modules - description: >- - RedelegationEntry defines a redelegation object with relevant - metadata. - balance: - type: string - description: >- - RedelegationEntryResponse is equivalent to a RedelegationEntry - except that it - - contains a balance in addition to shares which is more suitable for - client - - responses. - description: >- - RedelegationResponse is equivalent to a Redelegation except that its - entries - - contain a balance in addition to shares which is more suitable for client - - responses. - cosmos.staking.v1beta1.UnbondingDelegation: - type: object - properties: - delegator_address: - type: string - description: delegator_address is the bech32-encoded address of the delegator. - validator_address: - type: string - description: validator_address is the bech32-encoded address of the validator. - entries: - type: array - items: - type: object - properties: - creation_height: - type: string - format: int64 - description: creation_height is the height which the unbonding took place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to - receive at completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with relevant - metadata. - description: |- - entries are the unbonding delegation entries. - - unbonding delegation entries - description: |- - UnbondingDelegation stores all of a single delegator's unbonding bonds - for a single validator in an time-ordered list. - cosmos.staking.v1beta1.UnbondingDelegationEntry: - type: object - properties: - creation_height: - type: string - format: int64 - description: creation_height is the height which the unbonding took place. - completion_time: - type: string - format: date-time - description: completion_time is the unix time for unbonding completion. - initial_balance: - type: string - description: >- - initial_balance defines the tokens initially scheduled to receive at - completion. - balance: - type: string - description: balance defines the tokens to receive at completion. - unbonding_id: - type: string - format: uint64 - title: Incrementing id that uniquely identifies this entry - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - Strictly positive if this entry's unbonding has been stopped by - external modules - description: >- - UnbondingDelegationEntry defines an unbonding object with relevant - metadata. - cosmos.staking.v1beta1.Validator: - type: object - properties: - operator_address: - type: string - description: >- - operator_address defines the address of the validator's operator; bech - encoded in JSON. - consensus_pubkey: - description: >- - consensus_pubkey is the consensus public key of the validator, as a - Protobuf Any. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - jailed: - type: boolean - description: >- - jailed defined whether the validator has been jailed from bonded - status or not. - status: - description: status is the validator status (bonded/unbonding/unbonded). - type: string - enum: - - BOND_STATUS_UNSPECIFIED - - BOND_STATUS_UNBONDED - - BOND_STATUS_UNBONDING - - BOND_STATUS_BONDED - default: BOND_STATUS_UNSPECIFIED - tokens: - type: string - description: tokens define the delegated tokens (incl. self-delegation). - delegator_shares: - type: string - description: >- - delegator_shares defines total shares issued to a validator's - delegators. - description: - description: description defines the description terms for the validator. - type: object - properties: - moniker: - type: string - description: moniker defines a human-readable name for the validator. - identity: - type: string - description: >- - identity defines an optional identity signature (ex. UPort or - Keybase). - website: - type: string - description: website defines an optional website link. - security_contact: - type: string - description: security_contact defines an optional email for security contact. - details: - type: string - description: details define other optional details. - unbonding_height: - type: string - format: int64 - description: >- - unbonding_height defines, if unbonding, the height at which this - validator has begun unbonding. - unbonding_time: - type: string - format: date-time - description: >- - unbonding_time defines, if unbonding, the min time for the validator - to complete unbonding. - commission: - description: commission defines the commission parameters. - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be used - for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator - can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - min_self_delegation: - type: string - description: >- - min_self_delegation is the validator's self declared minimum self - delegation. - - - Since: cosmos-sdk 0.46 - unbonding_on_hold_ref_count: - type: string - format: int64 - title: >- - strictly positive if this validator's unbonding has been stopped by - external modules - unbonding_ids: - type: array - items: - type: string - format: uint64 - title: >- - list of unbonding ids, each uniquely identifing an unbonding of this - validator - description: >- - Validator defines a validator, together with the total amount of the - - Validator's bond shares and their exchange rate to coins. Slashing results - in - - a decrease in the exchange rate, allowing correct calculation of future - - undelegations without iterating over delegators. When coins are delegated - to - - this validator, the validator is credited with a delegation whose number - of - - bond shares is based on the amount of coins delegated divided by the - current - - exchange rate. Voting power can be calculated as total bonded shares - - multiplied by exchange rate. - cosmos.base.abci.v1beta1.ABCIMessageLog: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key and value - are - - strings instead of raw bytes. - description: |- - StringEvent defines en Event object wrapper where all the attributes - contain key/value pairs that are strings instead of raw bytes. - description: |- - Events contains a slice of Event objects that were emitted during some - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI message - log. - cosmos.base.abci.v1beta1.Attribute: - type: object - properties: - key: - type: string - value: - type: string - description: |- - Attribute defines an attribute wrapper where the key and value are - strings instead of raw bytes. - cosmos.base.abci.v1beta1.GasInfo: - type: object - properties: - gas_wanted: - type: string - format: uint64 - description: GasWanted is the maximum units of work we allow this tx to perform. - gas_used: - type: string - format: uint64 - description: GasUsed is the amount of gas actually consumed. - description: GasInfo defines tx execution gas context. - cosmos.base.abci.v1beta1.Result: - type: object - properties: - data: - type: string - format: byte - description: >- - Data is any data returned from message or handler execution. It MUST - be - - length prefixed in order to separate data from multiple message - executions. - - Deprecated. This field is still populated, but prefer msg_response - instead - - because it also contains the Msg response typeURL. - log: - type: string - description: Log contains the log information from message or handler execution. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with an - event. - description: >- - Event allows application developers to attach additional information - to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events contains a slice of Event objects that were emitted during - message - - or handler execution. - msg_responses: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - msg_responses contains the Msg handler responses type packed in Anys. - - Since: cosmos-sdk 0.46 - description: Result is the union of ResponseFormat and ResponseCheckTx. - cosmos.base.abci.v1beta1.StringEvent: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: |- - Attribute defines an attribute wrapper where the key and value are - strings instead of raw bytes. - description: |- - StringEvent defines en Event object wrapper where all the attributes - contain key/value pairs that are strings instead of raw bytes. - cosmos.base.abci.v1beta1.TxResponse: - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key and - value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all the - attributes - - contain key/value pairs that are strings instead of raw bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI - message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted median - of - - the timestamps of the valid votes in the block.LastCommit. For height - == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with an - event. - description: >- - Event allows application developers to attach additional information - to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a transaction. - Note, - - these events include those emitted by processing all the messages and - those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: >- - TxResponse defines a structure containing relevant tx data and metadata. - The - - tags are stringified and the log is JSON decoded. - cosmos.crypto.multisig.v1beta1.CompactBitArray: - type: object - properties: - extra_bits_stored: - type: integer - format: int64 - elems: - type: string - format: byte - description: |- - CompactBitArray is an implementation of a space efficient bit array. - This is used to ensure that the encoded data takes up a minimal amount of - space after proto encoding. - This is not thread safe, and is not intended for concurrent usage. - cosmos.tx.signing.v1beta1.SignMode: - type: string - enum: - - SIGN_MODE_UNSPECIFIED - - SIGN_MODE_DIRECT - - SIGN_MODE_TEXTUAL - - SIGN_MODE_DIRECT_AUX - - SIGN_MODE_LEGACY_AMINO_JSON - - SIGN_MODE_EIP_191 - default: SIGN_MODE_UNSPECIFIED - description: |- - SignMode represents a signing mode with its own security guarantees. - - This enum should be considered a registry of all known sign modes - in the Cosmos ecosystem. Apps are not expected to support all known - sign modes. Apps that would like to support custom sign modes are - encouraged to open a small PR against this file to add a new case - to this SignMode enum describing their sign mode so that different - apps have a consistent version of this enum. - - - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected. - - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx. - - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT. It is currently not supported. - - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - require signers signing over other signers' `signer_info`. It also allows - for adding Tips in transactions. - - Since: cosmos-sdk 0.46 - - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future. - - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - - Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, - but is not implemented on the SDK by default. To enable EIP-191, you need - to pass a custom `TxConfig` that has an implementation of - `SignModeHandler` for EIP-191. The SDK may decide to fully support - EIP-191 in the future. - - Since: cosmos-sdk 0.45.2 - cosmos.tx.v1beta1.AuthInfo: - type: object - properties: - signer_infos: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.SignerInfo' - description: >- - signer_infos defines the signing modes for the required signers. The - number - - and order of elements must match the required signers from TxBody's - - messages. The first element is the primary signer and the one which - pays - - the fee. - fee: - description: >- - Fee is the fee and gas limit for the transaction. The first signer is - the - - primary signer and the one which pays the fee. The fee can be - calculated - - based on the cost of evaluating the body and doing signature - verification - - of the signers. This can be estimated via simulation. - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - title: amount is the amount of coins to be paid as a fee - gas_limit: - type: string - format: uint64 - title: >- - gas_limit is the maximum gas that can be used in transaction - processing - - before an out of gas error occurs - payer: - type: string - description: >- - if unset, the first signer is responsible for paying the fees. If - set, the specified account must pay the fees. - - the payer must be a tx signer (and thus have signed this field in - AuthInfo). - - setting this field does *not* change the ordering of required - signers for the transaction. - granter: - type: string - title: >- - if set, the fee payer (either the first signer or the value of the - payer field) requests that a fee grant be used - - to pay fees instead of the fee payer's own balance. If an - appropriate fee grant does not exist or the chain does - - not support fee grants, this will fail - tip: - description: >- - Tip is the optional tip used for transactions fees paid in another - denom. - - - This field is ignored if the chain didn't enable tips, i.e. didn't add - the - - `TipDecorator` in its posthandler. - - - Since: cosmos-sdk 0.46 - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - title: amount is the amount of the tip - tipper: - type: string - title: tipper is the address of the account paying for the tip - description: |- - AuthInfo describes the fee and signer modes that are used to sign a - transaction. - cosmos.tx.v1beta1.BroadcastMode: - type: string - enum: - - BROADCAST_MODE_UNSPECIFIED - - BROADCAST_MODE_BLOCK - - BROADCAST_MODE_SYNC - - BROADCAST_MODE_ASYNC - default: BROADCAST_MODE_UNSPECIFIED - description: >- - BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC - method. - - - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, - BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. - cosmos.tx.v1beta1.BroadcastTxRequest: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - mode: - type: string - enum: - - BROADCAST_MODE_UNSPECIFIED - - BROADCAST_MODE_BLOCK - - BROADCAST_MODE_SYNC - - BROADCAST_MODE_ASYNC - default: BROADCAST_MODE_UNSPECIFIED - description: >- - BroadcastMode specifies the broadcast mode for the TxService.Broadcast - RPC method. - - - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, - BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. - description: |- - BroadcastTxRequest is the request type for the Service.BroadcastTxRequest - RPC method. - cosmos.tx.v1beta1.BroadcastTxResponse: - type: object - properties: - tx_response: - description: tx_response is the queried TxResponses. - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key - and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all the - attributes - - contain key/value pairs that are strings instead of raw - bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI - message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted - median of - - the timestamps of the valid votes in the block.LastCommit. For - height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with - an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a transaction. - Note, - - these events include those emitted by processing all the messages - and those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: |- - BroadcastTxResponse is the response type for the - Service.BroadcastTx method. - cosmos.tx.v1beta1.Fee: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: amount is the amount of coins to be paid as a fee - gas_limit: - type: string - format: uint64 - title: >- - gas_limit is the maximum gas that can be used in transaction - processing - - before an out of gas error occurs - payer: - type: string - description: >- - if unset, the first signer is responsible for paying the fees. If set, - the specified account must pay the fees. - - the payer must be a tx signer (and thus have signed this field in - AuthInfo). - - setting this field does *not* change the ordering of required signers - for the transaction. - granter: - type: string - title: >- - if set, the fee payer (either the first signer or the value of the - payer field) requests that a fee grant be used - - to pay fees instead of the fee payer's own balance. If an appropriate - fee grant does not exist or the chain does - - not support fee grants, this will fail - description: >- - Fee includes the amount of coins paid in fees and the maximum - - gas to be used by the transaction. The ratio yields an effective - "gasprice", - - which must be above some miminum to be accepted into the mempool. - cosmos.tx.v1beta1.GetBlockWithTxsResponse: - type: object - properties: - txs: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: txs are the transactions in the block. - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - block: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: commit from validators from the last block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: root hash of all results from the txs from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: Header defines the structure of a block header. - data: - type: object - properties: - txs: - type: array - items: - type: string - format: byte - description: >- - Txs that will be applied by state @ block.Height+1. - - NOTE: not all txs here are valid. We're just agreeing on the - order first. - - This means that block.AppHash does not include these txs. - title: Data contains the set of transactions included in the block - evidence: - type: object - properties: - evidence: - type: array - items: - type: object - properties: - duplicate_vote_evidence: - type: object - properties: - vote_a: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - vote_b: - type: object - properties: - type: - type: string - enum: - - SIGNED_MSG_TYPE_UNKNOWN - - SIGNED_MSG_TYPE_PREVOTE - - SIGNED_MSG_TYPE_PRECOMMIT - - SIGNED_MSG_TYPE_PROPOSAL - default: SIGNED_MSG_TYPE_UNKNOWN - description: >- - SignedMsgType is a type of signed message in the - consensus. - - - SIGNED_MSG_TYPE_PREVOTE: Votes - - SIGNED_MSG_TYPE_PROPOSAL: Proposals - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - description: zero if vote is nil. - timestamp: - type: string - format: date-time - validator_address: - type: string - format: byte - validator_index: - type: integer - format: int32 - signature: - type: string - format: byte - description: >- - Vote represents a prevote, precommit, or commit vote - from validators for - - consensus. - total_voting_power: - type: string - format: int64 - validator_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - DuplicateVoteEvidence contains evidence of a validator - signed two conflicting votes. - light_client_attack_evidence: - type: object - properties: - conflicting_block: - type: object - properties: - signed_header: - type: object - properties: - header: - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules - for processing a block in the - blockchain, - - including all blockchain data structures - and the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - last_commit_hash: - type: string - format: byte - description: >- - commit from validators from the last - block - title: hashes of block data - data_hash: - type: string - format: byte - title: transactions - validators_hash: - type: string - format: byte - description: validators for the current block - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - title: validators for the next block - consensus_hash: - type: string - format: byte - title: consensus params for current block - app_hash: - type: string - format: byte - title: state after txs from the previous block - last_results_hash: - type: string - format: byte - title: >- - root hash of all results from the txs - from the previous block - evidence_hash: - type: string - format: byte - description: evidence included in the block - title: consensus info - proposer_address: - type: string - format: byte - title: original proposer of the block - description: >- - Header defines the structure of a block - header. - commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: >- - BlockIdFlag indicates which BlcokID the - signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: >- - CommitSig is a part of the Vote included - in a Commit. - description: >- - Commit contains the evidence that a block - was committed by a set of validators. - validator_set: - type: object - properties: - validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - proposer: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for - use with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - common_height: - type: string - format: int64 - byzantine_validators: - type: array - items: - type: object - properties: - address: - type: string - format: byte - pub_key: - type: object - properties: - ed25519: - type: string - format: byte - secp256k1: - type: string - format: byte - title: >- - PublicKey defines the keys available for use - with Validators - voting_power: - type: string - format: int64 - proposer_priority: - type: string - format: int64 - total_voting_power: - type: string - format: int64 - timestamp: - type: string - format: date-time - description: >- - LightClientAttackEvidence contains evidence of a set of - validators attempting to mislead a light client. - last_commit: - type: object - properties: - height: - type: string - format: int64 - round: - type: integer - format: int32 - block_id: - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - title: BlockID - signatures: - type: array - items: - type: object - properties: - block_id_flag: - type: string - enum: - - BLOCK_ID_FLAG_UNKNOWN - - BLOCK_ID_FLAG_ABSENT - - BLOCK_ID_FLAG_COMMIT - - BLOCK_ID_FLAG_NIL - default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for - validator_address: - type: string - format: byte - timestamp: - type: string - format: date-time - signature: - type: string - format: byte - description: CommitSig is a part of the Vote included in a Commit. - description: >- - Commit contains the evidence that a block was committed by a set - of validators. - pagination: - description: pagination defines a pagination for the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - GetBlockWithTxsResponse is the response type for the - Service.GetBlockWithTxs method. - - - Since: cosmos-sdk 0.45.2 - cosmos.tx.v1beta1.GetTxResponse: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: tx is the queried transaction. - tx_response: - description: tx_response is the queried TxResponses. - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the key - and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all the - attributes - - contain key/value pairs that are strings instead of raw - bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx ABCI - message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted - median of - - the timestamps of the valid votes in the block.LastCommit. For - height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with - an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a transaction. - Note, - - these events include those emitted by processing all the messages - and those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: GetTxResponse is the response type for the Service.GetTx method. - cosmos.tx.v1beta1.GetTxsEventResponse: - type: object - properties: - txs: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: txs is the list of queried transactions. - tx_responses: - type: array - items: - type: object - properties: - height: - type: string - format: int64 - title: The block height - txhash: - type: string - description: The transaction hash. - codespace: - type: string - title: Namespace for the Code - code: - type: integer - format: int64 - description: Response code. - data: - type: string - description: Result bytes, if any. - raw_log: - type: string - description: |- - The output of the application's logger (raw string). May be - non-deterministic. - logs: - type: array - items: - type: object - properties: - msg_index: - type: integer - format: int64 - log: - type: string - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - description: >- - Attribute defines an attribute wrapper where the - key and value are - - strings instead of raw bytes. - description: >- - StringEvent defines en Event object wrapper where all - the attributes - - contain key/value pairs that are strings instead of raw - bytes. - description: >- - Events contains a slice of Event objects that were emitted - during some - - execution. - description: >- - ABCIMessageLog defines a structure containing an indexed tx - ABCI message log. - description: >- - The output of the application's logger (typed). May be - non-deterministic. - info: - type: string - description: Additional information. May be non-deterministic. - gas_wanted: - type: string - format: int64 - description: Amount of gas requested for transaction. - gas_used: - type: string - format: int64 - description: Amount of gas consumed by transaction. - tx: - description: The request transaction bytes. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - timestamp: - type: string - description: >- - Time of the previous block. For heights > 1, it's the weighted - median of - - the timestamps of the valid votes in the block.LastCommit. For - height == 1, - - it's genesis time. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated - with an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events defines all the events emitted by processing a - transaction. Note, - - these events include those emitted by processing all the - messages and those - - emitted from the ante. Whereas Logs contains the events, with - - additional metadata, emitted only by processing the messages. - - - Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - description: >- - TxResponse defines a structure containing relevant tx data and - metadata. The - - tags are stringified and the log is JSON decoded. - description: tx_responses is the list of queried TxResponses. - pagination: - description: |- - pagination defines a pagination for the response. - Deprecated post v0.46.x: use total instead. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - total: - type: string - format: uint64 - title: total is total number of results available - description: |- - GetTxsEventResponse is the response type for the Service.TxsByEvents - RPC method. - cosmos.tx.v1beta1.ModeInfo: - type: object - properties: - single: - title: single represents a single signer - type: object - properties: - mode: - title: mode is the signing mode of the single signer - type: string - enum: - - SIGN_MODE_UNSPECIFIED - - SIGN_MODE_DIRECT - - SIGN_MODE_TEXTUAL - - SIGN_MODE_DIRECT_AUX - - SIGN_MODE_LEGACY_AMINO_JSON - - SIGN_MODE_EIP_191 - default: SIGN_MODE_UNSPECIFIED - description: >- - SignMode represents a signing mode with its own security - guarantees. - - - This enum should be considered a registry of all known sign modes - - in the Cosmos ecosystem. Apps are not expected to support all - known - - sign modes. Apps that would like to support custom sign modes are - - encouraged to open a small PR against this file to add a new case - - to this SignMode enum describing their sign mode so that different - - apps have a consistent version of this enum. - - - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected. - - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx. - - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary - representation - - from SIGN_MODE_DIRECT. It is currently not supported. - - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode - does not - - require signers signing over other signers' `signer_info`. It also - allows - - for adding Tips in transactions. - - - Since: cosmos-sdk 0.46 - - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future. - - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - - - Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum - variant, - - but is not implemented on the SDK by default. To enable EIP-191, - you need - - to pass a custom `TxConfig` that has an implementation of - - `SignModeHandler` for EIP-191. The SDK may decide to fully support - - EIP-191 in the future. - - - Since: cosmos-sdk 0.45.2 - multi: - $ref: '#/definitions/cosmos.tx.v1beta1.ModeInfo.Multi' - title: multi represents a nested multisig signer - description: ModeInfo describes the signing mode of a single or nested multisig signer. - cosmos.tx.v1beta1.ModeInfo.Multi: - type: object - properties: - bitarray: - title: bitarray specifies which keys within the multisig are signing - type: object - properties: - extra_bits_stored: - type: integer - format: int64 - elems: - type: string - format: byte - description: >- - CompactBitArray is an implementation of a space efficient bit array. - - This is used to ensure that the encoded data takes up a minimal amount - of - - space after proto encoding. - - This is not thread safe, and is not intended for concurrent usage. - mode_infos: - type: array - items: - type: object - $ref: '#/definitions/cosmos.tx.v1beta1.ModeInfo' - title: |- - mode_infos is the corresponding modes of the signers of the multisig - which could include nested multisig public keys - title: Multi is the mode info for a multisig public key - cosmos.tx.v1beta1.ModeInfo.Single: - type: object - properties: - mode: - title: mode is the signing mode of the single signer - type: string - enum: - - SIGN_MODE_UNSPECIFIED - - SIGN_MODE_DIRECT - - SIGN_MODE_TEXTUAL - - SIGN_MODE_DIRECT_AUX - - SIGN_MODE_LEGACY_AMINO_JSON - - SIGN_MODE_EIP_191 - default: SIGN_MODE_UNSPECIFIED - description: >- - SignMode represents a signing mode with its own security guarantees. - - - This enum should be considered a registry of all known sign modes - - in the Cosmos ecosystem. Apps are not expected to support all known - - sign modes. Apps that would like to support custom sign modes are - - encouraged to open a small PR against this file to add a new case - - to this SignMode enum describing their sign mode so that different - - apps have a consistent version of this enum. - - - SIGN_MODE_UNSPECIFIED: SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - rejected. - - SIGN_MODE_DIRECT: SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - verified with raw bytes from Tx. - - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some - human-readable textual representation on top of the binary - representation - - from SIGN_MODE_DIRECT. It is currently not supported. - - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does - not - - require signers signing over other signers' `signer_info`. It also - allows - - for adding Tips in transactions. - - - Since: cosmos-sdk 0.46 - - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - Amino JSON and will be removed in the future. - - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 - - - Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, - - but is not implemented on the SDK by default. To enable EIP-191, you - need - - to pass a custom `TxConfig` that has an implementation of - - `SignModeHandler` for EIP-191. The SDK may decide to fully support - - EIP-191 in the future. - - - Since: cosmos-sdk 0.45.2 - title: |- - Single is the mode info for a single signer. It is structured as a message - to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - future - cosmos.tx.v1beta1.OrderBy: - type: string - enum: - - ORDER_BY_UNSPECIFIED - - ORDER_BY_ASC - - ORDER_BY_DESC - default: ORDER_BY_UNSPECIFIED - description: >- - - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting - order. OrderBy defaults to ASC in this case. - - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order - - ORDER_BY_DESC: ORDER_BY_DESC defines descending order - title: OrderBy defines the sorting order - cosmos.tx.v1beta1.SignerInfo: - type: object - properties: - public_key: - description: >- - public_key is the public key of the signer. It is optional for - accounts - - that already exist in state. If unset, the verifier can use the - required \ - - signer address for this position and lookup the public key. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - mode_info: - $ref: '#/definitions/cosmos.tx.v1beta1.ModeInfo' - title: |- - mode_info describes the signing mode of the signer and is a nested - structure to support nested multisig pubkey's - sequence: - type: string - format: uint64 - description: >- - sequence is the sequence of the account, which describes the - - number of committed transactions signed by a given address. It is used - to - - prevent replay attacks. - description: |- - SignerInfo describes the public key and signing mode of a single top-level - signer. - cosmos.tx.v1beta1.SimulateRequest: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: |- - tx is the transaction to simulate. - Deprecated. Send raw tx bytes instead. - tx_bytes: - type: string - format: byte - description: |- - tx_bytes is the raw transaction. - - Since: cosmos-sdk 0.43 - description: |- - SimulateRequest is the request type for the Service.Simulate - RPC method. - cosmos.tx.v1beta1.SimulateResponse: - type: object - properties: - gas_info: - description: gas_info is the information about gas used in the simulation. - type: object - properties: - gas_wanted: - type: string - format: uint64 - description: >- - GasWanted is the maximum units of work we allow this tx to - perform. - gas_used: - type: string - format: uint64 - description: GasUsed is the amount of gas actually consumed. - result: - description: result is the result of the simulation. - type: object - properties: - data: - type: string - format: byte - description: >- - Data is any data returned from message or handler execution. It - MUST be - - length prefixed in order to separate data from multiple message - executions. - - Deprecated. This field is still populated, but prefer msg_response - instead - - because it also contains the Msg response typeURL. - log: - type: string - description: >- - Log contains the log information from message or handler - execution. - events: - type: array - items: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: >- - EventAttribute is a single key-value pair, associated with - an event. - description: >- - Event allows application developers to attach additional - information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - description: >- - Events contains a slice of Event objects that were emitted during - message - - or handler execution. - msg_responses: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - msg_responses contains the Msg handler responses type packed in - Anys. - - - Since: cosmos-sdk 0.46 - description: |- - SimulateResponse is the response type for the - Service.SimulateRPC method. - cosmos.tx.v1beta1.Tip: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - title: amount is the amount of the tip - tipper: - type: string - title: tipper is the address of the account paying for the tip - description: |- - Tip is the tip used for meta-transactions. - - Since: cosmos-sdk 0.46 - cosmos.tx.v1beta1.Tx: - type: object - properties: - body: - title: body is the processable content of the transaction - type: object - properties: - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of messages to be executed. The required - signers of - - those messages define the number and order of elements in - AuthInfo's - - signer_infos and Tx's signatures. Each required signer address is - added to - - the list only the first time it occurs. - - By convention, the first required signer (usually from the first - message) - - is referred to as the primary signer and pays the fee for the - whole - - transaction. - memo: - type: string - description: >- - memo is any arbitrary note/comment to be added to the transaction. - - WARNING: in clients, any publicly exposed text should not be - called memo, - - but should be called `note` instead (see - https://github.com/cosmos/cosmos-sdk/issues/9122). - timeout_height: - type: string - format: uint64 - title: |- - timeout is the block height after which this transaction will not - be processed by the chain - extension_options: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by - chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, the transaction will be rejected - non_critical_extension_options: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by - chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, they will be ignored - description: TxBody is the body of a transaction that all signers sign over. - auth_info: - $ref: '#/definitions/cosmos.tx.v1beta1.AuthInfo' - title: |- - auth_info is the authorization related content of the transaction, - specifically signers, signer modes and fee - signatures: - type: array - items: - type: string - format: byte - description: >- - signatures is a list of signatures that matches the length and order - of - - AuthInfo's signer_infos to allow connecting signature meta information - like - - public key and signing mode by position. - description: Tx is the standard type used for broadcasting transactions. - cosmos.tx.v1beta1.TxBody: - type: object - properties: - messages: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - messages is a list of messages to be executed. The required signers of - - those messages define the number and order of elements in AuthInfo's - - signer_infos and Tx's signatures. Each required signer address is - added to - - the list only the first time it occurs. - - By convention, the first required signer (usually from the first - message) - - is referred to as the primary signer and pays the fee for the whole - - transaction. - memo: - type: string - description: >- - memo is any arbitrary note/comment to be added to the transaction. - - WARNING: in clients, any publicly exposed text should not be called - memo, - - but should be called `note` instead (see - https://github.com/cosmos/cosmos-sdk/issues/9122). - timeout_height: - type: string - format: uint64 - title: |- - timeout is the block height after which this transaction will not - be processed by the chain - extension_options: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, the transaction will be rejected - non_critical_extension_options: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, they will be ignored - description: TxBody is the body of a transaction that all signers sign over. - cosmos.tx.v1beta1.TxDecodeAminoRequest: - type: object - properties: - amino_binary: - type: string - format: byte - description: |- - TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxDecodeAminoResponse: - type: object - properties: - amino_json: - type: string - description: |- - TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxDecodeRequest: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the raw transaction. - description: |- - TxDecodeRequest is the request type for the Service.TxDecode - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxDecodeResponse: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: tx is the decoded transaction. - description: |- - TxDecodeResponse is the response type for the - Service.TxDecode method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeAminoRequest: - type: object - properties: - amino_json: - type: string - description: |- - TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeAminoResponse: - type: object - properties: - amino_binary: - type: string - format: byte - description: |- - TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeRequest: - type: object - properties: - tx: - $ref: '#/definitions/cosmos.tx.v1beta1.Tx' - description: tx is the transaction to encode. - description: |- - TxEncodeRequest is the request type for the Service.TxEncode - RPC method. - - Since: cosmos-sdk 0.47 - cosmos.tx.v1beta1.TxEncodeResponse: - type: object - properties: - tx_bytes: - type: string - format: byte - description: tx_bytes is the encoded transaction bytes. - description: |- - TxEncodeResponse is the response type for the - Service.TxEncode method. - - Since: cosmos-sdk 0.47 - tendermint.abci.Event: - type: object - properties: - type: - type: string - attributes: - type: array - items: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: EventAttribute is a single key-value pair, associated with an event. - description: >- - Event allows application developers to attach additional information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - - Later, transactions may be queried using these events. - tendermint.abci.EventAttribute: - type: object - properties: - key: - type: string - value: - type: string - index: - type: boolean - title: nondeterministic - description: EventAttribute is a single key-value pair, associated with an event. - cosmos.upgrade.v1beta1.ModuleVersion: - type: object - properties: - name: - type: string - title: name of the app module - version: - type: string - format: uint64 - title: consensus version of the app module - description: |- - ModuleVersion specifies a module and its consensus version. - - Since: cosmos-sdk 0.43 - cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse: - type: object - description: |- - MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. - - Since: cosmos-sdk 0.46 - cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse: - type: object - description: |- - MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. - - Since: cosmos-sdk 0.46 - cosmos.upgrade.v1beta1.Plan: - type: object - properties: - name: - type: string - description: >- - Sets the name for the upgrade. This name will be used by the upgraded - - version of the software to apply any special "on-upgrade" commands - during - - the first BeginBlock method after the upgrade is applied. It is also - used - - to detect whether a software version can handle a given upgrade. If no - - upgrade handler with this name has been set in the software, it will - be - - assumed that the software is out-of-date when the upgrade Time or - Height is - - reached and the software will exit. - time: - type: string - format: date-time - description: >- - Deprecated: Time based upgrades have been deprecated. Time based - upgrade logic - - has been removed from the SDK. - - If this field is not empty, an error will be thrown. - height: - type: string - format: int64 - description: The height at which the upgrade must be performed. - info: - type: string - title: |- - Any application specific upgrade info to be included on-chain - such as a git commit that validators could automatically upgrade to - upgraded_client_state: - description: >- - Deprecated: UpgradedClientState field has been deprecated. IBC upgrade - logic has been - - moved to the IBC module in the sub module 02-client. - - If this field is not empty, an error will be thrown. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - Plan specifies information about a planned upgrade and when it should - occur. - cosmos.upgrade.v1beta1.QueryAppliedPlanResponse: - type: object - properties: - height: - type: string - format: int64 - description: height is the block height at which the plan was applied. - description: >- - QueryAppliedPlanResponse is the response type for the Query/AppliedPlan - RPC - - method. - cosmos.upgrade.v1beta1.QueryAuthorityResponse: - type: object - properties: - address: - type: string - description: 'Since: cosmos-sdk 0.46' - title: QueryAuthorityResponse is the response type for Query/Authority - cosmos.upgrade.v1beta1.QueryCurrentPlanResponse: - type: object - properties: - plan: - description: plan is the current upgrade plan. - type: object - properties: - name: - type: string - description: >- - Sets the name for the upgrade. This name will be used by the - upgraded - - version of the software to apply any special "on-upgrade" commands - during - - the first BeginBlock method after the upgrade is applied. It is - also used - - to detect whether a software version can handle a given upgrade. - If no - - upgrade handler with this name has been set in the software, it - will be - - assumed that the software is out-of-date when the upgrade Time or - Height is - - reached and the software will exit. - time: - type: string - format: date-time - description: >- - Deprecated: Time based upgrades have been deprecated. Time based - upgrade logic - - has been removed from the SDK. - - If this field is not empty, an error will be thrown. - height: - type: string - format: int64 - description: The height at which the upgrade must be performed. - info: - type: string - title: >- - Any application specific upgrade info to be included on-chain - - such as a git commit that validators could automatically upgrade - to - upgraded_client_state: - description: >- - Deprecated: UpgradedClientState field has been deprecated. IBC - upgrade logic has been - - moved to the IBC module in the sub module 02-client. - - If this field is not empty, an error will be thrown. - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - QueryCurrentPlanResponse is the response type for the Query/CurrentPlan - RPC - - method. - cosmos.upgrade.v1beta1.QueryModuleVersionsResponse: - type: object - properties: - module_versions: - type: array - items: - type: object - properties: - name: - type: string - title: name of the app module - version: - type: string - format: uint64 - title: consensus version of the app module - description: |- - ModuleVersion specifies a module and its consensus version. - - Since: cosmos-sdk 0.43 - description: >- - module_versions is a list of module names with their consensus - versions. - description: >- - QueryModuleVersionsResponse is the response type for the - Query/ModuleVersions - - RPC method. - - - Since: cosmos-sdk 0.43 - cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse: - type: object - properties: - upgraded_consensus_state: - type: string - format: byte - title: 'Since: cosmos-sdk 0.43' - description: >- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState - - RPC method. - cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse: - type: object - description: >- - MsgCreateVestingAccountResponse defines the - Msg/CreatePeriodicVestingAccount - - response type. - - - Since: cosmos-sdk 0.46 - cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse: - type: object - description: >- - MsgCreatePermanentLockedAccountResponse defines the - Msg/CreatePermanentLockedAccount response type. - - - Since: cosmos-sdk 0.46 - cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse: - type: object - description: >- - MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount - response type. - cosmos.vesting.v1beta1.Period: - type: object - properties: - length: - type: string - format: int64 - description: Period duration in seconds. - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: Period defines a length of time and amount of coins that will vest. - ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse: - type: object - properties: - channel_id: - type: string - port_id: - type: string - title: >- - MsgRegisterInterchainAccountResponse defines the response for - Msg/RegisterAccount - ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse: - type: object - properties: - sequence: - type: string - format: uint64 - title: MsgSendTxResponse defines the response for MsgSendTx - ibc.applications.interchain_accounts.controller.v1.Params: - type: object - properties: - controller_enabled: - type: boolean - description: controller_enabled enables or disables the controller submodule. - description: |- - Params defines the set of on-chain interchain accounts parameters. - The following parameters may be used to disable the controller submodule. - ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse: - type: object - properties: - address: - type: string - description: >- - QueryInterchainAccountResponse the response type for the - Query/InterchainAccount RPC method. - ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - controller_enabled: - type: boolean - description: controller_enabled enables or disables the controller submodule. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - ibc.applications.interchain_accounts.v1.InterchainAccountPacketData: - type: object - properties: - type: - type: string - enum: - - TYPE_UNSPECIFIED - - TYPE_EXECUTE_TX - default: TYPE_UNSPECIFIED - description: |- - - TYPE_UNSPECIFIED: Default zero value enumeration - - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain - title: >- - Type defines a classification of message issued from a controller - chain to its associated interchain accounts - - host - data: - type: string - format: byte - memo: - type: string - description: >- - InterchainAccountPacketData is comprised of a raw transaction, type of - transaction and optional memo field. - ibc.applications.interchain_accounts.v1.Type: - type: string - enum: - - TYPE_UNSPECIFIED - - TYPE_EXECUTE_TX - default: TYPE_UNSPECIFIED - description: |- - - TYPE_UNSPECIFIED: Default zero value enumeration - - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain - title: >- - Type defines a classification of message issued from a controller chain to - its associated interchain accounts - - host - ibc.applications.interchain_accounts.host.v1.Params: - type: object - properties: - host_enabled: - type: boolean - description: host_enabled enables or disables the host submodule. - allow_messages: - type: array - items: - type: string - description: >- - allow_messages defines a list of sdk message typeURLs allowed to be - executed on a host chain. - description: |- - Params defines the set of on-chain interchain accounts parameters. - The following parameters may be used to disable the host submodule. - ibc.applications.interchain_accounts.host.v1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - host_enabled: - type: boolean - description: host_enabled enables or disables the host submodule. - allow_messages: - type: array - items: - type: string - description: >- - allow_messages defines a list of sdk message typeURLs allowed to - be executed on a host chain. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - ibc.applications.transfer.v1.DenomTrace: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for tracing - the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens and - the - - source tracing information path. - ibc.applications.transfer.v1.MsgTransferResponse: - type: object - properties: - sequence: - type: string - format: uint64 - title: sequence number of the transfer packet sent - description: MsgTransferResponse defines the Msg/Transfer response type. - ibc.applications.transfer.v1.Params: - type: object - properties: - send_enabled: - type: boolean - description: >- - send_enabled enables or disables all cross-chain token transfers from - this - - chain. - receive_enabled: - type: boolean - description: >- - receive_enabled enables or disables all cross-chain token transfers to - this - - chain. - description: >- - Params defines the set of IBC transfer parameters. - - NOTE: To prevent a single token from being transferred, set the - - TransfersEnabled parameter to true and then set the bank module's - SendEnabled - - parameter for the denomination to false. - ibc.applications.transfer.v1.QueryDenomHashResponse: - type: object - properties: - hash: - type: string - description: hash (in hex format) of the denomination trace information. - description: |- - QueryDenomHashResponse is the response type for the Query/DenomHash RPC - method. - ibc.applications.transfer.v1.QueryDenomTraceResponse: - type: object - properties: - denom_trace: - description: denom_trace returns the requested denomination trace information. - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for - tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: |- - QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC - method. - ibc.applications.transfer.v1.QueryDenomTracesResponse: - type: object - properties: - denom_traces: - type: array - items: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for - tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens - and the - - source tracing information path. - description: denom_traces returns all denominations trace information. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryConnectionsResponse is the response type for the Query/DenomTraces - RPC - - method. - ibc.applications.transfer.v1.QueryEscrowAddressResponse: - type: object - properties: - escrow_address: - type: string - title: the escrow account address - description: >- - QueryEscrowAddressResponse is the response type of the EscrowAddress RPC - method. - ibc.applications.transfer.v1.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - send_enabled: - type: boolean - description: >- - send_enabled enables or disables all cross-chain token transfers - from this - - chain. - receive_enabled: - type: boolean - description: >- - receive_enabled enables or disables all cross-chain token - transfers to this - - chain. - description: QueryParamsResponse is the response type for the Query/Params RPC method. - ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse: - type: object - properties: - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: >- - QueryTotalEscrowForDenomResponse is the response type for - TotalEscrowForDenom RPC method. - ibc.core.client.v1.Height: - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: |- - Normally the RevisionHeight is incremented at each height while keeping - RevisionNumber the same. However some consensus algorithms may choose to - reset the height in certain conditions e.g. hard forks, state-machine - breaking changes In these cases, the RevisionNumber is incremented so that - height continues to be monitonically increasing even as the RevisionHeight - gets reset - title: >- - Height is a monotonically increasing data type - - that can be compared against another Height for the purposes of updating - and - - freezing clients - ibc.core.channel.v1.Channel: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: |- - list of connection identifiers, in order, along which packets sent on - this channel will travel - version: - type: string - title: opaque channel version, which is agreed upon during the handshake - description: |- - Channel defines pipeline for exactly-once packet delivery between specific - modules on separate blockchains, which has at least one end capable of - sending packets and one end capable of receiving packets. - ibc.core.channel.v1.Counterparty: - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: - type: string - title: channel end on the counterparty chain - title: Counterparty defines a channel end counterparty - ibc.core.channel.v1.IdentifiedChannel: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: |- - list of connection identifiers, in order, along which packets sent on - this channel will travel - version: - type: string - title: opaque channel version, which is agreed upon during the handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: |- - IdentifiedChannel defines a channel with additional port and channel - identifier fields. - ibc.core.channel.v1.MsgAcknowledgementResponse: - type: object - properties: - result: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. - ibc.core.channel.v1.MsgChannelCloseConfirmResponse: - type: object - description: >- - MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm - response - - type. - ibc.core.channel.v1.MsgChannelCloseInitResponse: - type: object - description: >- - MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response - type. - ibc.core.channel.v1.MsgChannelOpenAckResponse: - type: object - description: MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. - ibc.core.channel.v1.MsgChannelOpenConfirmResponse: - type: object - description: |- - MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response - type. - ibc.core.channel.v1.MsgChannelOpenInitResponse: - type: object - properties: - channel_id: - type: string - version: - type: string - description: MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. - ibc.core.channel.v1.MsgChannelOpenTryResponse: - type: object - properties: - version: - type: string - channel_id: - type: string - description: MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. - ibc.core.channel.v1.MsgRecvPacketResponse: - type: object - properties: - result: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgRecvPacketResponse defines the Msg/RecvPacket response type. - ibc.core.channel.v1.MsgTimeoutOnCloseResponse: - type: object - properties: - result: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. - ibc.core.channel.v1.MsgTimeoutResponse: - type: object - properties: - result: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - description: MsgTimeoutResponse defines the Msg/Timeout response type. - ibc.core.channel.v1.Order: - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - title: Order defines if a channel is ORDERED or UNORDERED - ibc.core.channel.v1.Packet: - type: object - properties: - sequence: - type: string - format: uint64 - description: >- - number corresponds to the order of sends and receives, where a Packet - - with an earlier sequence number must be sent and received before a - Packet - - with a later sequence number. - source_port: - type: string - description: identifies the port on the sending chain. - source_channel: - type: string - description: identifies the channel end on the sending chain. - destination_port: - type: string - description: identifies the port on the receiving chain. - destination_channel: - type: string - description: identifies the channel end on the receiving chain. - data: - type: string - format: byte - title: actual opaque bytes transferred directly to the application module - timeout_height: - title: block height after which the packet times out - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - timeout_timestamp: - type: string - format: uint64 - title: block timestamp (in nanoseconds) after which the packet times out - title: >- - Packet defines a type that carries data across different chains through - IBC - ibc.core.channel.v1.PacketState: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: |- - PacketState defines the generic type necessary to retrieve and store - packet commitments, acknowledgements, and receipts. - Caller is responsible for knowing the context necessary to interpret this - state as a commitment, acknowledgement, or a receipt. - ibc.core.channel.v1.QueryChannelClientStateResponse: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - IdentifiedClientState defines a client state with an additional client - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - ibc.core.channel.v1.QueryChannelConsensusStateResponse: - type: object - properties: - consensus_state: - title: consensus state associated with the channel - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - client_id: - type: string - title: client ID associated with the consensus state - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryChannelClientStateResponse is the Response type for the - Query/QueryChannelClientState RPC method - ibc.core.channel.v1.QueryChannelResponse: - type: object - properties: - channel: - title: channel associated with the request identifiers - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of the - channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which packets sent - on - - this channel will travel - version: - type: string - title: opaque channel version, which is agreed upon during the handshake - description: >- - Channel defines pipeline for exactly-once packet delivery between - specific - - modules on separate blockchains, which has at least one end capable of - - sending packets and one end capable of receiving packets. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryChannelResponse is the response type for the Query/Channel RPC - method. - - Besides the Channel end, it includes a proof and the height from which the - - proof was retrieved. - ibc.core.channel.v1.QueryChannelsResponse: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of - the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which packets - sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: |- - IdentifiedChannel defines a channel with additional port and channel - identifier fields. - description: list of stored channels of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryChannelsResponse is the response type for the Query/Channels RPC - method. - ibc.core.channel.v1.QueryConnectionChannelsResponse: - type: object - properties: - channels: - type: array - items: - type: object - properties: - state: - title: current state of the channel end - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ordering: - title: whether the channel is ordered or unordered - type: string - enum: - - ORDER_NONE_UNSPECIFIED - - ORDER_UNORDERED - - ORDER_ORDERED - default: ORDER_NONE_UNSPECIFIED - description: |- - - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering - - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in - which they were sent. - - ORDER_ORDERED: packets are delivered exactly in the order which they were sent - counterparty: - title: counterparty channel end - type: object - properties: - port_id: - type: string - description: >- - port on the counterparty chain which owns the other end of - the channel. - channel_id: - type: string - title: channel end on the counterparty chain - connection_hops: - type: array - items: - type: string - title: >- - list of connection identifiers, in order, along which packets - sent on - - this channel will travel - version: - type: string - title: >- - opaque channel version, which is agreed upon during the - handshake - port_id: - type: string - title: port identifier - channel_id: - type: string - title: channel identifier - description: |- - IdentifiedChannel defines a channel with additional port and channel - identifier fields. - description: list of channels associated with a connection. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionChannelsResponse is the Response type for the - Query/QueryConnectionChannels RPC method - ibc.core.channel.v1.QueryNextSequenceReceiveResponse: - type: object - properties: - next_sequence_receive: - type: string - format: uint64 - title: next sequence receive number - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QuerySequenceResponse is the request type for the - Query/QueryNextSequenceReceiveResponse RPC method - ibc.core.channel.v1.QueryPacketAcknowledgementResponse: - type: object - properties: - acknowledgement: - type: string - format: byte - title: packet associated with the request fields - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketAcknowledgementResponse defines the client query response for a - packet which also includes a proof and the height from which the - proof was retrieved - ibc.core.channel.v1.QueryPacketAcknowledgementsResponse: - type: object - properties: - acknowledgements: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to interpret - this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketAcknowledgemetsResponse is the request type for the - Query/QueryPacketAcknowledgements RPC method - ibc.core.channel.v1.QueryPacketCommitmentResponse: - type: object - properties: - commitment: - type: string - format: byte - title: packet associated with the request fields - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketCommitmentResponse defines the client query response for a - packet - - which also includes a proof and the height from which the proof was - - retrieved - ibc.core.channel.v1.QueryPacketCommitmentsResponse: - type: object - properties: - commitments: - type: array - items: - type: object - properties: - port_id: - type: string - description: channel port identifier. - channel_id: - type: string - description: channel unique identifier. - sequence: - type: string - format: uint64 - description: packet sequence. - data: - type: string - format: byte - description: embedded data that represents packet state. - description: >- - PacketState defines the generic type necessary to retrieve and store - - packet commitments, acknowledgements, and receipts. - - Caller is responsible for knowing the context necessary to interpret - this - - state as a commitment, acknowledgement, or a receipt. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryPacketCommitmentsResponse is the request type for the - Query/QueryPacketCommitments RPC method - ibc.core.channel.v1.QueryPacketReceiptResponse: - type: object - properties: - received: - type: boolean - title: success flag for if receipt exists - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryPacketReceiptResponse defines the client query response for a packet - - receipt which also includes a proof, and the height from which the proof - was - - retrieved - ibc.core.channel.v1.QueryUnreceivedAcksResponse: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived acknowledgement sequences - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryUnreceivedAcksResponse is the response type for the - Query/UnreceivedAcks RPC method - ibc.core.channel.v1.QueryUnreceivedPacketsResponse: - type: object - properties: - sequences: - type: array - items: - type: string - format: uint64 - title: list of unreceived packet sequences - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryUnreceivedPacketsResponse is the response type for the - Query/UnreceivedPacketCommitments RPC method - ibc.core.channel.v1.ResponseResultType: - type: string - enum: - - RESPONSE_RESULT_TYPE_UNSPECIFIED - - RESPONSE_RESULT_TYPE_NOOP - - RESPONSE_RESULT_TYPE_SUCCESS - default: RESPONSE_RESULT_TYPE_UNSPECIFIED - description: |- - - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration - - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully - title: >- - ResponseResultType defines the possible outcomes of the execution of a - message - ibc.core.channel.v1.State: - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - - STATE_CLOSED - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a channel is in one of the following states: - CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A channel has just started the opening handshake. - - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. - - STATE_OPEN: A channel has completed the handshake. Open channels are - ready to send and receive packets. - - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive - packets. - ibc.core.client.v1.IdentifiedClientState: - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - IdentifiedClientState defines a client state with an additional client - identifier field. - ibc.core.client.v1.ConsensusStateWithHeight: - type: object - properties: - height: - title: consensus state height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - consensus_state: - title: consensus state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - ConsensusStateWithHeight defines a consensus state with an additional - height - - field. - ibc.core.client.v1.MsgCreateClientResponse: - type: object - description: MsgCreateClientResponse defines the Msg/CreateClient response type. - ibc.core.client.v1.MsgSubmitMisbehaviourResponse: - type: object - description: |- - MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response - type. - ibc.core.client.v1.MsgUpdateClientResponse: - type: object - description: MsgUpdateClientResponse defines the Msg/UpdateClient response type. - ibc.core.client.v1.MsgUpgradeClientResponse: - type: object - description: MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. - ibc.core.client.v1.Params: - type: object - properties: - allowed_clients: - type: array - items: - type: string - description: >- - allowed_clients defines the list of allowed client state types which - can be created - - and interacted with. If a client type is removed from the allowed - clients list, usage - - of this client will be disabled until it is added again to the list. - description: Params defines the set of IBC light client parameters. - ibc.core.client.v1.QueryClientParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - allowed_clients: - type: array - items: - type: string - description: >- - allowed_clients defines the list of allowed client state types - which can be created - - and interacted with. If a client type is removed from the allowed - clients list, usage - - of this client will be disabled until it is added again to the - list. - description: >- - QueryClientParamsResponse is the response type for the Query/ClientParams - RPC - - method. - ibc.core.client.v1.QueryClientStateResponse: - type: object - properties: - client_state: - title: client state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryClientStateResponse is the response type for the Query/ClientState - RPC - - method. Besides the client state, it includes a proof and the height from - - which the proof was retrieved. - ibc.core.client.v1.QueryClientStatesResponse: - type: object - properties: - client_states: - type: array - items: - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - IdentifiedClientState defines a client state with an additional - client - - identifier field. - description: list of stored ClientStates of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryClientStatesResponse is the response type for the Query/ClientStates - RPC - - method. - ibc.core.client.v1.QueryClientStatusResponse: - type: object - properties: - status: - type: string - description: >- - QueryClientStatusResponse is the response type for the Query/ClientStatus - RPC - - method. It returns the current status of the IBC client. - ibc.core.client.v1.QueryConsensusStateHeightsResponse: - type: object - properties: - consensus_state_heights: - type: array - items: - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is incremented - so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - Height is a monotonically increasing data type - - that can be compared against another Height for the purposes of - updating and - - freezing clients - title: consensus state heights - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStateHeightsResponse is the response type for the - Query/ConsensusStateHeights RPC method - ibc.core.client.v1.QueryConsensusStateResponse: - type: object - properties: - consensus_state: - title: >- - consensus state associated with the client identifier at the given - height - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: >- - QueryConsensusStateResponse is the response type for the - Query/ConsensusState - - RPC method - ibc.core.client.v1.QueryConsensusStatesResponse: - type: object - properties: - consensus_states: - type: array - items: - type: object - properties: - height: - title: consensus state height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may - choose to - - reset the height in certain conditions e.g. hard forks, - state-machine - - breaking changes In these cases, the RevisionNumber is - incremented so that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - consensus_state: - title: consensus state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in - the form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default - use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last - '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: >- - ConsensusStateWithHeight defines a consensus state with an - additional height - - field. - title: consensus states associated with the identifier - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryConsensusStatesResponse is the response type for the - Query/ConsensusStates RPC method - ibc.core.client.v1.QueryUpgradedClientStateResponse: - type: object - properties: - upgraded_client_state: - title: client state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - QueryUpgradedClientStateResponse is the response type for the - Query/UpgradedClientState RPC method. - ibc.core.client.v1.QueryUpgradedConsensusStateResponse: - type: object - properties: - upgraded_consensus_state: - title: Consensus state associated with the request identifier - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - QueryUpgradedConsensusStateResponse is the response type for the - Query/UpgradedConsensusState RPC method. - ibc.core.commitment.v1.MerklePrefix: - type: object - properties: - key_prefix: - type: string - format: byte - title: |- - MerklePrefix is merkle path prefixed to the key. - The constructed key from the Path and the key will be append(Path.KeyPath, - append(Path.KeyPrefix, key...)) - ibc.core.connection.v1.ConnectionEnd: - type: object - properties: - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in - - the connection handshake. - description: >- - IBC version which can be utilised to determine encodings or protocols - for - - channels or packets utilising this connection. - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: >- - delay period that must pass before a consensus state can be used for - - packet-verification NOTE: delay period logic is only implemented by - some - - clients. - description: |- - ConnectionEnd defines a stateful object on a chain connected to another - separate one. - NOTE: there must only be 2 defined ConnectionEnds to establish - a connection between two chains. - ibc.core.connection.v1.Counterparty: - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - description: >- - Counterparty defines the counterparty chain associated with a connection - end. - ibc.core.connection.v1.IdentifiedConnection: - type: object - properties: - id: - type: string - description: connection identifier. - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in - - the connection handshake. - title: >- - IBC version which can be utilised to determine encodings or protocols - for - - channels or packets utilising this connection - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: delay period associated with this connection. - description: |- - IdentifiedConnection defines a connection with additional connection - identifier field. - ibc.core.connection.v1.MsgConnectionOpenAckResponse: - type: object - description: >- - MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response - type. - ibc.core.connection.v1.MsgConnectionOpenConfirmResponse: - type: object - description: |- - MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm - response type. - ibc.core.connection.v1.MsgConnectionOpenInitResponse: - type: object - description: |- - MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response - type. - ibc.core.connection.v1.MsgConnectionOpenTryResponse: - type: object - description: >- - MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response - type. - ibc.core.connection.v1.Params: - type: object - properties: - max_expected_time_per_block: - type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the - - largest amount of time that the chain might reasonably take to produce - the next block under normal operating - - conditions. A safe choice is 3-5x the expected time per block. - description: Params defines the set of Connection parameters. - ibc.core.connection.v1.QueryClientConnectionsResponse: - type: object - properties: - connection_paths: - type: array - items: - type: string - description: slice of all the connection paths associated with a client. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was generated - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryClientConnectionsResponse is the response type for the - Query/ClientConnections RPC method - ibc.core.connection.v1.QueryConnectionClientStateResponse: - type: object - properties: - identified_client_state: - title: client state associated with the channel - type: object - properties: - client_id: - type: string - title: client identifier - client_state: - title: client state - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all - types that they - - expect it to use in the context of Any. However, for URLs - which use the - - scheme `http`, `https`, or no scheme, one can optionally set - up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on - the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message - along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a - field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - description: |- - IdentifiedClientState defines a client state with an additional client - identifier field. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionClientStateResponse is the response type for the - Query/ConnectionClientState RPC method - ibc.core.connection.v1.QueryConnectionConsensusStateResponse: - type: object - properties: - consensus_state: - title: consensus state associated with the channel - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - client_id: - type: string - title: client ID associated with the consensus state - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - title: |- - QueryConnectionConsensusStateResponse is the response type for the - Query/ConnectionConsensusState RPC method - ibc.core.connection.v1.QueryConnectionParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - max_expected_time_per_block: - type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the - - largest amount of time that the chain might reasonably take to - produce the next block under normal operating - - conditions. A safe choice is 3-5x the expected time per block. - description: >- - QueryConnectionParamsResponse is the response type for the - Query/ConnectionParams RPC method. - ibc.core.connection.v1.QueryConnectionResponse: - type: object - properties: - connection: - title: connection associated with the request identifier - type: object - properties: - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in - - the connection handshake. - description: >- - IBC version which can be utilised to determine encodings or - protocols for - - channels or packets utilising this connection. - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated - with a given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain - associated with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: >- - delay period that must pass before a consensus state can be used - for - - packet-verification NOTE: delay period logic is only implemented - by some - - clients. - description: >- - ConnectionEnd defines a stateful object on a chain connected to - another - - separate one. - - NOTE: there must only be 2 defined ConnectionEnds to establish - - a connection between two chains. - proof: - type: string - format: byte - title: merkle proof of existence - proof_height: - title: height at which the proof was retrieved - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryConnectionResponse is the response type for the Query/Connection RPC - - method. Besides the connection end, it includes a proof and the height - from - - which the proof was retrieved. - ibc.core.connection.v1.QueryConnectionsResponse: - type: object - properties: - connections: - type: array - items: - type: object - properties: - id: - type: string - description: connection identifier. - client_id: - type: string - description: client associated with this connection. - versions: - type: array - items: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the - IBC verison in - - the connection handshake. - title: >- - IBC version which can be utilised to determine encodings or - protocols for - - channels or packets utilising this connection - state: - description: current state of the connection end. - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - counterparty: - description: counterparty chain associated with this connection. - type: object - properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated - with a given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain - associated with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. - type: object - properties: - key_prefix: - type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - delay_period: - type: string - format: uint64 - description: delay period associated with this connection. - description: |- - IdentifiedConnection defines a connection with additional connection - identifier field. - description: list of stored connections of the chain. - pagination: - title: pagination response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - height: - title: query block height - type: object - properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: - type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine - - breaking changes In these cases, the RevisionNumber is incremented so - that - - height continues to be monitonically increasing even as the - RevisionHeight - - gets reset - description: >- - QueryConnectionsResponse is the response type for the Query/Connections - RPC - - method. - ibc.core.connection.v1.State: - type: string - enum: - - STATE_UNINITIALIZED_UNSPECIFIED - - STATE_INIT - - STATE_TRYOPEN - - STATE_OPEN - default: STATE_UNINITIALIZED_UNSPECIFIED - description: |- - State defines if a connection is in one of the following states: - INIT, TRYOPEN, OPEN or UNINITIALIZED. - - - STATE_UNINITIALIZED_UNSPECIFIED: Default State - - STATE_INIT: A connection end has just started the opening handshake. - - STATE_TRYOPEN: A connection end has acknowledged the handshake step on the counterparty - chain. - - STATE_OPEN: A connection end has completed the handshake. - ibc.core.connection.v1.Version: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: |- - Version defines the versioning scheme used to negotiate the IBC verison in - the connection handshake. - pocket.application.Application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - title: >- - Application defines the type used to store an on-chain definition and - state for an application - pocket.application.MsgDelegateToGatewayResponse: - type: object - pocket.application.MsgStakeApplicationResponse: - type: object - pocket.application.MsgUndelegateFromGatewayResponse: - type: object - pocket.application.MsgUnstakeApplicationResponse: - type: object - pocket.application.Params: - type: object - properties: - max_delegated_gateways: - type: string - format: int64 - title: The maximum number of gateways an application can delegate trust to - description: Params defines the parameters for the module. - pocket.application.QueryAllApplicationResponse: - type: object - properties: - application: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of - the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - title: >- - Application defines the type used to store an on-chain definition - and state for an application - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.application.QueryGetApplicationResponse: - type: object - properties: - application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - title: >- - Application defines the type used to store an on-chain definition and - state for an application - pocket.application.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_delegated_gateways: - type: string - format: int64 - title: >- - The maximum number of gateways an application can delegate trust - to - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.shared.ApplicationServiceConfig: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - title: >- - ApplicationServiceConfig holds the service configuration the application - stakes for - pocket.shared.Service: - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder than an - optional onchain representation of the service is necessary - title: >- - Service message to encapsulate unique and semantic identifiers for a - service on the network - pocket.gateway.Gateway: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - pocket.gateway.MsgStakeGatewayResponse: - type: object - pocket.gateway.MsgUnstakeGatewayResponse: - type: object - pocket.gateway.Params: - type: object - description: Params defines the parameters for the module. - pocket.gateway.QueryAllGatewayResponse: - type: object - properties: - gateway: - type: array - items: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.gateway.QueryGetGatewayResponse: - type: object - properties: - gateway: - type: object - properties: - address: - type: string - title: The Bech32 address of the gateway - stake: - title: The total amount of uPOKT the gateway has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - pocket.gateway.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.pocket.Params: - type: object - description: Params defines the parameters for the module. - pocket.pocket.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.service.MsgAddServiceResponse: - type: object - pocket.service.Params: - type: object - properties: - add_service_fee: - type: string - format: uint64 - description: |- - The amount of uPOKT required to add a new service. - This will be deducted from the signer's account balance, - and transferred to the pocket network foundation. - description: Params defines the parameters for the module. - pocket.service.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - add_service_fee: - type: string - format: uint64 - description: |- - The amount of uPOKT required to add a new service. - This will be deducted from the signer's account balance, - and transferred to the pocket network foundation. - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.session.Params: - type: object - description: Params defines the parameters for the module. - pocket.session.QueryGetSessionResponse: - type: object - properties: - session: - type: object - properties: - header: - title: The header of the session containing lightweight data - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block - of the session - description: >- - SessionHeader is a lightweight header for a session that can be - passed around. - - It is the minimal amount of data required to hydrate & retrieve - all data relevant to the session. - session_id: - type: string - title: A unique pseudoranom ID for this session - session_number: - type: string - format: int64 - title: The session number since genesis - num_blocks_per_session: - type: string - format: int64 - title: The number of blocks per session when this session started - application: - title: A fully hydrated application object this session is for - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as - a reminder than an optional onchain representation - of the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - suppliers: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session - for a certain service but with some additional - configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder than an optional onchain - representation of the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, - SLAs or something else? There will be more - discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto - maps can't be keyed by enums - title: >- - Additional configuration options for the - endpoint - title: >- - SupplierEndpoint message to hold service - configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - title: A fully hydrated set of servicers that are serving the application - description: >- - Session is a fully hydrated session object that contains all the - information for the Session - - and its parcipants. - pocket.session.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.session.Session: - type: object - properties: - header: - title: The header of the session containing lightweight data - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that identify - it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of - the session - description: >- - SessionHeader is a lightweight header for a session that can be passed - around. - - It is the minimal amount of data required to hydrate & retrieve all - data relevant to the session. - session_id: - type: string - title: A unique pseudoranom ID for this session - session_number: - type: string - format: int64 - title: The session number since genesis - num_blocks_per_session: - type: string - format: int64 - title: The number of blocks per session when this session started - application: - title: A fully hydrated application object this session is for - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - title: >- - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - suppliers: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of - the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs - or something else? There will be more - discussion once we get closer to implementing - on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto - maps can't be keyed by enums - title: Additional configuration options for the endpoint - title: >- - SupplierEndpoint message to hold service configuration - details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - title: A fully hydrated set of servicers that are serving the application - description: >- - Session is a fully hydrated session object that contains all the - information for the Session - - and its parcipants. - pocket.session.SessionHeader: - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using on-chain - but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of the - session - description: >- - SessionHeader is a lightweight header for a session that can be passed - around. - - It is the minimal amount of data required to hydrate & retrieve all data - relevant to the session. - pocket.shared.ConfigOption: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or something else? There - will be more discussion once we get closer to implementing on-chain - QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps can't be keyed by - enums - pocket.shared.ConfigOptions: - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or something else? There will - be more discussion once we get closer to implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - pocket.shared.RPCType: - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - title: Enum to define RPC types - pocket.shared.Supplier: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' ScalarDescriptor to - ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or - something else? There will be more discussion once - we get closer to implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps - can't be keyed by enums - title: Additional configuration options for the endpoint - title: SupplierEndpoint message to hold service configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the supplier - stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that provides - RPC services. - pocket.shared.SupplierEndpoint: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or something else? - There will be more discussion once we get closer to implementing - on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps can't be keyed - by enums - title: Additional configuration options for the endpoint - title: SupplierEndpoint message to hold service configuration details - pocket.shared.SupplierServiceConfig: - type: object - properties: - service: - title: The Service for which the supplier is configured for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or something - else? There will be more discussion once we get closer to - implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps can't be - keyed by enums - title: Additional configuration options for the endpoint - title: SupplierEndpoint message to hold service configuration details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the supplier stakes - for - pocket.supplier.Claim: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that identify - it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of - the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims pending to be - proven - pocket.supplier.MsgCreateClaimResponse: - type: object - pocket.supplier.MsgStakeSupplierResponse: - type: object - pocket.supplier.MsgSubmitProofResponse: - type: object - pocket.supplier.MsgUnstakeSupplierResponse: - type: object - pocket.supplier.Params: - type: object - description: Params defines the parameters for the module. - pocket.supplier.Proof: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that identify - it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - than an optional onchain representation of the service is - necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block of - the session - closest_merkle_proof: - type: string - format: byte - description: The serialized SMST proof from the `#ClosestProof()` method. - pocket.supplier.QueryAllClaimsResponse: - type: object - properties: - claim: - type: array - items: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last - block of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims pending to - be proven - description: 'TODO_IMPROVE: Rename to `Claims` (plural).' - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.supplier.QueryAllProofsResponse: - type: object - properties: - proof: - type: array - items: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last - block of the session - closest_merkle_proof: - type: string - format: byte - description: The serialized SMST proof from the `#ClosestProof()` method. - description: 'TODO_IMPROVE: Rename to `Proofs` (plural).' - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.supplier.QueryAllSupplierResponse: - type: object - properties: - supplier: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of - the service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs - or something else? There will be more - discussion once we get closer to implementing - on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto - maps can't be keyed by enums - title: Additional configuration options for the endpoint - title: >- - SupplierEndpoint message to hold service configuration - details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - pocket.supplier.QueryGetClaimResponse: - type: object - properties: - claim: - type: object - properties: - supplier_address: - type: string - title: the address of the supplier that submitted this claim - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block - of the session - root_hash: - type: string - format: byte - description: Root hash returned from smt.SMST#Root(). - title: >- - Claim is the serialized object stored on-chain for claims pending to - be proven - pocket.supplier.QueryGetProofResponse: - type: object - properties: - proof: - type: object - properties: - supplier_address: - type: string - session_header: - description: The session header of the session that this claim is for. - type: object - properties: - application_address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - service: - title: The service this session is for - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - session_start_block_height: - type: string - format: int64 - title: The height at which this session started - session_id: - type: string - description: A unique pseudoranom ID for this session - title: >- - NOTE: session_id can be derived from the above values using - on-chain but is included in the header for convenience - session_end_block_height: - type: string - format: int64 - title: >- - The height at which this session ended, this is the last block - of the session - closest_merkle_proof: - type: string - format: byte - description: The serialized SMST proof from the `#ClosestProof()` method. - pocket.supplier.QueryGetSupplierResponse: - type: object - properties: - supplier: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the supplier using cosmos' ScalarDescriptor - to ensure deterministic encoding - stake: - title: The total amount of uPOKT the supplier has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - services: - type: array - items: - type: object - properties: - service: - title: The Service for which the supplier is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder than an optional onchain representation of the - service is necessary - endpoints: - type: array - items: - type: object - properties: - url: - type: string - title: URL of the endpoint - rpc_type: - title: Type of RPC exposed on the url above - type: string - enum: - - UNKNOWN_RPC - - GRPC - - WEBSOCKET - - JSON_RPC - - REST - default: UNKNOWN_RPC - description: |- - - UNKNOWN_RPC: Undefined RPC type - - GRPC: gRPC - - WEBSOCKET: WebSocket - - JSON_RPC: JSON-RPC - - REST: REST - configs: - type: array - items: - type: object - properties: - key: - title: Config option key - type: string - enum: - - UNKNOWN_CONFIG - - TIMEOUT - default: UNKNOWN_CONFIG - description: >- - Enum to define configuration options - - TODO_RESEARCH: Should these be configs, SLAs or - something else? There will be more discussion - once we get closer to implementing on-chain QoS. - - - UNKNOWN_CONFIG: Undefined config option - - TIMEOUT: Timeout setting - value: - type: string - title: Config option value - title: >- - Key-value wrapper for config options, as proto maps - can't be keyed by enums - title: Additional configuration options for the endpoint - title: >- - SupplierEndpoint message to hold service configuration - details - title: List of endpoints for the service - title: >- - SupplierServiceConfig holds the service configuration the - supplier stakes for - title: The service configs this supplier can support - description: >- - Supplier is the type defining the actor in Pocket Network that - provides RPC services. - pocket.supplier.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. - pocket.tokenomics.MsgUpdateParamsResponse: - type: object - description: >- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - pocket.tokenomics.Params: - type: object - properties: - compute_units_to_tokens_multiplier: - type: string - format: uint64 - description: >- - The amount of upokt that a compute unit should translate to when - settling a session. - - TODO_DOCUMENT(@Olshansk): Make sure to document the units of this - parameter (or the map) once finalized. - description: >- - TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance - parameters. - - Params defines the parameters for the tokenomics module. - pocket.tokenomics.QueryParamsResponse: - type: object - properties: - params: - description: params defines the parameters of the module. - type: object - properties: - compute_units_to_tokens_multiplier: - type: string - format: uint64 - description: >- - The amount of upokt that a compute unit should translate to when - settling a session. - - TODO_DOCUMENT(@Olshansk): Make sure to document the units of this - parameter (or the map) once finalized. - description: QueryParamsResponse is the response type for the Query/Params RPC method. diff --git a/docs/template/index.tpl b/docs/template/index.tpl deleted file mode 100644 index ec098e82c..000000000 --- a/docs/template/index.tpl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - {{ .Title }} - - - - -
- - - - - -Footer -© 2022 GitHub, Inc. -Footer navigation diff --git a/docs/template/pkg/README.md b/docs/template/pkg/README.md deleted file mode 100644 index 10fdc2755..000000000 --- a/docs/template/pkg/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# Package [PackageName] - -> Brief one-liner or quote about what this package does. - -## Overview - -Provide a few sentences about the purpose and functionality of this package. Consider: -- What problems does it solve? -- Why would someone use this package as opposed to others or implementing their own solution? -- Any unique features or aspects that stand out. - -## Architecture Diagrams - -Visual representations often make it easier to understand the design and flow of a package. Below are the architecture diagrams that explain the high-level structure and interactions in this package: - -```mermaid ---- -title: Architecture Overview ---- -flowchart -``` - -> **Figure 1**: Brief description about what this diagram represents. - -```mermaid ---- -title: Another Diagram ---- -flowchart -``` - -> **Figure 2**: Brief description about what this other diagram represents. - -If you have multiple diagrams, you can explain each one separately or provide a list. - -## Installation - -```bash -go get github.com/yourusername/yourproject/[PackageName] -``` - -## Features - -- **Feature 1**: A brief description. -- **Feature 2**: Another description. -- ... - -## Usage - -### Basic Example - -```go -// A simple and concise code example showing the most common use case. -``` - -### Advanced Usage - -For complex features or functionalities, it's good to have a separate section: - -```go -// Advanced code example or usage. -``` - -### Configuration - -If the package can be configured in some way, describe it here: - -- **Config Option 1**: Explanation. -- **Config Option 2**: Explanation. - -## API Reference - -For the complete API details, see the [godoc](https://pkg.go.dev/github.com/pokt-network/poktroll/[PackageName]). - -## Best Practices - -- **Practice 1**: Description and rationale. -- **Practice 2**: Another helpful practice. - -## FAQ - -#### Question 1? - -Answer for question 1. - -#### Question 2? - -Answer for question 2. \ No newline at end of file diff --git a/go.mod b/go.mod deleted file mode 100644 index d8360ef37..000000000 --- a/go.mod +++ /dev/null @@ -1,313 +0,0 @@ -// NB: Since this repostiory was scaffolded using `ignite s chain pocket` -// but the module was later renamed to github.com/pokt-network/poktroll, we -// need to swap the two lines below only during the scaffolding operation. -// NOTE that the operation is expected to error out but all the necesary -// types and functions will be scaffolded correctly. -// Ref: https://github.com/ignite/cli/issues/3737 -// -// The following will need to be done manually after the scaffold: -// - Reverting the module name in go.mod (this file) -// - Manually updating imports in .go files: "pocket/x/" => "github.com/pokt-network/pocket/x/" -// - Manually `option go_package` in .proto files: `option go_package = "pocket` => `option go_package = "github.com/pokt-network/poktroll` -// - If an empty `service Msg {}` is generated in a `tx.proto` file, remove it - -// module pocket -module github.com/pokt-network/poktroll - -go 1.20 - -require ( - cosmossdk.io/api v0.3.1 - cosmossdk.io/depinject v1.0.0-alpha.4 - cosmossdk.io/errors v1.0.0 - cosmossdk.io/math v1.1.2 - github.com/athanorlabs/go-dleq v0.1.0 - github.com/cometbft/cometbft v0.37.2 - github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-sdk v0.47.5 - github.com/cosmos/gogoproto v1.4.11 - github.com/cosmos/ibc-go/v7 v7.3.1 - github.com/go-kit/kit v0.13.0 - github.com/gogo/status v1.1.1 - github.com/golang/mock v1.6.0 - github.com/golang/protobuf v1.5.3 - github.com/gorilla/mux v1.8.0 - github.com/gorilla/websocket v1.5.0 - github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 - github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f - github.com/pokt-network/smt v0.9.2 - github.com/pokt-network/smt/kvstore/badger v0.0.0-20240104123447-abb5c71c14ce - github.com/prometheus/client_golang v1.17.0 - github.com/regen-network/gocuke v0.6.2 - github.com/rs/zerolog v1.30.0 - github.com/slok/go-http-metrics v0.11.0 - github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.7.0 - github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.8.4 - go.uber.org/multierr v1.11.0 - golang.org/x/crypto v0.15.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/sync v0.5.0 - google.golang.org/grpc v1.59.0 - gopkg.in/yaml.v2 v2.4.0 -) - -require ( - cloud.google.com/go v0.110.7 // indirect - cloud.google.com/go/compute v1.23.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.1 // indirect - cloud.google.com/go/storage v1.30.1 // indirect - cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/log v1.2.1 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect - filippo.io/edwards25519 v1.0.0 // indirect - github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/alecthomas/participle/v2 v2.0.0-alpha7 // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect - github.com/benbjohnson/clock v1.3.5 // 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/celestiaorg/go-fraud v0.2.0 // indirect - github.com/celestiaorg/go-header v0.4.1 // indirect - github.com/celestiaorg/go-libp2p-messenger v0.2.0 // indirect - github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect - github.com/celestiaorg/nmt v0.20.0 // indirect - github.com/celestiaorg/rsmt2d v0.11.0 // indirect - github.com/celestiaorg/utils v0.1.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/chzyer/readline v1.5.1 // indirect - github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/apd/v3 v3.1.0 // indirect - github.com/cockroachdb/errors v1.10.0 // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/redact v1.1.5 // indirect - github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/confio/ics23/go v0.9.0 // indirect - github.com/containerd/cgroups v1.1.0 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v0.20.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.6.1 // indirect - github.com/cucumber/common/gherkin/go/v22 v22.0.0 // indirect - github.com/cucumber/common/messages/go/v17 v17.1.1 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // 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/badger/v3 v3.2103.5 // indirect - github.com/dgraph-io/badger/v4 v4.2.0 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/go-units v0.5.0 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect - github.com/elastic/gosigar v0.14.2 // indirect - github.com/felixge/httpsnoop v1.0.2 // indirect - github.com/filecoin-project/go-jsonrpc v0.3.1 // indirect - github.com/flynn/noise v1.0.0 // indirect - github.com/francoispqt/gojay v1.2.13 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/getsentry/sentry-go v0.23.0 // indirect - github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/gofrs/uuid v4.3.1+incompatible // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.3 // indirect - github.com/golang/glog v1.1.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.1.2 // indirect - github.com/google/flatbuffers v2.0.0+incompatible // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/google/gopacket v1.1.19 // indirect - github.com/google/orderedcode v0.0.1 // indirect - github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect - github.com/google/s2a-go v0.1.7 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/rpc v1.2.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect - github.com/hashicorp/errwrap v1.1.0 // 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-multierror v1.1.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/golang-lru/v2 v2.0.5 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect - github.com/huandu/skiplist v1.2.0 // indirect - github.com/huin/goupnp v1.2.0 // indirect - github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/ipfs/boxo v0.8.0 // indirect - github.com/ipfs/go-cid v0.4.1 // indirect - github.com/ipfs/go-datastore v0.6.0 // indirect - github.com/ipfs/go-ds-badger3 v0.0.2 // indirect - github.com/ipfs/go-ipfs-util v0.0.2 // indirect - github.com/ipfs/go-log v1.0.5 // indirect - github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/ipld/go-ipld-prime v0.20.0 // indirect - github.com/jackpal/go-nat-pmp v1.0.2 // indirect - github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect - github.com/jbenet/goprocess v0.1.4 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.1 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect - github.com/klauspost/reedsolomon v1.11.8 // indirect - github.com/koron/go-ssdp v0.0.4 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/libp2p/go-cidranger v1.1.0 // indirect - github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.30.0 // indirect - github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect - github.com/libp2p/go-libp2p-kad-dht v0.23.0 // indirect - github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect - github.com/libp2p/go-libp2p-pubsub v0.9.3 // indirect - github.com/libp2p/go-libp2p-record v0.2.0 // indirect - github.com/libp2p/go-msgio v0.3.0 // indirect - github.com/libp2p/go-nat v0.2.0 // indirect - github.com/libp2p/go-netroute v0.2.1 // indirect - github.com/libp2p/go-reuseport v0.4.0 // indirect - github.com/libp2p/go-yamux/v4 v4.0.1 // indirect - github.com/linxGnu/grocksdb v1.7.16 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/manifoldco/promptui v0.9.0 // indirect - github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/miekg/dns v1.1.55 // indirect - github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect - github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect - github.com/minio/highwayhash v1.0.2 // indirect - github.com/minio/sha256-simd v1.0.1 // 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/mr-tron/base58 v1.2.0 // indirect - github.com/mtibben/percent v0.2.1 // indirect - github.com/multiformats/go-base32 v0.1.0 // indirect - github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.0 // indirect - github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect - github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect - github.com/multiformats/go-multibase v0.2.0 // indirect - github.com/multiformats/go-multicodec v0.9.0 // indirect - github.com/multiformats/go-multihash v0.2.3 // indirect - github.com/multiformats/go-multistream v0.4.1 // indirect - github.com/multiformats/go-varint v0.0.7 // indirect - github.com/onsi/ginkgo/v2 v2.11.0 // indirect - github.com/opencontainers/runtime-spec v1.1.0 // indirect - github.com/opentracing/opentracing-go v1.2.0 // indirect - github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // 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/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect - github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.3.2 // indirect - github.com/quic-go/quic-go v0.37.6 // indirect - github.com/quic-go/webtransport-go v0.5.3 // indirect - github.com/rakyll/statik v0.1.7 // indirect - github.com/raulk/go-watchdog v1.3.0 // indirect - github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rollkit/celestia-openrpc v0.3.0 // indirect - github.com/rollkit/rollkit v0.10.6 // indirect - github.com/rs/cors v1.10.1 // indirect - github.com/sagikazarmark/locafero v0.3.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/afero v1.10.0 // indirect - github.com/spf13/viper v1.17.0 // indirect - github.com/stretchr/objx v0.5.1 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tendermint/tendermint v0.35.9 // indirect - github.com/tidwall/btree v1.6.0 // indirect - github.com/ulikunitz/xz v0.5.11 // indirect - github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect - go.etcd.io/bbolt v1.3.7 // indirect - go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/otel v1.16.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect - go.uber.org/dig v1.17.0 // indirect - go.uber.org/fx v1.20.0 // indirect - go.uber.org/zap v1.25.0 // indirect - golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect - golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/term v0.14.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.15.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - gonum.org/v1/gonum v0.11.0 // indirect - google.golang.org/api v0.143.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools/v3 v3.5.0 // indirect - lukechampine.com/blake3 v1.2.1 // indirect - nhooyr.io/websocket v1.8.7 // indirect - pgregory.net/rapid v0.5.5 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect -) - -replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - -// TODO_DOCUMENT(@okdas): Updating this line alone bumps the rest of the dependencies -replace github.com/cosmos/cosmos-sdk => github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs - -replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum deleted file mode 100644 index 5edf1f0d7..000000000 --- a/go.sum +++ /dev/null @@ -1,2932 +0,0 @@ -4d63.com/gochecknoglobals v0.1.0/go.mod h1:wfdC5ZjKSPr7CybKEcgJhUOgeAQW1+7WcyK8OvUilfo= -bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.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.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.60.0/go.mod h1:yw2G51M9IfRboUH61Us8GqCeF1PzPblB823Mn2q2eAU= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= -cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= -cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= -cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= -cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= -cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= -cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= -cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= -cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= -cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= -cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= -cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= -cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= -cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= -cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= -cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= -cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= -cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= -cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= -cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= -cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= -cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= -cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= -cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= -cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= -cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= -cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= -cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= -cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= -cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= -cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= -cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= -cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= -cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= -cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= -cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= -cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= -cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= -cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= -cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= -cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= -cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= -cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= -cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= -cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= -cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= -cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= -cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= -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.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= -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/pubsub v1.5.0/go.mod h1:ZEwJccE3z93Z2HWvstpri00jOg7oO4UZDtKhwDwqF0w= -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/spanner v1.7.0/go.mod h1:sd3K2gZ9Fd0vMPLXzeCrF6fq4i63Q7aTLW/lBIfBkIk= -cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= -cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= -cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= -cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= -cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= -cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= -cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= -cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= -cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= -cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= -cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= -cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= -cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= -cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= -cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= -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.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= -cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= -cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= -cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= -cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= -github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= -github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.0/go.mod h1:n/vLeA7V+QY84iYAGwMkkUUp9ooeuftMEvaDrSVch+Q= -github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -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/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= -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/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -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/repr v0.0.0-20181024024818-d37bc2a10ba1 h1:GDQdwm/gAcJcLAKQQZGOJ4knlw+7rfEQQcmwTbt4p5E= -github.com/alecthomas/repr v0.0.0-20181024024818-d37bc2a10ba1/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= -github.com/alingse/asasalint v0.0.10/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= -github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= -github.com/athanorlabs/go-dleq v0.1.0 h1:0/llWZG8fz2uintMBKOiBC502zCsDA8nt8vxI73W9Qc= -github.com/athanorlabs/go-dleq v0.1.0/go.mod h1:DWry6jSD7A13MKmeZA0AX3/xBeQCXDoygX99VPwL3yU= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= -github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= -github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= -github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= -github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= -github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= -github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= -github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= -github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -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/buf v1.3.1/go.mod h1:CTRUb23N+zlm1U8ZIBKz0Sqluk++qQloB2i/MZNZHIs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= -github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= -github.com/celestiaorg/go-fraud v0.2.0 h1:aaq2JiW0gTnhEdac3l51UCqSyJ4+VjFGTTpN83V4q7I= -github.com/celestiaorg/go-fraud v0.2.0/go.mod h1:lNY1i4K6kUeeE60Z2VK8WXd+qXb8KRzfBhvwPkK6aUc= -github.com/celestiaorg/go-header v0.4.1 h1:bjbUcKDnhrJJ9EoE7vtPpgleNLVjc2S+cB4/qe8nQmo= -github.com/celestiaorg/go-header v0.4.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= -github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao= -github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo= -github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= -github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= -github.com/celestiaorg/nmt v0.20.0 h1:9i7ultZ8Wv5ytt8ZRaxKQ5KOOMo4A2K2T/aPGjIlSas= -github.com/celestiaorg/nmt v0.20.0/go.mod h1:Oz15Ub6YPez9uJV0heoU4WpFctxazuIhKyUtaYNio7E= -github.com/celestiaorg/rsmt2d v0.11.0 h1:lcto/637WyTEZR3dLRoNvyuExfnUbxvdvKi3qz/2V4k= -github.com/celestiaorg/rsmt2d v0.11.0/go.mod h1:6Y580I3gVr0+OVFfW6m2JTwnCCmvW3WfbwSLfuT+HCA= -github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo= -github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU= -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/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/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/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4/go.mod h1:W8EnPSQ8Nv4fUjc/v1/8tHFqhuOJXnRub0dTfuAQktU= -github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= -github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= -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/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= -github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/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/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= -github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= -github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= -github.com/cockroachdb/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/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= -github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= -github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= -github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= -github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= -github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= -github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -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/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= -github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/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/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= -github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= -github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.3.1 h1:bil1IjnHdyWDASFYKfwdRiNtFP6WK3osW7QFEAgU4I8= -github.com/cosmos/ibc-go/v7 v7.3.1/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/atomicfile v0.2.6/go.mod h1:BRq8Une6ckFneYXZQ+kO7p1ZZP3I2fzVzf28JxrIkBc= -github.com/creachadair/command v0.0.0-20220426235536-a748effdf6a1/go.mod h1:bAM+qFQb/KwWyCc9MLC4U1jvn3XyakqP5QRkds5T6cY= -github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= -github.com/creachadair/taskgroup v0.6.1 h1:KQfRG4VhSj2qoXPkzXrsTaT8oZsMCZD0+KRll2jbF78= -github.com/creachadair/taskgroup v0.6.1/go.mod h1:2vCkZ5a+HVcvDl3llMpox2lTw0+MSzrkGsddxRAHXOo= -github.com/creachadair/tomledit v0.0.22/go.mod h1:cIu/4x5L855oSRejIqr+WRFh+mv9g4fWLiUFaApYn/Y= -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/creack/pty v1.1.11/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/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/daixiang0/gci v0.4.2/go.mod h1:d0f+IJhr9loBtIq+ebwhRoTt1LGbPH96ih8bKlsRT9E= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= -github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= -github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -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/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= -github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= -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.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= -github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= -github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= -github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= -github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= -github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= -github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= -github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -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.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= -github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= -github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/filecoin-project/go-jsonrpc v0.3.1 h1:qwvAUc5VwAkooquKJmfz9R2+F8znhiqcNHYjEp/NM10= -github.com/filecoin-project/go-jsonrpc v0.3.1/go.mod h1:jBSvPTl8V1N7gSTuCR4bis8wnQnIjHbRPpROol6iQKM= -github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= -github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= -github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= -github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -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 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-critic/go-critic v0.6.3/go.mod h1:c6b3ZP1MQ7o6lPR7Rv3lEf7pYQUmAcx8ABHgdZCQt/k= -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-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= -github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= -github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -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.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -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.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= -github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= -github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astequal v1.0.1/go.mod h1:4oGA3EZXTVItV/ipGiOx7NWkY5veFfcsOJVS2YxltLw= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= -github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= -github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= -github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= -github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI= -github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -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.1 h1:DuHXlSFHNKqTQ+/ACf5Vs6r4X/dH2EgIzR9Vr+H65kg= -github.com/gogo/status v1.1.1/go.mod h1:jpG3dM5QPcqu19Hg8lkUhBFBa3TcLs1DG7+2Jqci7oU= -github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= -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.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= -github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= -github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.47.0/go.mod h1:3TZhfF5KolbIkXYjUFvER6G9CoxzLEaafr/u/QI1S5A= -github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= -github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.3.5/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2/go.mod h1:LK+zW4MpyytAWQRz0M4xnzEk50lSvqDQKfx304apFkY= -github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= -github.com/google/certificate-transparency-go v1.1.1/go.mod h1:FDKqPvSXawb2ecErVRrD+nfy23RCzyl7eqVCEmlT1Zs= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/flatbuffers v2.0.0+incompatible h1:dicJ2oXwypfwUGnB2/TYWYEKiuk9eYQlQO/AnOHl5mI= -github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= -github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= -github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= -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/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-20200507031123-427632fa3b1c/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-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/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo= -github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -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/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/google/trillian v1.3.11/go.mod h1:0tPraVHrSDkA3BO6vKX67zgLXs6SsOAbHEivX+9mPgw= -github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -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.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.3.1 h1:SBWmZhjUDRorQxrN0nwzf+AHBxnbFjViHQS4P0yVpmQ= -github.com/googleapis/enterprise-certificate-proxy v0.3.1/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= -github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= -github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= -github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= -github.com/gostaticanalysis/analysisutil v0.4.1/go.mod h1:18U/DLpRgIUd459wGxVHE0fRgmo1UgHDcbw7F5idXu0= -github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= -github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= -github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= -github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= -github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= -github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= -github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= -github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= -github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -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-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= -github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= -github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= -github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4= -github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= -github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -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/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= -github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= -github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= -github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/ipfs/boxo v0.8.0 h1:UdjAJmHzQHo/j3g3b1bAcAXCj/GM6iTwvSlBDvPBNBs= -github.com/ipfs/boxo v0.8.0/go.mod h1:RIsi4CnTyQ7AUsNn5gXljJYZlQrHBMnJp94p73liFiA= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= -github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-cid v0.1.0/go.mod h1:rH5/Xv83Rfy8Rw6xG+id3DYAMUVmem1MowoKwdXmN2o= -github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= -github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= -github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= -github.com/ipfs/go-datastore v0.5.1/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= -github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= -github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= -github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.3.0/go.mod h1:1ke6mXNqeV8K3y5Ak2bAA0osoTfmxUdupVCGm4QUIek= -github.com/ipfs/go-ds-badger3 v0.0.2 h1:+pME0YfRnbUKhvySnakNMuCMsUUhmGfwIsH/nnHZ7QY= -github.com/ipfs/go-ds-badger3 v0.0.2/go.mod h1:6/yjF1KaOU+IpCaqMV43yoWIdxHqOAJlO9EhWLnZSkI= -github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= -github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs= -github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= -github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= -github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= -github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= -github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM= -github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= -github.com/ipfs/go-log/v2 v2.3.0/go.mod h1:QqGoj30OTpnKaG/LKTGTxoP2mmQtjVMEnK72gynbe/g= -github.com/ipfs/go-log/v2 v2.5.0/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= -github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= -github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= -github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= -github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= -github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= -github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= -github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -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/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= -github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f/go.mod h1:qr2b5kx4HbFS7/g4uYO5qv9ei8303JMsC7ESbYiqr2Q= -github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= -github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= -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/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.6.1/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= -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.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.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.1 h1:NE3C767s2ak2bweCZo3+rdP4U/HoyVXLv/X9f2gPS5g= -github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY= -github.com/klauspost/reedsolomon v1.11.8/go.mod h1:4bXRN+cVzMdml6ti7qLouuYi32KHJ5MGv0Qd8a47h6A= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/koron/go-ssdp v0.0.2/go.mod h1:XoLfkAiA2KeZsYh4DbHxD7h3nR2AZNqVQOa+LJuqPYs= -github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= -github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= -github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= -github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= -github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/libp2p/go-addr-util v0.1.0/go.mod h1:6I3ZYuFr2O/9D+SoyM0zEw0EF3YkldtTX406BpdQMqw= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -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/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= -github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= -github.com/libp2p/go-conn-security-multistream v0.3.0/go.mod h1:EEP47t4fw/bTelVmEzIDqSe69hO/ip52xBEhZMLWAHM= -github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= -github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= -github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.19.0/go.mod h1:Ki9jJXLO2YqrTIFxofV7Twyd3INWPT97+r8hGt7XPjI= -github.com/libp2p/go-libp2p v0.30.0 h1:9EZwFtJPFBcs/yJTnP90TpN1hgrT/EsFfM+OZuwV87U= -github.com/libp2p/go-libp2p v0.30.0/go.mod h1:nr2g5V7lfftwgiJ78/HrID+pwvayLyqKCEirT2Y3Byg= -github.com/libp2p/go-libp2p-asn-util v0.1.0/go.mod h1:wu+AnM9Ii2KgO5jMmS1rz9dvzTdj8BXqsPR9HR0XB7I= -github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= -github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= -github.com/libp2p/go-libp2p-blankhost v0.2.0/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ= -github.com/libp2p/go-libp2p-blankhost v0.3.0/go.mod h1:urPC+7U01nCGgJ3ZsV8jdwTp6Ji9ID0dMTvq+aJ+nZU= -github.com/libp2p/go-libp2p-circuit v0.6.0/go.mod h1:kB8hY+zCpMeScyvFrKrGicRdid6vNXbunKE4rXATZ0M= -github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= -github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= -github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= -github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.6.0/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.8.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= -github.com/libp2p/go-libp2p-core v0.8.6/go.mod h1:dgHr0l0hIKfWpGpqAMbpo19pen9wJfdCGv51mTmdpmM= -github.com/libp2p/go-libp2p-core v0.10.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQRAMf0sX9mf2sbGg= -github.com/libp2p/go-libp2p-core v0.11.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQRAMf0sX9mf2sbGg= -github.com/libp2p/go-libp2p-core v0.12.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQRAMf0sX9mf2sbGg= -github.com/libp2p/go-libp2p-core v0.14.0/go.mod h1:tLasfcVdTXnixsLB0QYaT1syJOhsbrhG7q6pGrHtBg8= -github.com/libp2p/go-libp2p-core v0.15.1/go.mod h1:agSaboYM4hzB1cWekgVReqV5M4g5M+2eNNejV+1EEhs= -github.com/libp2p/go-libp2p-kad-dht v0.23.0 h1:sxE6LxLopp79eLeV695n7+c77V/Vn4AMF28AdM/XFqM= -github.com/libp2p/go-libp2p-kad-dht v0.23.0/go.mod h1:oO5N308VT2msnQI6qi5M61wzPmJYg7Tr9e16m5n7uDU= -github.com/libp2p/go-libp2p-kbucket v0.5.0 h1:g/7tVm8ACHDxH29BGrpsQlnNeu+6OF1A9bno/4/U1oA= -github.com/libp2p/go-libp2p-kbucket v0.5.0/go.mod h1:zGzGCpQd78b5BNTDGHNDLaTt9aDK/A02xeZp9QeFC4U= -github.com/libp2p/go-libp2p-mplex v0.4.1/go.mod h1:cmy+3GfqfM1PceHTLL7zQzAAYaryDu6iPSC+CIb094g= -github.com/libp2p/go-libp2p-mplex v0.5.0/go.mod h1:eLImPJLkj3iG5t5lq68w3Vm5NAQ5BcKwrrb2VmOYb3M= -github.com/libp2p/go-libp2p-nat v0.1.0/go.mod h1:DQzAG+QbDYjN1/C3B6vXucLtz3u9rEonLVPtZVzQqks= -github.com/libp2p/go-libp2p-noise v0.4.0/go.mod h1:BzzY5pyzCYSyJbQy9oD8z5oP2idsafjt4/X42h9DjZU= -github.com/libp2p/go-libp2p-peerstore v0.4.0/go.mod h1:rDJUFyzEWPpXpEwywkcTYYzDHlwza8riYMaUzaN6hX0= -github.com/libp2p/go-libp2p-peerstore v0.6.0/go.mod h1:DGEmKdXrcYpK9Jha3sS7MhqYdInxJy84bIPtSu65bKc= -github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= -github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= -github.com/libp2p/go-libp2p-pubsub v0.9.3/go.mod h1:RYA7aM9jIic5VV47WXu4GkcRxRhrdElWf8xtyli+Dzc= -github.com/libp2p/go-libp2p-quic-transport v0.13.0/go.mod h1:39/ZWJ1TW/jx1iFkKzzUg00W6tDJh73FC0xYudjr7Hc= -github.com/libp2p/go-libp2p-quic-transport v0.16.0/go.mod h1:1BXjVMzr+w7EkPfiHkKnwsWjPjtfaNT0q8RS3tGDvEQ= -github.com/libp2p/go-libp2p-quic-transport v0.17.0/go.mod h1:x4pw61P3/GRCcSLypcQJE/Q2+E9f4X+5aRcZLXf20LM= -github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= -github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= -github.com/libp2p/go-libp2p-resource-manager v0.2.1/go.mod h1:K+eCkiapf+ey/LADO4TaMpMTP9/Qde/uLlrnRqV4PLQ= -github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL0L1lXUZ5ot2Fvc= -github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA= -github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= -github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= -github.com/libp2p/go-libp2p-testing v0.1.2-0.20200422005655-8775583591d8/go.mod h1:Qy8sAncLKpwXtS2dSnDOP8ktexIAHKu+J+pnZOFZLTc= -github.com/libp2p/go-libp2p-testing v0.4.0/go.mod h1:Q+PFXYoiYFN5CAEG2w3gLPEzotlKsNSbKQ/lImlOWF0= -github.com/libp2p/go-libp2p-testing v0.5.0/go.mod h1:QBk8fqIL1XNcno/l3/hhaIEn4aLRijpYOR+zVjjlh+A= -github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2Cl+FAjoWIA2pa0X6E= -github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= -github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= -github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= -github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= -github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= -github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= -github.com/libp2p/go-libp2p-transport-upgrader v0.7.0/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= -github.com/libp2p/go-libp2p-transport-upgrader v0.7.1/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= -github.com/libp2p/go-libp2p-yamux v0.5.0/go.mod h1:AyR8k5EzyM2QN9Bbdg6X1SkVVuqLwTGf0L4DFq9g6po= -github.com/libp2p/go-libp2p-yamux v0.8.0/go.mod h1:yTkPgN2ib8FHyU1ZcVD7aelzyAqXXwEPbyx+aSKm9h8= -github.com/libp2p/go-libp2p-yamux v0.8.1/go.mod h1:rUozF8Jah2dL9LLGyBaBeTQeARdwhefMCTQVQt6QobE= -github.com/libp2p/go-libp2p-yamux v0.9.1/go.mod h1:wRc6wvyxQINFcKe7daL4BeQ02Iyp+wxyC8WCNfngBrA= -github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= -github.com/libp2p/go-mplex v0.3.0/go.mod h1:0Oy/A9PQlwBytDRp4wSkFnzHYDKcpLot35JQ6msjvYQ= -github.com/libp2p/go-mplex v0.4.0/go.mod h1:y26Lx+wNVtMYMaPu300Cbot5LkEZ4tJaNYeHeT9dh6E= -github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= -github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= -github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= -github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= -github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk= -github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk= -github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-netroute v0.1.3/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-netroute v0.1.5/go.mod h1:V1SR3AaECRkEQCoFFzYwVYWvYIEtlxx89+O3qcpCl4A= -github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= -github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= -github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= -github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.7/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-reuseport v0.1.0/go.mod h1:bQVn9hmfcTaoo0c9v5pBhOarsU1eNOBZdaAd2hzXRKU= -github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s= -github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= -github.com/libp2p/go-reuseport-transport v0.1.0/go.mod h1:vev0C0uMkzriDY59yFHD9v+ujJvYmDQVLowvAjEOmfw= -github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= -github.com/libp2p/go-stream-muxer-multistream v0.4.0/go.mod h1:nb+dGViZleRP4XcyHuZSVrJCBl55nRBOMmiSL/dyziw= -github.com/libp2p/go-tcp-transport v0.4.0/go.mod h1:0y52Rwrn4076xdJYu/51/qJIdxz+EWDAOG2S45sV3VI= -github.com/libp2p/go-tcp-transport v0.5.0/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= -github.com/libp2p/go-tcp-transport v0.5.1/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= -github.com/libp2p/go-ws-transport v0.6.0/go.mod h1:dXqtI9e2JV9FtF1NOtWVZSKXh5zXvnuwPXfj8GPBbYU= -github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= -github.com/libp2p/go-yamux/v3 v3.0.1/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= -github.com/libp2p/go-yamux/v3 v3.0.2/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= -github.com/libp2p/go-yamux/v3 v3.1.1/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= -github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= -github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= -github.com/libp2p/zeroconf/v2 v2.1.1/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= -github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= -github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= -github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= -github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= -github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -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-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/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/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= -github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= -github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= -github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= -github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= -github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= -github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= -github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= -github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.13/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.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= -github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.2.1/go.mod h1:+Ro3wqY4vakcYNtkBWdZC7dBg1xSB6sp054wWwmeFm0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/miekg/dns v1.1.48/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= -github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= -github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= -github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= -github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= -github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= -github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= -github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= -github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= -github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= -github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -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-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= -github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= -github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= -github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= -github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= -github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mroth/weightedrand v0.4.1/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= -github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM= -github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= -github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= -github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= -github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= -github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= -github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= -github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= -github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI= -github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc= -github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0= -github.com/multiformats/go-multiaddr v0.4.0/go.mod h1:YcpyLH8ZPudLxQlemYBPhSm0/oCXAT8Z4mzFpyoPyRc= -github.com/multiformats/go-multiaddr v0.4.1/go.mod h1:3afI9HfVW8csiF8UZqtpYRiDyew8pRX7qLIGHu9FLuM= -github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar+bR+gh4zgbfr3SNug= -github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= -github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= -github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= -github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= -github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= -github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= -github.com/multiformats/go-multiaddr-net v0.2.0/go.mod h1:gGdH3UXny6U3cKKYCvpXI5rnK7YaOIEOPVDI9tsJbEA= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= -github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= -github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ= -github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= -github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= -github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= -github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= -github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= -github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38= -github.com/multiformats/go-multistream v0.2.1/go.mod h1:5GZPQZbkWOLOn3J2y4Y99vVW7vOfsAflxARk3x14o6k= -github.com/multiformats/go-multistream v0.3.0/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= -github.com/multiformats/go-multistream v0.3.1/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= -github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= -github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= -github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= -github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= -github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= -github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= -github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.8.1/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= -github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= -github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f h1:1+NP/H13eFAqBYrGpRkbJUWVWIO2Zr2eP7a/q0UtZVQ= -github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f/go.mod h1:0t3gzoSfW2bkTce1E/Jis3MQpjiKGhAgqieFK+nkQsI= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oasisprotocol/curve25519-voi v0.0.0-20210609091139-0a56a4bca00b/go.mod h1:TLJifjWF6eotcfzDjKZsDqWJ+73Uvj/N85MvVyrvynM= -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/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2/go.mod h1:rSAaSIOAGT9odnlyGlUfAJaoc5w2fSBUmeGDbRWPxyQ= -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.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= -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/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= -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.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= -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.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -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.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= -github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= -github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= -github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= -github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= -github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= -github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= -github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= -github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= -github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -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/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= -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= -github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pokt-network/smt v0.9.2 h1:h/GnFm1F6mNBbF1hopr+9+y7nr173SU55NX7NxTVU0Y= -github.com/pokt-network/smt v0.9.2/go.mod h1:S4Ho4OPkK2v2vUCHNtA49XDjqUC/OFYpBbynRVYmxvA= -github.com/pokt-network/smt/kvstore/badger v0.0.0-20240104123447-abb5c71c14ce h1:JCpmaD35pHq9VWbePNuysIVOX5ybmVzThNY2BcurjVE= -github.com/pokt-network/smt/kvstore/badger v0.0.0-20240104123447-abb5c71c14ce/go.mod h1:VG/uGRf6wmiDnSxee8rmVtmtLXrVM2SK4/xXtrBFeZ0= -github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= -github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= -github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= -github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/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= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.33.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -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.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= -github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= -github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a/go.mod h1:VMX+OnnSw4LicdiEGtRSD/1X8kW7GuEscjYNr4cOIT4= -github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.16/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= -github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= -github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= -github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= -github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/qtls-go1-20 v0.3.2 h1:rRgN3WfnKbyik4dBV8A6girlJVxGand/d+jVKbQq5GI= -github.com/quic-go/qtls-go1-20 v0.3.2/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.37.6 h1:2IIUmQzT5YNxAiaPGjs++Z4hGOtIR0q79uS5qE9ccfY= -github.com/quic-go/quic-go v0.37.6/go.mod h1:YsbH1r4mSHPJcLF4k4zruUkLBqctEMBDR6VPvcYjIsU= -github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= -github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= -github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= -github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= -github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= -github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/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/remyoudompheng/go-dbus v0.0.0-20121104212943-b7232d34b1d5/go.mod h1:+u151txRmLpwxBmpYn9z3d1sdJdjRPQpsXuYeY9jNls= -github.com/remyoudompheng/go-liblzma v0.0.0-20190506200333-81bf2d431b96/go.mod h1:90HvCY7+oHHUKkbeMCiHt1WuFR2/hPJ9QrljDG+v6ls= -github.com/remyoudompheng/go-misc v0.0.0-20190427085024-2d6ac652a50e/go.mod h1:80FQABjoFzZ2M5uEa6FUaJYEmqU2UOKojlFVak1UAwI= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -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.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rollkit/celestia-openrpc v0.3.0 h1:jMLsdLNQ7T20yiNDlisBhlyurFOpN1gZ6vC068FPrQA= -github.com/rollkit/celestia-openrpc v0.3.0/go.mod h1:2ZhU01YF2hsHIROWzxfMZOYM09Kgyy4roH5JWoNJzp0= -github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs h1:D9O/mnXjjIAF0mOsANByeWRwSDaVH587SjO6kgWVRyM= -github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs/go.mod h1:PNGEX1lXPh8yeJ6rYD6WkKJ6cwg4FuPh3OJzqpedKak= -github.com/rollkit/rollkit v0.10.6 h1:90EU4jSbIVGRhSmSfen5paJ92d2RtB9A84bbXX0cjCA= -github.com/rollkit/rollkit v0.10.6/go.mod h1:CfgrLRPIPXYH3gcxeanQM8QjLP26Q1NWHzI7lXGoU40= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= -github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= -github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= -github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.2.3/go.mod h1:rYbA/4Tg5c54mV1sv4sQTP5WOPBcoLtnBZ7/TEhXAbg= -github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= -github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= -github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= -github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/securego/gosec/v2 v2.12.0/go.mod h1:iTpT+eKTw59bSgklBHlSnH5O2tNygHMDxfvMubA4i7I= -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/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil/v3 v3.22.6/go.mod h1:EdIubSnZhbAvBS1yJ7Xi+AShB/hxwLHOMz4MCYz7yMs= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -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.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= -github.com/sivchari/nosnakecase v1.5.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= -github.com/sivchari/tenv v1.6.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/slok/go-http-metrics v0.11.0 h1:ABJUpekCZSkQT1wQrFvS4kGbhea/w6ndFJaWJeh3zL0= -github.com/slok/go-http-metrics v0.11.0/go.mod h1:ZGKeYG1ET6TEJpQx18BqAJAvxw9jBAZXCHU7bWQqqAc= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= -github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= -github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= -github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= -github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= -github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= -github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= -github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= -github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= -github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= -github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -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.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= -github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -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/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= -github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.35.9 h1:yUEgfkcNHWSidsU8wHjRDbYPVijV4cHxCclKVITGRAQ= -github.com/tendermint/tendermint v0.35.9/go.mod h1:FYvzUDkmVv1awfFl9V85yl5NKyjxz6XLZGX132+ftAY= -github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= -github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= -github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -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.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= -github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= -github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= -github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= -github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.6.2/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= -github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -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/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/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/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -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 v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.30.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= -github.com/valyala/quicktemplate v1.7.0/go.mod h1:sqKJnoaOF88V07vkO+9FL8fb9uZg/VPSJnLYn+LmLk8= -github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= -github.com/vektra/mockery/v2 v2.14.0/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M= -github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= -github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= -github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= -github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -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/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= -github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= -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.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= -gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= -gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975 h1:L/ENs/Ar1bFzUeKx6m3XjlmBgIUlykX9dzvp5k9NGxc= -gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 h1:dizWJqTWjwyD8KGcMOwgrkqu1JIkofYgKkmDeNE7oAs= -gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40/go.mod h1:rOnSnoRyxMI3fe/7KIbVcsHRGxe30OONv8dEgo+vCfA= -gitlab.com/bosi/decorder v0.2.2/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= -go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU= -go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= -go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= -go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= -go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= -go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= -go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= -go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= -go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= -go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= -go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= -go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -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.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= -go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= -go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/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= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200109152110-61a87790db17/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -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-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/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-20190313220215-9f648a60d977/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-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -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-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-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.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/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-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191206220618-eeba5f6aabab/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -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-20200602225109-6fdc65e7d980/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-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-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-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210317225723-c4fcb01b228e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/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-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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-20210616045830-e2b7044e8c71/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-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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-20220319134239-a9b59b0215f8/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-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/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-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.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.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/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-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/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-20190228203856-589c23e65e65/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/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-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190916130336-e45ffcd953cc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/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-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -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-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200630154851-b2d8b0336632/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200706234117-b22de6825cf7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201028025901-8cd080b735b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -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-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= -golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= -golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= -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.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= -gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.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.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= -google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= -google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.143.0 h1:o8cekTkqhywkbZT6p1UHJPZ9+9uuCAJs/KYomxZB8fA= -google.golang.org/api v0.143.0/go.mod h1:FoX9DO9hT7DLNn97OuoZAGSDuNAXdJRuGK98rSUgurk= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.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.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -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-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-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-20200626011028-ee7919e894b5/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200707001353-8e8330bf89df/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-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-20220519153652-3a47de7e79bd/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-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA= -google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb h1:lK0oleSc7IQsUxO3U5TjL9DWlsxpEBemh+zpB7IqhWI= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= -google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -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.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= -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.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -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.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-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/cheggaaa/pb.v1 v1.0.28/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/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.6/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/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= -gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.6/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/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.0/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/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -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.3.2/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= -lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= -lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= -lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= -lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= -mvdan.cc/gofumpt v0.3.1/go.mod h1:w3ymliuxvzVx8DAutBnVyDqYb1Niy/yCJt/lk821YCE= -mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= -mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5/go.mod h1:b8RRCBm0eeiWR8cfN88xeq2G5SG3VKGO+5UPWi5FSOY= -nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.4.8/go.mod h1:Z5PbWqjvWR1I3UGjvboUuan4fe4ZYEYNLNQLExzCoUs= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/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= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/proto/pocket/application/application.proto b/proto/pocket/application/application.proto deleted file mode 100644 index f4d3610ca..000000000 --- a/proto/pocket/application/application.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package pocket.application; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "gogoproto/gogo.proto"; - -import "pocket/shared/service.proto"; - -// Application defines the type used to store an on-chain definition and state for an application -message Application { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked - repeated shared.ApplicationServiceConfig service_configs = 3; // The list of services this appliccation is configured to request service for - repeated string delegatee_gateway_addresses = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.nullable) = false]; // The Bech32 encoded addresses for all delegatee Gateways, in a non-nullable slice -} diff --git a/proto/pocket/application/event.proto b/proto/pocket/application/event.proto deleted file mode 100644 index 619507cab..000000000 --- a/proto/pocket/application/event.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package pocket.application; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// EventRedelegation is an event emitted whenever an application changes its -// delegatee gateways on chain. This is in response to both a DelegateToGateway -// and UndelegateFromGateway message. -message EventRedelegation { - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "app_address"]; // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding - string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "gateway_address"]; // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding -} diff --git a/proto/pocket/application/genesis.proto b/proto/pocket/application/genesis.proto deleted file mode 100644 index e2741972a..000000000 --- a/proto/pocket/application/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.application; - -import "gogoproto/gogo.proto"; -import "pocket/application/params.proto"; -import "pocket/application/application.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// GenesisState defines the application module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Application applicationList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/application/params.proto b/proto/pocket/application/params.proto deleted file mode 100644 index 4914954f3..000000000 --- a/proto/pocket/application/params.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package pocket.application; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - - // The maximum number of gateways an application can delegate trust to - int64 max_delegated_gateways = 1 [(gogoproto.jsontag) = "max_delegated_gateways", (gogoproto.moretags) = "yaml:\"max_delegated_gateways\""]; -} \ No newline at end of file diff --git a/proto/pocket/application/query.proto b/proto/pocket/application/query.proto deleted file mode 100644 index 949ed3a07..000000000 --- a/proto/pocket/application/query.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; - -package pocket.application; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "pocket/application/params.proto"; -import "pocket/application/application.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/application/params"; - } - - // Queries a list of Application items. - rpc Application (QueryGetApplicationRequest) returns (QueryGetApplicationResponse) { - option (google.api.http).get = "/pocket/application/application/{address}"; - } - rpc ApplicationAll (QueryAllApplicationRequest) returns (QueryAllApplicationResponse) { - option (google.api.http).get = "/pocket/application/application"; - } -} -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetApplicationRequest { - string address = 1; -} - -message QueryGetApplicationResponse { - Application application = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllApplicationRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllApplicationResponse { - repeated Application application = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/application/tx.proto b/proto/pocket/application/tx.proto deleted file mode 100644 index 1f4b9674c..000000000 --- a/proto/pocket/application/tx.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; - -package pocket.application; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/msg/v1/msg.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - -// Msg defines the Msg service. -service Msg { - rpc StakeApplication (MsgStakeApplication ) returns (MsgStakeApplicationResponse ); - rpc UnstakeApplication (MsgUnstakeApplication ) returns (MsgUnstakeApplicationResponse ); - rpc DelegateToGateway (MsgDelegateToGateway ) returns (MsgDelegateToGatewayResponse ); - rpc UndelegateFromGateway (MsgUndelegateFromGateway) returns (MsgUndelegateFromGatewayResponse); -} -message MsgStakeApplication { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) - repeated shared.ApplicationServiceConfig services = 3; // The list of services this application is staked to request service for -} - -message MsgStakeApplicationResponse {} - -message MsgUnstakeApplication { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1; -} - -message MsgUnstakeApplicationResponse {} - -message MsgDelegateToGateway { - option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to delegate to using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding -} - -message MsgDelegateToGatewayResponse {} - -message MsgUndelegateFromGateway { - option (cosmos.msg.v1.signer) = "appAddress"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string appAddress = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - string gatewayAddress = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to undelegate from using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding -} - -message MsgUndelegateFromGatewayResponse {} - diff --git a/proto/pocket/gateway/gateway.proto b/proto/pocket/gateway/gateway.proto deleted file mode 100644 index ed7b08751..000000000 --- a/proto/pocket/gateway/gateway.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.gateway; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -message Gateway { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway has staked -} - diff --git a/proto/pocket/gateway/genesis.proto b/proto/pocket/gateway/genesis.proto deleted file mode 100644 index 85e6fb8a5..000000000 --- a/proto/pocket/gateway/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.gateway; - -import "gogoproto/gogo.proto"; -import "pocket/gateway/params.proto"; -import "pocket/gateway/gateway.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -// GenesisState defines the gateway module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated Gateway gatewayList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/gateway/params.proto b/proto/pocket/gateway/params.proto deleted file mode 100644 index 040f5630d..000000000 --- a/proto/pocket/gateway/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.gateway; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/pocket/gateway/query.proto b/proto/pocket/gateway/query.proto deleted file mode 100644 index 91080554d..000000000 --- a/proto/pocket/gateway/query.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; - -package pocket.gateway; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "pocket/gateway/params.proto"; -import "pocket/gateway/gateway.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/gateway/params"; - } - - // Queries a list of Gateway items. - rpc Gateway (QueryGetGatewayRequest) returns (QueryGetGatewayResponse) { - option (google.api.http).get = "/pocket/gateway/gateway/{address}"; - } - rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { - option (google.api.http).get = "/pocket/gateway/gateway"; - } -} -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetGatewayRequest { - string address = 1; -} - -message QueryGetGatewayResponse { - Gateway gateway = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllGatewayRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllGatewayResponse { - repeated Gateway gateway = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/gateway/tx.proto b/proto/pocket/gateway/tx.proto deleted file mode 100644 index 6b0814add..000000000 --- a/proto/pocket/gateway/tx.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; - -package pocket.gateway; - -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -// Msg defines the Msg service. -service Msg { - rpc StakeGateway (MsgStakeGateway ) returns (MsgStakeGatewayResponse ); - rpc UnstakeGateway (MsgUnstakeGateway) returns (MsgUnstakeGatewayResponse); -} -message MsgStakeGateway { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) -} - -message MsgStakeGatewayResponse {} - -message MsgUnstakeGateway { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1; -} - -message MsgUnstakeGatewayResponse {} diff --git a/proto/pocket/pocket/genesis.proto b/proto/pocket/pocket/genesis.proto deleted file mode 100644 index 52d21410c..000000000 --- a/proto/pocket/pocket/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -import "gogoproto/gogo.proto"; -import "pocket/pocket/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// GenesisState defines the pocket module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/pocket/params.proto b/proto/pocket/pocket/params.proto deleted file mode 100644 index a760a6fb6..000000000 --- a/proto/pocket/pocket/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/pocket/pocket/query.proto b/proto/pocket/pocket/query.proto deleted file mode 100644 index 55c4471c0..000000000 --- a/proto/pocket/pocket/query.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/pocket/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/pocket/params"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/proto/pocket/pocket/tx.proto b/proto/pocket/pocket/tx.proto deleted file mode 100644 index a0e741350..000000000 --- a/proto/pocket/pocket/tx.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package pocket.pocket; - -option go_package = "github.com/pokt-network/poktroll/x/pocket/types"; - -// Msg defines the Msg service. -service Msg {} \ No newline at end of file diff --git a/proto/pocket/service/genesis.proto b/proto/pocket/service/genesis.proto deleted file mode 100644 index 9e32feb53..000000000 --- a/proto/pocket/service/genesis.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "gogoproto/gogo.proto"; -import "pocket/service/params.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// GenesisState defines the service module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated pocket.shared.Service service_list = 2 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/service/params.proto b/proto/pocket/service/params.proto deleted file mode 100644 index 70e34a3c8..000000000 --- a/proto/pocket/service/params.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - - // The amount of uPOKT required to add a new service. - // This will be deducted from the signer's account balance, - // and transferred to the pocket network foundation. - uint64 add_service_fee = 1 - [(gogoproto.jsontag) = "add_service_fee"]; -} diff --git a/proto/pocket/service/query.proto b/proto/pocket/service/query.proto deleted file mode 100644 index 0ce354465..000000000 --- a/proto/pocket/service/query.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/service/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/service/params"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/service/relay.proto b/proto/pocket/service/relay.proto deleted file mode 100644 index 538f87610..000000000 --- a/proto/pocket/service/relay.proto +++ /dev/null @@ -1,47 +0,0 @@ -syntax = "proto3"; -package pocket.service; - -import "pocket/session/session.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Relay contains both the RelayRequest (signed by the Application) and the RelayResponse (signed by the Supplier). -// The serialized tuple is inserted into the SMST leaves as values in the Claim/Proof lifecycle. -message Relay { - RelayRequest req = 1; - RelayResponse res = 2; -} - -// RelayRequestMetadata contains the metadata for a RelayRequest. -message RelayRequestMetadata { - session.SessionHeader session_header = 1; // Session header associated with the relay. - // The request signature is a serialized ring signature that may have been - // by either the application itself or one of the gateways that the - // application has delegated to. The signature is made using the ring of the - // application in both cases. - bytes signature = 2; -} - -// RelayRequest holds the request details for a relay. -message RelayRequest { - RelayRequestMetadata meta = 1; - // payload is the serialized payload for the request. - // The payload is passed directly to the service and as such can be any - // format that the service supports: JSON-RPC, REST, gRPC, etc. - bytes payload = 2; -} - -// RelayResponse contains the response details for a RelayRequest. -message RelayResponse { - RelayResponseMetadata meta = 1; - // payload is the serialized payload for the response. - // The payload is passed directly from the service and as such can be any - // format the the service responds with: JSON-RPC, REST, gRPC, etc. - bytes payload = 2; -} - -// RelayResponseMetadata contains the metadata for a RelayResponse. -message RelayResponseMetadata { - session.SessionHeader session_header = 1; // Session header associated with the relay. - bytes supplier_signature = 2; // Signature of the supplier on the response. -} diff --git a/proto/pocket/service/tx.proto b/proto/pocket/service/tx.proto deleted file mode 100644 index 4a22016e1..000000000 --- a/proto/pocket/service/tx.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; - -package pocket.service; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - -// Msg defines the Msg service. -service Msg { - rpc AddService (MsgAddService) returns (MsgAddServiceResponse); -} - -// MsgAddService defines a message for adding a new message to the network. -// Services can be added by any actor in the network making them truly -// permissionless. -// TODO_DOCUMENT(@h5law): This is a key function in making services -// permissionless, document it's usage and design - in docusaurus covering how -// the entire process works. -message MsgAddService { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service supplier using cosmos' ScalarDescriptor - shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service for which the supplier is adding to the network -} - -message MsgAddServiceResponse {} - diff --git a/proto/pocket/session/genesis.proto b/proto/pocket/session/genesis.proto deleted file mode 100644 index 2ee8ed8ff..000000000 --- a/proto/pocket/session/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -import "gogoproto/gogo.proto"; -import "pocket/session/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// GenesisState defines the session module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/session/params.proto b/proto/pocket/session/params.proto deleted file mode 100644 index 428f2999e..000000000 --- a/proto/pocket/session/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/pocket/session/query.proto b/proto/pocket/session/query.proto deleted file mode 100644 index 44538be5d..000000000 --- a/proto/pocket/session/query.proto +++ /dev/null @@ -1,46 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos_proto/cosmos.proto"; - -import "pocket/session/params.proto"; -import "pocket/session/session.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/session/params"; - } - - // Queries a list of GetSession items. - rpc GetSession (QueryGetSessionRequest) returns (QueryGetSessionResponse) { - option (google.api.http).get = "/pocket/session/get_session"; - } -} -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetSessionRequest { - string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - shared.Service service = 2; // The service id to query the session for - int64 block_height = 3; // The block height to query the session for -} - -message QueryGetSessionResponse { - session.Session session = 1; -} - diff --git a/proto/pocket/session/session.proto b/proto/pocket/session/session.proto deleted file mode 100644 index e92a5b5ac..000000000 --- a/proto/pocket/session/session.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -import "cosmos_proto/cosmos.proto"; -import "pocket/shared/service.proto"; -import "pocket/application/application.proto"; -import "pocket/shared/supplier.proto"; - -// NOTE: Using signed integers for consistency with the cosmos SDK - -// SessionHeader is a lightweight header for a session that can be passed around. -// It is the minimal amount of data required to hydrate & retrieve all data relevant to the session. -message SessionHeader { - string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - shared.Service service = 2; // The service this session is for - int64 session_start_block_height = 3; // The height at which this session started - // NOTE: session_id can be derived from the above values using on-chain but is included in the header for convenience - string session_id = 4; // A unique pseudoranom ID for this session - int64 session_end_block_height = 5; // The height at which this session ended, this is the last block of the session -} - -// Session is a fully hydrated session object that contains all the information for the Session -// and its parcipants. -message Session { - SessionHeader header = 1; // The header of the session containing lightweight data - string session_id = 2; // A unique pseudoranom ID for this session - int64 session_number = 3; // The session number since genesis - int64 num_blocks_per_session = 4; // The number of blocks per session when this session started - application.Application application = 5; // A fully hydrated application object this session is for - repeated shared.Supplier suppliers = 6; // A fully hydrated set of servicers that are serving the application -} \ No newline at end of file diff --git a/proto/pocket/session/tx.proto b/proto/pocket/session/tx.proto deleted file mode 100644 index 6d793ffdb..000000000 --- a/proto/pocket/session/tx.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package pocket.session; - -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - -// Msg defines the Msg service. -service Msg {} \ No newline at end of file diff --git a/proto/pocket/shared/service.proto b/proto/pocket/shared/service.proto deleted file mode 100644 index 34553fb32..000000000 --- a/proto/pocket/shared/service.proto +++ /dev/null @@ -1,66 +0,0 @@ -syntax = "proto3"; - -// NOTE that the `shared` package is not a Cosmos module, -// but rather a manually created package to resolve circular dependencies. -package pocket.shared; - -option go_package = "github.com/pokt-network/poktroll/x/shared/types"; - -// TODO_CLEANUP(@Olshansk): Add native optional identifiers once its supported; https://github.com/ignite/cli/issues/3698 - -// Service message to encapsulate unique and semantic identifiers for a service on the network -message Service { - // For example, what if we want to request a session for a certain service but with some additional configs that identify it? - string id = 1; // Unique identifier for the service - - // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary - string name = 2; // (Optional) Semantic human readable name for the service -} - -// ApplicationServiceConfig holds the service configuration the application stakes for -message ApplicationServiceConfig { - Service service = 1; // The Service for which the application is configured - - // TODO_RESEARCH: There is an opportunity for applications to advertise the max - // they're willing to pay for a certain configuration/price, but this is outside of scope. - // RPCConfig rpc_configs = 2; // List of endpoints for the service -} - -// SupplierServiceConfig holds the service configuration the supplier stakes for -message SupplierServiceConfig { - Service service = 1; // The Service for which the supplier is configured - repeated SupplierEndpoint endpoints = 2; // List of endpoints for the service - // TODO_RESEARCH: There is an opportunity for supplier to advertise the min - // they're willing to earn for a certain configuration/price, but this is outside of scope. -} - -// SupplierEndpoint message to hold service configuration details -message SupplierEndpoint { - string url = 1; // URL of the endpoint - RPCType rpc_type = 2; // Type of RPC exposed on the url above - repeated ConfigOption configs = 3; // Additional configuration options for the endpoint -} - -// Enum to define RPC types -enum RPCType { - UNKNOWN_RPC = 0; // Undefined RPC type - GRPC = 1; // gRPC - WEBSOCKET = 2; // WebSocket - JSON_RPC = 3; // JSON-RPC - REST = 4; // REST - // Add new RPC types here as needed -} - -// Enum to define configuration options -// TODO_RESEARCH: Should these be configs, SLAs or something else? There will be more discussion once we get closer to implementing on-chain QoS. -enum ConfigOptions { - UNKNOWN_CONFIG = 0; // Undefined config option - TIMEOUT = 1; // Timeout setting - // Add new config options here as needed -} - -// Key-value wrapper for config options, as proto maps can't be keyed by enums -message ConfigOption { - ConfigOptions key = 1; // Config option key - string value = 2; // Config option value -} diff --git a/proto/pocket/shared/supplier.proto b/proto/pocket/shared/supplier.proto deleted file mode 100644 index 90e6999b3..000000000 --- a/proto/pocket/shared/supplier.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package pocket.shared; - -// NOTE that the `shared` package is not a Cosmos module, -// but rather a manually created package to resolve circular dependencies. - -option go_package = "github.com/pokt-network/poktroll/x/shared/types"; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "pocket/shared/service.proto"; - -// Supplier is the type defining the actor in Pocket Network that provides RPC services. -message Supplier { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked - repeated SupplierServiceConfig services = 3; // The service configs this supplier can support -} diff --git a/proto/pocket/supplier/claim.proto b/proto/pocket/supplier/claim.proto deleted file mode 100644 index 25b188040..000000000 --- a/proto/pocket/supplier/claim.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -import "cosmos_proto/cosmos.proto"; -import "pocket/session/session.proto"; - -// Claim is the serialized object stored on-chain for claims pending to be proven -message Claim { - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the address of the supplier that submitted this claim - // The session header of the session that this claim is for. - session.SessionHeader session_header = 2; - // Root hash returned from smt.SMST#Root(). - bytes root_hash = 3; -} \ No newline at end of file diff --git a/proto/pocket/supplier/genesis.proto b/proto/pocket/supplier/genesis.proto deleted file mode 100644 index 5bba7baea..000000000 --- a/proto/pocket/supplier/genesis.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "gogoproto/gogo.proto"; -import "pocket/supplier/params.proto"; -import "pocket/shared/supplier.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// GenesisState defines the supplier module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - repeated pocket.shared.Supplier supplierList = 2 [(gogoproto.nullable) = false]; -} - diff --git a/proto/pocket/supplier/params.proto b/proto/pocket/supplier/params.proto deleted file mode 100644 index 3ea82ce2f..000000000 --- a/proto/pocket/supplier/params.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - // TODO_BLOCKER: Add proof-related submission window params - // TODO_BLOCKER: Add claim-related submission window params -} diff --git a/proto/pocket/supplier/proof.proto b/proto/pocket/supplier/proof.proto deleted file mode 100644 index 7ec927d05..000000000 --- a/proto/pocket/supplier/proof.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "pocket/session/session.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -message Proof { - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // The session header of the session that this claim is for. - session.SessionHeader session_header = 2; - // The serialized SMST proof from the `#ClosestProof()` method. - bytes closest_merkle_proof = 3; -} - diff --git a/proto/pocket/supplier/query.proto b/proto/pocket/supplier/query.proto deleted file mode 100644 index ac0bad9de..000000000 --- a/proto/pocket/supplier/query.proto +++ /dev/null @@ -1,124 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/supplier/params.proto"; -import "pocket/shared/supplier.proto"; -import "pocket/supplier/claim.proto"; -import "pocket/supplier/proof.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Query defines the gRPC querier service. -service Query { - - // Parameters queries the parameters of the module. - rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/pocket/supplier/params"; - } - - // Queries a list of Supplier items. - rpc Supplier (QueryGetSupplierRequest) returns (QueryGetSupplierResponse) { - option (google.api.http).get = "/pocket/supplier/supplier/{address}"; - - } - rpc SupplierAll (QueryAllSupplierRequest) returns (QueryAllSupplierResponse) { - option (google.api.http).get = "/pocket/supplier/suppliers"; - } - - // Queries a list of Claim items. - rpc Claim (QueryGetClaimRequest) returns (QueryGetClaimResponse) { - option (google.api.http).get = "/pocket/supplier/claim/{session_id}/{supplier_address}"; - } - rpc AllClaims (QueryAllClaimsRequest) returns (QueryAllClaimsResponse) { - option (google.api.http).get = "/pocket/supplier/claims"; - } - - // Queries a list of Proof items. - rpc Proof (QueryGetProofRequest) returns (QueryGetProofResponse) { - option (google.api.http).get = "/pocket/supplier/proof/{session_id}/{supplier_address}"; - } - rpc AllProofs (QueryAllProofsRequest) returns (QueryAllProofsResponse) { - option (google.api.http).get = "/pocket/supplier/proof"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -message QueryGetSupplierRequest { - string address = 1; -} - -message QueryGetSupplierResponse { - pocket.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllSupplierRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllSupplierResponse { - repeated pocket.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryGetClaimRequest { - string session_id = 1; - string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -message QueryGetClaimResponse { - Claim claim = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllClaimsRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - oneof filter { - string supplier_address = 2; - string session_id = 3; - uint64 session_end_height = 4; - } -} - -message QueryAllClaimsResponse { - // TODO_IMPROVE: Rename to `Claims` (plural). - repeated Claim claim = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryGetProofRequest { - string session_id = 1; - string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -message QueryGetProofResponse { - Proof proof = 1 [(gogoproto.nullable) = false]; -} - -message QueryAllProofsRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; - oneof filter { - string supplier_address = 2; - string session_id = 3; - uint64 session_end_height = 4; - } -} - -message QueryAllProofsResponse { - // TODO_IMPROVE: Rename to `Proofs` (plural). - repeated Proof proof = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - diff --git a/proto/pocket/supplier/tx.proto b/proto/pocket/supplier/tx.proto deleted file mode 100644 index 2671b83a9..000000000 --- a/proto/pocket/supplier/tx.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; - -package pocket.supplier; - -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/msg/v1/msg.proto"; - -import "pocket/session/session.proto"; -import "pocket/shared/service.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - -// Msg defines the Msg service. -service Msg { - rpc StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); - rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); - rpc CreateClaim (MsgCreateClaim ) returns (MsgCreateClaimResponse ); - rpc SubmitProof (MsgSubmitProof ) returns (MsgSubmitProofResponse ); -} - -message MsgStakeSupplier { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) - repeated shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for -} - -message MsgStakeSupplierResponse {} - -message MsgUnstakeSupplier { - option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string address = 1; -} - -message MsgUnstakeSupplierResponse {} - -message MsgCreateClaim { - option (cosmos.msg.v1.signer) = "supplier_address"; - - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - pocket.session.SessionHeader session_header = 2; - // root returned from smt.SMST#Root() - bytes root_hash = 3; -} - -message MsgCreateClaimResponse {} - - - -message MsgSubmitProof { - option (cosmos.msg.v1.signer) = "supplier_address"; - - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - pocket.session.SessionHeader session_header = 2; - // serialized version of *smt.SparseMerkleClosestProof - bytes proof = 3; -} - -message MsgSubmitProofResponse {} - diff --git a/proto/pocket/tokenomics/genesis.proto b/proto/pocket/tokenomics/genesis.proto deleted file mode 100644 index c1f72d8b8..000000000 --- a/proto/pocket/tokenomics/genesis.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "gogoproto/gogo.proto"; -import "pocket/tokenomics/params.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// GenesisState defines the tokenomics module's genesis state. -message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/pocket/tokenomics/params.proto b/proto/pocket/tokenomics/params.proto deleted file mode 100644 index 79658a582..000000000 --- a/proto/pocket/tokenomics/params.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. -// Params defines the parameters for the tokenomics module. -message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - - // The amount of upokt that a compute unit should translate to when settling a session. - // TODO_DOCUMENT(@Olshansk): Make sure to document the units of this parameter (or the map) once finalized. - uint64 compute_units_to_tokens_multiplier = 1 [(gogoproto.jsontag) = "compute_units_to_tokens_multiplier", (gogoproto.moretags) = "yaml:\"compute_units_to_tokens_multiplier\""]; - - // TODO: Some parameters we should consider adding next: - // - Service.computeUnitsToTokensMultiplierMap - // - Application.MaxuPOKTPerRelay - // - Application.MinuPOKTPerRelay - // - Suppler.MaxuPOKTPerRelay - // - Suppler.MinuPOKTPerRelay - // - RevDistr.PercentageToSupploer - // - RevDistr.PercentageToDAO - // - RevDistr.PercentageToPNF - // - RevDistr.PercentageToDelegators -} \ No newline at end of file diff --git a/proto/pocket/tokenomics/query.proto b/proto/pocket/tokenomics/query.proto deleted file mode 100644 index ce302d0da..000000000 --- a/proto/pocket/tokenomics/query.proto +++ /dev/null @@ -1,30 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "pocket/tokenomics/params.proto"; -import "google/protobuf/any.proto"; -import "cosmos/auth/v1beta1/auth.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/query/v1/query.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/pokt-network/poktroll/tokenomics/params"; - } -} - -// QueryParamsRequest queries all parameters. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} \ No newline at end of file diff --git a/proto/pocket/tokenomics/tx.proto b/proto/pocket/tokenomics/tx.proto deleted file mode 100644 index d55ca7835..000000000 --- a/proto/pocket/tokenomics/tx.proto +++ /dev/null @@ -1,34 +0,0 @@ -syntax = "proto3"; -package pocket.tokenomics; - -import "cosmos/auth/v1beta1/auth.proto"; -import "gogoproto/gogo.proto"; -import "pocket/tokenomics/params.proto"; -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - -// Msg defines the Msg service. -service Msg { - rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); -} - -// MsgUpdateParams is the Msg/UpdateParams request type. -message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the - // latest Cosmos SDK version. We should look into either improving this ourselves - // or seeing if it is on their roadmap. - - // params defines the x/tokenomics parameters to update. - // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; -} - -// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go deleted file mode 100644 index e9248b622..000000000 --- a/testutil/keeper/application.go +++ /dev/null @@ -1,107 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - mocks "github.com/pokt-network/poktroll/testutil/application/mocks" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" -) - -// stakedGatewayMap is used to mock whether a gateway is staked or not for use -// in the application's mocked gateway keeper. This enables the tester to -// control whether a gateway is "staked" or not and whether it can be delegated to -// WARNING: Using this map may cause issues if running multiple tests in parallel -var stakedGatewayMap = make(map[string]struct{}) - -// ApplicationKeeper returns a mocked application keeper and context for testing -// it mocks the chain having staked gateways via the use of the stakedGatewayMap -func ApplicationKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() - - mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) - mockAccountKeeper.EXPECT().GetAccount(gomock.Any(), gomock.Any()).AnyTimes() - - mockGatewayKeeper := mocks.NewMockGatewayKeeper(ctrl) - mockGatewayKeeper.EXPECT().GetGateway(gomock.Any(), gomock.Any()).DoAndReturn( - func(_ sdk.Context, addr string) (gatewaytypes.Gateway, bool) { - if _, ok := stakedGatewayMap[addr]; !ok { - return gatewaytypes.Gateway{}, false - } - stake := sdk.NewCoin("upokt", sdk.NewInt(10000)) - return gatewaytypes.Gateway{ - Address: addr, - Stake: &stake, - }, true - }, - ).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "ApplicationParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - mockBankKeeper, - mockAccountKeeper, - mockGatewayKeeper, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} - -// AddGatewayToStakedGatewayMap adds the given gateway address to the staked -// gateway map for use in the application's mocked gateway keeper and ensures -// that it is removed from the map when the test is complete -func AddGatewayToStakedGatewayMap(t *testing.T, gatewayAddr string) { - t.Helper() - stakedGatewayMap[gatewayAddr] = struct{}{} - t.Cleanup(func() { - delete(stakedGatewayMap, gatewayAddr) - }) -} - -// RemoveGatewayFromStakedGatewayMap removes the given gateway address from the -// staked gateway map for use in the application's mocked gateway keeper -func RemoveGatewayFromStakedGatewayMap(t *testing.T, gatewayAddr string) { - t.Helper() - delete(stakedGatewayMap, gatewayAddr) -} diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go deleted file mode 100644 index 7a7fa84bb..000000000 --- a/testutil/keeper/gateway.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - mocks "github.com/pokt-network/poktroll/testutil/gateway/mocks" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func GatewayKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "GatewayParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - mockBankKeeper, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/pocket.go b/testutil/keeper/pocket.go deleted file mode 100644 index cebf1b0bf..000000000 --- a/testutil/keeper/pocket.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func PocketKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "PocketParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/service.go b/testutil/keeper/service.go deleted file mode 100644 index 10c43cd08..000000000 --- a/testutil/keeper/service.go +++ /dev/null @@ -1,119 +0,0 @@ -package keeper - -import ( - "sync" - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/service/mocks" - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" -) - -var ( - // mapAccAddrCoins is used by the mock BankModule to determine who has what - // coins, if they are sufficient to pay the fee for adding a service. - mapAccAddrCoins = make(map[string]sdk.Coins) - mapMu = sync.RWMutex{} -) - -// ServiceKeeper returns an instance of the keeper for the service module -// with a mocked dependency of the BankModule for testing purposes. -func ServiceKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT(). - SpendableCoins(gomock.Any(), gomock.Any()). - DoAndReturn(func(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { - mapMu.RLock() - defer mapMu.RUnlock() - if coins, ok := mapAccAddrCoins[addr.String()]; ok { - return coins - } - return sdk.Coins{} - }). - AnyTimes() - mockBankKeeper.EXPECT(). - SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()). - DoAndReturn(func(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { - mapMu.Lock() - defer mapMu.Unlock() - coins := mapAccAddrCoins[senderAddr.String()] - if coins.AmountOf("upokt").GT(amt.AmountOf("upokt")) { - mapAccAddrCoins[senderAddr.String()] = coins.Sub(amt...) - return nil - } - return types.ErrServiceNotEnoughFunds - }). - AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "ServiceParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - mockBankKeeper, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} - -// AddAccToAccMapCoins adds to the mapAccAddrCoins map the coins specified as -// parameters, to the function under the address specified. When it cleans up -// it deletes the entry in the map for the provided address. -func AddAccToAccMapCoins(t *testing.T, addr, denom string, amount uint64) { - t.Helper() - t.Cleanup(func() { - mapMu.Lock() - delete(mapAccAddrCoins, addr) - mapMu.Unlock() - }) - addrBech32, err := sdk.AccAddressFromBech32(addr) - require.NoError(t, err) - coins := sdk.NewCoins(sdk.Coin{Denom: denom, Amount: sdk.NewIntFromUint64(amount)}) - mapMu.Lock() - defer mapMu.Unlock() - mapAccAddrCoins[addrBech32.String()] = coins -} - -// RemoveFromAccMapCoins removes an address from the mapAccAddrCoins map -func RemoveFromAccMapCoins(t *testing.T, addr string) { - t.Helper() - mapMu.Lock() - defer mapMu.Unlock() - delete(mapAccAddrCoins, addr) -} diff --git a/testutil/keeper/session.go b/testutil/keeper/session.go deleted file mode 100644 index 8173da24c..000000000 --- a/testutil/keeper/session.go +++ /dev/null @@ -1,223 +0,0 @@ -package keeper - -import ( - "context" - "encoding/hex" - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/session/mocks" - apptypes "github.com/pokt-network/poktroll/x/application/types" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -type option[V any] func(k *keeper.Keeper) - -var ( - TestServiceId1 = "svc1" // staked for by app1 & supplier1 - TestServiceId11 = "svc11" // staked for by app1 - - TestServiceId2 = "svc2" // staked for by app2 & supplier1 - TestServiceId22 = "svc22" // staked for by app2 - - TestServiceId12 = "svc12" // staked for by app1, app2 & supplier1 - - TestApp1Address = "pokt1mdccn4u38eyjdxkk4h0jaddw4n3c72u82m5m9e" // Generated via sample.AccAddress() - TestApp1 = apptypes.Application{ - Address: TestApp1Address, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: TestServiceId1}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId11}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId12}, - }, - }, - } - - TestApp2Address = "pokt133amv5suh75zwkxxcq896azvmmwszg99grvk9f" // Generated via sample.AccAddress() - TestApp2 = apptypes.Application{ - Address: TestApp1Address, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: TestServiceId2}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId22}, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId12}, - }, - }, - } - - TestSupplierUrl = "http://olshansky.info" - TestSupplierAddress = sample.AccAddress() - TestSupplier = sharedtypes.Supplier{ - Address: TestSupplierAddress, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: TestServiceId1}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: TestSupplierUrl, - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId2}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: TestSupplierUrl, - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{Id: TestServiceId12}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: TestSupplierUrl, - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } -) - -func SessionKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - mockAppKeeper := defaultAppKeeperMock(t) - mockSupplierKeeper := defaultSupplierKeeperMock(t) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "SessionParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockAppKeeper, - mockSupplierKeeper, - ) - - // TODO_TECHDEBT: See the comment at the bottom of this file explaining - // why we don't support options yet. - // for _, opt := range opts { - // opt(k) - // } - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - // In prod, the hashes of all block heights are stored in the hash store while - // the block hashes below are hardcoded to match the hardcoded session IDs used - // in the `session_hydrator_test.go`. - // TODO_IMPROVE: Use fixtures populated by block hashes and their corresponding - // session IDs for each block height in the [0, N] interval, instead of using - // in-place hardcoded values. - // Store block hashes to be used in tests - blockHash := map[int64]string{ - 0: "", - 4: "261594ddc3c8afc5b4c63f59ee58e89d3a115bcd164c83fd79349de0b1ffd21d", - 8: "251665c7cf286a30fbd98acd983c63e9a34efc16496511373405e24eb02a8fb9", - } - - store := ctx.KVStore(storeKey) - for height, hash := range blockHash { - hashBz, err := hex.DecodeString(hash) - require.NoError(t, err) - store.Set(keeper.GetBlockHashKey(height), hashBz) - } - - return k, ctx -} - -func defaultAppKeeperMock(t testing.TB) types.ApplicationKeeper { - t.Helper() - ctrl := gomock.NewController(t) - - getAppFn := func(_ context.Context, appAddr string) (apptypes.Application, bool) { - switch appAddr { - case TestApp1Address: - return TestApp1, true - case TestApp2Address: - return TestApp2, true - default: - return apptypes.Application{}, false - } - } - - mockAppKeeper := mocks.NewMockApplicationKeeper(ctrl) - mockAppKeeper.EXPECT().GetApplication(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(getAppFn) - mockAppKeeper.EXPECT().GetApplication(gomock.Any(), TestApp1Address).AnyTimes().Return(TestApp1, true) - - return mockAppKeeper -} - -func defaultSupplierKeeperMock(t testing.TB) types.SupplierKeeper { - t.Helper() - ctrl := gomock.NewController(t) - - allSuppliers := []sharedtypes.Supplier{TestSupplier} - - mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) - mockSupplierKeeper.EXPECT().GetAllSupplier(gomock.Any()).AnyTimes().Return(allSuppliers) - - return mockSupplierKeeper -} - -// TODO_TECHDEBT: Figure out how to vary the supplierKeep on a per test basis with exposing `SupplierKeeper publically` - -// type option[V any] func(k *keeper.Keeper) - -// WithPublisher returns an option function which sets the given publishCh of the -// resulting observable when passed to NewObservable(). -// func WithSupplierKeeperMock(supplierKeeper types.SupplierKeeper) option[any] { -// return func(k *keeper.Keeper) { -// k.supplierKeeper = supplierKeeper -// } -// } diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go deleted file mode 100644 index 8bd600c27..000000000 --- a/testutil/keeper/supplier.go +++ /dev/null @@ -1,97 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/supplier" - "github.com/pokt-network/poktroll/testutil/supplier/mocks" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SupplierKeeper(t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress) (*keeper.Keeper, sdk.Context) { - t.Helper() - - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - ctrl := gomock.NewController(t) - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() - - mockSessionKeeper := mocks.NewMockSessionKeeper(ctrl) - mockSessionKeeper.EXPECT(). - GetSession(gomock.AssignableToTypeOf(sdk.Context{}), gomock.Any()). - DoAndReturn( - func( - ctx sdk.Context, - req *sessiontypes.QueryGetSessionRequest, - ) (*sessiontypes.QueryGetSessionResponse, error) { - session, ok := sessionByAppAddr[req.GetApplicationAddress()] - require.Truef(t, ok, "application address not provided during mock construction: %q", req.ApplicationAddress) - - return &sessiontypes.QueryGetSessionResponse{ - Session: &sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - ApplicationAddress: session.GetApplication().GetAddress(), - Service: req.GetService(), - SessionStartBlockHeight: 1, - SessionId: session.GetSessionId(), - SessionEndBlockHeight: 5, - }, - SessionId: session.GetSessionId(), - SessionNumber: 1, - NumBlocksPerSession: session.GetNumBlocksPerSession(), - Application: session.GetApplication(), - Suppliers: session.GetSuppliers(), - }, - }, nil - }, - ).AnyTimes() - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "SupplierParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockBankKeeper, - ) - k.SupplySessionKeeper(mockSessionKeeper) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go deleted file mode 100644 index a00ab49ab..000000000 --- a/testutil/keeper/tokenomics.go +++ /dev/null @@ -1,130 +0,0 @@ -package keeper - -import ( - "testing" - - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - mocks "github.com/pokt-network/poktroll/testutil/tokenomics/mocks" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// TODO_TECHDEBT: Replace `AnyTimes` w/ `Times/MinTimes/MaxTimes` as the tests -// mature to be explicit about the number of expected tests. - -func TokenomicsKeeper(t testing.TB) ( - k *keeper.Keeper, s sdk.Context, - appAddr, supplierAddr string, -) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - // Initialize the in-memory tendermint database - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - // Initialize the codec and other necessary components - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - ctrl := gomock.NewController(t) - - // The on-chain governance address - authority := authtypes.NewModuleAddress("gov").String() - - // Prepare the test application - application := apptypes.Application{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100000)}, - } - - // Prepare the test supplier - supplier := sharedtypes.Supplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100000)}, - } - - // Mock the application keeper - mockApplicationKeeper := mocks.NewMockApplicationKeeper(ctrl) - mockApplicationKeeper.EXPECT(). - GetApplication(gomock.Any(), gomock.Eq(application.Address)). - Return(application, true). - AnyTimes() - mockApplicationKeeper.EXPECT(). - GetApplication(gomock.Any(), gomock.Not(application.Address)). - Return(apptypes.Application{}, false). - AnyTimes() - mockApplicationKeeper.EXPECT(). - SetApplication(gomock.Any(), gomock.Any()). - AnyTimes() - - // Mock the supplier keeper - mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) - mockSupplierKeeper.EXPECT(). - GetSupplier(gomock.Any(), supplier.Address). - Return(supplier, true). - AnyTimes() - - // Mock the bank keeper - mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT(). - MintCoins(gomock.Any(), gomock.Any(), gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - BurnCoins(gomock.Any(), gomock.Any(), gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(gomock.Any(), suppliertypes.ModuleName, gomock.Any(), gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), apptypes.ModuleName, gomock.Any()). - AnyTimes() - mockBankKeeper.EXPECT(). - UndelegateCoinsFromModuleToAccount(gomock.Any(), apptypes.ModuleName, gomock.Any(), gomock.Any()). - AnyTimes() - - // Initialize the tokenomics keeper - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "TokenomicsParams", - ) - tokenomicsKeeper := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - - mockBankKeeper, - mockApplicationKeeper, - mockSupplierKeeper, - - authority, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - tokenomicsKeeper.SetParams(ctx, types.DefaultParams()) - - return tokenomicsKeeper, ctx, application.Address, supplier.Address -} diff --git a/testutil/network/config.go b/testutil/network/config.go deleted file mode 100644 index f43aaac7e..000000000 --- a/testutil/network/config.go +++ /dev/null @@ -1,90 +0,0 @@ -package network - -import ( - "fmt" - "testing" - "time" - - db "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - sdkservertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" - "github.com/cosmos/cosmos-sdk/testutil/network" - "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - "github.com/pokt-network/poktroll/app" -) - -// GetNumApplications returns the number of applications to be created in the -// network at genesis. NOTE: This method is intended to compute the correct value, -// regardless of how the configuration is configured (i.e. the expectations/usage -// of it in any given in-memory network implementation). -func (cfg *InMemoryNetworkConfig) GetNumApplications(t *testing.T) int { - t.Helper() - - if cfg.NumApplications > 0 { - return cfg.NumApplications - } - - return cfg.AppSupplierPairingRatio * cfg.NumSuppliers -} - -// GetNumKeyringAccounts returns the number of keyring accounts needed for the given configuration. -func (cfg *InMemoryNetworkConfig) GetNumKeyringAccounts(t *testing.T) int { - t.Helper() - - return cfg.NumGateways + cfg.NumSuppliers + cfg.GetNumApplications(t) -} - -// DefaultConfig will initialize config for the network with custom application, -// genesis and single validator. -// All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig. -// -// TODO_UPNEXT(@bryanchriswhite #285): Remove _ prefix after DebugConfig is removed from network.go. -func _DefaultConfig() network.Config { - var ( - encoding = app.MakeEncodingConfig() - chainID = "chain-" + rand.NewRand().Str(6) - ) - return network.Config{ - Codec: encoding.Marshaler, - TxConfig: encoding.TxConfig, - LegacyAmino: encoding.Amino, - InterfaceRegistry: encoding.InterfaceRegistry, - AccountRetriever: types.AccountRetriever{}, - AppConstructor: func(val network.ValidatorI) sdkservertypes.Application { - return app.New( - val.GetCtx().Logger, - db.NewMemDB(), - nil, - true, - map[int64]bool{}, - val.GetCtx().Config.RootDir, - 0, - encoding, - sims.EmptyAppOptions{}, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(chainID), - ) - }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), - TimeoutCommit: 2 * time.Second, - ChainID: chainID, - NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), - PruningStrategy: pruningtypes.PruningOptionNothing, - CleanupDir: true, - SigningAlgo: string(hd.Secp256k1Type), - KeyringOptions: []keyring.Option{}, - } -} diff --git a/testutil/network/interface.go b/testutil/network/interface.go deleted file mode 100644 index fa2c90eef..000000000 --- a/testutil/network/interface.go +++ /dev/null @@ -1,34 +0,0 @@ -package network - -import ( - "context" - "testing" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -// InMemoryNetwork encapsulates the cosmos-sdk testutil network instance and the -// responsibility of initializing it, along with (optional) additional/ setup, in -// #Start(). It also provides access to additional cosmos-sdk testutil network -// internals via corresponding methods. -type InMemoryNetwork interface { - // GetConfig returns the InMemoryNetworkConfig which associated with a given - // InMemoryNetwork instance. - GetConfig(*testing.T) *InMemoryNetworkConfig - - // GetClientCtx returns a cosmos-sdk client.Context associated with the - // underlying cosmos-sdk testutil network instance. - GetClientCtx(*testing.T) client.Context - - // GetCosmosNetworkConfig returns the underlying cosmos-sdk testutil network config. - GetCosmosNetworkConfig(*testing.T) *network.Config - - // GetNetwork returns the underlying cosmos-sdk testutil network instance. - GetNetwork(*testing.T) *network.Network - - // Start initializes the in-memory network, performing any setup - // (e.g. preparing on-chain state) for the test scenarios which - // will be exercised afterward. - Start(context.Context, *testing.T) -} diff --git a/testutil/network/network.go b/testutil/network/network.go deleted file mode 100644 index 4bbed2925..000000000 --- a/testutil/network/network.go +++ /dev/null @@ -1,364 +0,0 @@ -package network - -import ( - "encoding/json" - "fmt" - "testing" - "time" - - "cosmossdk.io/math" - sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/cosmos/cosmos-sdk/testutil/network" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/testutil/sample" - appcli "github.com/pokt-network/poktroll/x/application/client/cli" - apptypes "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -type ( - Network = network.Network - Config = network.Config -) - -// New creates instance with fully configured cosmos network. -// Accepts optional config, that will be used in place of the DefaultConfig() if provided. -func New(t *testing.T, configs ...Config) *Network { - if len(configs) > 1 { - panic("at most one config should be provided") - } - var cfg network.Config - if len(configs) == 0 { - cfg = DefaultConfig() - } else { - cfg = configs[0] - } - net, err := network.New(t, t.TempDir(), cfg) - require.NoError(t, err) - _, err = net.WaitForHeight(1) - require.NoError(t, err) - t.Cleanup(net.Cleanup) - return net -} - -// DefaultConfig will initialize config for the network with custom application, -// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig -func DefaultConfig() network.Config { - var ( - encoding = app.MakeEncodingConfig() - chainID = "chain-" + tmrand.NewRand().Str(6) - ) - return network.Config{ - Codec: encoding.Marshaler, - TxConfig: encoding.TxConfig, - LegacyAmino: encoding.Amino, - InterfaceRegistry: encoding.InterfaceRegistry, - AccountRetriever: authtypes.AccountRetriever{}, - AppConstructor: func(val network.ValidatorI) servertypes.Application { - return app.New( - val.GetCtx().Logger, - tmdb.NewMemDB(), - nil, - true, - map[int64]bool{}, - val.GetCtx().Config.RootDir, - 0, - encoding, - simtestutil.EmptyAppOptions{}, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(chainID), - ) - }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), - TimeoutCommit: 2 * time.Second, - ChainID: chainID, - NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), - PruningStrategy: pruningtypes.PruningOptionNothing, - CleanupDir: true, - SigningAlgo: string(hd.Secp256k1Type), - KeyringOptions: []keyring.Option{}, - } -} - -// TODO_CLEANUP: Refactor the genesis state helpers below to consolidate usage -// and reduce the code footprint. - -// DefaultApplicationModuleGenesisState generates a GenesisState object with a given number of applications. -// It returns the populated GenesisState object. -func DefaultApplicationModuleGenesisState(t *testing.T, n int) *apptypes.GenesisState { - t.Helper() - state := apptypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i+1))) - application := apptypes.Application{ - Address: sample.AccAddress(), - Stake: &stake, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - }, - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d%d", i, i)}, - }, - }, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&application) - state.ApplicationList = append(state.ApplicationList, application) - } - return state -} - -// ApplicationModuleGenesisStateWithAccount generates a GenesisState object with -// a single application for each of the given addresses. -func ApplicationModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *apptypes.GenesisState { - t.Helper() - state := apptypes.DefaultGenesis() - for _, addr := range addresses { - application := apptypes.Application{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - state.ApplicationList = append(state.ApplicationList, application) - } - - return state -} - -// DefaultSupplierModuleGenesisState generates a GenesisState object with a given number of suppliers. -// It returns the populated GenesisState object. -func DefaultSupplierModuleGenesisState(t *testing.T, n int) *suppliertypes.GenesisState { - t.Helper() - state := suppliertypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i))) - supplier := sharedtypes.Supplier{ - Address: sample.AccAddress(), - Stake: &stake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: fmt.Sprintf("http://localhost:%d", i), - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - }, - }, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&supplier) - state.SupplierList = append(state.SupplierList, supplier) - } - return state -} - -// SupplierModuleGenesisStateWithAddresses generates a GenesisState object with -// a single supplier for each of the given addresses. -func SupplierModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *suppliertypes.GenesisState { - t.Helper() - state := suppliertypes.DefaultGenesis() - for _, addr := range addresses { - supplier := sharedtypes.Supplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:1", - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - }, - }, - } - state.SupplierList = append(state.SupplierList, supplier) - } - - return state -} - -func DefaultTokenomicsModuleGenesisState(t *testing.T) *tokenomicstypes.GenesisState { - t.Helper() - state := tokenomicstypes.DefaultGenesis() - return state -} - -// DefaultGatewayModuleGenesisState generates a GenesisState object with a given -// number of gateways. It returns the populated GenesisState object. -func DefaultGatewayModuleGenesisState(t *testing.T, n int) *gatewaytypes.GenesisState { - t.Helper() - state := gatewaytypes.DefaultGenesis() - for i := 0; i < n; i++ { - stake := sdk.NewCoin("upokt", sdk.NewInt(int64(i))) - gateway := gatewaytypes.Gateway{ - Address: sample.AccAddress(), - Stake: &stake, - } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere - // nullify.Fill(&gateway) - state.GatewayList = append(state.GatewayList, gateway) - } - return state -} - -// GatewayModuleGenesisStateWithAddresses generates a GenesisState object with -// a gateway list full of gateways with the given addresses. -// It returns the populated GenesisState object. -func GatewayModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *gatewaytypes.GenesisState { - t.Helper() - state := gatewaytypes.DefaultGenesis() - for _, addr := range addresses { - gateway := gatewaytypes.Gateway{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(10000)}, - } - state.GatewayList = append(state.GatewayList, gateway) - } - return state -} - -// TODO_CLEANUP: Consolidate all of the helpers below to use shared business -// logic and move into its own helpers file. - -// InitAccount initializes an Account by sending it some funds from the validator -// in the network to the address provided -func InitAccount(t *testing.T, net *Network, addr sdk.AccAddress) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) - responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) - require.NoError(t, err) - var responseJSON map[string]interface{} - err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) - require.NoError(t, err) - require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) -} - -// InitAccountWithSequence initializes an Account by sending it some funds from -// the validator in the network to the address provided -func InitAccountWithSequence( - t *testing.T, - net *Network, - addr sdk.AccAddress, - signatureSequencerNumber int, -) { - t.Helper() - val := net.Validators[0] - signerAccountNumber := 0 - ctx := val.ClientCtx - args := []string{ - fmt.Sprintf("--%s=true", flags.FlagOffline), - fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, signerAccountNumber), - fmt.Sprintf("--%s=%d", flags.FlagSequence, signatureSequencerNumber), - - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) - responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) - require.NoError(t, err) - var responseJSON map[string]interface{} - err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) - require.NoError(t, err) - require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) -} - -// DelegateAppToGateway delegates the provided application to the provided gateway -func DelegateAppToGateway( - t *testing.T, - net *Network, - appAddr string, - gatewayAddr string, -) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - gatewayAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdDelegateToGateway(), args) - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) -} - -// UndelegateAppFromGateway undelegates the provided application from the provided gateway -func UndelegateAppFromGateway( - t *testing.T, - net *Network, - appAddr string, - gatewayAddr string, -) { - t.Helper() - val := net.Validators[0] - ctx := val.ClientCtx - args := []string{ - gatewayAddr, - fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdUndelegateFromGateway(), args) - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) -} - -// TODO_TECHDEBT: Reuse this helper in all test helpers where appropriate. -func NewBondDenomCoins(t *testing.T, net *network.Network, numCoins int64) sdk.Coins { - t.Helper() - - return sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(numCoins))) -} diff --git a/testutil/network/types.go b/testutil/network/types.go deleted file mode 100644 index 368f3c485..000000000 --- a/testutil/network/types.go +++ /dev/null @@ -1,66 +0,0 @@ -package network - -import ( - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/testutil/network" -) - -// TestMerkleProofPath is intended to be used as a "path" in a merkle tree for -// which to generate a proof. -var TestMerkleProofPath = []byte("test_proof_merkle_path") - -// InMemoryNetworkConfig is a **SHARED** config struct for use by InMemoryNetwork -// implementations to configure themselves, provide the necessary parameters to set-up -// code, and initialize the underlying cosmos-sdk testutil network. -// -// Examples of set-up operations include but are not limited to: -// - Creating accounts in the local keyring. -// - Creating genesis state for (a) module(s). -// - Executing on-chain transactions (i.e. on-chain, non-genesis state). -// - Governance parameter configuration -// - Etc... -type InMemoryNetworkConfig struct { - // NumSessions is the number of sessions (with increasing start heights) for - // which the network should generate claims and proofs. - NumSessions int - - // NumRelaysPerSession is the number of nodes to be inserted into each claim's - // session tree prior to generating the corresponding proof. - NumRelaysPerSession int - - // NumSuppliers is the number of suppliers that should be created at genesis. - NumSuppliers int - - // NumGateways is the number of gateways that should be created at genesis. - NumGateways int - - // NumApplications is the number of applications that should be created at genesis. - // Usage is mutually exclusive with AppSupplierPairingRatio. This is enforced by - // InMemoryNetwork implementations. - // - // NOTE: Use #GetNumApplications() to compute the correct value, regardless of - // which field is used; in-memory network implementations SHOULD NOT modify config - // fields. #GetNumApplications() is intended to be the single source of truth. - NumApplications int - - // AppSupplierPairingRatio is the number of applications, per supplier, that - // share a serviceId (i.e. will be in the same session). - // Usage is mutually exclusive with NumApplications. This is enforced by - // InMemoryNetwork implementations. - // - // NOTE: Use #GetNumApplications() to compute the correct value, regardless of - // which field is used; in-memory network implementations SHOULD NOT modify config - // fields. #GetNumApplications() is intended to be the single source of truth. - AppSupplierPairingRatio int - - // CosmosCfg is the configuration for the underlying cosmos-sdk testutil network. - CosmosCfg *network.Config - - // Keyring is the keyring to be used by clients of the cosmos-sdk testutil network. - // It is intended to be populated with a sufficient number of accounts for the - // InMemoryNetwork implementation's use cases. BaseInMemoryNetwork - // implements a #GetNumKeyringAccounts() for this purpose. - // This keyring is associated with the cosmos client context returned from - // BaseInMemoryNetwork#GetClientCtx(). - Keyring keyring.Keyring -} diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go deleted file mode 100644 index 3b968c09c..000000000 --- a/testutil/nullify/nullify.go +++ /dev/null @@ -1,57 +0,0 @@ -// Package nullify provides methods to init nil values structs for test assertion. -package nullify - -import ( - "reflect" - "unsafe" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - coinType = reflect.TypeOf(sdk.Coin{}) - coinsType = reflect.TypeOf(sdk.Coins{}) -) - -// Fill analyze all struct fields and slices with -// reflection and initialize the nil and empty slices, -// structs, and pointers. -func Fill(x interface{}) interface{} { - v := reflect.Indirect(reflect.ValueOf(x)) - switch v.Kind() { - case reflect.Slice: - for i := 0; i < v.Len(); i++ { - obj := v.Index(i) - objPt := reflect.NewAt(obj.Type(), unsafe.Pointer(obj.UnsafeAddr())).Interface() - objPt = Fill(objPt) - obj.Set(reflect.ValueOf(objPt)) - } - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - f := reflect.Indirect(v.Field(i)) - if !f.CanSet() { - continue - } - switch f.Kind() { - case reflect.Slice: - f.Set(reflect.MakeSlice(f.Type(), 0, 0)) - case reflect.Struct: - switch f.Type() { - case coinType: - coin := reflect.New(coinType).Interface() - s := reflect.ValueOf(coin).Elem() - f.Set(s) - case coinsType: - coins := reflect.New(coinsType).Interface() - s := reflect.ValueOf(coins).Elem() - f.Set(s) - default: - objPt := reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Interface() - s := Fill(objPt) - f.Set(reflect.ValueOf(s)) - } - } - } - } - return reflect.Indirect(v).Interface() -} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go deleted file mode 100644 index 152aa43d0..000000000 --- a/testutil/sample/sample.go +++ /dev/null @@ -1,28 +0,0 @@ -package sample - -import ( - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// AccAddressAndPubKey returns a sample account address and public key -func AccAddressAndPubKey() (string, cryptotypes.PubKey) { - pk := secp256k1.GenPrivKey().PubKey() - addr := pk.Address() - return sdk.AccAddress(addr).String(), pk -} - -// AccAddress returns a sample account address -func AccAddress() string { - addr, _ := AccAddressAndPubKey() - return addr -} - -// AccAddressAndPubKeyEdd2519 returns a sample account address and public key -func AccAddressAndPubKeyEdd2519() (string, cryptotypes.PubKey) { - pk := ed25519.GenPrivKey().PubKey() - addr := pk.Address() - return sdk.AccAddress(addr).String(), pk -} diff --git a/x/application/client/cli/helpers_test.go b/x/application/client/cli/helpers_test.go deleted file mode 100644 index 46f1e9440..000000000 --- a/x/application/client/cli/helpers_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "strconv" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/types" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithApplicationObjects creates a new network with a given number of application objects. -// It returns the network and a slice of the created application objects. -func networkWithApplicationObjects(t *testing.T, n int) (*network.Network, []types.Application) { - t.Helper() - cfg := network.DefaultConfig() - appGenesisState := network.DefaultApplicationModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(appGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), appGenesisState.ApplicationList -} diff --git a/x/application/client/cli/query.go b/x/application/client/cli/query.go deleted file mode 100644 index 86cd73b25..000000000 --- a/x/application/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group application queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListApplication()) - cmd.AddCommand(CmdShowApplication()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/application/client/cli/query_application.go b/x/application/client/cli/query_application.go deleted file mode 100644 index 4fbf32228..000000000 --- a/x/application/client/cli/query_application.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func CmdListApplication() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-application", - Short: "list all application", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllApplicationRequest{ - Pagination: pageReq, - } - - res, err := queryClient.ApplicationAll(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowApplication() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-application ", - Short: "shows a application", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - argAddress := args[0] - - params := &types.QueryGetApplicationRequest{ - Address: argAddress, - } - - res, err := queryClient.Application(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/query_application_test.go b/x/application/client/cli/query_application_test.go deleted file mode 100644 index 10a8b77c6..000000000 --- a/x/application/client/cli/query_application_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestShowApplication(t *testing.T) { - net, objs := networkWithApplicationObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - tests := []struct { - desc string - idAddress string - - args []string - err error - obj types.Application - }{ - { - desc: "found", - idAddress: objs[0].Address, - - args: common, - obj: objs[0], - }, - { - desc: "not found", - idAddress: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.idAddress, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowApplication(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Application) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Application), - ) - } - }) - } -} - -func TestListApplication(t *testing.T) { - net, objs := networkWithApplicationObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListApplication(), args) - require.NoError(t, err) - var resp types.QueryAllApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListApplication(), args) - require.NoError(t, err) - var resp types.QueryAllApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListApplication(), args) - require.NoError(t, err) - var resp types.QueryAllApplicationResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), - ) - }) -} diff --git a/x/application/client/cli/query_params.go b/x/application/client/cli/query_params.go deleted file mode 100644 index 7a47d705c..000000000 --- a/x/application/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx.go b/x/application/client/cli/tx.go deleted file mode 100644 index cb09f9b3f..000000000 --- a/x/application/client/cli/tx.go +++ /dev/null @@ -1,41 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/application/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdStakeApplication()) - cmd.AddCommand(CmdUnstakeApplication()) - - cmd.AddCommand(CmdDelegateToGateway()) - cmd.AddCommand(CmdUndelegateFromGateway()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/application/client/cli/tx_delegate_to_gateway.go b/x/application/client/cli/tx_delegate_to_gateway.go deleted file mode 100644 index f1363e6db..000000000 --- a/x/application/client/cli/tx_delegate_to_gateway.go +++ /dev/null @@ -1,49 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -var _ = strconv.Itoa(0) - -func CmdDelegateToGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "delegate-to-gateway ", - Short: "Delegate an application to a gateway", - Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation -that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway -act on the behalf of the application during a session. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - gatewayAddress := args[0] - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgDelegateToGateway( - clientCtx.GetFromAddress().String(), - gatewayAddress, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_delegate_to_gateway_test.go b/x/application/client/cli/tx_delegate_to_gateway_test.go deleted file mode 100644 index 22d2630b2..000000000 --- a/x/application/client/cli/tx_delegate_to_gateway_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_DelegateToGateway(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be delegated - // and the gateway to be delegated to - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 2) - appAccount := accounts[0] - gatewayAccount := accounts[1] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - appAddress string - gatewayAddress string - err *sdkerrors.Error - }{ - { - desc: "delegate to gateway: valid", - appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - }, - { - desc: "invalid - missing app address", - // appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - invalid app address", - appAddress: "invalid address", - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - missing gateway address", - appAddress: appAccount.Address.String(), - // gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidGatewayAddress, - }, - { - desc: "invalid - invalid gateway address", - appAddress: appAccount.Address.String(), - gatewayAddress: "invalid address", - err: types.ErrAppInvalidGatewayAddress, - }, - } - - // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis - network.InitAccountWithSequence(t, net, appAccount.Address, 1) - network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - tt.gatewayAddress, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), - } - args = append(args, commonArgs...) - - // Execute the command - delegateOutput, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdDelegateToGateway(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(delegateOutput.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/cli/tx_stake_application.go b/x/application/client/cli/tx_stake_application.go deleted file mode 100644 index 1c8f23dda..000000000 --- a/x/application/client/cli/tx_stake_application.go +++ /dev/null @@ -1,66 +0,0 @@ -package cli - -import ( - "os" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/client/config" - "github.com/pokt-network/poktroll/x/application/types" -) - -var ( - flagStakeConfig string - _ = strconv.Itoa(0) -) - -func CmdStakeApplication() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "stake-application --config ", - Short: "Stake an application", - Long: `Stake an application with the provided parameters. This is a broadcast operation that -will stake the tokens and serviceIds and associate them with the application specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - configContent, err := os.ReadFile(flagStakeConfig) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - appStakeConfigs, err := config.ParseApplicationConfigs(configContent) - if err != nil { - return err - } - - msg := types.NewMsgStakeApplication( - clientCtx.GetFromAddress().String(), - appStakeConfigs.StakeAmount, - appStakeConfigs.Services, - ) - - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_stake_application_test.go b/x/application/client/cli/tx_stake_application_test.go deleted file mode 100644 index 6f255207e..000000000 --- a/x/application/client/cli/tx_stake_application_test.go +++ /dev/null @@ -1,235 +0,0 @@ -package cli_test - -import ( - "fmt" - "os" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_StakeApplication(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be staked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - appAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - defaultConfig := ` - stake_amount: 1000upokt - service_ids: - - svc1 - - svc2 - - svc3 - ` - - tests := []struct { - desc string - - inputConfig string - inputAddress string - - expectedError *sdkerrors.Error - }{ - // Happy Paths - { - desc: "valid", - - inputAddress: appAccount.Address.String(), - inputConfig: defaultConfig, - - expectedError: nil, - }, - - // Error Paths - Address Related - { - desc: "invalid: missing address", - // inputAddress: "explicitly missing", - inputConfig: defaultConfig, - - expectedError: types.ErrAppInvalidAddress, - }, - { - desc: "invalid: invalid address", - - inputAddress: "invalid", - inputConfig: defaultConfig, - - expectedError: types.ErrAppInvalidAddress, - }, - - // Error Paths - Stake Related - { - desc: "invalid: missing stake", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: # explicitly missing - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - { - desc: "invalid: invalid stake denom", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000invalid - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - { - desc: "invalid: stake amount (zero)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 0upokt - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - { - desc: "invalid: stake amount (negative)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: -1000upokt - service_ids: - - svc1 - - svc2 - - svc3 - `, - - expectedError: types.ErrAppInvalidStake, - }, - - // Error Paths - Service Related - { - desc: "invalid: services (empty string)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - { - desc: "invalid: single invalid service contains spaces", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1 svc1_part2 svc1_part3 - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - { - desc: "invalid: one of two services is invalid because it contains spaces", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1 svc1_part2 - - svc2 - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - { - desc: "invalid: service ID is too long (8 chars is the max)", - - inputAddress: appAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1, - - abcdefghi - `, - - expectedError: types.ErrAppInvalidServiceConfigs, - }, - } - - // Initialize the App Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, appAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() - t.Cleanup(func() { os.Remove(configPath) }) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.inputAddress), - } - args = append(args, commonArgs...) - - // Execute the command - outStake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdStakeApplication(), args) - - // Validate the error if one is expected - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/cli/tx_undelegate_from_gateway.go b/x/application/client/cli/tx_undelegate_from_gateway.go deleted file mode 100644 index 50a755d8f..000000000 --- a/x/application/client/cli/tx_undelegate_from_gateway.go +++ /dev/null @@ -1,49 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/pokt-network/poktroll/x/application/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" -) - -var _ = strconv.Itoa(0) - -func CmdUndelegateFromGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "undelegate-from-gateway [gateway address]", - Short: "Undelegate an application from a gateway", - Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation -that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway -act on the behalf of the application during a session. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - gatewayAddress := args[0] - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUndelegateFromGateway( - clientCtx.GetFromAddress().String(), - gatewayAddress, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_undelegate_from_gateway_test.go b/x/application/client/cli/tx_undelegate_from_gateway_test.go deleted file mode 100644 index a5d942268..000000000 --- a/x/application/client/cli/tx_undelegate_from_gateway_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_UndelegateFromGateway(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be delegated - // and the gateway to be delegated to - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 2) - appAccount := accounts[0] - gatewayAccount := accounts[1] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - appAddress string - gatewayAddress string - err *sdkerrors.Error - }{ - { - desc: "undelegate from gateway: valid", - appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - }, - { - desc: "invalid - missing app address", - // appAddress: appAccount.Address.String(), - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - invalid app address", - appAddress: "invalid address", - gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, - }, - { - desc: "invalid - missing gateway address", - appAddress: appAccount.Address.String(), - // gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidGatewayAddress, - }, - { - desc: "invalid - invalid gateway address", - appAddress: appAccount.Address.String(), - gatewayAddress: "invalid address", - err: types.ErrAppInvalidGatewayAddress, - }, - } - - // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis - network.InitAccountWithSequence(t, net, appAccount.Address, 1) - network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - tt.gatewayAddress, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), - } - args = append(args, commonArgs...) - - // Execute the command - undelegateOutput, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUndelegateFromGateway(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(undelegateOutput.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/cli/tx_unstake_application.go b/x/application/client/cli/tx_unstake_application.go deleted file mode 100644 index c602def16..000000000 --- a/x/application/client/cli/tx_unstake_application.go +++ /dev/null @@ -1,47 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/application/types" -) - -var _ = strconv.Itoa(0) - -func CmdUnstakeApplication() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "unstake-application", - Short: "Unstake an application", - Long: `Unstake an application. This is a broadcast operation that will unstake -the application specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUnstakeApplication( - clientCtx.GetFromAddress().String(), - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/application/client/cli/tx_unstake_application_test.go b/x/application/client/cli/tx_unstake_application_test.go deleted file mode 100644 index 2681a7d77..000000000 --- a/x/application/client/cli/tx_unstake_application_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestCLI_UnstakeApplication(t *testing.T) { - net, _ := networkWithApplicationObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the application to be unstaked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - appAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - err *sdkerrors.Error - }{ - { - desc: "unstake application: valid", - address: appAccount.Address.String(), - }, - { - desc: "unstake application: missing address", - // address: "explicitly missing", - err: types.ErrAppInvalidAddress, - }, - { - desc: "unstake application: invalid address", - address: "invalid", - err: types.ErrAppInvalidAddress, - }, - } - - // Initialize the App Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, appAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outUnstake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUnstakeApplication(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/application/client/config/application_configs_reader.go b/x/application/client/config/application_configs_reader.go deleted file mode 100644 index 871ac8709..000000000 --- a/x/application/client/config/application_configs_reader.go +++ /dev/null @@ -1,91 +0,0 @@ -package config - -import ( - "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// YAMLApplicationConfig is the structure describing a single service stake entry in the stake config file -// TODO_DOCUMENT(@red-0ne): Add additional documentation on app config files. -type YAMLApplicationConfig struct { - StakeAmount string `yaml:"stake_amount"` - ServiceIds []string `yaml:"service_ids"` -} - -type ApplicationStakeConfig struct { - // StakeAmount is the amount of upokt tokens that the application is willing to stake - StakeAmount sdk.Coin - // Services is the list of services that the application is willing to stake for - Services []*sharedtypes.ApplicationServiceConfig -} - -// ParseApplicationConfig parses the stake config file and returns a slice of ApplicationServiceConfig -func ParseApplicationConfigs(configContent []byte) (*ApplicationStakeConfig, error) { - var parsedAppConfig YAMLApplicationConfig - - if len(configContent) == 0 { - return nil, ErrApplicationConfigEmptyContent - } - - // Unmarshal the stake config file into a applicationServiceConfig - if err := yaml.Unmarshal(configContent, &parsedAppConfig); err != nil { - return nil, ErrApplicationConfigUnmarshalYAML.Wrapf("%s", err) - } - - if len(parsedAppConfig.ServiceIds) == 0 || parsedAppConfig.ServiceIds == nil { - return nil, ErrApplicationConfigInvalidServiceId.Wrap("serviceIds cannot be empty") - } - - if parsedAppConfig.StakeAmount == "" { - return nil, ErrApplicationConfigInvalidStake.Wrap("stake amount cannot be empty") - } - - stakeAmount, err := sdk.ParseCoinNormalized(parsedAppConfig.StakeAmount) - if err != nil { - return nil, ErrApplicationConfigInvalidStake.Wrap(err.Error()) - } - - if err := stakeAmount.Validate(); err != nil { - return nil, ErrApplicationConfigInvalidStake.Wrap(err.Error()) - } - - if stakeAmount.IsZero() { - return nil, ErrApplicationConfigInvalidStake.Wrap("stake amount cannot be zero") - } - - if stakeAmount.Denom != "upokt" { - return nil, ErrApplicationConfigInvalidStake.Wrapf( - "invalid stake denom, expecting: upokt, got: %s", - stakeAmount.Denom, - ) - } - - // Prepare the applicationServiceConfig - applicationServiceConfig := make( - []*sharedtypes.ApplicationServiceConfig, - 0, - len(parsedAppConfig.ServiceIds), - ) - - for _, serviceId := range parsedAppConfig.ServiceIds { - // Validate serviceId - if !sharedhelpers.IsValidServiceId(serviceId) { - return nil, ErrApplicationConfigInvalidServiceId.Wrapf("%s", serviceId) - } - - appServiceConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: serviceId}, - } - - applicationServiceConfig = append(applicationServiceConfig, appServiceConfig) - } - - return &ApplicationStakeConfig{ - StakeAmount: stakeAmount, - Services: applicationServiceConfig, - }, nil -} diff --git a/x/application/client/config/application_configs_reader_test.go b/x/application/client/config/application_configs_reader_test.go deleted file mode 100644 index f46e49245..000000000 --- a/x/application/client/config/application_configs_reader_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package config_test - -import ( - "testing" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/application/client/config" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func Test_ParseApplicationConfigs(t *testing.T) { - tests := []struct { - desc string - - inputConfig string - - expectedError *sdkerrors.Error - expectedConfig *config.ApplicationStakeConfig - }{ - // Valid Configs - { - desc: "valid: service staking config", - - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - svc1 - - svc2 - `, - - expectedError: nil, - expectedConfig: &config.ApplicationStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - { - Service: &sharedtypes.Service{Id: "svc2"}, - }, - }, - }, - }, - // Invalid Configs - { - desc: "invalid: empty service staking config", - - inputConfig: ``, - - expectedError: config.ErrApplicationConfigEmptyContent, - }, - { - desc: "invalid: no service ids", - - inputConfig: ` - stake_amount: 1000upokt - service_ids: # explicitly omitting service ids - `, - - expectedError: config.ErrApplicationConfigInvalidServiceId, - }, - { - desc: "invalid: invalid serviceId", - - inputConfig: ` - stake_amount: 1000upokt - service_ids: - - sv c1 - `, - - expectedError: config.ErrApplicationConfigInvalidServiceId, - }, - { - desc: "invalid: no stake amount", - - inputConfig: ` - stake_amount: # explicitly omitting stake amount - service_ids: - - svc1 - - svc2 - `, - - expectedError: config.ErrApplicationConfigInvalidStake, - }, - { - desc: "invalid: non-positive stake amount", - - inputConfig: ` - stake_amount: 0upokt - service_ids: - - svc1 - - svc2 - `, - - expectedError: config.ErrApplicationConfigInvalidStake, - }, - { - desc: "invalid: unsupported stake denom", - - inputConfig: ` - stake_amount: 1000npokt - service_ids: - - svc1 - - svc2 - `, - - expectedError: config.ErrApplicationConfigInvalidStake, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) - appServiceConfig, err := config.ParseApplicationConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, appServiceConfig) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.StakeAmount.Amount, appServiceConfig.StakeAmount.Amount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, appServiceConfig.StakeAmount.Denom) - - t.Logf("serviceIds: %v", tt.expectedConfig.Services) - require.Equal(t, len(tt.expectedConfig.Services), len(appServiceConfig.Services)) - for i, expected := range tt.expectedConfig.Services { - require.Equal(t, expected.Service.Id, appServiceConfig.Services[i].Service.Id) - } - }) - } -} diff --git a/x/application/client/config/errors.go b/x/application/client/config/errors.go deleted file mode 100644 index cc009197e..000000000 --- a/x/application/client/config/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "applicationconfig" - ErrApplicationConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrApplicationConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in application config") - ErrApplicationConfigEmptyContent = sdkerrors.Register(codespace, 3, "empty application config content") - ErrApplicationConfigInvalidStake = sdkerrors.Register(codespace, 4, "invalid stake amount in application config") -) diff --git a/x/application/genesis.go b/x/application/genesis.go deleted file mode 100644 index 713c9da61..000000000 --- a/x/application/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package application - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the application - for _, app := range genState.ApplicationList { - k.SetApplication(ctx, app) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.ApplicationList = k.GetAllApplication(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/application/genesis_test.go b/x/application/genesis_test.go deleted file mode 100644 index 74ac91f37..000000000 --- a/x/application/genesis_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package application_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// Please see `x/application/types/genesis_test.go` for extensive tests related to the validity of the genesis state. -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - ApplicationList: []types.Application{ - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - }, - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc2"}, - }, - }, - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.ApplicationKeeper(t) - application.InitGenesis(ctx, *k, genesisState) - got := application.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.ApplicationList, got.ApplicationList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/application/keeper/application.go b/x/application/keeper/application.go deleted file mode 100644 index b95b77f9e..000000000 --- a/x/application/keeper/application.go +++ /dev/null @@ -1,64 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// SetApplication set a specific application in the store from its index -func (k Keeper) SetApplication(ctx sdk.Context, application types.Application) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - b := k.cdc.MustMarshal(&application) - store.Set(types.ApplicationKey( - application.Address, - ), b) -} - -// GetApplication returns a application from its index -func (k Keeper) GetApplication( - ctx sdk.Context, - appAddr string, - -) (app types.Application, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - - b := store.Get(types.ApplicationKey( - appAddr, - )) - if b == nil { - return app, false - } - - k.cdc.MustUnmarshal(b, &app) - return app, true -} - -// RemoveApplication removes a application from the store -func (k Keeper) RemoveApplication( - ctx sdk.Context, - appAddr string, - -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - store.Delete(types.ApplicationKey( - appAddr, - )) -} - -// GetAllApplication returns all application -func (k Keeper) GetAllApplication(ctx sdk.Context) (apps []types.Application) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Application - k.cdc.MustUnmarshal(iterator.Value(), &val) - apps = append(apps, val) - } - - return -} diff --git a/x/application/keeper/application_test.go b/x/application/keeper/application_test.go deleted file mode 100644 index 6af5e3d26..000000000 --- a/x/application/keeper/application_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNApplication(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Application { - apps := make([]types.Application, n) - for i := range apps { - app := &apps[i] - app.Address = sample.AccAddress() - app.Stake = &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(int64(i))} - app.ServiceConfigs = []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - }, - } - keeper.SetApplication(ctx, *app) - } - return apps -} - -func TestApplicationGet(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) - for _, app := range apps { - appFound, isAppFound := keeper.GetApplication(ctx, - app.Address, - ) - require.True(t, isAppFound) - require.Equal(t, - nullify.Fill(&app), - nullify.Fill(&appFound), - ) - } -} -func TestApplicationRemove(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) - for _, app := range apps { - keeper.RemoveApplication(ctx, - app.Address, - ) - _, found := keeper.GetApplication(ctx, - app.Address, - ) - require.False(t, found) - } -} - -func TestApplicationGetAll(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(apps), - nullify.Fill(keeper.GetAllApplication(ctx)), - ) -} - -// The application module address is derived off of its semantic name. -// This test is a helper for us to easily identify the underlying address. -func TestApplicationModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1rl3gjgzexmplmds3tq3r3yk84zlwdl6djzgsvm", moduleAddress.String()) -} diff --git a/x/application/keeper/keeper.go b/x/application/keeper/keeper.go deleted file mode 100644 index 38ac34db4..000000000 --- a/x/application/keeper/keeper.go +++ /dev/null @@ -1,57 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - accountKeeper types.AccountKeeper - gatewayKeeper types.GatewayKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, - accountKeeper types.AccountKeeper, - gatewayKeeper types.GatewayKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - accountKeeper: accountKeeper, - gatewayKeeper: gatewayKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/application/keeper/msg_server.go b/x/application/keeper/msg_server.go deleted file mode 100644 index 8f740e15c..000000000 --- a/x/application/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/application/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/application/keeper/msg_server_delegate_to_gateway.go b/x/application/keeper/msg_server_delegate_to_gateway.go deleted file mode 100644 index 11dea867f..000000000 --- a/x/application/keeper/msg_server_delegate_to_gateway.go +++ /dev/null @@ -1,70 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelegateToGateway) (*types.MsgDelegateToGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "DelegateToGateway") - logger.Info(fmt.Sprintf("About to delegate application to gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("Delegation Message failed basic validation: %v", err)) - return nil, err - } - - // Retrieve the application from the store - app, found := k.GetApplication(ctx, msg.AppAddress) - if !found { - logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) - } - logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) - - // Check if the gateway is staked - if _, found := k.gatewayKeeper.GetGateway(ctx, msg.GatewayAddress); !found { - logger.Info(fmt.Sprintf("Gateway not found with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppGatewayNotFound, "gateway not found with address: %s", msg.GatewayAddress) - } - - // Ensure the application is not already delegated to the maximum number of gateways - maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways - if int64(len(app.DelegateeGatewayAddresses)) >= maxDelegatedParam { - logger.Info(fmt.Sprintf("Application already delegated to maximum number of gateways: %d", maxDelegatedParam)) - return nil, sdkerrors.Wrapf(types.ErrAppMaxDelegatedGateways, "application already delegated to %d gateways", maxDelegatedParam) - } - - // Check if the application is already delegated to the gateway - for _, gatewayAddr := range app.DelegateeGatewayAddresses { - if gatewayAddr == msg.GatewayAddress { - logger.Info(fmt.Sprintf("Application already delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppAlreadyDelegated, "application already delegated to gateway with address: %s", msg.GatewayAddress) - } - } - - // Update the application with the new delegatee public key - app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses, msg.GatewayAddress) - logger.Info(fmt.Sprintf("Successfully added delegatee public key to application")) - - // Update the application store with the new delegation - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully delegated application to gateway for app: %+v", app)) - - // Emit the application redelegation event - event := msg.NewRedelegationEvent() - logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) - if err := ctx.EventManager().EmitTypedEvent(event); err != nil { - logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) - return nil, err - } - - return &types.MsgDelegateToGatewayResponse{}, nil -} diff --git a/x/application/keeper/msg_server_delegate_to_gateway_test.go b/x/application/keeper/msg_server_delegate_to_gateway_test.go deleted file mode 100644 index f926af58d..000000000 --- a/x/application/keeper/msg_server_delegate_to_gateway_test.go +++ /dev/null @@ -1,280 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateways - appAddr := sample.AccAddress() - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr1) - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr1, - } - - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events := ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr1), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) - - // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr2, - } - - // Delegate the application to the second gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg2) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, 2, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[1].Type) - require.Equal(t, "app_address", events[1].Attributes[0].Key) - require.Equal(t, "gateway_address", events[1].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[1].Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr2), events[1].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 2, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) - require.Equal(t, gatewayAddr2, foundApp.DelegateeGatewayAddresses[1]) -} - -func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateway - appAddr := sample.AccAddress() - gatewayAddr := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events := ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) - - // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Attempt to delegate the application to the gateway again - _, err = srv.DelegateToGateway(wctx, delegateMsg2) - require.ErrorIs(t, err, types.ErrAppAlreadyDelegated) - events = ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) -} - -func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateway - appAddr := sample.AccAddress() - gatewayAddr := sample.AccAddress() - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Attempt to delegate the application to the unstaked gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppGatewayNotFound) - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) -} - -func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - appAddr := sample.AccAddress() - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Delegate the application to the max number of gateways - maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways - gatewayAddresses := make([]string, maxDelegatedParam) - for i := int64(0); i < k.GetParams(ctx).MaxDelegatedGateways; i++ { - // Prepare the delegation message - gatewayAddr := sample.AccAddress() - gatewayAddresses[i] = gatewayAddr - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - // Check number of gateways delegated to is correct - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, int(i+1), len(foundApp.DelegateeGatewayAddresses)) - } - - events := ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedParam), len(events)) - for i, event := range events { - require.Equal(t, "pocket.application.EventRedelegation", event.Type) - require.Equal(t, "app_address", event.Attributes[0].Key) - require.Equal(t, "gateway_address", event.Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), event.Attributes[0].Value) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[i]), event.Attributes[1].Value) - } - - // Generate an address for the gateway that'll exceed the max - gatewayAddr := sample.AccAddress() - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - - // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Attempt to delegate the application when the max is already reached - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppMaxDelegatedGateways) - events = ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedParam), len(events)) - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, maxDelegatedParam, int64(len(foundApp.DelegateeGatewayAddresses))) -} diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go deleted file mode 100644 index da22a134e..000000000 --- a/x/application/keeper/msg_server_stake_application.go +++ /dev/null @@ -1,105 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k msgServer) StakeApplication( - goCtx context.Context, - msg *types.MsgStakeApplication, -) (*types.MsgStakeApplicationResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "StakeApplication") - logger.Info(fmt.Sprintf("About to stake application with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeApplication: %v", err)) - return nil, err - } - - // Check if the application already exists or not - var err error - var coinsToDelegate sdk.Coin - app, isAppFound := k.GetApplication(ctx, msg.Address) - if !isAppFound { - logger.Info(fmt.Sprintf("Application not found. Creating new application for address %s", msg.Address)) - app = k.createApplication(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Application found. Updating application for address %s", msg.Address)) - currAppStake := *app.Stake - if err = k.updateApplication(ctx, &app, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currAppStake) - } - - // Retrieve the address of the application - appAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? - // Send the coins from the application to the staked application pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, appAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Application in the store - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully updated application stake for app: %+v", app)) - - return &types.MsgStakeApplicationResponse{}, nil -} - -func (k msgServer) createApplication( - ctx sdk.Context, - msg *types.MsgStakeApplication, -) types.Application { - return types.Application{ - Address: msg.Address, - Stake: msg.Stake, - ServiceConfigs: msg.Services, - DelegateeGatewayAddresses: make([]string, 0), - } -} - -func (k msgServer) updateApplication( - ctx sdk.Context, - app *types.Application, - msg *types.MsgStakeApplication, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != app.Address { - return sdkerrors.Wrapf(types.ErrAppUnauthorized, "msg Address (%s) != application address (%s)", msg.Address, app.Address) - } - - // Validate that the stake is not being lowered - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*app.Stake) { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake) - } - app.Stake = msg.Stake - - // Validate that the service configs maintain at least one service. - // Additional validation is done in `msg.ValidateBasic` above. - if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrAppInvalidServiceConfigs, "must have at least one service") - } - app.ServiceConfigs = msg.Services - - return nil -} diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go deleted file mode 100644 index d3e858987..000000000 --- a/x/application/keeper/msg_server_stake_application_test.go +++ /dev/null @@ -1,181 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - addr := sample.AccAddress() - - // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) - require.False(t, isAppFound) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the application exists - appFound, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, addr, appFound.Address) - require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) - require.Len(t, appFound.ServiceConfigs, 1) - require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) - - // Prepare an updated application with a higher stake and another service - updateStakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(200)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - { - Service: &sharedtypes.Service{Id: "svc2"}, - }, - }, - } - - // Update the staked application - _, err = srv.StakeApplication(wctx, updateStakeMsg) - require.NoError(t, err) - appFound, isAppFound = k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, int64(200), appFound.Stake.Amount.Int64()) - require.Len(t, appFound.ServiceConfigs, 2) - require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) - require.Equal(t, "svc2", appFound.ServiceConfigs[1].Service.Id) -} - -func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - appAddr := sample.AccAddress() - - // Prepare the application stake message - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - - // Prepare the application stake message without any services - updateStakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{}, - } - - // Fail updating the application when the list of services is empty - _, err = srv.StakeApplication(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the app still exists and is staked for svc1 - app, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, app.Address) - require.Len(t, app.ServiceConfigs, 1) - require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) - - // Prepare the application stake message with an invalid service ID - updateStakeMsg = &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, - }, - }, - } - - // Fail updating the application when the list of services is empty - _, err = srv.StakeApplication(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the app still exists and is staked for svc1 - app, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, app.Address) - require.Len(t, app.ServiceConfigs, 1) - require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) -} - -func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Prepare the application - addr := sample.AccAddress() - stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - - // Prepare an updated application with a lower stake - updateMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(50)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Verify that it fails - _, err = srv.StakeApplication(wctx, updateMsg) - require.Error(t, err) - - // Verify that the application stake is unchanged - appFound, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) -} diff --git a/x/application/keeper/msg_server_test.go b/x/application/keeper/msg_server_test.go deleted file mode 100644 index cc6a8f16f..000000000 --- a/x/application/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.ApplicationKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/application/keeper/msg_server_undelegate_from_gateway.go b/x/application/keeper/msg_server_undelegate_from_gateway.go deleted file mode 100644 index 5c755e648..000000000 --- a/x/application/keeper/msg_server_undelegate_from_gateway.go +++ /dev/null @@ -1,63 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k msgServer) UndelegateFromGateway( - goCtx context.Context, - msg *types.MsgUndelegateFromGateway, -) (*types.MsgUndelegateFromGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UndelegateFromGateway") - logger.Info(fmt.Sprintf("About to undelegate application from gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("Undelegation Message failed basic validation: %v", err)) - return nil, err - } - - // Retrieve the application from the store - app, found := k.GetApplication(ctx, msg.AppAddress) - if !found { - logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) - } - logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) - - // Check if the application is already delegated to the gateway - foundIdx := -1 - for i, gatewayAddr := range app.DelegateeGatewayAddresses { - if gatewayAddr == msg.GatewayAddress { - foundIdx = i - } - } - if foundIdx == -1 { - logger.Info(fmt.Sprintf("Application not delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotDelegated, "application not delegated to gateway with address: %s", msg.GatewayAddress) - } - - // Remove the gateway from the application's delegatee gateway public keys - app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses[:foundIdx], app.DelegateeGatewayAddresses[foundIdx+1:]...) - - // Update the application store with the new delegation - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully undelegated application from gateway for app: %+v", app)) - - // Emit the application redelegation event - event := msg.NewRedelegationEvent() - logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) - if err := ctx.EventManager().EmitTypedEvent(event); err != nil { - logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) - return nil, err - } - - return &types.MsgUndelegateFromGatewayResponse{}, nil -} diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go deleted file mode 100644 index 63dba4f31..000000000 --- a/x/application/keeper/msg_server_undelegate_from_gateway_test.go +++ /dev/null @@ -1,257 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateways - appAddr := sample.AccAddress() - maxDelegatedGateways := k.GetParams(ctx).MaxDelegatedGateways - gatewayAddresses := make([]string, int(maxDelegatedGateways)) - for i := 0; i < len(gatewayAddresses); i++ { - gatewayAddr := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - gatewayAddresses[i] = gatewayAddr - } - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation messages and delegate the application to the gateways - for _, gatewayAddr := range gatewayAddresses { - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - } - events := ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedGateways), len(events)) - for i, event := range events { - require.Equal(t, "pocket.application.EventRedelegation", event.Type) - require.Equal(t, "app_address", event.Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), event.Attributes[0].Value) - require.Equal(t, "gateway_address", event.Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[i]), event.Attributes[1].Value) - } - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, maxDelegatedGateways, int64(len(foundApp.DelegateeGatewayAddresses))) - for i, gatewayAddr := range gatewayAddresses { - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) - } - - // Prepare an undelegation message - undelegateMsg := &types.MsgUndelegateFromGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddresses[3], - } - - // Undelegate the application from the gateway - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, int(maxDelegatedGateways)+1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[7].Type) - require.Equal(t, "app_address", events[7].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[7].Attributes[0].Value) - require.Equal(t, "gateway_address", events[7].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[3]), events[7].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, maxDelegatedGateways-1, int64(len(foundApp.DelegateeGatewayAddresses))) - gatewayAddresses = append(gatewayAddresses[:3], gatewayAddresses[4:]...) - for i, gatewayAddr := range gatewayAddresses { - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) - } -} - -func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateway - appAddr := sample.AccAddress() - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr1) - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the undelegation message - undelegateMsg := &types.MsgUndelegateFromGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr1, - } - - // Attempt to undelgate the application from the gateway - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.ErrorIs(t, err, types.ErrAppNotDelegated) - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) - events := ctx.EventManager().Events() - require.Equal(t, 0, len(events)) - - // Prepare a delegation message - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr2, - } - - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr2), events[0].Attributes[1].Value) - - // Ensure the failed undelegation did not affect the application - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.ErrorIs(t, err, types.ErrAppNotDelegated) - events = ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr2, foundApp.DelegateeGatewayAddresses[0]) -} - -func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGateway(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application and gateways - appAddr := sample.AccAddress() - gatewayAddr := sample.AccAddress() - // Mock the gateway being staked via the staked gateway map - keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - - // Prepare the application - stakeMsg := &types.MsgStakeApplication{ - Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application & verify that the application exists - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - - // Prepare the delegation message and delegate the application to the gateway - delegateMsg := &types.MsgDelegateToGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - // Delegate the application to the gateway - _, err = srv.DelegateToGateway(wctx, delegateMsg) - require.NoError(t, err) - events := ctx.EventManager().Events() - require.Equal(t, 1, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[0].Type) - require.Equal(t, "app_address", events[0].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound := k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) - require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) - - // Mock unstaking the gateway - keepertest.RemoveGatewayFromStakedGatewayMap(t, gatewayAddr) - - // Prepare an undelegation message - undelegateMsg := &types.MsgUndelegateFromGateway{ - AppAddress: appAddr, - GatewayAddress: gatewayAddr, - } - - // Undelegate the application from the gateway - _, err = srv.UndelegateFromGateway(wctx, undelegateMsg) - require.NoError(t, err) - events = ctx.EventManager().Events() - require.Equal(t, 2, len(events)) - require.Equal(t, "pocket.application.EventRedelegation", events[1].Type) - require.Equal(t, "app_address", events[1].Attributes[0].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[1].Attributes[0].Value) - require.Equal(t, "gateway_address", events[0].Attributes[1].Key) - require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) - - // Verify that the application exists - foundApp, isAppFound = k.GetApplication(ctx, appAddr) - require.True(t, isAppFound) - require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) -} diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go deleted file mode 100644 index d6f582aaa..000000000 --- a/x/application/keeper/msg_server_unstake_application.go +++ /dev/null @@ -1,50 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// TODO(#73): Determine if an application needs an unbonding period after unstaking. -func (k msgServer) UnstakeApplication( - goCtx context.Context, - msg *types.MsgUnstakeApplication, -) (*types.MsgUnstakeApplicationResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UnstakeApplication") - logger.Info(fmt.Sprintf("About to unstake application with msg: %v", msg)) - - // Check if the application already exists or not - var err error - app, isAppFound := k.GetApplication(ctx, msg.Address) - if !isAppFound { - logger.Info(fmt.Sprintf("Application not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrAppNotFound - } - logger.Info(fmt.Sprintf("Application found. Unstaking application for address %s", msg.Address)) - - // Retrieve the address of the application - appAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the application pool back to the application - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, appAddress, []sdk.Coin{*app.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", app.Stake, appAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Application in the store - k.RemoveApplication(ctx, appAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the application: %+v", app)) - - return &types.MsgUnstakeApplicationResponse{}, nil -} diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go deleted file mode 100644 index 4d23ff0a0..000000000 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgServer_UnstakeApplication_Success(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - addr := sample.AccAddress() - - // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) - require.False(t, isAppFound) - - // Prepare the application - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &initialStake, - Services: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1"}, - }, - }, - } - - // Stake the application - _, err := srv.StakeApplication(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the application exists - appFound, isAppFound := k.GetApplication(ctx, addr) - require.True(t, isAppFound) - require.Equal(t, addr, appFound.Address) - require.Equal(t, initialStake.Amount, appFound.Stake.Amount) - require.Len(t, appFound.ServiceConfigs, 1) - - // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: addr} - _, err = srv.UnstakeApplication(wctx, unstakeMsg) - require.NoError(t, err) - - // Make sure the app can no longer be found after unstaking - _, isAppFound = k.GetApplication(ctx, addr) - require.False(t, isAppFound) -} - -func TestMsgServer_UnstakeApplication_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.ApplicationKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the application - addr := sample.AccAddress() - - // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) - require.False(t, isAppFound) - - // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: addr} - _, err := srv.UnstakeApplication(wctx, unstakeMsg) - require.Error(t, err) - require.ErrorIs(t, err, types.ErrAppNotFound) - - _, isAppFound = k.GetApplication(ctx, addr) - require.False(t, isAppFound) -} diff --git a/x/application/keeper/params.go b/x/application/keeper/params.go deleted file mode 100644 index 566999f58..000000000 --- a/x/application/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/application/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/application/keeper/params_test.go b/x/application/keeper/params_test.go deleted file mode 100644 index fb0b40921..000000000 --- a/x/application/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.ApplicationKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/application/keeper/query.go b/x/application/keeper/query.go deleted file mode 100644 index 288fcb527..000000000 --- a/x/application/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/application/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/application/keeper/query_application.go b/x/application/keeper/query_application.go deleted file mode 100644 index c08c3c925..000000000 --- a/x/application/keeper/query_application.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k Keeper) ApplicationAll(goCtx context.Context, req *types.QueryAllApplicationRequest) (*types.QueryAllApplicationResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var applications []types.Application - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - applicationStore := prefix.NewStore(store, types.KeyPrefix(types.ApplicationKeyPrefix)) - - pageRes, err := query.Paginate(applicationStore, req.Pagination, func(key []byte, value []byte) error { - var application types.Application - if err := k.cdc.Unmarshal(value, &application); err != nil { - return err - } - - applications = append(applications, application) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllApplicationResponse{Application: applications, Pagination: pageRes}, nil -} - -func (k Keeper) Application(goCtx context.Context, req *types.QueryGetApplicationRequest) (*types.QueryGetApplicationResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetApplication( - ctx, - req.Address, - ) - if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("application not found: address %s", req.Address)) - } - - return &types.QueryGetApplicationResponse{Application: val}, nil -} diff --git a/x/application/keeper/query_application_test.go b/x/application/keeper/query_application_test.go deleted file mode 100644 index 0cc9c35e9..000000000 --- a/x/application/keeper/query_application_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/application/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestApplicationQuerySingle(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNApplication(keeper, ctx, 2) - tests := []struct { - desc string - request *types.QueryGetApplicationRequest - response *types.QueryGetApplicationResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetApplicationRequest{ - Address: msgs[0].Address, - }, - response: &types.QueryGetApplicationResponse{Application: msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetApplicationRequest{ - Address: msgs[1].Address, - }, - response: &types.QueryGetApplicationResponse{Application: msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetApplicationRequest{ - Address: strconv.Itoa(100000), - }, - err: status.Error(codes.NotFound, "application not found"), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Application(wctx, tc.request) - if tc.err != nil { - require.ErrorContains(t, err, tc.err.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestApplicationQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.ApplicationKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNApplication(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllApplicationRequest { - return &types.QueryAllApplicationRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ApplicationAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ApplicationAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Application), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.ApplicationAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.ApplicationAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/application/keeper/query_params.go b/x/application/keeper/query_params.go deleted file mode 100644 index b0c717d4f..000000000 --- a/x/application/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/application/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/application/keeper/query_params_test.go b/x/application/keeper/query_params_test.go deleted file mode 100644 index 6463c3764..000000000 --- a/x/application/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.ApplicationKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/application/module.go b/x/application/module.go deleted file mode 100644 index 44ba01150..000000000 --- a/x/application/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package application - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "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/pokt-network/poktroll/x/application/client/cli" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/application/module_simulation.go b/x/application/module_simulation.go deleted file mode 100644 index 9982f2db9..000000000 --- a/x/application/module_simulation.go +++ /dev/null @@ -1,157 +0,0 @@ -package application - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - applicationsimulation "github.com/pokt-network/poktroll/x/application/simulation" - "github.com/pokt-network/poktroll/x/application/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = applicationsimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgStakeApplication = "op_weight_msg_stake_application" - // TODO: Determine the simulation weight value - defaultWeightMsgStakeApplication int = 100 - - opWeightMsgUnstakeApplication = "op_weight_msg_unstake_application" - // TODO: Determine the simulation weight value - defaultWeightMsgUnstakeApplication int = 100 - - opWeightMsgDelegateToGateway = "op_weight_msg_delegate_to_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgDelegateToGateway int = 100 - - opWeightMsgUndelegateFromGateway = "op_weight_msg_undelegate_from_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgUndelegateFromGateway int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - applicationGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&applicationGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgStakeApplication int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgStakeApplication, &weightMsgStakeApplication, nil, - func(_ *rand.Rand) { - weightMsgStakeApplication = defaultWeightMsgStakeApplication - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgStakeApplication, - applicationsimulation.SimulateMsgStakeApplication(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUnstakeApplication int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnstakeApplication, &weightMsgUnstakeApplication, nil, - func(_ *rand.Rand) { - weightMsgUnstakeApplication = defaultWeightMsgUnstakeApplication - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUnstakeApplication, - applicationsimulation.SimulateMsgUnstakeApplication(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgDelegateToGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDelegateToGateway, &weightMsgDelegateToGateway, nil, - func(_ *rand.Rand) { - weightMsgDelegateToGateway = defaultWeightMsgDelegateToGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgDelegateToGateway, - applicationsimulation.SimulateMsgDelegateToGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUndelegateFromGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUndelegateFromGateway, &weightMsgUndelegateFromGateway, nil, - func(_ *rand.Rand) { - weightMsgUndelegateFromGateway = defaultWeightMsgUndelegateFromGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUndelegateFromGateway, - applicationsimulation.SimulateMsgUndelegateFromGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgStakeApplication, - defaultWeightMsgStakeApplication, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgStakeApplication(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUnstakeApplication, - defaultWeightMsgUnstakeApplication, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgUnstakeApplication(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgDelegateToGateway, - defaultWeightMsgDelegateToGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgDelegateToGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUndelegateFromGateway, - defaultWeightMsgUndelegateFromGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgUndelegateFromGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/application/simulation/delegate_to_gateway.go b/x/application/simulation/delegate_to_gateway.go deleted file mode 100644 index 37070e16e..000000000 --- a/x/application/simulation/delegate_to_gateway.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -func SimulateMsgDelegateToGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAppAccount, _ := simtypes.RandomAcc(r, accs) - simGatewayAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDelegateToGateway{ - AppAddress: simAppAccount.Address.String(), - GatewayAddress: simGatewayAccount.Address.String(), - } - - // TODO: Handling the DelegateToGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DelegateToGateway simulation not implemented"), nil, nil - } -} diff --git a/x/application/simulation/helpers.go b/x/application/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/application/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/application/simulation/stake_application.go b/x/application/simulation/stake_application.go deleted file mode 100644 index d17afd14e..000000000 --- a/x/application/simulation/stake_application.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -// TODO(@Olshansk): Implement simulation for application staking -func SimulateMsgStakeApplication( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - stakeMsg := &types.MsgStakeApplication{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the StakeApplication simulation - // See the documentation here to simulate application staking: https://docs.cosmos.network/main/learn/advanced/simulation - - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeApplication simulation not implemented"), nil, nil - } -} diff --git a/x/application/simulation/undelegate_from_gateway.go b/x/application/simulation/undelegate_from_gateway.go deleted file mode 100644 index 9ada988fd..000000000 --- a/x/application/simulation/undelegate_from_gateway.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -func SimulateMsgUndelegateFromGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAppAccount, _ := simtypes.RandomAcc(r, accs) - simGatewayAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUndelegateFromGateway{ - AppAddress: simAppAccount.Address.String(), - GatewayAddress: simGatewayAccount.Address.String(), - } - - // TODO: Handling the UndelegateFromGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UndelegateFromGateway simulation not implemented"), nil, nil - } -} diff --git a/x/application/simulation/unstake_application.go b/x/application/simulation/unstake_application.go deleted file mode 100644 index 3dcccd3b5..000000000 --- a/x/application/simulation/unstake_application.go +++ /dev/null @@ -1,32 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" -) - -// TODO(@Olshansk): Implement simulation for application staking -func SimulateMsgUnstakeApplication( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUnstakeApplication{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the UnstakeApplication simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeApplication simulation not implemented"), nil, nil - } -} diff --git a/x/application/types/codec.go b/x/application/types/codec.go deleted file mode 100644 index 420ef8ecb..000000000 --- a/x/application/types/codec.go +++ /dev/null @@ -1,37 +0,0 @@ -package types - -import ( - "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/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeApplication{}, "application/StakeApplication", nil) - cdc.RegisterConcrete(&MsgUnstakeApplication{}, "application/UnstakeApplication", nil) - cdc.RegisterConcrete(&MsgDelegateToGateway{}, "application/DelegateToGateway", nil) - cdc.RegisterConcrete(&MsgUndelegateFromGateway{}, "application/UndelegateFromGateway", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeApplication{}, - &MsgUnstakeApplication{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgDelegateToGateway{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUndelegateFromGateway{}, - ) - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/application/types/errors.go b/x/application/types/errors.go deleted file mode 100644 index ea89e77e1..000000000 --- a/x/application/types/errors.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/application module sentinel errors -var ( - ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid application stake") - ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid application address") - ErrAppUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized application signer") - ErrAppNotFound = sdkerrors.Register(ModuleName, 4, "application not found") - ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 6, "invalid service configs") - ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 7, "gateway not found") - ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 8, "invalid gateway address") - ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 9, "application already delegated to gateway") - ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 10, "maximum number of delegated gateways reached") - ErrAppInvalidMaxDelegatedGateways = sdkerrors.Register(ModuleName, 11, "invalid MaxDelegatedGateways parameter") - ErrAppNotDelegated = sdkerrors.Register(ModuleName, 12, "application not delegated to gateway") -) diff --git a/x/application/types/expected_keepers.go b/x/application/types/expected_keepers.go deleted file mode 100644 index 55ab9222a..000000000 --- a/x/application/types/expected_keepers.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/application/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,GatewayKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} - -// GatewayKeeper defines the expected interface needed to retrieve gateway information. -type GatewayKeeper interface { - GetGateway(ctx sdk.Context, addr string) (gatewaytypes.Gateway, bool) -} diff --git a/x/application/types/genesis.go b/x/application/types/genesis.go deleted file mode 100644 index ce8046f53..000000000 --- a/x/application/types/genesis.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - ApplicationList: []Application{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // Check for duplicated index in application - applicationIndexMap := make(map[string]struct{}) - for _, app := range gs.ApplicationList { - index := string(ApplicationKey(app.Address)) - if _, ok := applicationIndexMap[index]; ok { - return fmt.Errorf("duplicated index for application") - } - applicationIndexMap[index] = struct{}{} - } - - // Check that the stake value for the apps is valid and that the delegatee addresses are valid - for _, app := range gs.ApplicationList { - // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, - // similar to how we have `ValidateAppServiceConfigs` below - if app.Stake == nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "nil stake amount for application") - } - stake, err := sdk.ParseCoinNormalized(app.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse stake amount for application %v; (%v)", app.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", app.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application %v", app.Stake) - } - - // Check that the application's delegated gateway addresses are valid - for _, gatewayAddr := range app.DelegateeGatewayAddresses { - if _, err := sdk.AccAddressFromBech32(gatewayAddr); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", gatewayAddr, err) - } - } - - // Validate the application service configs - if err := servicehelpers.ValidateAppServiceConfigs(app.ServiceConfigs); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) - } - } - - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/application/types/genesis_test.go b/x/application/types/genesis_test.go deleted file mode 100644 index 3e7ce0361..000000000 --- a/x/application/types/genesis_test.go +++ /dev/null @@ -1,388 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - svc1AppConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: "svc1"}, - } - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - svc2AppConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: "svc2"}, - } - - emptyDelegatees := make([]string, 0) - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - zero app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative application stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to duplicated app address", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr1, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to nil app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: nil, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to missing app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - // Explicitly missing stake - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to invalid delegatee pub key", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{"invalid address"}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to invalid delegatee pub keys", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1}, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{"invalid address", gatewayAddr2}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service config not present", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - // ServiceConfigs: omitted - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - empty service config", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service ID too long", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12345678901"}}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service name too long", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service ID with invalid characters", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12 45 !"}}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - MaxDelegatedGateways less than 1", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 0, - }, - }, - valid: false, - }, - - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/application/types/key_application.go b/x/application/types/key_application.go deleted file mode 100644 index 02cbefc4e..000000000 --- a/x/application/types/key_application.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // ApplicationKeyPrefix is the prefix to retrieve all Application - ApplicationKeyPrefix = "Application/value/" -) - -// ApplicationKey returns the store key to retrieve a Application from the index fields -func ApplicationKey( - address string, -) []byte { - var key []byte - - addressBytes := []byte(address) - key = append(key, addressBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/application/types/keys.go b/x/application/types/keys.go deleted file mode 100644 index 5c9cbdd98..000000000 --- a/x/application/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "application" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_application" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/application/types/message_delegate_to_gateway.go b/x/application/types/message_delegate_to_gateway.go deleted file mode 100644 index 71b17984f..000000000 --- a/x/application/types/message_delegate_to_gateway.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgDelegateToGateway = "delegate_to_gateway" - -var _ sdk.Msg = (*MsgDelegateToGateway)(nil) - -func NewMsgDelegateToGateway(appAddress, gatewayAddress string) *MsgDelegateToGateway { - return &MsgDelegateToGateway{ - AppAddress: appAddress, - GatewayAddress: gatewayAddress, - } -} - -func (msg *MsgDelegateToGateway) Route() string { - return RouterKey -} - -func (msg *MsgDelegateToGateway) Type() string { - return TypeMsgDelegateToGateway -} - -func (msg *MsgDelegateToGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.AppAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgDelegateToGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgDelegateToGateway) NewRedelegationEvent() *EventRedelegation { - return &EventRedelegation{ - AppAddress: msg.AppAddress, - GatewayAddress: msg.GatewayAddress, - } -} - -func (msg *MsgDelegateToGateway) ValidateBasic() error { - // Validate the application address - if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) - } - // Validate the gateway address - if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) - } - return nil -} diff --git a/x/application/types/message_delegate_to_gateway_test.go b/x/application/types/message_delegate_to_gateway_test.go deleted file mode 100644 index 0769d3e65..000000000 --- a/x/application/types/message_delegate_to_gateway_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - - "github.com/stretchr/testify/require" -) - -func TestMsgDelegateToGateway_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgDelegateToGateway - err error - }{ - { - name: "invalid app address - no gateway address", - msg: MsgDelegateToGateway{ - AppAddress: "invalid_address", - // GatewayAddress: intentionally omitted, - }, - err: ErrAppInvalidAddress, - }, { - name: "valid app address - no gateway address", - msg: MsgDelegateToGateway{ - AppAddress: sample.AccAddress(), - // GatewayAddress: intentionally omitted, - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid app address - invalid gateway address", - msg: MsgDelegateToGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: "invalid_address", - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid address", - msg: MsgDelegateToGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/message_stake_application.go b/x/application/types/message_stake_application.go deleted file mode 100644 index 2b559d3a5..000000000 --- a/x/application/types/message_stake_application.go +++ /dev/null @@ -1,83 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const TypeMsgStakeApplication = "stake_application" - -var _ sdk.Msg = (*MsgStakeApplication)(nil) - -// TODO_TECHDEBT: See `NewMsgStakeSupplier` and follow the same pattern for the `Services` parameter -func NewMsgStakeApplication( - address string, - stake types.Coin, - appServiceConfigs []*sharedtypes.ApplicationServiceConfig, -) *MsgStakeApplication { - - return &MsgStakeApplication{ - Address: address, - Stake: &stake, - Services: appServiceConfigs, - } -} - -func (msg *MsgStakeApplication) Route() string { - return RouterKey -} - -func (msg *MsgStakeApplication) Type() string { - return TypeMsgStakeApplication -} - -func (msg *MsgStakeApplication) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeApplication) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgStakeApplication) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.Address, err) - } - - // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "nil application stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid application stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse application stake %v; (%v)", msg.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application: %v", msg.Stake) - } - - // Validate the application service configs - if err := servicehelpers.ValidateAppServiceConfigs(msg.Services); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) - } - - return nil -} diff --git a/x/application/types/message_stake_application_test.go b/x/application/types/message_stake_application_test.go deleted file mode 100644 index 0d155f50c..000000000 --- a/x/application/types/message_stake_application_test.go +++ /dev/null @@ -1,172 +0,0 @@ -package types - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgStakeApplication_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgStakeApplication - err error - }{ - // address related tests - { - name: "invalid address - nil stake", - msg: MsgStakeApplication{ - Address: "invalid_address", - // Stake explicitly nil - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidAddress, - }, - - // stake related tests - { - name: "valid address - nil stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - // Stake explicitly nil - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - }, { - name: "valid address - zero stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - invalid stake denom", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - }, - }, - err: ErrAppInvalidStake, - }, - - // service related tests - { - name: "valid service configs - multiple services", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "svc1"}}, - {Service: &sharedtypes.Service{Id: "svc2"}}, - }, - }, - }, - { - name: "invalid service configs - not present", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - // Services: omitted - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - empty", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{}, - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - invalid service ID that's too long", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "123456790"}}, - }, - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - invalid service Name that's too long", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }}, - }, - }, - err: ErrAppInvalidServiceConfigs, - }, - { - name: "invalid service configs - invalid service ID that contains invalid characters", - msg: MsgStakeApplication{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12 45 !"}}, - }, - }, - err: ErrAppInvalidServiceConfigs, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorContains(t, err, tt.err.Error()) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/message_undelegate_from_gateway.go b/x/application/types/message_undelegate_from_gateway.go deleted file mode 100644 index 0ab47aa47..000000000 --- a/x/application/types/message_undelegate_from_gateway.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -const TypeMsgUndelegateFromGateway = "undelegate_from_gateway" - -var _ sdk.Msg = (*MsgUndelegateFromGateway)(nil) - -func NewMsgUndelegateFromGateway(appAddress, gatewayAddress string) *MsgUndelegateFromGateway { - return &MsgUndelegateFromGateway{ - AppAddress: appAddress, - GatewayAddress: gatewayAddress, - } -} - -func (msg *MsgUndelegateFromGateway) Route() string { - return RouterKey -} - -func (msg *MsgUndelegateFromGateway) Type() string { - return TypeMsgUndelegateFromGateway -} - -func (msg *MsgUndelegateFromGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.AppAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUndelegateFromGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUndelegateFromGateway) NewRedelegationEvent() *EventRedelegation { - return &EventRedelegation{ - AppAddress: msg.AppAddress, - GatewayAddress: msg.GatewayAddress, - } -} - -func (msg *MsgUndelegateFromGateway) ValidateBasic() error { - // Validate the application address - if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) - } - // Validate the gateway address - if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) - } - return nil -} diff --git a/x/application/types/message_undelegate_from_gateway_test.go b/x/application/types/message_undelegate_from_gateway_test.go deleted file mode 100644 index b40b520e9..000000000 --- a/x/application/types/message_undelegate_from_gateway_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - - "github.com/stretchr/testify/require" -) - -func TestMsgUndelegateFromGateway_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUndelegateFromGateway - err error - }{ - { - name: "invalid app address - no gateway address", - msg: MsgUndelegateFromGateway{ - AppAddress: "invalid_address", - // GatewayAddress: sample.AccAddress(), - }, - err: ErrAppInvalidAddress, - }, { - name: "valid app address - no gateway address", - msg: MsgUndelegateFromGateway{ - AppAddress: sample.AccAddress(), - // GatewayAddress: sample.AccAddress(), - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid app address - invalid gateway address", - msg: MsgUndelegateFromGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: "invalid_address", - }, - err: ErrAppInvalidGatewayAddress, - }, { - name: "valid address", - msg: MsgUndelegateFromGateway{ - AppAddress: sample.AccAddress(), - GatewayAddress: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/message_unstake_application.go b/x/application/types/message_unstake_application.go deleted file mode 100644 index 010bae551..000000000 --- a/x/application/types/message_unstake_application.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUnstakeApplication = "unstake_application" - -var _ sdk.Msg = (*MsgUnstakeApplication)(nil) - -func NewMsgUnstakeApplication(address string) *MsgUnstakeApplication { - return &MsgUnstakeApplication{ - Address: address, - } -} - -func (msg *MsgUnstakeApplication) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeApplication) Type() string { - return TypeMsgUnstakeApplication -} - -func (msg *MsgUnstakeApplication) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeApplication) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUnstakeApplication) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid address address (%s)", err) - } - return nil -} diff --git a/x/application/types/message_unstake_application_test.go b/x/application/types/message_unstake_application_test.go deleted file mode 100644 index fdc9a5a91..000000000 --- a/x/application/types/message_unstake_application_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgUnstakeApplication_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUnstakeApplication - err error - }{ - { - name: "valid", - msg: MsgUnstakeApplication{ - Address: sample.AccAddress(), - }, - }, - { - name: "invalid - missing address", - msg: MsgUnstakeApplication{}, - err: ErrAppInvalidAddress, - }, - { - name: "invalid - invalid address", - msg: MsgUnstakeApplication{ - Address: "invalid_address", - }, - err: ErrAppInvalidAddress, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/application/types/params.go b/x/application/types/params.go deleted file mode 100644 index f5ec7cd0c..000000000 --- a/x/application/types/params.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -// TODO: Revisit default param values -const DefaultMaxDelegatedGateways int64 = 7 - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{MaxDelegatedGateways: DefaultMaxDelegatedGateways} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - if p.MaxDelegatedGateways < 1 { - return sdkerrors.Wrapf(ErrAppInvalidMaxDelegatedGateways, "MaxDelegatedGateways param < 1: got %d", p.MaxDelegatedGateways) - } - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/application/types/types.go b/x/application/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/application/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/gateway/client/cli/helpers_test.go b/x/gateway/client/cli/helpers_test.go deleted file mode 100644 index cf2ccf899..000000000 --- a/x/gateway/client/cli/helpers_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli_test - -import ( - "strconv" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithGatewayObjects creates a network with a populated gateway state of n gateway objects -func networkWithGatewayObjects(t *testing.T, n int) (*network.Network, []types.Gateway) { - t.Helper() - cfg := network.DefaultConfig() - gatewayGenesisState := network.DefaultGatewayModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(gatewayGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), gatewayGenesisState.GatewayList -} diff --git a/x/gateway/client/cli/query.go b/x/gateway/client/cli/query.go deleted file mode 100644 index b896f7583..000000000 --- a/x/gateway/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group gateway queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListGateway()) - cmd.AddCommand(CmdShowGateway()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/gateway/client/cli/query_gateway.go b/x/gateway/client/cli/query_gateway.go deleted file mode 100644 index 124c515c8..000000000 --- a/x/gateway/client/cli/query_gateway.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func CmdListGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-gateway", - Short: "list all gateways", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllGatewayRequest{ - Pagination: pageReq, - } - - res, err := queryClient.GatewayAll(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-gateway ", - Short: "shows a gateway", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - argAddress := args[0] - - params := &types.QueryGetGatewayRequest{ - Address: argAddress, - } - - res, err := queryClient.Gateway(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/query_gateway_test.go b/x/gateway/client/cli/query_gateway_test.go deleted file mode 100644 index fba32713c..000000000 --- a/x/gateway/client/cli/query_gateway_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestShowGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - tests := []struct { - desc string - idAddress string - - args []string - err error - obj types.Gateway - }{ - { - desc: "found", - idAddress: objs[0].Address, - - args: common, - obj: objs[0], - }, - { - desc: "not found", - idAddress: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.idAddress, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowGateway(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Gateway) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Gateway), - ) - } - }) - } -} - -func TestListGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGateway(), args) - require.NoError(t, err) - var resp types.QueryAllGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGateway(), args) - require.NoError(t, err) - var resp types.QueryAllGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGateway(), args) - require.NoError(t, err) - var resp types.QueryAllGatewayResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), - ) - }) -} diff --git a/x/gateway/client/cli/query_params.go b/x/gateway/client/cli/query_params.go deleted file mode 100644 index 447a64b79..000000000 --- a/x/gateway/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/tx.go b/x/gateway/client/cli/tx.go deleted file mode 100644 index 52be2fb88..000000000 --- a/x/gateway/client/cli/tx.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdStakeGateway()) - cmd.AddCommand(CmdUnstakeGateway()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/gateway/client/cli/tx_stake_gateway.go b/x/gateway/client/cli/tx_stake_gateway.go deleted file mode 100644 index 3369f3885..000000000 --- a/x/gateway/client/cli/tx_stake_gateway.go +++ /dev/null @@ -1,61 +0,0 @@ -package cli - -import ( - "os" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/client/config" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var ( - flagStakeConfig string - _ = strconv.Itoa(0) -) - -func CmdStakeGateway() *cobra.Command { - cmd := &cobra.Command{ - Use: "stake-gateway --config ", - Short: "Stake a gateway", - Long: `Stake a gateway with the provided parameters. This is a broadcast operation that -will stake the tokens and associate them with the gateway specified by the 'from' address. -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - configContent, err := os.ReadFile(flagStakeConfig) - if err != nil { - return err - } - - gatewayStakeConfig, err := config.ParseGatewayConfig(configContent) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgStakeGateway( - clientCtx.GetFromAddress().String(), - gatewayStakeConfig.StakeAmount, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/tx_stake_gateway_test.go b/x/gateway/client/cli/tx_stake_gateway_test.go deleted file mode 100644 index f50549686..000000000 --- a/x/gateway/client/cli/tx_stake_gateway_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package cli_test - -import ( - "fmt" - "os" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestCLI_StakeGateway(t *testing.T) { - net, _ := networkWithGatewayObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the gateway to be staked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - gatewayAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - inputConfig string - expectedError *sdkerrors.Error - }{ - { - desc: "stake gateway: invalid address", - address: "invalid", - inputConfig: ` - stake_amount: 1000upokt - `, - expectedError: types.ErrGatewayInvalidAddress, - }, - { - desc: "stake gateway: missing address", - // address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - `, - expectedError: types.ErrGatewayInvalidAddress, - }, - { - desc: "stake gateway: invalid stake amount (zero)", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 0upokt - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake amount (negative)", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: -1000upokt - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake denom", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000invalid - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake missing denom", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000 - `, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: invalid stake missing stake", - address: gatewayAccount.Address.String(), - inputConfig: ``, - expectedError: types.ErrGatewayInvalidStake, - }, - { - desc: "stake gateway: valid", - address: gatewayAccount.Address.String(), - inputConfig: ` - stake_amount: 1000upokt - `, - }, - } - - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() - t.Cleanup(func() { os.Remove(configPath) }) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outStake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdStakeGateway(), args) - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - return - } - require.NoError(t, err) - - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/gateway/client/cli/tx_unstake_gateway.go b/x/gateway/client/cli/tx_unstake_gateway.go deleted file mode 100644 index e97406495..000000000 --- a/x/gateway/client/cli/tx_unstake_gateway.go +++ /dev/null @@ -1,44 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var _ = strconv.Itoa(0) - -func CmdUnstakeGateway() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "unstake-gateway ", - Short: "Unstake a gateway", - Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - msg := types.NewMsgUnstakeGateway( - clientCtx.GetFromAddress().String(), - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/gateway/client/cli/tx_unstake_gateway_test.go b/x/gateway/client/cli/tx_unstake_gateway_test.go deleted file mode 100644 index b0aa9fc16..000000000 --- a/x/gateway/client/cli/tx_unstake_gateway_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestCLI_UnstakeGateway(t *testing.T) { - net, _ := networkWithGatewayObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the gateway to be unstaked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - gatewayAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - err *sdkerrors.Error - }{ - { - desc: "unstake gateway: valid", - address: gatewayAccount.Address.String(), - }, - { - desc: "unstake gateway: missing address", - // address: gatewayAccount.Address.String(), - err: types.ErrGatewayInvalidAddress, - }, - { - desc: "unstake gateway: invalid address", - address: "invalid", - err: types.ErrGatewayInvalidAddress, - }, - } - - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outUnstake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUnstakeGateway(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/gateway/client/config/errors.go b/x/gateway/client/config/errors.go deleted file mode 100644 index aa01b3a46..000000000 --- a/x/gateway/client/config/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "gatewayconfig" - ErrGatewayConfigEmptyContent = sdkerrors.Register(codespace, 1, "empty gateway staking config content") - ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(codespace, 2, "config reader cannot unmarshal yaml content") - ErrGatewayConfigInvalidStake = sdkerrors.Register(codespace, 3, "invalid stake in gateway stake config") -) diff --git a/x/gateway/client/config/gateway_config_reader.go b/x/gateway/client/config/gateway_config_reader.go deleted file mode 100644 index 6bf7aa3e3..000000000 --- a/x/gateway/client/config/gateway_config_reader.go +++ /dev/null @@ -1,62 +0,0 @@ -package config - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "gopkg.in/yaml.v2" -) - -// YAMLStakeGateway is the structure describing the gateway stake config file -type YAMLStakeGateway struct { - StakeAmount string `yaml:"stake_amount"` -} - -// GatewayStakeConfig is the structure describing the gateway stake config -type GatewayStakeConfig struct { - StakeAmount sdk.Coin -} - -// ParseGatewayConfig parses the gateway stake yaml config file into a StakeGatewayConfig struct -func ParseGatewayConfig(configContent []byte) (*GatewayStakeConfig, error) { - var stakeConfig *YAMLStakeGateway - - if len(configContent) == 0 { - return nil, ErrGatewayConfigEmptyContent - } - - // Unmarshal the stake config file into a stakeConfig - if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { - return nil, ErrGatewayConfigUnmarshalYAML.Wrap(err.Error()) - } - - // Validate the stake config - if len(stakeConfig.StakeAmount) == 0 { - return nil, ErrGatewayConfigInvalidStake - } - - // Parse the stake amount to a coin struct - stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) - if err != nil { - return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) - } - - // Basic validation of the stake amount - if err := stakeAmount.Validate(); err != nil { - return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) - } - - if stakeAmount.IsZero() { - return nil, ErrGatewayConfigInvalidStake.Wrap("stake amount cannot be zero") - } - - // Only allow upokt coins staking - if stakeAmount.Denom != "upokt" { - return nil, ErrGatewayConfigInvalidStake.Wrapf( - "invalid stake denom, expecting: upokt, got: %s", - stakeAmount.Denom, - ) - } - - return &GatewayStakeConfig{ - StakeAmount: stakeAmount, - }, nil -} diff --git a/x/gateway/client/config/gateway_config_reader_test.go b/x/gateway/client/config/gateway_config_reader_test.go deleted file mode 100644 index b9ec91f2e..000000000 --- a/x/gateway/client/config/gateway_config_reader_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package config_test - -import ( - "testing" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/gateway/client/config" -) - -func Test_ParseGatewayStakeConfig(t *testing.T) { - tests := []struct { - desc string - expectedError *sdkerrors.Error - expectedConfig *config.GatewayStakeConfig - inputConfig string - }{ - // Valid Configs - { - desc: "valid gateway stake config", - inputConfig: ` - stake_amount: 1000upokt - `, - expectedError: nil, - expectedConfig: &config.GatewayStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - }, - }, - // Invalid Configs - { - desc: "services_test: invalid service config with empty content", - expectedError: config.ErrGatewayConfigEmptyContent, - inputConfig: ``, - }, - { - desc: "invalid stake denom", - inputConfig: ` - stake_amount: 1000invalid - `, - expectedError: config.ErrGatewayConfigInvalidStake, - }, - { - desc: "negative stake amount", - inputConfig: ` - stake_amount: -1000upokt - `, - expectedError: config.ErrGatewayConfigInvalidStake, - }, - { - desc: "zero stake amount", - inputConfig: ` - stake_amount: 0upokt - `, - expectedError: config.ErrGatewayConfigInvalidStake, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) - supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, supplierServiceConfig) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) - }) - } -} diff --git a/x/gateway/genesis.go b/x/gateway/genesis.go deleted file mode 100644 index eb9791d31..000000000 --- a/x/gateway/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package gateway - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the gateway - for _, gateway := range genState.GatewayList { - k.SetGateway(ctx, gateway) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.GatewayList = k.GetAllGateway(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/gateway/genesis_test.go b/x/gateway/genesis_test.go deleted file mode 100644 index 2a020c7cb..000000000 --- a/x/gateway/genesis_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package gateway_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - GatewayList: []types.Gateway{ - { - Address: "0", - }, - { - Address: "1", - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.GatewayKeeper(t) - gateway.InitGenesis(ctx, *k, genesisState) - got := gateway.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.GatewayList, got.GatewayList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go deleted file mode 100644 index 4cb1e5092..000000000 --- a/x/gateway/keeper/gateway.go +++ /dev/null @@ -1,64 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// SetGateway set a specific gateway in the store from its index -func (k Keeper) SetGateway(ctx sdk.Context, gateway types.Gateway) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - b := k.cdc.MustMarshal(&gateway) - store.Set(types.GatewayKey( - gateway.Address, - ), b) -} - -// GetGateway returns a gateway from its index -func (k Keeper) GetGateway( - ctx sdk.Context, - address string, - -) (val types.Gateway, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - - b := store.Get(types.GatewayKey( - address, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveGateway removes a gateway from the store -func (k Keeper) RemoveGateway( - ctx sdk.Context, - address string, - -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - store.Delete(types.GatewayKey( - address, - )) -} - -// GetAllGateway returns all gateways -func (k Keeper) GetAllGateway(ctx sdk.Context) (list []types.Gateway) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Gateway - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go deleted file mode 100644 index b343591a0..000000000 --- a/x/gateway/keeper/gateway_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNGateway(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Gateway { - items := make([]types.Gateway, n) - for i := range items { - items[i].Address = strconv.Itoa(i) - - keeper.SetGateway(ctx, items[i]) - } - return items -} - -func TestGatewayModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1f6j7u6875p2cvyrgjr0d2uecyzah0kget9vlpl", moduleAddress.String()) -} - -func TestGatewayGet(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetGateway(ctx, - item.Address, - ) - require.True(t, found) - require.Equal(t, - nullify.Fill(&item), - nullify.Fill(&rst), - ) - } -} - -func TestGatewayRemove(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { - keeper.RemoveGateway(ctx, - item.Address, - ) - _, found := keeper.GetGateway(ctx, - item.Address, - ) - require.False(t, found) - } -} - -func TestGatewayGetAll(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllGateway(ctx)), - ) -} diff --git a/x/gateway/keeper/keeper.go b/x/gateway/keeper/keeper.go deleted file mode 100644 index fcc143222..000000000 --- a/x/gateway/keeper/keeper.go +++ /dev/null @@ -1,51 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/gateway/keeper/msg_server.go b/x/gateway/keeper/msg_server.go deleted file mode 100644 index fafeff27b..000000000 --- a/x/gateway/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go deleted file mode 100644 index f5f6e63e2..000000000 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ /dev/null @@ -1,91 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func (k msgServer) StakeGateway( - goCtx context.Context, - msg *types.MsgStakeGateway, -) (*types.MsgStakeGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "StakeGateway") - logger.Info(fmt.Sprintf("About to stake gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the gateway already exists or not - var err error - var coinsToDelegate sdk.Coin - gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) - if !isGatewayFound { - logger.Info(fmt.Sprintf("Gateway not found. Creating new gateway for address %s", msg.Address)) - gateway = k.createGateway(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Gateway found. Updating gateway stake for address %s", msg.Address)) - currGatewayStake := *gateway.Stake - if err = k.updateGateway(ctx, &gateway, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) - } - - // Retrieve the address of the gateway - gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the gateway to the staked gateway pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Gateway in the store - k.SetGateway(ctx, gateway) - logger.Info(fmt.Sprintf("Successfully updated stake for gateway: %+v", gateway)) - - return &types.MsgStakeGatewayResponse{}, nil -} - -func (k msgServer) createGateway( - ctx sdk.Context, - msg *types.MsgStakeGateway, -) types.Gateway { - return types.Gateway{ - Address: msg.Address, - Stake: msg.Stake, - } -} - -func (k msgServer) updateGateway( - ctx sdk.Context, - gateway *types.Gateway, - msg *types.MsgStakeGateway, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != gateway.Address { - return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) - } - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*gateway.Stake) { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) - } - gateway.Stake = msg.Stake - return nil -} diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go deleted file mode 100644 index 597cc76d2..000000000 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the gateway - addr := sample.AccAddress() - - // Verify that the gateway does not exist yet - _, isGatewayFound := k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) - - // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &initialStake, - } - - // Stake the gateway - _, err := srv.StakeGateway(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the gateway exists - foundGateway, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, addr, foundGateway.Address) - require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) - - // Prepare an updated gateway with a higher stake - updatedStake := sdk.NewCoin("upokt", sdk.NewInt(200)) - updateMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &updatedStake, - } - - // Update the staked gateway - _, err = srv.StakeGateway(wctx, updateMsg) - require.NoError(t, err) - foundGateway, isGatewayFound = k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, updatedStake.Amount, foundGateway.Stake.Amount) -} - -func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Prepare the gateway - addr := sample.AccAddress() - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &initialStake, - } - - // Stake the gateway & verify that the gateway exists - _, err := srv.StakeGateway(wctx, stakeMsg) - require.NoError(t, err) - _, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - - // Prepare an updated gateway with a lower stake - updatedStake := sdk.NewCoin("upokt", sdk.NewInt(50)) - updateMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &updatedStake, - } - - // Verify that it fails - _, err = srv.StakeGateway(wctx, updateMsg) - require.Error(t, err) - - // Verify that the gateway stake is unchanged - gatewayFound, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, initialStake.Amount, gatewayFound.Stake.Amount) -} diff --git a/x/gateway/keeper/msg_server_test.go b/x/gateway/keeper/msg_server_test.go deleted file mode 100644 index 598dda0e5..000000000 --- a/x/gateway/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.GatewayKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go deleted file mode 100644 index 3521d1bac..000000000 --- a/x/gateway/keeper/msg_server_unstake_gateway.go +++ /dev/null @@ -1,54 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// TODO_TECHDEBT(#49): Add un-delegation from delegated apps -// TODO(#73): Determine if a gateway needs an unbonding period after unstaking. -func (k msgServer) UnstakeGateway( - goCtx context.Context, - msg *types.MsgUnstakeGateway, -) (*types.MsgUnstakeGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UnstakeGateway") - logger.Info(fmt.Sprintf("About to unstake gateway with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the gateway already exists or not - var err error - gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) - if !isGatewayFound { - logger.Info(fmt.Sprintf("Gateway not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrGatewayNotFound - } - logger.Info(fmt.Sprintf("Gateway found. Unstaking gateway for address %s", msg.Address)) - - // Retrieve the address of the gateway - gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the gateway pool back to the gateway - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, gatewayAddress, []sdk.Coin{*gateway.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", gateway.Stake, gatewayAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Gateway in the store - k.RemoveGateway(ctx, gatewayAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the gateway: %+v", gateway)) - return &types.MsgUnstakeGatewayResponse{}, nil -} diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go deleted file mode 100644 index 421316b78..000000000 --- a/x/gateway/keeper/msg_server_unstake_gateway_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestMsgServer_UnstakeGateway_Success(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the gateway - addr := sample.AccAddress() - - // Verify that the gateway does not exist yet - _, isGatewayFound := k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) - - // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ - Address: addr, - Stake: &initialStake, - } - - // Stake the gateway - _, err := srv.StakeGateway(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the gateway exists - foundGateway, isGatewayFound := k.GetGateway(ctx, addr) - require.True(t, isGatewayFound) - require.Equal(t, addr, foundGateway.Address) - require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) - - // Unstake the gateway - unstakeMsg := &types.MsgUnstakeGateway{Address: addr} - _, err = srv.UnstakeGateway(wctx, unstakeMsg) - require.NoError(t, err) - - // Make sure the gateway can no longer be found after unstaking - _, isGatewayFound = k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) -} - -func TestMsgServer_UnstakeGateway_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the gateway - addr := sample.AccAddress() - - // Verify that the gateway does not exist yet - _, isGatewayFound := k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) - - // Unstake the gateway - unstakeMsg := &types.MsgUnstakeGateway{Address: addr} - _, err := srv.UnstakeGateway(wctx, unstakeMsg) - require.Error(t, err) - require.ErrorIs(t, err, types.ErrGatewayNotFound) - - _, isGatewayFound = k.GetGateway(ctx, addr) - require.False(t, isGatewayFound) -} diff --git a/x/gateway/keeper/params.go b/x/gateway/keeper/params.go deleted file mode 100644 index e16780bc5..000000000 --- a/x/gateway/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go deleted file mode 100644 index 748d837cf..000000000 --- a/x/gateway/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.GatewayKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/gateway/keeper/query.go b/x/gateway/keeper/query.go deleted file mode 100644 index ffa80d00d..000000000 --- a/x/gateway/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go deleted file mode 100644 index 7e18dea34..000000000 --- a/x/gateway/keeper/query_gateway.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func (k Keeper) GatewayAll(goCtx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var gateways []types.Gateway - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - gatewayStore := prefix.NewStore(store, types.KeyPrefix(types.GatewayKeyPrefix)) - - pageRes, err := query.Paginate(gatewayStore, req.Pagination, func(key []byte, value []byte) error { - var gateway types.Gateway - if err := k.cdc.Unmarshal(value, &gateway); err != nil { - return err - } - - gateways = append(gateways, gateway) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil -} - -func (k Keeper) Gateway(goCtx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetGateway( - ctx, - req.Address, - ) - if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) - } - - return &types.QueryGetGatewayResponse{Gateway: val}, nil -} diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go deleted file mode 100644 index 4c289e6ae..000000000 --- a/x/gateway/keeper/query_gateway_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestGatewayQuerySingle(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNGateway(keeper, ctx, 2) - tests := []struct { - desc string - request *types.QueryGetGatewayRequest - response *types.QueryGetGatewayResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetGatewayRequest{ - Address: msgs[0].Address, - }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetGatewayRequest{ - Address: msgs[1].Address, - }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetGatewayRequest{ - Address: strconv.Itoa(100000), - }, - err: status.Error(codes.NotFound, "gateway not found"), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Gateway(wctx, tc.request) - if tc.err != nil { - require.ErrorContains(t, err, tc.err.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestGatewayQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNGateway(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewayRequest { - return &types.QueryAllGatewayRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.GatewayAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.GatewayAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/gateway/keeper/query_params.go b/x/gateway/keeper/query_params.go deleted file mode 100644 index 8d3afe26d..000000000 --- a/x/gateway/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/gateway/keeper/query_params_test.go b/x/gateway/keeper/query_params_test.go deleted file mode 100644 index 062f049ff..000000000 --- a/x/gateway/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.GatewayKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/gateway/module.go b/x/gateway/module.go deleted file mode 100644 index 86f16fb7c..000000000 --- a/x/gateway/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package gateway - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "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/pokt-network/poktroll/x/gateway/client/cli" - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/gateway/module_simulation.go b/x/gateway/module_simulation.go deleted file mode 100644 index 0aab36ae9..000000000 --- a/x/gateway/module_simulation.go +++ /dev/null @@ -1,111 +0,0 @@ -package gateway - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/testutil/sample" - gatewaysimulation "github.com/pokt-network/poktroll/x/gateway/simulation" - "github.com/pokt-network/poktroll/x/gateway/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = gatewaysimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgStakeGateway = "op_weight_msg_stake_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgStakeGateway int = 100 - - opWeightMsgUnstakeGateway = "op_weight_msg_unstake_gateway" - // TODO: Determine the simulation weight value - defaultWeightMsgUnstakeGateway int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - gatewayGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&gatewayGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgStakeGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgStakeGateway, &weightMsgStakeGateway, nil, - func(_ *rand.Rand) { - weightMsgStakeGateway = defaultWeightMsgStakeGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgStakeGateway, - gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUnstakeGateway int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnstakeGateway, &weightMsgUnstakeGateway, nil, - func(_ *rand.Rand) { - weightMsgUnstakeGateway = defaultWeightMsgUnstakeGateway - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUnstakeGateway, - gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgStakeGateway, - defaultWeightMsgStakeGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUnstakeGateway, - defaultWeightMsgUnstakeGateway, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/gateway/simulation/helpers.go b/x/gateway/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/gateway/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go deleted file mode 100644 index 9a76e82fc..000000000 --- a/x/gateway/simulation/stake_gateway.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func SimulateMsgStakeGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - stakeMsg := &types.MsgStakeGateway{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the StakeGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeGateway simulation not implemented"), nil, nil - } -} diff --git a/x/gateway/simulation/unstake_gateway.go b/x/gateway/simulation/unstake_gateway.go deleted file mode 100644 index e82ebf748..000000000 --- a/x/gateway/simulation/unstake_gateway.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func SimulateMsgUnstakeGateway( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUnstakeGateway{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the UnstakeGateway simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeGateway simulation not implemented"), nil, nil - } -} diff --git a/x/gateway/types/codec.go b/x/gateway/types/codec.go deleted file mode 100644 index 8b6a56c1e..000000000 --- a/x/gateway/types/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "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/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeGateway{}, "gateway/StakeGateway", nil) - cdc.RegisterConcrete(&MsgUnstakeGateway{}, "gateway/UnstakeGateway", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeGateway{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUnstakeGateway{}, - ) - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go deleted file mode 100644 index 7a3a82930..000000000 --- a/x/gateway/types/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/gateway module sentinel errors -var ( - ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1, "invalid gateway address") - ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 2, "invalid gateway stake") - ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized signer") - ErrGatewayNotFound = sdkerrors.Register(ModuleName, 4, "gateway not found") -) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go deleted file mode 100644 index 2a6f6eed1..000000000 --- a/x/gateway/types/expected_keepers.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/gateway/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go deleted file mode 100644 index 5cb161252..000000000 --- a/x/gateway/types/genesis.go +++ /dev/null @@ -1,53 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - GatewayList: []Gateway{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - gatewayIndexMap := make(map[string]struct{}) - - for _, gateway := range gs.GatewayList { - // Check for duplicated index in gateway - index := string(GatewayKey(gateway.Address)) - if _, ok := gatewayIndexMap[index]; ok { - return sdkerrors.Wrap(ErrGatewayInvalidAddress, "duplicated index for gateway") - } - gatewayIndexMap[index] = struct{}{} - // Validate the stake of each gateway - if gateway.Stake == nil { - return sdkerrors.Wrap(ErrGatewayInvalidStake, "nil stake amount for gateway") - } - stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", gateway.Stake) - } - } - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go deleted file mode 100644 index ea1e6cdf8..000000000 --- a/x/gateway/types/genesis_test.go +++ /dev/null @@ -1,171 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &stake2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - duplicated gateway address", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr1, - Stake: &stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - nil gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: nil, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - // Stake: stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - zero gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go deleted file mode 100644 index 8fe1e65f7..000000000 --- a/x/gateway/types/key_gateway.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // GatewayKeyPrefix is the prefix to retrieve all Gateways - GatewayKeyPrefix = "Gateway/value/" -) - -// GatewayKey returns the store key to retrieve a Gateway from the index fields -func GatewayKey( - address string, -) []byte { - var key []byte - - addressBytes := []byte(address) - key = append(key, addressBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/gateway/types/keys.go b/x/gateway/types/keys.go deleted file mode 100644 index 9e70da166..000000000 --- a/x/gateway/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "gateway" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_gateway" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go deleted file mode 100644 index 70811076c..000000000 --- a/x/gateway/types/message_stake_gateway.go +++ /dev/null @@ -1,66 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgStakeGateway = "stake_gateway" - -var _ sdk.Msg = (*MsgStakeGateway)(nil) - -func NewMsgStakeGateway(address string, stake types.Coin) *MsgStakeGateway { - return &MsgStakeGateway{ - Address: address, - Stake: &stake, - } -} - -func (msg *MsgStakeGateway) Route() string { - return RouterKey -} - -func (msg *MsgStakeGateway) Type() string { - return TypeMsgStakeGateway -} - -func (msg *MsgStakeGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgStakeGateway) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) - } - - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "nil gateway stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse gateway stake %v; (%v)", msg.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", msg.Stake) - } - return nil -} diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go deleted file mode 100644 index 94299afaa..000000000 --- a/x/gateway/types/message_stake_gateway_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package types - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgStakeGateway_ValidateBasic(t *testing.T) { - coins := sdk.NewCoin("upokt", sdk.NewInt(100)) - tests := []struct { - name string - msg MsgStakeGateway - err error - }{ - { - name: "invalid address - no stake", - msg: MsgStakeGateway{ - Address: "invalid_address", - // Stake explicitly nil - }, - err: ErrGatewayInvalidAddress, - }, { - name: "valid address - nil stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - // Stake explicitly nil - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - zero stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - invalid stake denom", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - }, - err: ErrGatewayInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeGateway{ - Address: sample.AccAddress(), - Stake: &coins, - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go deleted file mode 100644 index 23bf5f97a..000000000 --- a/x/gateway/types/message_unstake_gateway.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUnstakeGateway = "unstake_gateway" - -var _ sdk.Msg = (*MsgUnstakeGateway)(nil) - -func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { - return &MsgUnstakeGateway{ - Address: address, - } -} - -func (msg *MsgUnstakeGateway) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeGateway) Type() string { - return TypeMsgUnstakeGateway -} - -func (msg *MsgUnstakeGateway) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeGateway) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUnstakeGateway) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) - } - return nil -} diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go deleted file mode 100644 index 759aa11d7..000000000 --- a/x/gateway/types/message_unstake_gateway_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUnstakeGateway - err error - }{ - { - name: "invalid address", - msg: MsgUnstakeGateway{ - Address: "invalid_address", - }, - err: ErrGatewayInvalidAddress, - }, { - name: "missing address", - msg: MsgUnstakeGateway{}, - err: ErrGatewayInvalidAddress, - }, { - name: "valid address", - msg: MsgUnstakeGateway{ - Address: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/gateway/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/gateway/types/types.go b/x/gateway/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/gateway/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/pocket/client/cli/query.go b/x/pocket/client/cli/query.go deleted file mode 100644 index 7fb94d626..000000000 --- a/x/pocket/client/cli/query.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group pocket queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/pocket/client/cli/query_params.go b/x/pocket/client/cli/query_params.go deleted file mode 100644 index 8461c3c60..000000000 --- a/x/pocket/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/pocket/client/cli/tx.go b/x/pocket/client/cli/tx.go deleted file mode 100644 index 70032b9b8..000000000 --- a/x/pocket/client/cli/tx.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/pocket/genesis.go b/x/pocket/genesis.go deleted file mode 100644 index 1a6b8738d..000000000 --- a/x/pocket/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package pocket - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/pocket/genesis_test.go b/x/pocket/genesis_test.go deleted file mode 100644 index 8e5f5ba18..000000000 --- a/x/pocket/genesis_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package pocket_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/pocket" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.PocketKeeper(t) - pocket.InitGenesis(ctx, *k, genesisState) - got := pocket.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/pocket/keeper/keeper.go b/x/pocket/keeper/keeper.go deleted file mode 100644 index 44114c392..000000000 --- a/x/pocket/keeper/keeper.go +++ /dev/null @@ -1,46 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/pocket/keeper/msg_server.go b/x/pocket/keeper/msg_server.go deleted file mode 100644 index 310ebb2e5..000000000 --- a/x/pocket/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/pocket/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/pocket/keeper/msg_server_test.go b/x/pocket/keeper/msg_server_test.go deleted file mode 100644 index e27eda21b..000000000 --- a/x/pocket/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.PocketKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/pocket/keeper/params.go b/x/pocket/keeper/params.go deleted file mode 100644 index b4b197932..000000000 --- a/x/pocket/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/pocket/keeper/params_test.go b/x/pocket/keeper/params_test.go deleted file mode 100644 index 06afe192c..000000000 --- a/x/pocket/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.PocketKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/pocket/keeper/query.go b/x/pocket/keeper/query.go deleted file mode 100644 index 24adda2bb..000000000 --- a/x/pocket/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/pocket/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/pocket/keeper/query_params.go b/x/pocket/keeper/query_params.go deleted file mode 100644 index 3fdff1051..000000000 --- a/x/pocket/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/pocket/keeper/query_params_test.go b/x/pocket/keeper/query_params_test.go deleted file mode 100644 index d40a517f4..000000000 --- a/x/pocket/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.PocketKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/pocket/module.go b/x/pocket/module.go deleted file mode 100644 index 684ea1d95..000000000 --- a/x/pocket/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package pocket - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "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/pokt-network/poktroll/x/pocket/client/cli" - "github.com/pokt-network/poktroll/x/pocket/keeper" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/pocket/module_simulation.go b/x/pocket/module_simulation.go deleted file mode 100644 index 5d5746526..000000000 --- a/x/pocket/module_simulation.go +++ /dev/null @@ -1,65 +0,0 @@ -package pocket - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - pocketsimulation "github.com/pokt-network/poktroll/x/pocket/simulation" - "github.com/pokt-network/poktroll/x/pocket/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = pocketsimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( -// this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - pocketGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&pocketGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/pocket/simulation/helpers.go b/x/pocket/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/pocket/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/pocket/types/codec.go b/x/pocket/types/codec.go deleted file mode 100644 index 39e7482ab..000000000 --- a/x/pocket/types/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( - // this line is used by starport scaffolding # 1 - - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/pocket/types/errors.go b/x/pocket/types/errors.go deleted file mode 100644 index 0d0497b02..000000000 --- a/x/pocket/types/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/pocket module sentinel errors -var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") -) diff --git a/x/pocket/types/expected_keepers.go b/x/pocket/types/expected_keepers.go deleted file mode 100644 index 6aa6e9778..000000000 --- a/x/pocket/types/expected_keepers.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here -} diff --git a/x/pocket/types/genesis.go b/x/pocket/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/pocket/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/pocket/types/genesis_test.go b/x/pocket/types/genesis_test.go deleted file mode 100644 index c2eb457a8..000000000 --- a/x/pocket/types/genesis_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/pocket/types" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/pocket/types/keys.go b/x/pocket/types/keys.go deleted file mode 100644 index 41ef46733..000000000 --- a/x/pocket/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "pocket" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_pocket" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/pocket/types/params.go b/x/pocket/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/pocket/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/pocket/types/types.go b/x/pocket/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/pocket/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/service/client/cli/query.go b/x/service/client/cli/query.go deleted file mode 100644 index f52a37c7a..000000000 --- a/x/service/client/cli/query.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/service/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group service queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/service/client/cli/query_params.go b/x/service/client/cli/query_params.go deleted file mode 100644 index cd99b673f..000000000 --- a/x/service/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/service/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/service/client/cli/tx.go b/x/service/client/cli/tx.go deleted file mode 100644 index 38c85ed8f..000000000 --- a/x/service/client/cli/tx.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/service/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdAddService()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/service/client/cli/tx_add_service.go b/x/service/client/cli/tx_add_service.go deleted file mode 100644 index af8e4861e..000000000 --- a/x/service/client/cli/tx_add_service.go +++ /dev/null @@ -1,51 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/service/types" -) - -var _ = strconv.Itoa(0) - -func CmdAddService() *cobra.Command { - cmd := &cobra.Command{ - Use: "add-service ", - Short: "Add a new service to the network", - Long: `Add a new service to the network that will be available for applications, -gateways and suppliers to use. The service id MUST be unique - or the command -will fail, however the name you use to describe it does not have to be unique. - -Example: -$ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - serviceIdStr := args[0] - serviceNameStr := args[1] - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgAddService( - clientCtx.GetFromAddress().String(), - serviceIdStr, - serviceNameStr, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/service/client/cli/tx_add_service_test.go b/x/service/client/cli/tx_add_service_test.go deleted file mode 100644 index b74d56b79..000000000 --- a/x/service/client/cli/tx_add_service_test.go +++ /dev/null @@ -1,143 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/service/client/cli" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestCLI_AddService(t *testing.T) { - net := network.New(t, network.DefaultConfig()) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the address adding the service - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - account := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf( - "--%s=%s", - flags.FlagFees, - sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), - ), - } - - // Initialize the Supplier account by sending it some funds from the - // validator account that is part of genesis - network.InitAccountWithSequence(t, net, account.Address, 1) - - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare two valid services - svc1 := sharedtypes.Service{ - Id: "svc1", - Name: "service name", - } - svc2 := sharedtypes.Service{ - Id: "svc2", - Name: "service name 2", - } - // Add svc2 to the network - args := []string{ - svc2.Id, - svc2.Name, - fmt.Sprintf("--%s=%s", flags.FlagFrom, account.Address.String()), - } - args = append(args, commonArgs...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdAddService(), args) - require.NoError(t, err) - - tests := []struct { - desc string - supplierAddress string - service sharedtypes.Service - err *sdkerrors.Error - }{ - { - desc: "valid - add new service", - supplierAddress: account.Address.String(), - service: svc1, - }, - { - desc: "invalid - missing service id", - supplierAddress: account.Address.String(), - service: sharedtypes.Service{Name: "service name"}, // ID intentionally omitted - err: types.ErrServiceMissingID, - }, - { - desc: "invalid - missing service name", - supplierAddress: account.Address.String(), - service: sharedtypes.Service{Id: "svc1"}, // Name intentionally omitted - err: types.ErrServiceMissingName, - }, - { - desc: "invalid - invalid supplier address", - supplierAddress: "invalid address", - service: svc1, - err: types.ErrServiceInvalidAddress, - }, - { - desc: "invalid - service already staked", - supplierAddress: account.Address.String(), - service: svc2, - err: types.ErrServiceAlreadyExists, - }, - } - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - tt.service.Id, - tt.service.Name, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.supplierAddress), - } - args = append(args, commonArgs...) - - // Execute the command - addServiceOutput, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdAddService(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(addServiceOutput.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/service/genesis.go b/x/service/genesis.go deleted file mode 100644 index c81e649dd..000000000 --- a/x/service/genesis.go +++ /dev/null @@ -1,29 +0,0 @@ -package service - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the initial services - for _, service := range genState.ServiceList { - k.SetService(ctx, service) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.ServiceList = k.GetAllServices(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/service/genesis_test.go b/x/service/genesis_test.go deleted file mode 100644 index d7d44c9c4..000000000 --- a/x/service/genesis_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package service_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/service" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - ServiceList: []sharedtypes.Service{ - { - Id: "svc1", - Name: "service one", - }, - { - Id: "svc2", - Name: "service two", - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.ServiceKeeper(t) - service.InitGenesis(ctx, *k, genesisState) - got := service.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.ServiceList, got.ServiceList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/service/keeper/keeper.go b/x/service/keeper/keeper.go deleted file mode 100644 index 891ec3128..000000000 --- a/x/service/keeper/keeper.go +++ /dev/null @@ -1,54 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/service/types" -) - -type ( - // Keeper defines the keeper, and its dependencies, for the service module. - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - } -) - -// NewKeeper creates a new Service module Keeper instance. -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - } -} - -// Logger provides a module-specific logger from the context's logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/x/service/keeper/msg_server.go b/x/service/keeper/msg_server.go deleted file mode 100644 index e5f891b01..000000000 --- a/x/service/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/service/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go deleted file mode 100644 index 668759873..000000000 --- a/x/service/keeper/msg_server_add_service.go +++ /dev/null @@ -1,85 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/service/types" -) - -// AddService handles MsgAddService and adds a service to the network storing -// it in the service keeper's store using the provided ID from the message. -// If the transaction's signer does not have enough funds (upokt) to cover the -// AddServiceFee service module's governance parameter, it will not be able to -// add the service. If it does, the fee will be deducted and debited to the -// service module's account, then the service will be added on-chain. -func (k msgServer) AddService( - goCtx context.Context, - msg *types.MsgAddService, -) (*types.MsgAddServiceResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "AddService") - logger.Info(fmt.Sprintf("About to add a new service with msg: %v", msg)) - - // Validate the message. - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("Adding service failed basic validation: %v", err)) - return nil, err - } - - // Check if the service already exists or not. - if _, found := k.GetService(ctx, msg.Service.Id); found { - logger.Error(fmt.Sprintf("Service already exists: %v", msg.Service)) - return nil, types.ErrServiceAlreadyExists.Wrapf( - "duplicate service ID: %s", msg.Service.Id, - ) - } - - // Retrieve the address of the actor adding the service. - accAddr, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, types.ErrServiceInvalidAddress.Wrapf( - "%s is not in Bech32 format", msg.Address, - ) - } - - // Check the actor has sufficient funds to pay for the add service fee. - accCoins := k.bankKeeper.SpendableCoins(ctx, accAddr) - if accCoins.Len() == 0 { - logger.Error(fmt.Sprintf("%s doesn't have any funds to add service: %v", msg.Address, err)) - return nil, types.ErrServiceNotEnoughFunds.Wrapf( - "account has no spendable coins", - ) - } - - // Check the balance of upokt is enough to cover the AddServiceFee. - accBalance := accCoins.AmountOf("upokt") - addServiceFee := sdk.NewIntFromUint64(k.GetParams(ctx).AddServiceFee) - if accBalance.LTE(addServiceFee) { - logger.Error(fmt.Sprintf("%s doesn't have enough funds to add service: %v", msg.Address, err)) - return nil, types.ErrServiceNotEnoughFunds.Wrapf( - "account has %d uPOKT, but the service fee is %d uPOKT", - accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, - ) - } - - // Deduct the service fee from the actor's balance. - serviceFee := sdk.Coins{sdk.NewCoin("upokt", addServiceFee)} - err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, types.ModuleName, serviceFee) - if err != nil { - logger.Error(fmt.Sprintf("Failed to deduct service fee from actor's balance: %v", err)) - return nil, types.ErrServiceFailedToDeductFee.Wrapf( - "account has %d uPOKT, failed to deduct %d uPOKT", - accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, - ) - } - - logger.Info(fmt.Sprintf("Adding service: %v", msg.Service)) - k.SetService(ctx, msg.Service) - - return &types.MsgAddServiceResponse{}, nil -} diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go deleted file mode 100644 index 9e5ab38cf..000000000 --- a/x/service/keeper/msg_server_add_service_test.go +++ /dev/null @@ -1,199 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// oneUPOKTGreaterThanFee is 1 upokt more than the AddServiceFee -const oneUPOKTGreaterThanFee = types.DefaultAddServiceFee + 1 - -func TestMsgServer_AddService(t *testing.T) { - k, ctx := keepertest.ServiceKeeper(t) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Create a service - svc1 := sharedtypes.Service{ - Id: "svc1", - Name: "service 1", - } - - // Generate a valid address - addr := sample.AccAddress() - // Create a service - preExistingService := sharedtypes.Service{ - Id: "svc2", - Name: "service 2", - } - // Mock adding a balance to the account - keepertest.AddAccToAccMapCoins(t, addr, "upokt", oneUPOKTGreaterThanFee) - // Add the service to the store - _, err := srv.AddService(wctx, &types.MsgAddService{ - Address: addr, - Service: preExistingService, - }) - require.NoError(t, err) - // Validate the service was added - serviceFound, found := k.GetService(ctx, preExistingService.Id) - require.True(t, found) - require.Equal(t, preExistingService, serviceFound) - - validAddr1 := sample.AccAddress() - validAddr2 := sample.AccAddress() - - tests := []struct { - desc string - setup func(t *testing.T) - address string - service sharedtypes.Service - expectedError error - }{ - { - desc: "valid - service added successfully", - setup: func(t *testing.T) { - // Add 10000000001 upokt to the account - keepertest.AddAccToAccMapCoins(t, validAddr1, "upokt", oneUPOKTGreaterThanFee) - }, - address: validAddr1, - service: svc1, - expectedError: nil, - }, - { - desc: "invalid - service supplier address is empty", - setup: func(t *testing.T) {}, - address: "", // explicitly set to empty string - service: sharedtypes.Service{ - Id: "svc1", - Name: "service 1", - }, - expectedError: types.ErrServiceInvalidAddress, - }, - { - desc: "invalid - invalid service supplier address", - setup: func(t *testing.T) {}, - address: "invalid address", - service: svc1, - expectedError: types.ErrServiceInvalidAddress, - }, - { - desc: "invalid - missing service ID", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: sharedtypes.Service{ - // Explicitly omitting Id field - Name: "service 1", - }, - expectedError: types.ErrServiceMissingID, - }, - { - desc: "invalid - empty service ID", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: sharedtypes.Service{ - Id: "", // explicitly set to empty string - Name: "service 1", - }, - expectedError: types.ErrServiceMissingID, - }, - { - desc: "invalid - missing service name", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: sharedtypes.Service{ - Id: "svc1", - // Explicitly omitting Name field - }, - expectedError: types.ErrServiceMissingName, - }, - { - desc: "invalid - empty service name", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: sharedtypes.Service{ - Id: "svc1", - Name: "", // explicitly set to empty string - }, - expectedError: types.ErrServiceMissingName, - }, - { - desc: "invalid - service already exists (same service supplier)", - setup: func(t *testing.T) {}, - address: addr, - service: preExistingService, - expectedError: types.ErrServiceAlreadyExists, - }, - { - desc: "invalid - service already exists (different service supplier)", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: preExistingService, - expectedError: types.ErrServiceAlreadyExists, - }, - { - desc: "invalid - no spendable coins", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, - }, - { - desc: "invalid - insufficient upokt balance", - setup: func(t *testing.T) { - // Add 999999999 upokt to the account (one less than AddServiceFee) - keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", oneUPOKTGreaterThanFee-2) - }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, - }, - { - desc: "invalid - account has exactly AddServiceFee", - setup: func(t *testing.T) { - // Add the exact fee in upokt to the account - keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", types.DefaultAddServiceFee) - }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, - }, - { - desc: "invalid - sufficient balance of different denom", - setup: func(t *testing.T) { - // Adds 10000000001 wrong coins to the account - keepertest.AddAccToAccMapCoins(t, validAddr2, "wrong", oneUPOKTGreaterThanFee) - }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - tt.setup(t) - _, err := srv.AddService(wctx, &types.MsgAddService{ - Address: tt.address, - Service: tt.service, - }) - if tt.expectedError != nil { - // Using ErrorAs as wrapping the error sometimes gives errors with ErrorIs - require.ErrorAs(t, err, &tt.expectedError) - return - } - require.NoError(t, err) - // Validate the service was added - serviceFound, found := k.GetService(ctx, tt.service.Id) - require.True(t, found) - require.Equal(t, tt.service, serviceFound) - }) - } -} diff --git a/x/service/keeper/msg_server_test.go b/x/service/keeper/msg_server_test.go deleted file mode 100644 index 0c2446853..000000000 --- a/x/service/keeper/msg_server_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" - "github.com/stretchr/testify/require" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.ServiceKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/service/keeper/params.go b/x/service/keeper/params.go deleted file mode 100644 index 948fec7a1..000000000 --- a/x/service/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/service/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/service/keeper/params_test.go b/x/service/keeper/params_test.go deleted file mode 100644 index 097742cd1..000000000 --- a/x/service/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/service/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.ServiceKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/service/keeper/query.go b/x/service/keeper/query.go deleted file mode 100644 index ac3116f9a..000000000 --- a/x/service/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/service/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/service/keeper/query_params.go b/x/service/keeper/query_params.go deleted file mode 100644 index c04f32dd9..000000000 --- a/x/service/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/service/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/service/keeper/query_params_test.go b/x/service/keeper/query_params_test.go deleted file mode 100644 index 243a9ed80..000000000 --- a/x/service/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/service/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.ServiceKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/service/keeper/service.go b/x/service/keeper/service.go deleted file mode 100644 index dd7b860f0..000000000 --- a/x/service/keeper/service.go +++ /dev/null @@ -1,75 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// SetService set a specific service in the store from its index. -func (k Keeper) SetService(ctx sdk.Context, service sharedtypes.Service) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) - serviceBz := k.cdc.MustMarshal(&service) - store.Set(types.ServiceKey( - service.Id, - ), serviceBz) -} - -// GetService returns a service from the store by its index. -func (k Keeper) GetService( - ctx sdk.Context, - serviceID string, -) (service sharedtypes.Service, found bool) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) - - serviceBz := store.Get(types.ServiceKey( - serviceID, - )) - if serviceBz == nil { - return service, false - } - - k.cdc.MustUnmarshal(serviceBz, &service) - return service, true -} - -// RemoveService removes a service from the store. -func (k Keeper) RemoveService( - ctx sdk.Context, - serviceID string, -) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) - store.Delete(types.ServiceKey( - serviceID, - )) -} - -// GetAllServices returns all services from the store. -func (k Keeper) GetAllServices(ctx sdk.Context) (list []sharedtypes.Service) { - store := prefix.NewStore( - ctx.KVStore(k.storeKey), - types.KeyPrefix(types.ServiceKeyPrefix), - ) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - service := sharedtypes.Service{} - k.cdc.MustUnmarshal(iterator.Value(), &service) - list = append(list, service) - } - - return -} diff --git a/x/service/keeper/service_test.go b/x/service/keeper/service_test.go deleted file mode 100644 index 2e7d3e763..000000000 --- a/x/service/keeper/service_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNServices(keeper *keeper.Keeper, ctx sdk.Context, n int) []sharedtypes.Service { - services := make([]sharedtypes.Service, n) - for i := range services { - services[i].Id = fmt.Sprintf("svcId%d", i) - services[i].Name = fmt.Sprintf("svcName%d", i) - - keeper.SetService(ctx, services[i]) - } - return services -} - -func TestServiceModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1nhmtqf4gcmpxu0p6e53hpgtwj0llmsqpxtumcf", moduleAddress.String()) -} - -func TestServiceGet(t *testing.T) { - keeper, ctx := keepertest.ServiceKeeper(t) - services := createNServices(keeper, ctx, 10) - for _, service := range services { - service, found := keeper.GetService(ctx, - service.Id, - ) - require.True(t, found) - require.Equal(t, - nullify.Fill(&service), - nullify.Fill(&service), - ) - } -} - -func TestServiceRemove(t *testing.T) { - keeper, ctx := keepertest.ServiceKeeper(t) - services := createNServices(keeper, ctx, 10) - for _, service := range services { - keeper.RemoveService(ctx, - service.Id, - ) - _, found := keeper.GetService(ctx, - service.Id, - ) - require.False(t, found) - } -} - -func TestServiceGetAll(t *testing.T) { - keeper, ctx := keepertest.ServiceKeeper(t) - services := createNServices(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(services), - nullify.Fill(keeper.GetAllServices(ctx)), - ) -} diff --git a/x/service/module.go b/x/service/module.go deleted file mode 100644 index a7ebd35f2..000000000 --- a/x/service/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package service - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "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/pokt-network/poktroll/x/service/client/cli" - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/service/module_simulation.go b/x/service/module_simulation.go deleted file mode 100644 index 320a12916..000000000 --- a/x/service/module_simulation.go +++ /dev/null @@ -1,88 +0,0 @@ -package service - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - servicesimulation "github.com/pokt-network/poktroll/x/service/simulation" - "github.com/pokt-network/poktroll/x/service/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = servicesimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgAddService = "op_weight_msg_add_service" - // TODO: Determine the simulation weight value - defaultWeightMsgAddService int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - serviceGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&serviceGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgAddService int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgAddService, &weightMsgAddService, nil, - func(_ *rand.Rand) { - weightMsgAddService = defaultWeightMsgAddService - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgAddService, - servicesimulation.SimulateMsgAddService(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgAddService, - defaultWeightMsgAddService, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - servicesimulation.SimulateMsgAddService(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/service/simulation/add_service.go b/x/service/simulation/add_service.go deleted file mode 100644 index 8462edcd2..000000000 --- a/x/service/simulation/add_service.go +++ /dev/null @@ -1,37 +0,0 @@ -package simulation - -import ( - "fmt" - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/service/keeper" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func SimulateMsgAddService( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - rndNum := r.Intn(100) - msg := &types.MsgAddService{ - Address: simAccount.Address.String(), - Service: sharedtypes.Service{ - Id: fmt.Sprintf("svcId%d", rndNum), - Name: fmt.Sprintf("svcName%d", rndNum), - }, - } - - // TODO: Handling the AddService simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "AddService simulation not implemented"), nil, nil - } -} diff --git a/x/service/simulation/helpers.go b/x/service/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/service/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/service/types/codec.go b/x/service/types/codec.go deleted file mode 100644 index ce02fc85e..000000000 --- a/x/service/types/codec.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -import ( - "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/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgAddService{}, "service/AddService", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgAddService{}, - ) - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/service/types/errors.go b/x/service/types/errors.go deleted file mode 100644 index b7afd2674..000000000 --- a/x/service/types/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1, "duplicate index when adding a new service") - ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address when adding a new service") - ErrServiceMissingID = sdkerrors.Register(ModuleName, 3, "missing service ID") - ErrServiceMissingName = sdkerrors.Register(ModuleName, 4, "missing service name") - ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 5, "service already exists") - ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 6, "invalid service fee") - ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found") - ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 8, "not enough funds to add service") - ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 9, "failed to deduct fee") -) diff --git a/x/service/types/expected_keepers.go b/x/service/types/expected_keepers.go deleted file mode 100644 index 37bcd4551..000000000 --- a/x/service/types/expected_keepers.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:generate mockgen -destination ../../../testutil/service/mocks/expected_keepers_mock.go -package mocks . BankKeeper -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI -} - -// BankKeeper defines the expected interface needed to retrieve account -// balances, and send coins from one account to a module's account. -type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromAccountToModule( - ctx sdk.Context, - senderAddr sdk.AccAddress, - recipientModule string, - amt sdk.Coins, - ) error -} diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go deleted file mode 100644 index 06cc3f252..000000000 --- a/x/service/types/genesis.go +++ /dev/null @@ -1,40 +0,0 @@ -package types - -import ( - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - ServiceList: []sharedtypes.Service{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // Check for duplicated index in services - serviceIDIndexMap := make(map[string]struct{}) - serviceNameIndexMap := make(map[string]struct{}) - for _, service := range gs.ServiceList { - idIndex := string(ServiceKey(service.Id)) - if _, ok := serviceIDIndexMap[idIndex]; ok { - return ErrServiceDuplicateIndex.Wrapf("duplicated ID for service: %v", service) - } - serviceIDIndexMap[idIndex] = struct{}{} - nameIndex := string(ServiceKey(service.Name)) - if _, ok := serviceNameIndexMap[nameIndex]; ok { - return ErrServiceDuplicateIndex.Wrapf("duplicated name for service: %v", service) - } - serviceNameIndexMap[nameIndex] = struct{}{} - } - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go deleted file mode 100644 index b51d7dd5b..000000000 --- a/x/service/types/genesis_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestGenesisState_Validate(t *testing.T) { - svc1 := &sharedtypes.Service{ - Id: "svcId1", - Name: "svcName1", - } - - svc2 := &sharedtypes.Service{ - Id: "svcId2", - Name: "svcName2", - } - - svc3 := &sharedtypes.Service{ - Id: "svcId3", - Name: "svcName1", - } - - tests := []struct { - desc string - genState *types.GenesisState - expectedError error - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - expectedError: nil, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - ServiceList: []sharedtypes.Service{ - *svc1, *svc2, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - expectedError: nil, - }, - { - desc: "invalid - duplicate service ID", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - ServiceList: []sharedtypes.Service{ - *svc1, *svc1, - }, - }, - expectedError: types.ErrServiceDuplicateIndex, - }, - { - desc: "invalid - duplicate service name", - genState: &types.GenesisState{ - Params: types.DefaultParams(), - ServiceList: []sharedtypes.Service{ - *svc1, *svc3, - }, - }, - expectedError: types.ErrServiceDuplicateIndex, - }, - { - desc: "invalid - invalid add service fee parameter (below minimum)", - genState: &types.GenesisState{ - Params: types.Params{ - AddServiceFee: 999999, // 0.999999 POKT - }, - ServiceList: []sharedtypes.Service{ - *svc1, *svc2, - }, - }, - expectedError: types.ErrServiceInvalidServiceFee, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.expectedError == nil { - require.NoError(t, err) - } else { - require.ErrorIs(t, err, tc.expectedError) - } - }) - } -} diff --git a/x/service/types/key_service.go b/x/service/types/key_service.go deleted file mode 100644 index 6893f7e29..000000000 --- a/x/service/types/key_service.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import ( - "encoding/binary" -) - -var _ binary.ByteOrder - -const ( - // ServiceKeyPrefix is the prefix to retrieve all Services - ServiceKeyPrefix = "Service/value/" -) - -// ServiceKey returns the store key to retrieve a Service from the index fields -func ServiceKey(serviceID string) []byte { - var key []byte - - serviceIDBz := []byte(serviceID) - key = append(key, serviceIDBz...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/service/types/keys.go b/x/service/types/keys.go deleted file mode 100644 index f84e13d4e..000000000 --- a/x/service/types/keys.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -import "bytes" - -const ( - // ModuleName defines the module name - ModuleName = "service" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_service" -) - -// KeyDelimiter is the delimiter for composite keys. -var KeyDelimiter = []byte("/") - -// KeyPrefix returns the given prefix as a byte slice for use with the KVStore. -func KeyPrefix(p string) []byte { - return []byte(p) -} - -// KeyComposite combines the given keys into a single key for use with KVStore. -func KeyComposite(keys ...[]byte) []byte { - return bytes.Join(keys, KeyDelimiter) -} diff --git a/x/service/types/message_add_service.go b/x/service/types/message_add_service.go deleted file mode 100644 index b904d2767..000000000 --- a/x/service/types/message_add_service.go +++ /dev/null @@ -1,62 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TypeMsgAddService is the name of the service message -const TypeMsgAddService = "add_service" - -var _ sdk.Msg = (*MsgAddService)(nil) - -// NewMsgAddService creates a new MsgAddService instance -func NewMsgAddService(address string, serviceID, serviceName string) *MsgAddService { - return &MsgAddService{ - Address: address, - Service: sharedtypes.Service{Id: serviceID, Name: serviceName}, - } -} - -// Route returns the roter key for the message -func (msg *MsgAddService) Route() string { - return RouterKey -} - -// Type returns the message type -func (msg *MsgAddService) Type() string { - return TypeMsgAddService -} - -// GetSigners returns the signers of the message -func (msg *MsgAddService) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -// GetSignBytes returns the signable bytes of the message -func (msg *MsgAddService) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -// ValidateBasic performs basic validation of the message and its fields -func (msg *MsgAddService) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { - return ErrServiceInvalidAddress.Wrapf( - "invalid supplier address %s; (%v)", msg.Address, err, - ) - } - // TODO_TECHDEBT: Add a validate basic function to the `Service` object - if msg.Service.Id == "" { - return ErrServiceMissingID - } - if msg.Service.Name == "" { - return ErrServiceMissingName - } - return nil -} diff --git a/x/service/types/message_add_service_test.go b/x/service/types/message_add_service_test.go deleted file mode 100644 index dfcc674e0..000000000 --- a/x/service/types/message_add_service_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgAddService_ValidateBasic(t *testing.T) { - tests := []struct { - desc string - msg MsgAddService - expectedErr error - }{ - { - desc: "invalid service supplier address - no service", - msg: MsgAddService{ - Address: "invalid_address", - // Service: intentionally omitted, - }, - expectedErr: ErrServiceInvalidAddress, - }, { - desc: "valid service supplier address - no service ID", - msg: MsgAddService{ - Address: sample.AccAddress(), - Service: sharedtypes.Service{Name: "service name"}, // ID intentionally omitted - }, - expectedErr: ErrServiceMissingID, - }, { - desc: "valid service supplier address - no service name", - msg: MsgAddService{ - Address: sample.AccAddress(), - Service: sharedtypes.Service{Id: "svc1"}, // Name intentionally omitted - }, - expectedErr: ErrServiceMissingName, - }, { - desc: "valid service supplier address and service", - msg: MsgAddService{ - Address: sample.AccAddress(), - Service: sharedtypes.Service{Id: "svc1", Name: "service name"}, - }, - expectedErr: nil, - }, - } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/service/types/params.go b/x/service/types/params.go deleted file mode 100644 index 2b5e999cc..000000000 --- a/x/service/types/params.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -// DefaultAddServiceFee is the default value for the add service fee -// parameter in the genesis state of the service module. -// TODO_BLOCKER: Revisit default param values for service fee -const DefaultAddServiceFee = 1000000000 // 1000 POKT - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{AddServiceFee: DefaultAddServiceFee} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - // TODO(@h5law): Look into better validation - if p.AddServiceFee < DefaultAddServiceFee { - return sdkerrors.Wrapf( - ErrServiceInvalidServiceFee, - "AddServiceFee param %d uPOKT: got %d", - DefaultAddServiceFee, - p.AddServiceFee, - ) - } - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/service/types/relay.go b/x/service/types/relay.go deleted file mode 100644 index 7815fc1ab..000000000 --- a/x/service/types/relay.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import "crypto/sha256" - -// getSignableBytes returns the bytes resulting from marshaling the relay request -// A value receiver is used to avoid overwriting any pre-existing signature -func (req RelayRequest) getSignableBytes() ([]byte, error) { - // set signature to nil - req.Meta.Signature = nil - - return req.Marshal() -} - -// GetSignableBytesHash returns the hash of the signable bytes of the relay request -// Hashing the marshaled request message guarantees that the signable bytes are -// always of a constant and expected length. -func (req *RelayRequest) GetSignableBytesHash() ([32]byte, error) { - requestBz, err := req.getSignableBytes() - if err != nil { - return [32]byte{}, err - } - - // return the marshaled request hash to guarantee that the signable bytes are - // always of a constant and expected length - return sha256.Sum256(requestBz), nil -} - -// getSignableBytes returns the bytes resulting from marshaling the relay response -// A value receiver is used to avoid overwriting any pre-existing signature -func (res RelayResponse) getSignableBytes() ([]byte, error) { - // set signature to nil - res.Meta.SupplierSignature = nil - - return res.Marshal() -} - -// GetSignableBytesHash returns the hash of the signable bytes of the relay response -// Hashing the marshaled response message guarantees that the signable bytes are -// always of a constant and expected length. -func (res *RelayResponse) GetSignableBytesHash() ([32]byte, error) { - responseBz, err := res.getSignableBytes() - if err != nil { - return [32]byte{}, err - } - - // return the marshaled response hash to guarantee that the signable bytes are - // always of a constant and expected length - return sha256.Sum256(responseBz), nil -} - -func (res *RelayResponse) ValidateBasic() error { - // TODO_FUTURE: if a client gets a response with an invalid/incomplete - // SessionHeader, consider sending an on-chain challenge, lowering their - // QoS, or other future work. - - return nil -} diff --git a/x/service/types/types.go b/x/service/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/service/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/session/client/cli/helpers_test.go b/x/session/client/cli/helpers_test.go deleted file mode 100644 index 484bca4db..000000000 --- a/x/session/client/cli/helpers_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "strconv" - "testing" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithApplicationsAndSupplier creates a new network with a given number of supplier & application objects. -// It returns the network and a slice of the created supplier & application objects. -func networkWithApplicationsAndSupplier(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier, []apptypes.Application) { - t.Helper() - cfg := network.DefaultConfig() - - // Prepare the application genesis state - applicationGenesisState := network.DefaultApplicationModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(applicationGenesisState) - require.NoError(t, err) - cfg.GenesisState[apptypes.ModuleName] = buf - - // Prepare the supplier genesis state - supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) - buf, err = cfg.Codec.MarshalJSON(supplierGenesisState) - require.NoError(t, err) - cfg.GenesisState[suppliertypes.ModuleName] = buf - - // Start the network - return network.New(t, cfg), supplierGenesisState.SupplierList, applicationGenesisState.ApplicationList -} diff --git a/x/session/client/cli/query.go b/x/session/client/cli/query.go deleted file mode 100644 index cd6bf6f70..000000000 --- a/x/session/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/session/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group session queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdGetSession()) - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/session/client/cli/query_get_session.go b/x/session/client/cli/query_get_session.go deleted file mode 100644 index 9659ce331..000000000 --- a/x/session/client/cli/query_get_session.go +++ /dev/null @@ -1,65 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/session/types" -) - -var _ = strconv.Itoa(0) - -func CmdGetSession() *cobra.Command { - cmd := &cobra.Command{ - Use: "get-session [block_height]", - Short: "Query get-session", - Long: `Query the session data for a specific (app, service, height) tuple. - -[block_height] is optional. If unspecified, or set to 0, it defaults to the latest height of the node being queried. - -This is a query operation that will not result in a state transition but simply gives a view into the chain state. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE)`, - Args: cobra.RangeArgs(2, 3), - RunE: func(cmd *cobra.Command, args []string) (err error) { - appAddressString := args[0] - serviceIdString := args[1] - blockHeightString := "0" // 0 will default to latest height - if len(args) == 3 { - blockHeightString = args[2] - } - - blockHeight, err := strconv.ParseInt(blockHeightString, 10, 64) - if err != nil { - return fmt.Errorf("couldn't convert block height to int: %s; (%v)", blockHeightString, err) - } - - getSessionReq := types.NewQueryGetSessionRequest(appAddressString, serviceIdString, blockHeight) - if err := getSessionReq.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - getSessionRes, err := queryClient.GetSession(cmd.Context(), getSessionReq) - if err != nil { - return err - } - - return clientCtx.PrintProto(getSessionRes) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/session/client/cli/query_get_session_test.go b/x/session/client/cli/query_get_session_test.go deleted file mode 100644 index 480bafa48..000000000 --- a/x/session/client/cli/query_get_session_test.go +++ /dev/null @@ -1,197 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - tmcli "github.com/cometbft/cometbft/libs/cli" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/session/client/cli" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -func TestCLI_GetSession(t *testing.T) { - // Prepare the network - net, suppliers, applications := networkWithApplicationsAndSupplier(t, 2) - _, err := net.WaitForHeight(10) // Wait for a sufficiently high block height to ensure the staking transactions have been processed - require.NoError(t, err) - val := net.Validators[0] - ctx := val.ClientCtx - - // Sanity check the application configs are what we expect them to be - appSvc0 := applications[0] - appSvc1 := applications[1] - - require.Len(t, appSvc0.ServiceConfigs, 2) - require.Len(t, appSvc1.ServiceConfigs, 2) - - require.Equal(t, appSvc0.ServiceConfigs[0].Service.Id, "svc0") // svc0 has a supplier - require.Equal(t, appSvc0.ServiceConfigs[1].Service.Id, "svc00") // svc00 doesn't have a supplier - require.Equal(t, appSvc1.ServiceConfigs[0].Service.Id, "svc1") // svc1 has a supplier - require.Equal(t, appSvc1.ServiceConfigs[1].Service.Id, "svc11") // svc11 doesn't have a supplier - - // Sanity check the supplier configs are what we expect them to be - supplierSvc0 := suppliers[0] // supplier for svc0 - supplierSvc1 := suppliers[1] // supplier for svc1 - - require.Len(t, supplierSvc0.Services, 1) - require.Len(t, supplierSvc1.Services, 1) - - require.Equal(t, supplierSvc0.Services[0].Service.Id, "svc0") - require.Equal(t, supplierSvc1.Services[0].Service.Id, "svc1") - - // Prepare the test cases - tests := []struct { - desc string - - appAddress string - serviceId string - blockHeight int64 - - expectedErr *sdkerrors.Error - expectedNumSuppliers int - }{ - // Valid requests - { - desc: "valid - block height specified and is zero", - - appAddress: appSvc0.Address, - serviceId: "svc0", - blockHeight: 0, - - expectedErr: nil, - expectedNumSuppliers: 1, - }, - { - desc: "valid - block height specified and is greater than zero", - - appAddress: appSvc1.Address, - serviceId: "svc1", - blockHeight: 10, - - expectedErr: nil, - expectedNumSuppliers: 1, - }, - { - desc: "valid - block height unspecified and defaults to 0", - - appAddress: appSvc0.Address, - serviceId: "svc0", - // blockHeight: intentionally omitted, - - expectedErr: nil, - expectedNumSuppliers: 1, - }, - - // Invalid requests - incompatible state - { - desc: "invalid - app not staked for service", - - appAddress: appSvc0.Address, - serviceId: "svc9001", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) and is not staked for service over 9000 - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionAppNotStakedForService, - }, - { - desc: "invalid - no suppliers staked for service", - - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "svc00", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionSuppliersNotFound, - }, - { - desc: "invalid - block height is in the future", - - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "svc0", - blockHeight: 9001, // block height over 9000 is greater than the context height of 10 - - expectedErr: sessiontypes.ErrSessionInvalidBlockHeight, - }, - - // Invalid requests - bad app address input - { - desc: "invalid - invalid appAddress", - - appAddress: "invalidAddress", // providing a deliberately invalid address - serviceId: "svc0", - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidAppAddress, - }, - { - desc: "invalid - missing appAddress", - // appAddress: intentionally omitted - serviceId: "svc0", - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidAppAddress, - }, - - // Invalid requests - bad serviceID input - { - desc: "invalid - invalid service ID", - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "invalidServiceId", - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidService, - }, - { - desc: "invalid - missing service ID", - appAddress: appSvc0.Address, // dynamically getting address from applications - // serviceId: intentionally omitted - blockHeight: 0, - - expectedErr: sessiontypes.ErrSessionInvalidService, - }, - } - - // We want to use the `--output=json` flag for all tests so it's easy to unmarshal below - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Prepare the arguments for the CLI command - args := []string{ - tt.appAddress, - tt.serviceId, - fmt.Sprintf("%d", tt.blockHeight), - } - args = append(args, common...) - - // Execute the command - getSessionOut, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdGetSession(), args) - if tt.expectedErr != nil { - stat, ok := status.FromError(tt.expectedErr) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedErr.Error()) - return - } - require.NoError(t, err) - - var getSessionRes sessiontypes.QueryGetSessionResponse - err = net.Config.Codec.UnmarshalJSON(getSessionOut.Bytes(), &getSessionRes) - require.NoError(t, err) - require.NotNil(t, getSessionRes) - - session := getSessionRes.Session - require.NotNil(t, session) - - // Verify some data about the session - require.Equal(t, tt.appAddress, session.Application.Address) - require.Equal(t, tt.serviceId, session.Header.Service.Id) - require.Len(t, session.Suppliers, tt.expectedNumSuppliers) - }) - } -} diff --git a/x/session/client/cli/query_params.go b/x/session/client/cli/query_params.go deleted file mode 100644 index 5f8aa0609..000000000 --- a/x/session/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/session/client/cli/tx.go b/x/session/client/cli/tx.go deleted file mode 100644 index 248ae5237..000000000 --- a/x/session/client/cli/tx.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/session/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/session/genesis.go b/x/session/genesis.go deleted file mode 100644 index a14b12f31..000000000 --- a/x/session/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package session - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/session/genesis_test.go b/x/session/genesis_test.go deleted file mode 100644 index 50298ada9..000000000 --- a/x/session/genesis_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package session_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/session" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.SessionKeeper(t) - session.InitGenesis(ctx, *k, genesisState) - got := session.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/session/keeper/keeper.go b/x/session/keeper/keeper.go deleted file mode 100644 index 52c5e42d3..000000000 --- a/x/session/keeper/keeper.go +++ /dev/null @@ -1,74 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/session/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - appKeeper types.ApplicationKeeper - supplierKeeper types.SupplierKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - appKeeper types.ApplicationKeeper, - supplierKeeper types.SupplierKeeper, - -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - appKeeper: appKeeper, - supplierKeeper: supplierKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// BeginBlocker is called at the beginning of every block. -// It fetches the block hash from the committed block ans saves its hash -// in the store. -func (k Keeper) BeginBlocker(ctx sdk.Context) { - // ctx.BlockHeader().LastBlockId.Hash is the hash of the last block committed - hash := ctx.BlockHeader().LastBlockId.Hash - // ctx.BlockHeader().Height is the height of the last committed block. - height := ctx.BlockHeader().Height - // Block height 1 is the first committed block which uses `genesis.json` as its parent. - // See the explanation here for more details: https://github.com/pokt-network/poktroll/issues/377#issuecomment-1936607294 - // Fallback to an empty byte slice during the genesis block. - if height == 1 { - hash = []byte{} - } - - store := ctx.KVStore(k.storeKey) - store.Set(GetBlockHashKey(height), hash) -} diff --git a/x/session/keeper/msg_server.go b/x/session/keeper/msg_server.go deleted file mode 100644 index 6dbe55462..000000000 --- a/x/session/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/session/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/session/keeper/msg_server_test.go b/x/session/keeper/msg_server_test.go deleted file mode 100644 index b00a56aba..000000000 --- a/x/session/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.SessionKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/session/keeper/params.go b/x/session/keeper/params.go deleted file mode 100644 index 142887657..000000000 --- a/x/session/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/session/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/session/keeper/params_test.go b/x/session/keeper/params_test.go deleted file mode 100644 index bf020e294..000000000 --- a/x/session/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.SessionKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/session/keeper/query.go b/x/session/keeper/query.go deleted file mode 100644 index 700ec87e8..000000000 --- a/x/session/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/session/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/session/keeper/query_get_session.go b/x/session/keeper/query_get_session.go deleted file mode 100644 index eac1345a1..000000000 --- a/x/session/keeper/query_get_session.go +++ /dev/null @@ -1,45 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/session/types" -) - -// GetSession should be deterministic and always return the same session for -// the same block height. -func (k Keeper) GetSession(goCtx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - // Note that `GetSession` is called via the `Query` service rather than the `Msg` server. - // The former is stateful but does not lead to state transitions, while the latter one - // does. The request height depends on how much the node has synched and only acts as a read, - // while the `Msg` server handles the code flow of the validator/sequencer when a new block - // is being proposed. - blockHeight := req.BlockHeight - - k.Logger(ctx).Info("Getting session for height: %d", blockHeight) - - sessionHydrator := NewSessionHydrator(req.ApplicationAddress, req.Service.Id, blockHeight) - session, err := k.HydrateSession(ctx, sessionHydrator) - if err != nil { - return nil, err - } - - res := &types.QueryGetSessionResponse{ - Session: session, - } - return res, nil -} diff --git a/x/session/keeper/query_get_session_test.go b/x/session/keeper/query_get_session_test.go deleted file mode 100644 index 9cd574c51..000000000 --- a/x/session/keeper/query_get_session_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func init() { - cmd.InitSDKConfig() -} - -// NOTE: See `session_hydrator_test.go` for more extensive test coverage of different -// GetSession scenarios. This is just used to verify a few basic scenarios that act as -// the Cosmos SDK context aware wrapper around it. - -func TestSession_GetSession_Success(t *testing.T) { - keeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - wctx := sdk.WrapSDKContext(ctx) - - // TODO_TECHDEBT(#377): These test assume that the genesis block has a height of 0, - // rewrite them in terms of height = 1 genesis. - type test struct { - name string - - appAddr string - serviceId string - blockHeight int64 - - expectedSessionId string - expectedSessionNumber int64 - expectedNumSuppliers int - } - - tests := []test{ - { - name: "valid - app1 svc1 at height=1", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId1, - blockHeight: 1, - - // Intentionally only checking a subset of the session metadata returned - expectedSessionId: "6f2e0b6cba5a8cb93506ed4045143c4268945ebfb730b2c98fc7e3dc40132926", - expectedSessionNumber: 0, - expectedNumSuppliers: 1, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - req := &types.QueryGetSessionRequest{ - ApplicationAddress: tt.appAddr, - Service: &sharedtypes.Service{ - Id: tt.serviceId, - }, - BlockHeight: 1, - } - - response, err := keeper.GetSession(wctx, req) - require.NoError(t, err) - require.NotNil(t, response) - - require.Equal(t, tt.expectedSessionId, response.Session.SessionId) - require.Equal(t, tt.expectedSessionNumber, response.Session.SessionNumber) - require.Len(t, response.Session.Suppliers, tt.expectedNumSuppliers) - }) - } -} - -func TestSession_GetSession_Failure(t *testing.T) { - keeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - wctx := sdk.WrapSDKContext(ctx) - - type test struct { - name string - - appAddr string - serviceId string - blockHeight int64 - - expectedErrContains string - } - - tests := []test{ - { - name: "application address does not reflected a staked application", - - appAddr: sample.AccAddress(), // a random (valid) app address that's not staked - serviceId: keepertest.TestServiceId1, - blockHeight: 1, - - expectedErrContains: types.ErrSessionAppNotFound.Error(), - }, - { - name: "application staked for service that has no available suppliers", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId11, - blockHeight: 1, - - expectedErrContains: types.ErrSessionSuppliersNotFound.Error(), - }, - { - name: "application is valid but not staked for the specified service", - - appAddr: keepertest.TestApp1Address, - serviceId: "svc9001", // App1 is not staked for service over 9000 - blockHeight: 1, - - expectedErrContains: types.ErrSessionAppNotStakedForService.Error(), - }, - { - name: "application address is invalid format", - - appAddr: "invalid_app_address", - serviceId: keepertest.TestServiceId1, - blockHeight: 1, - - expectedErrContains: types.ErrSessionInvalidAppAddress.Error(), - }, - { - name: "service ID is invalid", - - appAddr: keepertest.TestApp1Address, - serviceId: "service_id_is_too_long_to_be_valid", - blockHeight: 1, - - expectedErrContains: "invalid service in session", - }, - { - name: "negative block height", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId1, - blockHeight: -1, - - expectedErrContains: "invalid block height for session being retrieved", - }, - } - - expectedRes := (*types.QueryGetSessionResponse)(nil) - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - req := &types.QueryGetSessionRequest{ - ApplicationAddress: tt.appAddr, - Service: &sharedtypes.Service{ - Id: tt.serviceId, - }, - BlockHeight: tt.blockHeight, - } - - res, err := keeper.GetSession(wctx, req) - require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErrContains) - require.Equal(t, expectedRes, res) - }) - } -} diff --git a/x/session/keeper/query_params.go b/x/session/keeper/query_params.go deleted file mode 100644 index 75734ad7a..000000000 --- a/x/session/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/session/keeper/query_params_test.go b/x/session/keeper/query_params_test.go deleted file mode 100644 index 85f0ddd9b..000000000 --- a/x/session/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.SessionKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go deleted file mode 100644 index 6f081fb3c..000000000 --- a/x/session/keeper/session_hydrator.go +++ /dev/null @@ -1,306 +0,0 @@ -package keeper - -import ( - "crypto" - "encoding/binary" - "encoding/hex" - "fmt" - "math/rand" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - _ "golang.org/x/crypto/sha3" - - "github.com/pokt-network/poktroll/x/session/types" - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO_TECHDEBT(#377): The business logic in this file assume that genesis has -// a block height of 0. Revisit it and adjust, where/if necessary, accounting for the -// fact that it's 1. - -var SHA3HashLen = crypto.SHA3_256.Size() - -// TODO_BLOCKER(#21): Make these configurable governance param -const ( - // TODO_BLOCKER: Remove direct usage of these constants in helper functions - // when they will be replaced by governance params - NumBlocksPerSession = 4 - // Duration of the grace period in number of sessions - SessionGracePeriod = 1 - NumSupplierPerSession = 15 - SessionIDComponentDelimiter = "." -) - -type sessionHydrator struct { - // The session header that is used to hydrate the rest of the session data - sessionHeader *types.SessionHeader - - // The fully hydrated session object - session *types.Session - - // The height at which the session being request - blockHeight int64 - - // A redundant helper that maintains a hex decoded copy of `session.Id` used for session hydration - sessionIdBz []byte -} - -func NewSessionHydrator( - appAddress string, - serviceId string, - blockHeight int64, -) *sessionHydrator { - sessionHeader := &types.SessionHeader{ - ApplicationAddress: appAddress, - Service: &sharedtypes.Service{Id: serviceId}, - } - return &sessionHydrator{ - sessionHeader: sessionHeader, - session: &types.Session{}, - blockHeight: blockHeight, - sessionIdBz: make([]byte, 0), - } -} - -// GetSession implements of the exposed `UtilityModule.GetSession` function -// TECHDEBT(#519): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. -func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Session, error) { - logger := k.Logger(ctx).With("method", "hydrateSession") - - if err := k.hydrateSessionMetadata(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session metadata: %v", err) - } - logger.Debug("Finished hydrating session metadata") - - if err := k.hydrateSessionID(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session ID: %v", err) - } - logger.Info(fmt.Sprintf("Finished hydrating session ID: %s", sh.sessionHeader.SessionId)) - - if err := k.hydrateSessionApplication(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate application for session: %v", err) - } - logger.Debug("Finished hydrating session application: %+v", sh.session.Application) - - if err := k.hydrateSessionSuppliers(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate suppliers for session: %v", err) - } - logger.Debug("Finished hydrating session suppliers: %+v") - - sh.session.Header = sh.sessionHeader - sh.session.SessionId = sh.sessionHeader.SessionId - - return sh.session, nil -} - -// hydrateSessionMetadata hydrates metadata related to the session such as the height at which the session started, its number, the number of blocks per session, etc.. -func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) error { - // TODO_TECHDEBT: Add a test if `blockHeight` is ahead of the current chain or what this node is aware of - - if sh.blockHeight > ctx.BlockHeight() { - return sdkerrors.Wrapf( - types.ErrSessionHydration, - "block height %d is ahead of the last committed block height %d", - sh.blockHeight, ctx.BlockHeight(), - ) - } - - sh.session.NumBlocksPerSession = NumBlocksPerSession - sh.session.SessionNumber = GetSessionNumber(sh.blockHeight) - - sh.sessionHeader.SessionStartBlockHeight = GetSessionStartBlockHeight(sh.blockHeight) - sh.sessionHeader.SessionEndBlockHeight = GetSessionEndBlockHeight(sh.blockHeight) - return nil -} - -// hydrateSessionID use both session and on-chain data to determine a unique session ID -func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { - prevHashBz := k.GetBlockHash(ctx, sh.sessionHeader.SessionStartBlockHeight) - - // TODO_TECHDEBT: In the future, we will need to valid that the Service is a valid service depending on whether - // or not its permissioned or permissionless - - if !sharedhelpers.IsValidService(sh.sessionHeader.Service) { - return sdkerrors.Wrapf(types.ErrSessionHydration, "invalid service: %v", sh.sessionHeader.Service) - } - - sh.sessionHeader.SessionId, sh.sessionIdBz = GetSessionId( - sh.sessionHeader.ApplicationAddress, - sh.sessionHeader.Service.Id, - prevHashBz, - sh.blockHeight, - ) - - return nil -} - -// hydrateSessionApplication hydrates the full Application actor based on the address provided -func (k Keeper) hydrateSessionApplication(ctx sdk.Context, sh *sessionHydrator) error { - app, appIsFound := k.appKeeper.GetApplication(ctx, sh.sessionHeader.ApplicationAddress) - if !appIsFound { - return sdkerrors.Wrapf(types.ErrSessionAppNotFound, "could not find app with address: %s at height %d", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.SessionStartBlockHeight) - } - - for _, appServiceConfig := range app.ServiceConfigs { - if appServiceConfig.Service.Id == sh.sessionHeader.Service.Id { - sh.session.Application = &app - return nil - } - } - - return sdkerrors.Wrapf(types.ErrSessionAppNotStakedForService, "application %s not staked for service %s", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id) -} - -// hydrateSessionSuppliers finds the suppliers that are staked at the session height and populates the session with them -func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) error { - logger := k.Logger(ctx).With("method", "hydrateSessionSuppliers") - - // TODO_TECHDEBT(@Olshansk, @bryanchriswhite): Need to retrieve the suppliers at SessionStartBlockHeight, - // NOT THE CURRENT ONE which is what's provided by the context. For now, for simplicity, - // only retrieving the suppliers at the current block height which could create a discrepancy - // if new suppliers were staked mid session. - // TODO(@bryanchriswhite): Investigate if `BlockClient` + `ReplayObservable` where `N = SessionLength` could be used here.` - suppliers := k.supplierKeeper.GetAllSupplier(ctx) - - candidateSuppliers := make([]*sharedtypes.Supplier, 0) - for _, s := range suppliers { - // NB: Allocate a new heap variable as s is a value and we're appending - // to a slice of pointers; otherwise, we'd be appending new pointers to - // the same memory address containing the last supplier in the loop. - supplier := s - // TODO_OPTIMIZE: If `supplier.Services` was a map[string]struct{}, we could eliminate `slices.Contains()`'s loop - for _, supplierServiceConfig := range supplier.Services { - if supplierServiceConfig.Service.Id == sh.sessionHeader.Service.Id { - candidateSuppliers = append(candidateSuppliers, &supplier) - break - } - } - } - - if len(candidateSuppliers) == 0 { - logger.Error(fmt.Sprintf("[ERROR] no suppliers found for session")) - return sdkerrors.Wrapf(types.ErrSessionSuppliersNotFound, "could not find suppliers for service %s at height %d", sh.sessionHeader.Service, sh.sessionHeader.SessionStartBlockHeight) - } - - if len(candidateSuppliers) < NumSupplierPerSession { - logger.Info(fmt.Sprintf("[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", len(candidateSuppliers), NumSupplierPerSession)) - sh.session.Suppliers = candidateSuppliers - } else { - sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIdBz) - } - - return nil -} - -// TODO_INVESTIGATE: We are using a `Go` native implementation for a pseudo-random number generator. In order -// for it to be language agnostic, a general purpose algorithm MUST be used. -// pseudoRandomSelection returns a random subset of the candidates. -func pseudoRandomSelection(candidates []*sharedtypes.Supplier, numTarget int, sessionIdBz []byte) []*sharedtypes.Supplier { - // Take the first 8 bytes of sessionId to use as the seed - // NB: There is specific reason why `BigEndian` was chosen over `LittleEndian` in this specific context. - seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIdBz)[:8])) - - // Retrieve the indices for the candidates - actors := make([]*sharedtypes.Supplier, 0) - uniqueIndices := uniqueRandomIndices(seed, int64(len(candidates)), int64(numTarget)) - for idx := range uniqueIndices { - actors = append(actors, candidates[idx]) - } - - return actors -} - -// uniqueRandomIndices returns a map of `numIndices` unique random numbers less than `maxIndex` -// seeded by `seed`. -// panics if `numIndicies > maxIndex` since that code path SHOULD never be executed. -// NB: A map pointing to empty structs is used to simulate set behavior. -func uniqueRandomIndices(seed, maxIndex, numIndices int64) map[int64]struct{} { - // This should never happen - if numIndices > maxIndex { - panic(fmt.Sprintf("uniqueRandomIndices: numIndices (%d) is greater than maxIndex (%d)", numIndices, maxIndex)) - } - - // create a new random source with the seed - randSrc := rand.NewSource(seed) - - // initialize a map to capture the indicesMap we'll return - indicesMap := make(map[int64]struct{}, maxIndex) - - // The random source could potentially return duplicates, so while loop until we have enough unique indices - for int64(len(indicesMap)) < numIndices { - indicesMap[randSrc.Int63()%int64(maxIndex)] = struct{}{} - } - - return indicesMap -} - -func concatWithDelimiter(delimiter string, b ...[]byte) (result []byte) { - for _, bz := range b { - result = append(result, bz...) - result = append(result, []byte(delimiter)...) - } - return result -} - -func sha3Hash(bz []byte) []byte { - hasher := crypto.SHA3_256.New() - hasher.Write(bz) - return hasher.Sum(nil) -} - -// GetSessionStartBlockHeight returns the block height at which the session starts -func GetSessionStartBlockHeight(blockHeight int64) int64 { - return blockHeight - (blockHeight % NumBlocksPerSession) -} - -// GetSessionEndBlockHeight returns the block height at which the session ends -func GetSessionEndBlockHeight(blockHeight int64) int64 { - return GetSessionStartBlockHeight(blockHeight) + NumBlocksPerSession - 1 -} - -// GetSessionNumber returns the session number given the block height -func GetSessionNumber(blockHeight int64) int64 { - return blockHeight / NumBlocksPerSession -} - -// GetSessionId returns the string and bytes representation of the sessionId -// given the application public key, service ID, block hash, and block height -// that is used to get the session start block height. -func GetSessionId( - appPubKey, - serviceId string, - blockHashBz []byte, - blockHeight int64, -) (sessionId string, sessionIdBz []byte) { - appPubKeyBz := []byte(appPubKey) - serviceIdBz := []byte(serviceId) - - blockHeightBz := getSessionStartBlockHeightBz(blockHeight) - sessionIdBz = concatWithDelimiter( - SessionIDComponentDelimiter, - blockHashBz, - serviceIdBz, - appPubKeyBz, - blockHeightBz, - ) - sessionId = hex.EncodeToString(sha3Hash(sessionIdBz)) - - return sessionId, sessionIdBz -} - -// GetSessionGracePeriodBlockCount returns the number of blocks in the session -// grace period. -func GetSessionGracePeriodBlockCount() int64 { - return SessionGracePeriod * NumBlocksPerSession -} - -// getSessionStartBlockHeightBz returns the bytes representation of the session -// start block height given the block height. -func getSessionStartBlockHeightBz(blockHeight int64) []byte { - sessionStartBlockHeight := GetSessionStartBlockHeight(blockHeight) - sessionStartBlockHeightBz := make([]byte, 8) - binary.LittleEndian.PutUint64(sessionStartBlockHeightBz, uint64(sessionStartBlockHeight)) - return sessionStartBlockHeightBz -} diff --git a/x/session/keeper/session_hydrator_test.go b/x/session/keeper/session_hydrator_test.go deleted file mode 100644 index e914ca0ea..000000000 --- a/x/session/keeper/session_hydrator_test.go +++ /dev/null @@ -1,359 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -// TODO_TECHDEBT(#377): All the tests in this file assume genesis has a block -// height of 0. Rewrite them in terms of height = 1 genesis. - -func TestSession_HydrateSession_Success_BaseCase(t *testing.T) { - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - blockHeight := int64(10) - - sessionHydrator := keeper.NewSessionHydrator(keepertest.TestApp1Address, keepertest.TestServiceId1, blockHeight) - session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - require.NoError(t, err) - - // Check the header - sessionHeader := session.Header - require.Equal(t, keepertest.TestApp1Address, sessionHeader.ApplicationAddress) - require.Equal(t, keepertest.TestServiceId1, sessionHeader.Service.Id) - require.Equal(t, "", sessionHeader.Service.Name) - require.Equal(t, int64(8), sessionHeader.SessionStartBlockHeight) - require.Equal(t, int64(11), sessionHeader.SessionEndBlockHeight) - require.Equal(t, "f621ad93e2d9ebf2e967eb16b8ea2bc470baa1d4e13a82f348f34c6fc93eae7f", sessionHeader.SessionId) - - // Check the session - require.Equal(t, int64(4), session.NumBlocksPerSession) - require.Equal(t, "f621ad93e2d9ebf2e967eb16b8ea2bc470baa1d4e13a82f348f34c6fc93eae7f", session.SessionId) - require.Equal(t, int64(2), session.SessionNumber) - - // Check the application - app := session.Application - require.Equal(t, keepertest.TestApp1Address, app.Address) - require.Len(t, app.ServiceConfigs, 3) - - // Check the suppliers - suppliers := session.Suppliers - require.Len(t, suppliers, 1) - supplier := suppliers[0] - require.Equal(t, keepertest.TestSupplierAddress, supplier.Address) - require.Len(t, supplier.Services, 3) -} - -func TestSession_HydrateSession_Metadata(t *testing.T) { - type test struct { - desc string - blockHeight int64 - - expectedNumBlocksPerSession int64 - expectedSessionNumber int64 - expectedSessionStartBlock int64 - expectedSessionEndBlock int64 - errExpected error - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumBlocksPerSession=4 - tests := []test{ - { - desc: "blockHeight = 0", - blockHeight: 0, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 0, - expectedSessionStartBlock: 0, - expectedSessionEndBlock: 3, - errExpected: nil, - }, - { - desc: "blockHeight = 1", - blockHeight: 1, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 0, - expectedSessionStartBlock: 0, - expectedSessionEndBlock: 3, - errExpected: nil, - }, - { - desc: "blockHeight = sessionHeight", - blockHeight: 4, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 1, - expectedSessionStartBlock: 4, - expectedSessionEndBlock: 7, - errExpected: nil, - }, - { - desc: "blockHeight != sessionHeight", - blockHeight: 5, - - expectedNumBlocksPerSession: 4, - expectedSessionNumber: 1, - expectedSessionStartBlock: 4, - expectedSessionEndBlock: 7, - errExpected: nil, - }, - { - desc: "blockHeight > contextHeight", - blockHeight: 9001, // block height over 9000 is too high given that the context height is 100 - - errExpected: types.ErrSessionHydration, - }, - } - - appAddr := keepertest.TestApp1Address - serviceId := keepertest.TestServiceId1 - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator := keeper.NewSessionHydrator(appAddr, serviceId, tt.blockHeight) - session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - - if tt.errExpected != nil { - require.ErrorIs(t, tt.errExpected, err) - return - } - require.NoError(t, err) - - require.Equal(t, tt.expectedNumBlocksPerSession, session.NumBlocksPerSession) - require.Equal(t, tt.expectedSessionNumber, session.SessionNumber) - require.Equal(t, tt.expectedSessionStartBlock, session.Header.SessionStartBlockHeight) - require.Equal(t, tt.expectedSessionEndBlock, session.Header.SessionEndBlockHeight) - }) - } -} - -func TestSession_HydrateSession_SessionId(t *testing.T) { - type test struct { - desc string - - blockHeight1 int64 - blockHeight2 int64 - - appAddr1 string - appAddr2 string - - serviceId1 string - serviceId2 string - - expectedSessionId1 string - expectedSessionId2 string - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumBlocksPerSession=4 - tests := []test{ - { - desc: "(app1, svc1): sessionId at first session block != sessionId at next session block", - - blockHeight1: 4, - blockHeight2: 8, - - appAddr1: keepertest.TestApp1Address, // app1 - appAddr2: keepertest.TestApp1Address, // app1 - - serviceId1: keepertest.TestServiceId1, // svc1 - serviceId2: keepertest.TestServiceId1, // svc1 - - expectedSessionId1: "8d7919d1addb175425ed99bc897aee7fecd6a184e46a0ce4119b610db9242db5", - expectedSessionId2: "f621ad93e2d9ebf2e967eb16b8ea2bc470baa1d4e13a82f348f34c6fc93eae7f", - }, - { - desc: "app1: sessionId for svc1 != sessionId for svc12", - - blockHeight1: 4, - blockHeight2: 4, - - appAddr1: keepertest.TestApp1Address, // app1 - appAddr2: keepertest.TestApp1Address, // app1 - - serviceId1: keepertest.TestServiceId1, // svc1 - serviceId2: keepertest.TestServiceId12, // svc12 - - expectedSessionId1: "8d7919d1addb175425ed99bc897aee7fecd6a184e46a0ce4119b610db9242db5", - expectedSessionId2: "40d02827f0f3f717caf844cd4cfbe1ebc2f3ada7d4e5974ed6ec795b9a715e07", - }, - { - desc: "svc12: sessionId for app1 != sessionId for app2", - - blockHeight1: 4, - blockHeight2: 4, - - appAddr1: keepertest.TestApp1Address, // app1 - appAddr2: keepertest.TestApp2Address, // app2 - - serviceId1: keepertest.TestServiceId12, // svc12 - serviceId2: keepertest.TestServiceId12, // svc12 - - expectedSessionId1: "40d02827f0f3f717caf844cd4cfbe1ebc2f3ada7d4e5974ed6ec795b9a715e07", - expectedSessionId2: "5c338ae8bf5138b7ca9a0ca124942984734531fb30f1670da772ef3e635939f6", - }, - } - - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator1 := keeper.NewSessionHydrator(tt.appAddr1, tt.serviceId1, tt.blockHeight1) - session1, err := sessionKeeper.HydrateSession(ctx, sessionHydrator1) - require.NoError(t, err) - - sessionHydrator2 := keeper.NewSessionHydrator(tt.appAddr2, tt.serviceId2, tt.blockHeight2) - session2, err := sessionKeeper.HydrateSession(ctx, sessionHydrator2) - require.NoError(t, err) - - require.NotEqual(t, session1.Header.SessionId, session2.Header.SessionId) - require.Equal(t, tt.expectedSessionId1, session1.Header.SessionId) - require.Equal(t, tt.expectedSessionId2, session2.Header.SessionId) - }) - } -} - -// TODO_TECHDEBT: Expand these tests to account for application joining/leaving the network at different heights as well changing the services they support -func TestSession_HydrateSession_Application(t *testing.T) { - type test struct { - // Description - desc string - // Inputs - appAddr string - serviceId string - - // Outputs - expectedErr error - } - - tests := []test{ - { - desc: "app is found", - - appAddr: keepertest.TestApp1Address, - serviceId: keepertest.TestServiceId1, - - expectedErr: nil, - }, - { - desc: "app is not found", - - appAddr: sample.AccAddress(), // Generating a random address on the fly - serviceId: keepertest.TestServiceId1, - - expectedErr: types.ErrSessionHydration, - }, - { - desc: "invalid app address", - - appAddr: "invalid", - serviceId: keepertest.TestServiceId1, - - expectedErr: types.ErrSessionHydration, - }, - { - desc: "invalid - app not staked for service", - - appAddr: keepertest.TestApp1Address, // app1 - serviceId: "svc9001", // app1 is only stake for svc1 and svc11 - - expectedErr: types.ErrSessionHydration, - }, - // TODO_TECHDEBT: Add tests for when: - // - Application join/leaves (stakes/unstakes) altogether - // - Application adds/removes certain services mid-session - // - Application increases stakes mid-session - } - - blockHeight := int64(10) - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) - _, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - if tt.expectedErr != nil { - require.Error(t, err) - } else { - require.NoError(t, err) - } - }) - } -} - -// TODO_TECHDEBT: Expand these tests to account for supplier joining/leaving the network at different heights as well changing the services they support -func TestSession_HydrateSession_Suppliers(t *testing.T) { - type test struct { - // Description - desc string - - // Inputs - appAddr string - serviceId string - - // Outputs - numExpectedSuppliers int - expectedErr error - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumSupplierPerSession=15 - tests := []test{ - { - desc: "num_suppliers_available = 0", - - appAddr: keepertest.TestApp1Address, // app1 - serviceId: keepertest.TestServiceId11, - - numExpectedSuppliers: 0, - expectedErr: types.ErrSessionSuppliersNotFound, - }, - { - desc: "num_suppliers_available < num_suppliers_per_session_param", - - appAddr: keepertest.TestApp1Address, // app1 - serviceId: keepertest.TestServiceId1, // svc1 - - numExpectedSuppliers: 1, - expectedErr: nil, - }, - // TODO_TECHDEBT: Add this test once we make the num suppliers per session configurable - // { - // name: "num_suppliers_available > num_suppliers_per_session_param", - // }, - // TODO_TECHDEBT: Add tests for when: - // - Supplier join/leaves (stakes/unstakes) altogether - // - Supplier adds/removes certain services mid-session - // - Supplier increases stakes mid-session - } - - blockHeight := int64(10) - sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) {}) - - sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) - session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - - if tt.expectedErr != nil { - require.ErrorContains(t, err, tt.expectedErr.Error()) - continue - } - require.NoError(t, err) - require.Len(t, session.Suppliers, tt.numExpectedSuppliers) - } -} diff --git a/x/session/module.go b/x/session/module.go deleted file mode 100644 index bb27b4049..000000000 --- a/x/session/module.go +++ /dev/null @@ -1,148 +0,0 @@ -package session - -import ( - "context" - "encoding/json" - "fmt" - - 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/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/session/client/cli" - "github.com/pokt-network/poktroll/x/session/keeper" - "github.com/pokt-network/poktroll/x/session/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - am.keeper.BeginBlocker(ctx) -} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/session/module_simulation.go b/x/session/module_simulation.go deleted file mode 100644 index befedd421..000000000 --- a/x/session/module_simulation.go +++ /dev/null @@ -1,65 +0,0 @@ -package session - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - sessionsimulation "github.com/pokt-network/poktroll/x/session/simulation" - "github.com/pokt-network/poktroll/x/session/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = sessionsimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( -// this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - sessionGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&sessionGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/session/simulation/helpers.go b/x/session/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/session/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/session/types/codec.go b/x/session/types/codec.go deleted file mode 100644 index 39e7482ab..000000000 --- a/x/session/types/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( - // this line is used by starport scaffolding # 1 - - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/session/types/errors.go b/x/session/types/errors.go deleted file mode 100644 index 900c3c72e..000000000 --- a/x/session/types/errors.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/session module sentinel errors -var ( - ErrSessionHydration = sdkerrors.Register(ModuleName, 1, "error during session hydration") - ErrSessionAppNotFound = sdkerrors.Register(ModuleName, 2, "application for session not found not found ") - ErrSessionAppNotStakedForService = sdkerrors.Register(ModuleName, 3, "application in session not staked for requested service") - ErrSessionSuppliersNotFound = sdkerrors.Register(ModuleName, 4, "no suppliers not found for session") - ErrSessionInvalidAppAddress = sdkerrors.Register(ModuleName, 5, "invalid application address for session") - ErrSessionInvalidService = sdkerrors.Register(ModuleName, 6, "invalid service in session") - ErrSessionInvalidBlockHeight = sdkerrors.Register(ModuleName, 7, "invalid block height for session") - ErrSessionInvalidSessionId = sdkerrors.Register(ModuleName, 8, "invalid sessionId") -) diff --git a/x/session/types/expected_keepers.go b/x/session/types/expected_keepers.go deleted file mode 100644 index 697528f21..000000000 --- a/x/session/types/expected_keepers.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/session/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface{} - -// ApplicationKeeper defines the expected application keeper to retrieve applications -type ApplicationKeeper interface { - GetApplication(ctx sdk.Context, address string) (app apptypes.Application, found bool) -} - -// SupplierKeeper defines the expected supplier keeper to retrieve suppliers -type SupplierKeeper interface { - GetAllSupplier(ctx sdk.Context) (suppliers []sharedtypes.Supplier) -} diff --git a/x/session/types/genesis.go b/x/session/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/session/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/session/types/genesis_test.go b/x/session/types/genesis_test.go deleted file mode 100644 index 97252a21e..000000000 --- a/x/session/types/genesis_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/x/session/types" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/session/types/keys.go b/x/session/types/keys.go deleted file mode 100644 index 5cdde17b9..000000000 --- a/x/session/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "session" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_session" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/session/types/params.go b/x/session/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/session/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/session/types/query_get_session_request.go b/x/session/types/query_get_session_request.go deleted file mode 100644 index 3c7b754d3..000000000 --- a/x/session/types/query_get_session_request.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// NOTE: Please note that `QueryGetSessionRequest` is not a `sdk.Msg`, and is therefore not a message/request -// that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern -// allows us to localize & reuse validation logic. -func NewQueryGetSessionRequest(appAddress, serviceId string, blockHeight int64) *QueryGetSessionRequest { - return &QueryGetSessionRequest{ - ApplicationAddress: appAddress, - Service: &sharedtypes.Service{ - Id: serviceId, - }, - BlockHeight: blockHeight, - } -} - -func (query *QueryGetSessionRequest) ValidateBasic() error { - // Validate the application address - if _, err := sdk.AccAddressFromBech32(query.ApplicationAddress); err != nil { - return ErrSessionInvalidAppAddress.Wrapf("invalid app address for session being retrieved %s; (%v)", query.ApplicationAddress, err) - } - - // Validate the Service ID - if !sharedhelpers.IsValidService(query.Service) { - return ErrSessionInvalidService.Wrapf("invalid service for session being retrieved %s;", query.Service) - } - - // Validate the height for which a session is being retrieved - if query.BlockHeight < 0 { // Note that `0` defaults to the latest height rather than genesis - return ErrSessionInvalidBlockHeight.Wrapf("invalid block height for session being retrieved %d;", query.BlockHeight) - } - return nil -} diff --git a/x/session/types/types.go b/x/session/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/session/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/shared/helpers/service.go b/x/shared/helpers/service.go deleted file mode 100644 index 9825f26d4..000000000 --- a/x/shared/helpers/service.go +++ /dev/null @@ -1,86 +0,0 @@ -package helpers - -import ( - "net/url" - "regexp" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - maxServiceIdLength = 8 // Limiting all serviceIds to 8 characters - maxServiceIdName = 42 // Limit the the name of the - - regexServiceId = "^[a-zA-Z0-9_-]+$" // Define the regex pattern to match allowed characters - regexServiceName = "^[a-zA-Z0-9-_ ]+$" // Define the regex pattern to match allowed characters (allows spaces) -) - -var ( - regexExprServiceId *regexp.Regexp - regexExprServiceName *regexp.Regexp -) - -func init() { - // Compile the regex pattern - regexExprServiceId = regexp.MustCompile(regexServiceId) - regexExprServiceName = regexp.MustCompile(regexServiceName) - -} - -// IsValidService checks if the provided ServiceId struct has valid fields -func IsValidService(service *sharedtypes.Service) bool { - // Check if service Id and Name are valid using the provided helper functions - return service != nil && - IsValidServiceId(service.Id) && - IsValidServiceName(service.Name) -} - -// IsValidServiceId checks if the input string is a valid serviceId -func IsValidServiceId(serviceId string) bool { - // ServiceId CANNOT be empty - if len(serviceId) == 0 { - return false - } - - if len(serviceId) > maxServiceIdLength { - return false - } - - // Use the regex to match against the input string - return regexExprServiceId.MatchString(serviceId) -} - -// IsValidServiceName checks if the input string is a valid serviceName -func IsValidServiceName(serviceName string) bool { - // ServiceName CAN be empty - if len(serviceName) == 0 { - return true - } - - if len(serviceName) > maxServiceIdName { - return false - } - - // Use the regex to match against the input string - return regexExprServiceName.MatchString(serviceName) -} - -// IsValidEndpointUrl checks if the provided string is a valid URL. -func IsValidEndpointUrl(endpoint string) bool { - u, err := url.Parse(endpoint) - if err != nil { - return false - } - - // Check if scheme is http or https - if u.Scheme != "http" && u.Scheme != "https" { - return false - } - - // Ensure the URL has a host - if u.Host == "" { - return false - } - - return true -} diff --git a/x/shared/helpers/service_configs.go b/x/shared/helpers/service_configs.go deleted file mode 100644 index 95335d058..000000000 --- a/x/shared/helpers/service_configs.go +++ /dev/null @@ -1,81 +0,0 @@ -package helpers - -import ( - "fmt" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// ValidateAppServiceConfigs returns an error if any of the application service configs are invalid -func ValidateAppServiceConfigs(services []*sharedtypes.ApplicationServiceConfig) error { - if len(services) == 0 { - return fmt.Errorf("no services configs provided for application: %v", services) - } - for _, serviceConfig := range services { - if serviceConfig == nil { - return fmt.Errorf("serviceConfig cannot be nil: %v", services) - } - // Check the Service - if !IsValidService(serviceConfig.Service) { - return fmt.Errorf("invalid service: %v", serviceConfig.Service) - } - } - return nil -} - -// ValidateSupplierServiceConfigs returns an error if any of the supplier service configs are invalid -func ValidateSupplierServiceConfigs(services []*sharedtypes.SupplierServiceConfig) error { - if len(services) == 0 { - return fmt.Errorf("no services provided for supplier: %v", services) - } - for _, serviceConfig := range services { - if serviceConfig == nil { - return fmt.Errorf("serviceConfig cannot be nil: %v", services) - } - - // Check the Service - if !IsValidService(serviceConfig.Service) { - return fmt.Errorf("invalid service: %v", serviceConfig.Service) - } - - // Check the Endpoints - if serviceConfig.Endpoints == nil { - return fmt.Errorf("endpoints cannot be nil: %v", serviceConfig) - } - if len(serviceConfig.Endpoints) == 0 { - return fmt.Errorf("endpoints must have at least one entry: %v", serviceConfig) - } - - // Check each endpoint - for _, endpoint := range serviceConfig.Endpoints { - if endpoint == nil { - return fmt.Errorf("endpoint cannot be nil: %v", serviceConfig) - } - - // Validate the URL - if endpoint.Url == "" { - return fmt.Errorf("endpoint.Url cannot be empty: %v", serviceConfig) - } - if !IsValidEndpointUrl(endpoint.Url) { - return fmt.Errorf("invalid endpoint.Url: %v", serviceConfig) - } - - // Validate the RPC type - if endpoint.RpcType == sharedtypes.RPCType_UNKNOWN_RPC { - return fmt.Errorf("endpoint.RpcType cannot be UNKNOWN_RPC: %v", serviceConfig) - } - if _, ok := sharedtypes.RPCType_name[int32(endpoint.RpcType)]; !ok { - return fmt.Errorf("endpoint.RpcType is not a valid RPCType: %v", serviceConfig) - } - - // TODO: Validate configs once they are being used - // if endpoint.Configs == nil { - // return fmt.Errorf("endpoint.Configs cannot be nil: %v", serviceConfig) - // } - // if len(endpoint.Configs) == 0 { - // return fmt.Errorf("endpoint.Configs must have at least one entry: %v", serviceConfig) - // } - } - } - return nil -} diff --git a/x/shared/helpers/service_test.go b/x/shared/helpers/service_test.go deleted file mode 100644 index e3dcf57d6..000000000 --- a/x/shared/helpers/service_test.go +++ /dev/null @@ -1,261 +0,0 @@ -package helpers - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestIsValidService(t *testing.T) { - tests := []struct { - desc string - - serviceId string - serviceName string - - expectedIsValid bool - }{ - { - desc: "Valid ID and Name", - - serviceId: "Service1", - serviceName: "Valid Service Name", - - expectedIsValid: true, - }, - { - desc: "Valid ID and empty Name", - - serviceId: "svc", - serviceName: "", // Valid because the service name can be empty - - expectedIsValid: true, - }, - { - desc: "ID exceeds max length", - - serviceId: "TooLongId123", // Exceeds maxServiceIdLength - serviceName: "Valid Name", - - expectedIsValid: false, - }, - { - desc: "Name exceeds max length", - - serviceId: "ValidID", - serviceName: "This service name is way too long to be considered valid since it exceeds the max length", - - expectedIsValid: false, - }, - { - desc: "Empty ID is invalid", - - serviceId: "", // Invalid because the service ID cannot be empty - serviceName: "Valid Name", - - expectedIsValid: false, - }, - { - desc: "Invalid characters in ID", - - serviceId: "ID@Invalid", // Invalid character '@' - serviceName: "Valid Name", - - expectedIsValid: false, - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - service := &sharedtypes.Service{ - Id: test.serviceId, - Name: test.serviceName, - } - result := IsValidService(service) - require.Equal(t, test.expectedIsValid, result) - }) - } -} - -func TestIsValidServiceName(t *testing.T) { - tests := []struct { - desc string - input string - expected bool - }{ - { - desc: "Valid with hyphen and number", - input: "ValidName-1", - expected: true, - }, - { - desc: "Valid with space and underscore", - input: "Valid Name_1", - expected: true, - }, - { - desc: "Valid name with spaces", - input: "valid name with spaces", - expected: true, - }, - { - desc: "Invalid character '@'", - input: "invalid@name", - expected: false, - }, - { - desc: "Invalid character '.'", - input: "Valid.Name", - expected: false, - }, - { - desc: "Empty string", - input: "", - expected: true, - }, - { - desc: "Exceeds maximum length", - input: "validnamebuttoolongvalidnamebuttoolongvalidnamebuttoolong", - expected: false, - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - result := IsValidServiceName(test.input) - require.Equal(t, test.expected, result) - }) - } -} - -func TestIsValidServiceId(t *testing.T) { - tests := []struct { - desc string - - input string - expected bool - }{ - { - desc: "Valid alphanumeric with hyphen", - - input: "Hello-1", - expected: true, - }, - { - desc: "Valid alphanumeric with underscore", - - input: "Hello_2", - expected: true, - }, - { - desc: "Exceeds maximum length", - - input: "hello-world", - expected: false, // exceeds maxServiceIdLength - }, - { - desc: "Contains invalid character '@'", - - input: "Hello@", - expected: false, // contains invalid character '@' - }, - { - desc: "All uppercase", - - input: "HELLO", - expected: true, - }, - { - desc: "Maximum length boundary", - - input: "12345678", - expected: true, // exactly maxServiceIdLength - }, - { - desc: "Above maximum length boundary", - - input: "123456789", - expected: false, // exceeds maxServiceIdLength - }, - { - desc: "Contains invalid character '.'", - - input: "Hello.World", - expected: false, // contains invalid character '.' - }, - { - desc: "Empty string", - - input: "", - expected: false, // empty string - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - result := IsValidServiceId(test.input) - require.Equal(t, test.expected, result) - }) - } -} - -func TestIsValidEndpointUrl(t *testing.T) { - tests := []struct { - desc string - - input string - expected bool - }{ - { - desc: "valid http URL", - - input: "http://example.com", - expected: true, - }, - { - desc: "valid https URL", - - input: "https://example.com/path?query=value#fragment", - expected: true, - }, - { - desc: "valid localhost URL with scheme", - - input: "https://localhost:8081", - expected: true, - }, - { - desc: "valid loopback URL with scheme", - - input: "http://127.0.0.1:8081", - expected: true, - }, - { - desc: "invalid scheme", - - input: "ftp://example.com", - expected: false, - }, - { - desc: "missing scheme", - - input: "example.com", - expected: false, - }, - { - desc: "invalid URL", - - input: "not-a-valid-url", - expected: false, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - got := IsValidEndpointUrl(tt.input) - require.Equal(t, tt.expected, got) - }) - } -} diff --git a/x/shared/types/types.go b/x/shared/types/types.go deleted file mode 100644 index 78d9ec9f9..000000000 --- a/x/shared/types/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package types - -// This file is in place to declare the package for dynamically generated protobufs diff --git a/x/supplier/client/cli/flags.go b/x/supplier/client/cli/flags.go deleted file mode 100644 index 1755bbf2d..000000000 --- a/x/supplier/client/cli/flags.go +++ /dev/null @@ -1,7 +0,0 @@ -package cli - -const ( - FlagSessionEndHeight = "session-end-height" - FlagSessionId = "session-id" - FlagSupplierAddress = "supplier-address" -) diff --git a/x/supplier/client/cli/helpers_test.go b/x/supplier/client/cli/helpers_test.go deleted file mode 100644 index e8a0753d0..000000000 --- a/x/supplier/client/cli/helpers_test.go +++ /dev/null @@ -1,260 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "context" - "encoding/base64" - "encoding/json" - "fmt" - "strconv" - "testing" - - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - testcli "github.com/cosmos/cosmos-sdk/testutil/cli" - sdktypes "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/testkeyring" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO_TECHDEBT: This should not be hardcoded once the num blocks per session is configurable. -const ( - numBlocksPerSession = 4 - testServiceId = "svc1" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithSupplierObjects creates a new network with a given number of supplier objects. -// It returns the network and a slice of the created supplier objects. -func networkWithSupplierObjects(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier) { - t.Helper() - cfg := network.DefaultConfig() - supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) - buf, err := cfg.Codec.MarshalJSON(supplierGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg), supplierGenesisState.SupplierList -} - -// TODO_CONSIDERATION: perhaps this (and/or other similar helpers) can be refactored -// into something more generic and moved into a shared testutil package. -// TODO_TECHDEBT: refactor; this function has more than a single responsibility, -// which should be to configure and start the test network. The genesis state, -// accounts, and claims set up logic can probably be factored out and/or reduced. -func networkWithClaimObjects( - t *testing.T, - sessionCount int, - supplierCount int, - appCount int, -) (net *network.Network, claims []types.Claim) { - t.Helper() - - // Initialize a network config. - cfg := network.DefaultConfig() - - // Construct an in-memory keyring so that it can be populated and used prior - // to network start. - kr := keyring.NewInMemory(cfg.Codec) - // Populate the in-memmory keyring with as many pre-generated accounts as - // we expect to need for the test (i.e. appCount + supplierCount). - testkeyring.CreatePreGeneratedKeyringAccounts(t, kr, supplierCount+appCount) - - // Use the pre-generated accounts iterator to populate the supplier and - // application accounts and addresses lists for use in genesis state construction. - preGeneratedAccts := testkeyring.PreGeneratedAccounts().Clone() - - // Create a supplier for each session in numClaimsSessions and an app for each - // claim in numClaimsPerSession. - supplierAccts := make([]*testkeyring.PreGeneratedAccount, supplierCount) - supplierAddrs := make([]string, supplierCount) - for i := range supplierAccts { - account, ok := preGeneratedAccts.Next() - require.True(t, ok) - supplierAccts[i] = account - supplierAddrs[i] = account.Address.String() - } - appAccts := make([]*testkeyring.PreGeneratedAccount, appCount) - appAddrs := make([]string, appCount) - for i := range appAccts { - account, ok := preGeneratedAccts.Next() - require.True(t, ok) - appAccts[i] = account - appAddrs[i] = account.Address.String() - } - - // Construct supplier and application module genesis states given the account addresses. - supplierGenesisState := network.SupplierModuleGenesisStateWithAddresses(t, supplierAddrs) - supplierGenesisBuffer, err := cfg.Codec.MarshalJSON(supplierGenesisState) - require.NoError(t, err) - appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, appAddrs) - appGenesisBuffer, err := cfg.Codec.MarshalJSON(appGenesisState) - require.NoError(t, err) - - // Add supplier and application module genesis states to the network config. - cfg.GenesisState[types.ModuleName] = supplierGenesisBuffer - cfg.GenesisState[apptypes.ModuleName] = appGenesisBuffer - - // Construct the network with the configuration. - net = network.New(t, cfg) - // Only the first validator's client context is populated. - // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk/testutil/network#pkg-overview) - ctx := net.Validators[0].ClientCtx - // Overwrite the client context's keyring with the in-memory one that contains - // our pre-generated accounts. - ctx = ctx.WithKeyring(kr) - - // Initialize all the accounts - sequenceIndex := 1 - for _, supplierAcct := range supplierAccts { - network.InitAccountWithSequence(t, net, supplierAcct.Address, sequenceIndex) - sequenceIndex++ - } - for _, appAcct := range appAccts { - network.InitAccountWithSequence(t, net, appAcct.Address, sequenceIndex) - sequenceIndex++ - } - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - - // Create sessionCount * numClaimsPerSession claims for the supplier - sessionEndHeight := int64(1) - for sessionIdx := 0; sessionIdx < sessionCount; sessionIdx++ { - sessionEndHeight += numBlocksPerSession - for _, appAcct := range appAccts { - for _, supplierAcct := range supplierAccts { - claim := createClaim( - t, net, ctx, - supplierAcct.Address.String(), - sessionEndHeight, - appAcct.Address.String(), - ) - claims = append(claims, *claim) - // TODO_TECHDEBT(#196): Move this outside of the forloop so that the test iteration is faster - require.NoError(t, net.WaitForNextBlock()) - } - } - } - - return net, claims -} - -// encodeSessionHeader returns a base64 encoded string of a json -// serialized session header. -func encodeSessionHeader( - t *testing.T, - appAddr string, - sessionId string, - sessionStartHeight int64, -) string { - t.Helper() - - argSessionHeader := &sessiontypes.SessionHeader{ - ApplicationAddress: appAddr, - SessionStartBlockHeight: sessionStartHeight, - SessionId: sessionId, - SessionEndBlockHeight: sessionStartHeight + numBlocksPerSession, - Service: &sharedtypes.Service{Id: testServiceId}, - } - cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - sessionHeaderBz := cdc.MustMarshalJSON(argSessionHeader) - return base64.StdEncoding.EncodeToString(sessionHeaderBz) -} - -// createClaim sends a tx using the test CLI to create an on-chain claim -func createClaim( - t *testing.T, - net *network.Network, - ctx client.Context, - supplierAddr string, - sessionEndHeight int64, - appAddress string, -) *types.Claim { - t.Helper() - - rootHash := []byte("root_hash") - sessionStartHeight := sessionEndHeight - numBlocksPerSession - sessionId := getSessionId(t, net, appAddress, supplierAddr, sessionStartHeight) - sessionHeaderEncoded := encodeSessionHeader(t, appAddress, sessionId, sessionStartHeight) - rootHashEncoded := base64.StdEncoding.EncodeToString(rootHash) - - args := []string{ - sessionHeaderEncoded, - rootHashEncoded, - fmt.Sprintf("--%s=%s", flags.FlagFrom, supplierAddr), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdktypes.NewCoins(sdktypes.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), - } - - responseRaw, err := testcli.ExecTestCLICmd(ctx, cli.CmdCreateClaim(), args) - require.NoError(t, err) - var responseJson map[string]interface{} - err = json.Unmarshal(responseRaw.Bytes(), &responseJson) - require.NoError(t, err) - require.Equal(t, float64(0), responseJson["code"], "code is not 0 in the response: %v", responseJson) - - // TODO_TECHDEBT: Forward the actual claim in the response once the response is updated to return it. - return &types.Claim{ - SupplierAddress: supplierAddr, - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: appAddress, - Service: &sharedtypes.Service{Id: testServiceId}, - SessionId: sessionId, - SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: sessionEndHeight, - }, - RootHash: rootHash, - } -} - -// getSessionId sends a query using the test CLI to get a session for the inputs provided. -// It is assumed that the supplierAddr will be in that session based on the test design, but this -// is insured in this function before it's successfully returned. -func getSessionId( - t *testing.T, - net *network.Network, - appAddr string, - supplierAddr string, - sessionStartHeight int64, -) string { - t.Helper() - ctx := context.TODO() - - sessionQueryClient := sessiontypes.NewQueryClient(net.Validators[0].ClientCtx) - res, err := sessionQueryClient.GetSession(ctx, &sessiontypes.QueryGetSessionRequest{ - ApplicationAddress: appAddr, - Service: &sharedtypes.Service{Id: testServiceId}, - BlockHeight: sessionStartHeight, - }) - require.NoError(t, err) - - var found bool - for _, supplier := range res.GetSession().GetSuppliers() { - if supplier.GetAddress() == supplierAddr { - found = true - break - } - } - require.Truef(t, found, "supplier address %s not found in session", supplierAddr) - - return res.Session.SessionId -} diff --git a/x/supplier/client/cli/query.go b/x/supplier/client/cli/query.go deleted file mode 100644 index e87eda8ed..000000000 --- a/x/supplier/client/cli/query.go +++ /dev/null @@ -1,33 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group supplier queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListSupplier()) - cmd.AddCommand(CmdShowSupplier()) - cmd.AddCommand(CmdListClaims()) - cmd.AddCommand(CmdShowClaim()) - cmd.AddCommand(CmdListProof()) - cmd.AddCommand(CmdShowProof()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/supplier/client/cli/query_claim.go b/x/supplier/client/cli/query_claim.go deleted file mode 100644 index 949ac0d6e..000000000 --- a/x/supplier/client/cli/query_claim.go +++ /dev/null @@ -1,172 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -// AddPaginationFlagsToCmd adds common pagination flags to cmd -func AddClaimFilterFlags(cmd *cobra.Command) { - cmd.Flags().Uint64(FlagSessionEndHeight, 0, "claims whose session ends at this height will be returned") - cmd.Flags().String(FlagSessionId, "", "claims matching this session id will be returned") - cmd.Flags().String(FlagSupplierAddress, "", "claims submitted by suppliers matching this address will be returned") -} - -func CmdListClaims() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-claims", - Short: "list all claims", - Long: `List all the claims that the node being queried has in its state. - -The claims can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-id --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-end-height --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --supplier-address --node $(POCKET_NODE)`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - req := &types.QueryAllClaimsRequest{ - Pagination: pageReq, - } - if err := updateClaimsFilter(cmd, req); err != nil { - return err - } - if err := req.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AllClaims(cmd.Context(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - AddClaimFilterFlags(cmd) - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowClaim() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-claim ", - Short: "shows a specific claim", - Long: `List a specific claim that the node being queried has access to (if it still exists). - -A unique claim can be defined via a ` + "`session_id`" + ` that the given ` + "`supplier`" + ` participated in. - -` + "`Claims`" + ` are pruned, according to protocol parameters, some time after their respective ` + "`proof`" + ` has been submitted and any dispute window has elapsed. - -This is done to minimize the rate at which state accumulates by eliminating claims as a long-term factor to persistence requirements. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q claim show-claims --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - sessionId := args[0] - supplierAddr := args[1] - - getClaimRequest := &types.QueryGetClaimRequest{ - SessionId: sessionId, - SupplierAddress: supplierAddr, - } - if err := getClaimRequest.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Claim(cmd.Context(), getClaimRequest) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// updateClaimsFilter updates the claims filter request based on the flags set provided -func updateClaimsFilter(cmd *cobra.Command, req *types.QueryAllClaimsRequest) error { - sessionId, _ := cmd.Flags().GetString(FlagSessionId) - supplierAddr, _ := cmd.Flags().GetString(FlagSupplierAddress) - sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) - - // Preparing a shared error in case more than one flag was set - err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) - - // Use the session id as the filter - if sessionId != "" { - // If the session id is set, then the other flags must not be set - if supplierAddr != "" || sessionEndHeight > 0 { - return err - } - // Set the session id filter - req.Filter = &types.QueryAllClaimsRequest_SessionId{ - SessionId: sessionId, - } - return nil - } - - // Use the supplier address as the filter - if supplierAddr != "" { - // If the supplier address is set, then the other flags must not be set - if sessionId != "" || sessionEndHeight > 0 { - return err - } - // Set the supplier address filter - req.Filter = &types.QueryAllClaimsRequest_SupplierAddress{ - SupplierAddress: supplierAddr, - } - return nil - } - - // Use the session end height as the filter - if sessionEndHeight > 0 { - // If the session end height is set, then the other flags must not be set - if sessionId != "" || supplierAddr != "" { - return err - } - // Set the session end height filter - req.Filter = &types.QueryAllClaimsRequest_SessionEndHeight{ - SessionEndHeight: sessionEndHeight, - } - return nil - } - - return nil -} diff --git a/x/supplier/client/cli/query_claim_test.go b/x/supplier/client/cli/query_claim_test.go deleted file mode 100644 index d7bd4aabd..000000000 --- a/x/supplier/client/cli/query_claim_test.go +++ /dev/null @@ -1,284 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestClaim_Show(t *testing.T) { - sessionCount := 1 - supplierCount := 3 - appCount := 3 - - net, claims := networkWithClaimObjects( - t, sessionCount, - appCount, - supplierCount, - ) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - - var wrongSupplierAddr = sample.AccAddress() - tests := []struct { - desc string - sessionId string - supplierAddr string - - args []string - expectedErr error - claim types.Claim - }{ - { - desc: "claim found", - sessionId: claims[0].GetSessionHeader().GetSessionId(), - supplierAddr: claims[0].GetSupplierAddress(), - - args: common, - claim: claims[0], - }, - { - desc: "claim not found (wrong session ID)", - sessionId: "wrong_session_id", - supplierAddr: claims[0].GetSupplierAddress(), - - args: common, - - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - "session ID %q and supplier %q", - "wrong_session_id", - claims[0].GetSupplierAddress(), - ).Error(), - ), - }, - { - desc: "claim not found (invalid bech32 supplier address)", - sessionId: claims[0].GetSessionHeader().GetSessionId(), - supplierAddr: "invalid_bech32_supplier_address", - - args: common, - // NB: this is *NOT* a gRPC status error because the bech32 parse - // error occurs during request validation (i.e. client-side). - expectedErr: types.ErrSupplierInvalidAddress.Wrapf( - // TODO_CONSIDERATION: prefer using "%q" in error format strings - // to disambiguate empty string from space or no output. - "invalid supplier address for claim being retrieved %s; (decoding bech32 failed: invalid separator index -1)", - "invalid_bech32_supplier_address", - ), - }, - { - desc: "claim not found (wrong supplier address)", - sessionId: claims[0].GetSessionHeader().GetSessionId(), - supplierAddr: wrongSupplierAddr, - - args: common, - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - "session ID %q and supplier %q", - claims[0].GetSessionHeader().GetSessionId(), - wrongSupplierAddr, - ).Error(), - ), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.sessionId, - tc.supplierAddr, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowClaim(), args) - if tc.expectedErr != nil { - require.ErrorContains(t, err, tc.expectedErr.Error()) - } else { - require.NoError(t, err) - var resp types.QueryGetClaimResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Claim) - - require.Equal(t, tc.claim.GetSupplierAddress(), resp.Claim.GetSupplierAddress()) - require.Equal(t, tc.claim.GetRootHash(), resp.Claim.GetRootHash()) - require.Equal(t, tc.claim.GetSessionHeader(), resp.Claim.GetSessionHeader()) - } - }) - } -} - -func TestClaim_List(t *testing.T) { - sessionCount := 2 - supplierCount := 4 - appCount := 3 - serviceCount := 1 - // Each supplier will submit a claim for each app x service combination (per session). - numClaimsPerSession := supplierCount * appCount * serviceCount - totalClaims := sessionCount * numClaimsPerSession - - net, claims := networkWithClaimObjects( - t, sessionCount, - supplierCount, - appCount, - ) - - ctx := net.Validators[0].ClientCtx - prepareArgs := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < totalClaims; i += step { - args := prepareArgs(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - } - }) - - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < totalClaims; i += step { - args := prepareArgs(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - next = resp.Pagination.NextKey - } - }) - - t.Run("ByAddress", func(t *testing.T) { - supplierAddr := claims[0].SupplierAddress - args := prepareArgs(nil, 0, uint64(totalClaims), true) - args = append(args, fmt.Sprintf("--%s=%s", cli.FlagSupplierAddress, supplierAddr)) - - expectedClaims := make([]types.Claim, 0) - for _, claim := range claims { - if claim.SupplierAddress == supplierAddr { - expectedClaims = append(expectedClaims, claim) - } - } - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.ElementsMatch(t, - nullify.Fill(expectedClaims), - nullify.Fill(resp.Claim), - ) - require.Equal(t, sessionCount*appCount, int(resp.Pagination.Total)) - }) - - t.Run("BySession", func(t *testing.T) { - sessionId := claims[0].GetSessionHeader().SessionId - args := prepareArgs(nil, 0, uint64(totalClaims), true) - args = append(args, fmt.Sprintf("--%s=%s", cli.FlagSessionId, sessionId)) - - expectedClaims := make([]types.Claim, 0) - for _, claim := range claims { - if claim.GetSessionHeader().SessionId == sessionId { - expectedClaims = append(expectedClaims, claim) - } - } - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.ElementsMatch(t, - nullify.Fill(expectedClaims), - nullify.Fill(resp.Claim), - ) - require.Equal(t, supplierCount, int(resp.Pagination.Total)) - }) - - t.Run("ByHeight", func(t *testing.T) { - sessionEndHeight := claims[0].GetSessionHeader().GetSessionEndBlockHeight() - args := prepareArgs(nil, 0, uint64(totalClaims), true) - args = append(args, fmt.Sprintf("--%s=%d", cli.FlagSessionEndHeight, sessionEndHeight)) - - expectedClaims := make([]types.Claim, 0) - for _, claim := range claims { - if claim.GetSessionHeader().GetSessionEndBlockHeight() == sessionEndHeight { - expectedClaims = append(expectedClaims, claim) - } - } - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.Equal(t, numClaimsPerSession, int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(expectedClaims), - nullify.Fill(resp.Claim), - ) - }) - - t.Run("Total", func(t *testing.T) { - args := prepareArgs(nil, 0, uint64(totalClaims), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListClaims(), args) - require.NoError(t, err) - - var resp types.QueryAllClaimsResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - - require.Equal(t, totalClaims, int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - }) -} diff --git a/x/supplier/client/cli/query_params.go b/x/supplier/client/cli/query_params.go deleted file mode 100644 index 339dbcf00..000000000 --- a/x/supplier/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/query_proof.go b/x/supplier/client/cli/query_proof.go deleted file mode 100644 index 091c4403c..000000000 --- a/x/supplier/client/cli/query_proof.go +++ /dev/null @@ -1,165 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// AddProofFilterFlagsToCmd adds common pagination flags to cmd -func AddProofFilterFlagsToCmd(cmd *cobra.Command) { - cmd.Flags().Uint64(FlagSessionEndHeight, 0, "proofs whose session ends at this height will be returned") - cmd.Flags().String(FlagSessionId, "", "proofs matching this session id will be returned") - cmd.Flags().String(FlagSupplierAddress, "", "proofs submitted by suppliers matching this address will be returned") -} - -func CmdListProof() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-proofs", - Short: "list all proofs", - Long: `List all the proofs that the node being queried has in its state. - -The proofs can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags - -Example: -$ poktrolld q proof list-proofs --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --session-id --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --session-end-height --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --supplier-address --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - req := &types.QueryAllProofsRequest{ - Pagination: pageReq, - } - if err := updateProofsFilter(cmd, req); err != nil { - return err - } - if err := req.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.AllProofs(cmd.Context(), req) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - AddProofFilterFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowProof() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-proof ", - Short: "shows a specific proof", - Long: `List a specific proof that the node being queried has access to. - -A unique proof can be defined via a session_id that a given supplier participated in. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) q proof show-proofs --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - sessionId := args[0] - supplierAddr := args[1] - - getProofRequest := &types.QueryGetProofRequest{ - SessionId: sessionId, - SupplierAddress: supplierAddr, - } - if err := getProofRequest.ValidateBasic(); err != nil { - return err - } - - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Proof(cmd.Context(), getProofRequest) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// updateProofsFilter updates the proofs filter request based on the flags set provided -func updateProofsFilter(cmd *cobra.Command, req *types.QueryAllProofsRequest) error { - sessionId, _ := cmd.Flags().GetString(FlagSessionId) - supplierAddr, _ := cmd.Flags().GetString(FlagSupplierAddress) - sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) - - // Preparing a shared error in case more than one flag was set - err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) - - // Use the session id as the filter - if sessionId != "" { - // If the session id is set, then the other flags must not be set - if supplierAddr != "" || sessionEndHeight > 0 { - return err - } - // Set the session id filter - req.Filter = &types.QueryAllProofsRequest_SessionId{ - SessionId: sessionId, - } - return nil - } - - // Use the supplier address as the filter - if supplierAddr != "" { - // If the supplier address is set, then the other flags must not be set - if sessionId != "" || sessionEndHeight > 0 { - return err - } - // Set the supplier address filter - req.Filter = &types.QueryAllProofsRequest_SupplierAddress{ - SupplierAddress: supplierAddr, - } - return nil - } - - // Use the session end height as the filter - if sessionEndHeight > 0 { - // If the session end height is set, then the other flags must not be set - if sessionId != "" || supplierAddr != "" { - return err - } - // Set the session end height filter - req.Filter = &types.QueryAllProofsRequest_SessionEndHeight{ - SessionEndHeight: sessionEndHeight, - } - return nil - } - - return nil -} diff --git a/x/supplier/client/cli/query_proof_test.go b/x/supplier/client/cli/query_proof_test.go deleted file mode 100644 index f6f4fcefe..000000000 --- a/x/supplier/client/cli/query_proof_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package cli_test - -// TODO_UPNEXT(@Olshansk): Add these tests back in after merging on-chain Proof persistence. -// Prevent strconv unused error -// var _ = strconv.IntSize - -// func networkWithProofObjects(t *testing.T, n int) (*network.Network, []types.Proof) { -// t.Helper() -// cfg := network.DefaultConfig() -// state := types.GenesisState{} -// for i := 0; i < n; i++ { -// proof := types.Proof{ -// Index: strconv.Itoa(i), - -// } -// nullify.Fill(&proof) -// state.ProofList = append(state.ProofList, proof) -// } -// buf, err := cfg.Codec.MarshalJSON(&state) -// require.NoError(t, err) -// cfg.GenesisState[types.ModuleName] = buf -// return network.New(t, cfg), state.ProofList -// } - -// func TestShowProof(t *testing.T) { -// net, objs := networkWithProofObjects(t, 2) - -// ctx := net.Validators[0].ClientCtx -// common := []string{ -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// } -// tests := []struct { -// desc string -// idIndex string - -// args []string -// err error -// obj types.Proof -// }{ -// { -// desc: "found", -// idIndex: objs[0].Index, - -// args: common, -// obj: objs[0], -// }, -// { -// desc: "not found", -// idIndex: strconv.Itoa(100000), - -// args: common, -// err: status.Error(codes.NotFound, "not found"), -// }, -// } -// for _, tc := range tests { -// t.Run(tc.desc, func(t *testing.T) { -// args := []string{ -// tc.idIndex, - -// } -// args = append(args, tc.args...) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowProof(), args) -// if tc.err != nil { -// stat, ok := status.FromError(tc.err) -// require.True(t, ok) -// require.ErrorIs(t, stat.Err(), tc.err) -// } else { -// require.NoError(t, err) -// var resp types.QueryGetProofResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.NotNil(t, resp.Proof) -// require.Equal(t, -// nullify.Fill(&tc.obj), -// nullify.Fill(&resp.Proof), -// ) -// } -// }) -// } -// } - -// func TestListProof(t *testing.T) { -// net, objs := networkWithProofObjects(t, 5) - -// ctx := net.Validators[0].ClientCtx -// request := func(next []byte, offset, limit uint64, total bool) []string { -// args := []string{ -// fmt.Sprintf("--%s=json", tmcli.OutputFlag), -// } -// if next == nil { -// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) -// } else { -// args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) -// } -// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) -// if total { -// args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) -// } -// return args -// } -// t.Run("ByOffset", func(t *testing.T) { -// step := 2 -// for i := 0; i < len(objs); i += step { -// args := request(nil, uint64(i), uint64(step), false) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) -// require.NoError(t, err) -// var resp types.QueryAllProofsResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.LessOrEqual(t, len(resp.Proof), step) -// require.Subset(t, -// nullify.Fill(objs), -// nullify.Fill(resp.Proof), -// ) -// } -// }) -// t.Run("ByKey", func(t *testing.T) { -// step := 2 -// var next []byte -// for i := 0; i < len(objs); i += step { -// args := request(next, 0, uint64(step), false) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) -// require.NoError(t, err) -// var resp types.QueryAllProofsResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.LessOrEqual(t, len(resp.Proof), step) -// require.Subset(t, -// nullify.Fill(objs), -// nullify.Fill(resp.Proof), -// ) -// next = resp.Pagination.NextKey -// } -// }) -// t.Run("Total", func(t *testing.T) { -// args := request(nil, 0, uint64(len(objs)), true) -// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) -// require.NoError(t, err) -// var resp types.QueryAllProofsResponse -// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) -// require.NoError(t, err) -// require.Equal(t, len(objs), int(resp.Pagination.Total)) -// require.ElementsMatch(t, -// nullify.Fill(objs), -// nullify.Fill(resp.Proof), -// ) -// }) -// } diff --git a/x/supplier/client/cli/query_supplier.go b/x/supplier/client/cli/query_supplier.go deleted file mode 100644 index 604c1182f..000000000 --- a/x/supplier/client/cli/query_supplier.go +++ /dev/null @@ -1,78 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func CmdListSupplier() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-supplier", - Short: "list all supplier", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllSupplierRequest{ - Pagination: pageReq, - } - - res, err := queryClient.SupplierAll(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowSupplier() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-supplier ", - Short: "shows a supplier", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - argAddress := args[0] - - params := &types.QueryGetSupplierRequest{ - Address: argAddress, - } - - res, err := queryClient.Supplier(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/query_supplier_test.go b/x/supplier/client/cli/query_supplier_test.go deleted file mode 100644 index bf05a5d44..000000000 --- a/x/supplier/client/cli/query_supplier_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/pokt-network/poktroll/testutil/nullify" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func TestShowSupplier(t *testing.T) { - net, suppliers := networkWithSupplierObjects(t, 2) - - ctx := net.Validators[0].ClientCtx - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - tests := []struct { - desc string - idAddress string - - args []string - err error - obj sharedtypes.Supplier - }{ - { - desc: "supplier found", - idAddress: suppliers[0].Address, - - args: common, - obj: suppliers[0], - }, - { - desc: "supplier not found", - idAddress: strconv.Itoa(100000), - - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := []string{ - tc.idAddress, - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowSupplier(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - } else { - require.NoError(t, err) - var resp types.QueryGetSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.Supplier) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.Supplier), - ) - } - }) - } -} - -func TestListSupplier(t *testing.T) { - net, suppliers := networkWithSupplierObjects(t, 5) - - ctx := net.Validators[0].ClientCtx - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(suppliers); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) - require.NoError(t, err) - var resp types.QueryAllSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(suppliers), - nullify.Fill(resp.Supplier), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(suppliers); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) - require.NoError(t, err) - var resp types.QueryAllSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(suppliers), - nullify.Fill(resp.Supplier), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(suppliers)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSupplier(), args) - require.NoError(t, err) - var resp types.QueryAllSupplierResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(suppliers), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(suppliers), - nullify.Fill(resp.Supplier), - ) - }) -} diff --git a/x/supplier/client/cli/tx.go b/x/supplier/client/cli/tx.go deleted file mode 100644 index c76c24dae..000000000 --- a/x/supplier/client/cli/tx.go +++ /dev/null @@ -1,39 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdStakeSupplier()) - cmd.AddCommand(CmdUnstakeSupplier()) - cmd.AddCommand(CmdCreateClaim()) - cmd.AddCommand(CmdSubmitProof()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/supplier/client/cli/tx_create_claim.go b/x/supplier/client/cli/tx_create_claim.go deleted file mode 100644 index 9fd509e55..000000000 --- a/x/supplier/client/cli/tx_create_claim.go +++ /dev/null @@ -1,68 +0,0 @@ -package cli - -import ( - "encoding/base64" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/spf13/cobra" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO(@bryanchriswhite): Add unit tests for the CLI command when implementing the business logic. - -var _ = strconv.Itoa(0) - -func CmdCreateClaim() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-claim ", - Short: "Broadcast message create-claim", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - sessionHeaderEncodedStr := args[0] - rootHashEncodedStr := args[1] - - // Get the session header - cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) - sessionHeaderBz, err := base64.StdEncoding.DecodeString(sessionHeaderEncodedStr) - if err != nil { - return err - } - sessionHeader := sessiontypes.SessionHeader{} - cdc.MustUnmarshalJSON(sessionHeaderBz, &sessionHeader) - - // Get the root hash - rootHash, err := base64.StdEncoding.DecodeString(rootHashEncodedStr) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - supplierAddress := clientCtx.GetFromAddress().String() - - msg := types.NewMsgCreateClaim( - supplierAddress, - &sessionHeader, - rootHash, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_stake_supplier.go b/x/supplier/client/cli/tx_stake_supplier.go deleted file mode 100644 index 2c611f817..000000000 --- a/x/supplier/client/cli/tx_stake_supplier.go +++ /dev/null @@ -1,67 +0,0 @@ -package cli - -import ( - "os" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/client/config" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - flagStakeConfig string - _ = strconv.Itoa(0) // Part of the default ignite imports -) - -func CmdStakeSupplier() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "stake-supplier --config ", - Short: "Stake a supplier", - Long: `Stake an supplier with the provided parameters. This is a broadcast operation that -will stake the tokens and associate them with the supplier specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, - - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) (err error) { - configContent, err := os.ReadFile(flagStakeConfig) - if err != nil { - return err - } - - supplierStakeConfigs, err := config.ParseSupplierConfigs(configContent) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgStakeSupplier( - clientCtx.GetFromAddress().String(), - supplierStakeConfigs.StakeAmount, - supplierStakeConfigs.Services, - ) - - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_stake_supplier_test.go b/x/supplier/client/cli/tx_stake_supplier_test.go deleted file mode 100644 index 7400e404c..000000000 --- a/x/supplier/client/cli/tx_stake_supplier_test.go +++ /dev/null @@ -1,297 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestCLI_StakeSupplier(t *testing.T) { - net, _ := networkWithSupplierObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the supplier to be staked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - supplierAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - defaultConfig := ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - ` - - tests := []struct { - desc string - address string - config string - err *sdkerrors.Error - }{ - // Happy Paths - { - desc: "stake supplier: valid", - address: supplierAccount.Address.String(), - config: defaultConfig, - }, - - // Error Paths - Address Related - { - desc: "stake supplier: missing address", - // address: "explicitly missing", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, - }, - { - desc: "stake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, - }, - - // Error Paths - Stake Related - { - desc: "stake supplier: missing stake", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - # explicitly omitted stake - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - { - desc: "stake supplier: invalid stake denom", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - stake_amount: 1000invalid - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - { - desc: "stake supplier: invalid stake amount (zero)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - stake_amount: 0upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - { - desc: "stake supplier: invalid stake amount (negative)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, - config: ` - stake_amount: -1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - }, - - // Happy Paths - Service Related - { - desc: "services_test: valid multiple services", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - - service_id: svc2 - endpoints: - - url: http://pokt.network:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: valid localhost", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://127.0.0.1:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: valid loopback", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://localhost:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: valid without a pork", - address: supplierAccount.Address.String(), - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network - rpc_type: json_rpc - `, - }, - - // Error Paths - Service Related - { - desc: "services_test: invalid services (missing argument)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - // servicesString: "explicitly omitted", - config: ` - stake_amount: 1000upokt - `, - }, - { - desc: "services_test: invalid services (empty string)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - `, - }, - { - desc: "services_test: invalid URL", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: bad_url - rpc_type: json_rpc - `, - }, - { - desc: "services_test: missing URLs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - - service_id: svc2 - `, - }, - { - desc: "services_test: missing service IDs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - endpoints: - - url: localhost:8081 - rpc_type: json_rpc - - endpoints: - - url: localhost:8082 - rpc_type: json_rpc - `, - }, - { - desc: "services_test: missing rpc type", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - config: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: localhost:8082 - `, - }, - } - - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.config)).Name() - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outStake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdStakeSupplier(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/supplier/client/cli/tx_submit_proof.go b/x/supplier/client/cli/tx_submit_proof.go deleted file mode 100644 index 32a0604d3..000000000 --- a/x/supplier/client/cli/tx_submit_proof.go +++ /dev/null @@ -1,65 +0,0 @@ -package cli - -import ( - "encoding/base64" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/spf13/cobra" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO(@bryanchriswhite): Add unit tests for the CLI command when implementing the business logic. - -var _ = strconv.Itoa(0) - -func CmdSubmitProof() *cobra.Command { - cmd := &cobra.Command{ - Use: "submit-proof ", - Short: "Broadcast message submit-proof", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) (err error) { - sessionHeaderEncodedStr := args[0] - smstProofEncodedStr := args[1] - - // Get the session header - sessionHeaderBz, err := base64.StdEncoding.DecodeString(sessionHeaderEncodedStr) - if err != nil { - return err - } - sessionHeader := &sessiontypes.SessionHeader{} - cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) - cdc.MustUnmarshalJSON(sessionHeaderBz, sessionHeader) - - smstProof, err := base64.StdEncoding.DecodeString(smstProofEncodedStr) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgSubmitProof( - clientCtx.GetFromAddress().String(), - sessionHeader, - smstProof, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_unstake_supplier.go b/x/supplier/client/cli/tx_unstake_supplier.go deleted file mode 100644 index 434eceb24..000000000 --- a/x/supplier/client/cli/tx_unstake_supplier.go +++ /dev/null @@ -1,42 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func CmdUnstakeSupplier() *cobra.Command { - // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` - cmd := &cobra.Command{ - Use: "unstake-supplier", - Short: "Unstake a supplier", - Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. - -Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) (err error) { - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUnstakeSupplier( - clientCtx.GetFromAddress().String(), - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/supplier/client/cli/tx_unstake_supplier_test.go b/x/supplier/client/cli/tx_unstake_supplier_test.go deleted file mode 100644 index 179e5dce5..000000000 --- a/x/supplier/client/cli/tx_unstake_supplier_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestCLI_UnstakeSupplier(t *testing.T) { - net, _ := networkWithSupplierObjects(t, 2) - val := net.Validators[0] - ctx := val.ClientCtx - - // Create a keyring and add an account for the supplier to be unstaked - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 1) - supplierAccount := accounts[0] - - // Update the context with the new keyring - ctx = ctx.WithKeyring(kr) - - // Common args used for all requests - commonArgs := []string{ - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), - } - - tests := []struct { - desc string - address string - err *sdkerrors.Error - }{ - { - desc: "unstake supplier: valid", - address: supplierAccount.Address.String(), - }, - { - desc: "unstake supplier: missing address", - // address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidAddress, - }, - { - desc: "unstake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, - }, - } - - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.Address) - - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - // Wait for a new block to be committed - require.NoError(t, net.WaitForNextBlock()) - - // Prepare the arguments for the CLI command - args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), - } - args = append(args, commonArgs...) - - // Execute the command - outUnstake, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUnstakeSupplier(), args) - - // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) - return - } - require.NoError(t, err) - - // Check the response - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - }) - } -} diff --git a/x/supplier/client/config/errors.go b/x/supplier/client/config/errors.go deleted file mode 100644 index 6a0194a75..000000000 --- a/x/supplier/client/config/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "supplierconfig" - ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrSupplierConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in supplier config") - ErrSupplierConfigNoEndpoints = sdkerrors.Register(codespace, 3, "no endpoints defined for serviceId in supplier config") - ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(codespace, 4, "invalid endpoint config in supplier config") - ErrSupplierConfigInvalidRPCType = sdkerrors.Register(codespace, 5, "invalid rpc type in supplier config") - ErrSupplierConfigInvalidURL = sdkerrors.Register(codespace, 6, "invalid endpoint url in supplier config") - ErrSupplierConfigEmptyContent = sdkerrors.Register(codespace, 7, "empty supplier config content") - ErrSupplierConfigInvalidStake = sdkerrors.Register(codespace, 8, "invalid stake amount in supplier config") -) diff --git a/x/supplier/client/config/supplier_configs_reader.go b/x/supplier/client/config/supplier_configs_reader.go deleted file mode 100644 index c5f1aeffc..000000000 --- a/x/supplier/client/config/supplier_configs_reader.go +++ /dev/null @@ -1,193 +0,0 @@ -package config - -import ( - "net/url" - - "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// YAMLStakeConfig is the structure describing the supplier stake config file -type YAMLStakeConfig struct { - StakeAmount string `yaml:"stake_amount"` - Services []*YAMLStakeService `yaml:"services"` -} - -// YAMLStakeService is the structure describing a single service stake entry in the stake config file -type YAMLStakeService struct { - ServiceId string `yaml:"service_id"` - Endpoints []YAMLServiceEndpoint `yaml:"endpoints"` -} - -// YAMLServiceEndpoint is the structure describing a single service endpoint in the stake config file -type YAMLServiceEndpoint struct { - Url string `yaml:"url"` - RPCType string `yaml:"rpc_type"` - Config map[string]string `yaml:"config,omitempty"` -} - -// SupplierStakeConfig is the structure describing the parsed supplier stake config -type SupplierStakeConfig struct { - StakeAmount sdk.Coin - Services []*sharedtypes.SupplierServiceConfig -} - -// ParseSupplierServiceConfig parses the stake config file into a SupplierServiceConfig -func ParseSupplierConfigs(configContent []byte) (*SupplierStakeConfig, error) { - var stakeConfig *YAMLStakeConfig - - if len(configContent) == 0 { - return nil, ErrSupplierConfigEmptyContent - } - - // Unmarshal the stake config file into a stakeConfig - if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { - return nil, ErrSupplierConfigUnmarshalYAML.Wrapf("%s", err) - } - - // Validate the stake amount - if len(stakeConfig.StakeAmount) == 0 { - return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be empty") - } - - stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) - if err != nil { - return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) - } - - if err := stakeAmount.Validate(); err != nil { - return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) - } - - if stakeAmount.IsZero() { - return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be zero") - } - - if stakeAmount.Denom != "upokt" { - return nil, ErrSupplierConfigInvalidStake.Wrapf( - "invalid stake denom, expecting: upokt, got: %s", - stakeAmount.Denom, - ) - } - - // Validate the services - if stakeConfig.Services == nil || len(stakeConfig.Services) == 0 { - return nil, ErrSupplierConfigInvalidServiceId.Wrap("serviceIds cannot be empty") - } - - // Prepare the supplierServiceConfig - supplierServiceConfig := make([]*sharedtypes.SupplierServiceConfig, 0, len(stakeConfig.Services)) - - // Populate the services slice - for _, svc := range stakeConfig.Services { - // Validate the serviceId - if !sharedhelpers.IsValidServiceId(svc.ServiceId) { - return nil, ErrSupplierConfigInvalidServiceId.Wrapf("%s", svc.ServiceId) - } - - if len(svc.Endpoints) == 0 { - return nil, ErrSupplierConfigNoEndpoints.Wrapf("%s", svc.ServiceId) - } - - // Create a supplied service config with the serviceId - service := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{Id: svc.ServiceId}, - Endpoints: []*sharedtypes.SupplierEndpoint{}, - } - - // Iterate over the service endpoints and add their parsed representation to the supplied service config - for _, endpoint := range svc.Endpoints { - parsedEndpointEntry, err := parseEndpointEntry(endpoint) - if err != nil { - return nil, err - } - service.Endpoints = append(service.Endpoints, parsedEndpointEntry) - } - supplierServiceConfig = append(supplierServiceConfig, service) - } - - return &SupplierStakeConfig{ - StakeAmount: stakeAmount, - Services: supplierServiceConfig, - }, nil -} - -func parseEndpointEntry(endpoint YAMLServiceEndpoint) (*sharedtypes.SupplierEndpoint, error) { - endpointEntry := &sharedtypes.SupplierEndpoint{} - var err error - - // Endpoint URL - if endpointEntry.Url, err = validateEndpointURL(endpoint); err != nil { - return nil, err - } - - // Endpoint config - if endpointEntry.Configs, err = parseEndpointConfigs(endpoint); err != nil { - return nil, err - } - - // Endpoint RPC type - if endpointEntry.RpcType, err = parseEndpointRPCType(endpoint); err != nil { - return nil, err - } - - return endpointEntry, nil -} - -// validateEndpointURL validates the endpoint URL, making sure that the string provided is a valid URL -func validateEndpointURL(endpoint YAMLServiceEndpoint) (string, error) { - // Validate the endpoint URL - if _, err := url.Parse(endpoint.Url); err != nil { - return "", ErrSupplierConfigInvalidURL.Wrapf("%s", err) - } - - return endpoint.Url, nil -} - -// parseEndpointConfigs parses the endpoint config entries into a slice of ConfigOption -// compatible with the SupplierEndpointConfig. -// It accepts a nil config entry or a map of valid config keys. -func parseEndpointConfigs(endpoint YAMLServiceEndpoint) ([]*sharedtypes.ConfigOption, error) { - // Prepare the endpoint configs slice - endpointConfigs := []*sharedtypes.ConfigOption{} - - // If we have an endpoint config entry, parse it into a slice of ConfigOption - if endpoint.Config == nil { - return endpointConfigs, nil - } - - // Iterate over the endpoint config entries and add them to the slice of ConfigOption - for key, value := range endpoint.Config { - var configKey sharedtypes.ConfigOptions - - // Make sure the config key is valid - switch key { - case "timeout": - configKey = sharedtypes.ConfigOptions_TIMEOUT - default: - return nil, ErrSupplierConfigInvalidEndpointConfig.Wrapf("%s", key) - } - - config := &sharedtypes.ConfigOption{ - Key: configKey, - Value: value, - } - endpointConfigs = append(endpointConfigs, config) - } - - return endpointConfigs, nil -} - -// parseEndpointRPCType parses the endpoint RPC type into a sharedtypes.RPCType -func parseEndpointRPCType(endpoint YAMLServiceEndpoint) (sharedtypes.RPCType, error) { - switch endpoint.RPCType { - case "json_rpc": - return sharedtypes.RPCType_JSON_RPC, nil - default: - return sharedtypes.RPCType_UNKNOWN_RPC, ErrSupplierConfigInvalidRPCType.Wrapf("%s", endpoint.RPCType) - } -} diff --git a/x/supplier/client/config/supplier_configs_reader_test.go b/x/supplier/client/config/supplier_configs_reader_test.go deleted file mode 100644 index 546a735c3..000000000 --- a/x/supplier/client/config/supplier_configs_reader_test.go +++ /dev/null @@ -1,407 +0,0 @@ -package config_test - -import ( - "testing" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/yaml" - "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/client/config" -) - -func Test_ParseSupplierConfigs(t *testing.T) { - tests := []struct { - desc string - expectedError *sdkerrors.Error - expectedConfig *config.SupplierStakeConfig - inputConfig string - }{ - // Valid Configs - { - desc: "services_test: valid full service config", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config without endpoint config", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config with empty endpoint config", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{}, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config with multiple endpoints", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - - url: http://pokt.network:8082 - rpc_type: json_rpc - config: - timeout: 11 - `, - expectedError: nil, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - { - Url: "http://pokt.network:8082", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "11", - }, - }, - }, - }, - }, - }, - }, - }, - { - desc: "services_test: valid service config with multiple services", - expectedError: nil, - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc1 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - - service_id: svc2 - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedConfig: &config.SupplierStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdk.NewInt(1000)), - Services: []*types.SupplierServiceConfig{ - { - Service: &types.Service{Id: "svc1"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - }, - }, - { - Service: &types.Service{Id: "svc2"}, - Endpoints: []*types.SupplierEndpoint{ - { - Url: "http://pokt.network:8081", - RpcType: types.RPCType_JSON_RPC, - Configs: []*types.ConfigOption{ - { - Key: types.ConfigOptions_TIMEOUT, - Value: "10", - }, - }, - }, - }, - }, - }, - }, - }, - // Invalid Configs - { - desc: "services_test: invalid service config without service ID", - inputConfig: ` - stake_amount: 1000upokt - services: - - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidServiceId, - }, - { - desc: "services_test: invalid service config with empty service ID", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidServiceId, - }, - { - desc: "services_test: invalid service config without endpoints", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - `, - expectedError: config.ErrSupplierConfigNoEndpoints, - }, - { - desc: "services_test: invalid service config with empty endpoints", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - `, - expectedError: config.ErrSupplierConfigNoEndpoints, - }, - { - desc: "services_test: invalid service config with unknown endpoint config key", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - somekey: 10 - `, - expectedError: config.ErrSupplierConfigInvalidEndpointConfig, - }, - { - desc: "services_test: invalid service config with unknown endpoint rpc type", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: somerpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidRPCType, - }, - { - desc: "services_test: invalid service config with invalid endpoint url", - inputConfig: ` - stake_amount: 1000upokt - services: - - service_id: svc - endpoints: - - url: ::invalid_url - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidURL, - }, - { - desc: "services_test: invalid service config with empty content", - expectedError: config.ErrSupplierConfigEmptyContent, - inputConfig: ``, - }, - { - desc: "services_test: missing stake amount", - inputConfig: ` - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - { - desc: "services_test: invalid stake denom", - inputConfig: ` - stake_amount: 1000invalid - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - { - desc: "services_test: negative stake amount", - inputConfig: ` - stake_amount: -1000upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - { - desc: "services_test: zero stake amount", - inputConfig: ` - stake_amount: 0upokt - services: - - service_id: svc - endpoints: - - url: http://pokt.network:8081 - rpc_type: json_rpc - config: - timeout: 10 - `, - expectedError: config.ErrSupplierConfigInvalidStake, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) - supplierServiceConfig, err := config.ParseSupplierConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, supplierServiceConfig) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) - - require.Equal(t, len(tt.expectedConfig.Services), len(supplierServiceConfig.Services)) - for i, expected := range tt.expectedConfig.Services { - - require.Equal(t, expected.Service.Id, supplierServiceConfig.Services[i].Service.Id) - - require.Equal(t, len(expected.Endpoints), len(supplierServiceConfig.Services[i].Endpoints)) - for j, expectedEndpoint := range expected.Endpoints { - - require.Equal(t, expectedEndpoint.Url, supplierServiceConfig.Services[i].Endpoints[j].Url) - require.Equal(t, expectedEndpoint.RpcType, supplierServiceConfig.Services[i].Endpoints[j].RpcType) - - require.Equal(t, len(expectedEndpoint.Configs), len(supplierServiceConfig.Services[i].Endpoints[j].Configs)) - for k, expectedConfig := range expectedEndpoint.Configs { - - require.Equal(t, expectedConfig.Key, supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Key) - require.Equal(t, expectedConfig.Value, supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Value) - } - } - } - }) - } -} diff --git a/x/supplier/genesis.go b/x/supplier/genesis.go deleted file mode 100644 index 156d80118..000000000 --- a/x/supplier/genesis.go +++ /dev/null @@ -1,30 +0,0 @@ -package supplier - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO_TECHDEBT(@Olshansk): Remove existing claims from genesis. -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // Set all the supplier - for _, supplier := range genState.SupplierList { - k.SetSupplier(ctx, supplier) - } - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - genesis.SupplierList = k.GetAllSupplier(ctx) - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/supplier/genesis_test.go b/x/supplier/genesis_test.go deleted file mode 100644 index da9245955..000000000 --- a/x/supplier/genesis_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package supplier_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Please see `x/supplier/types/genesis_test.go` for extensive tests related to the validity of the genesis state. -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - SupplierList: []sharedtypes.Supplier{ - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - { - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.SupplierKeeper(t, nil) - supplier.InitGenesis(ctx, *k, genesisState) - got := supplier.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.SupplierList, got.SupplierList) - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/supplier/keeper/claim.go b/x/supplier/keeper/claim.go deleted file mode 100644 index b73cfee84..000000000 --- a/x/supplier/keeper/claim.go +++ /dev/null @@ -1,160 +0,0 @@ -package keeper - -import ( - "encoding/binary" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// UpsertClaim inserts or updates a specific claim in the store by index. -func (k Keeper) UpsertClaim(ctx sdk.Context, claim types.Claim) { - logger := k.Logger(ctx).With("method", "UpsertClaim") - - claimBz := k.cdc.MustMarshal(&claim) - parentStore := ctx.KVStore(k.storeKey) - - // Update the primary store: ClaimPrimaryKey -> ClaimObject - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - sessionId := claim.GetSessionHeader().GetSessionId() - primaryKey := types.ClaimPrimaryKey(sessionId, claim.SupplierAddress) - primaryStore.Set(primaryKey, claimBz) - - logger.Info(fmt.Sprintf("upserted claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) - - // Update the address index: supplierAddress -> [ClaimPrimaryKey] - addressStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - addressKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) - addressStoreIndex.Set(addressKey, primaryKey) - - logger.Info(fmt.Sprintf("indexed claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) - - // Update the session end height index: sessionEndHeight -> [ClaimPrimaryKey] - sessionHeightStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) - sessionHeightStoreIndex.Set(heightKey, primaryKey) - - logger.Info(fmt.Sprintf("indexed claim for supplier %s at session ending height %d", claim.SupplierAddress, sessionEndBlockHeight)) -} - -// RemoveClaim removes a claim from the store -func (k Keeper) RemoveClaim(ctx sdk.Context, sessionId, supplierAddr string) { - logger := k.Logger(ctx).With("method", "RemoveClaim") - - parentStore := ctx.KVStore(k.storeKey) - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - - // Check if the claim exists - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) - claim, foundClaim := k.getClaimByPrimaryKey(ctx, primaryKey) - if !foundClaim { - logger.Error(fmt.Sprintf("trying to delete non-existent claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) - return - } - - // Prepare the indices for deletion - addressStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - sessionHeightStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - - addressKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) - sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) - - // Delete all the entries (primary store and secondary indices) - primaryStore.Delete(primaryKey) - addressStoreIndex.Delete(addressKey) - sessionHeightStoreIndex.Delete(heightKey) - - logger.Info(fmt.Sprintf("deleted claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) -} - -// GetClaim returns a Claim given a SessionId & SupplierAddr -func (k Keeper) GetClaim(ctx sdk.Context, sessionId, supplierAddr string) (val types.Claim, found bool) { - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) - return k.getClaimByPrimaryKey(ctx, primaryKey) -} - -// GetAllClaims returns all claim -func (k Keeper) GetAllClaims(ctx sdk.Context) (claims []types.Claim) { - primaryStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(primaryStore, []byte{}) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Claim - k.cdc.MustUnmarshal(iterator.Value(), &val) - claims = append(claims, val) - } - - return -} - -// GetClaimsByAddress returns all claims for a given supplier address -func (k Keeper) GetClaimsByAddress(ctx sdk.Context, address string) (claims []types.Claim) { - addressStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - - iterator := sdk.KVStorePrefixIterator(addressStoreIndex, []byte(address)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - primaryKey := iterator.Value() - claim, claimFound := k.getClaimByPrimaryKey(ctx, primaryKey) - if claimFound { - claims = append(claims, claim) - } - } - - return claims -} - -// GetClaimsByAddress returns all claims whose session ended at the given block height -func (k Keeper) GetClaimsByHeight(ctx sdk.Context, height uint64) (claims []types.Claim) { - sessionHeightStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, height) - - iterator := sdk.KVStorePrefixIterator(sessionHeightStoreIndex, heightBz) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - primaryKey := iterator.Value() - claim, claimFound := k.getClaimByPrimaryKey(ctx, primaryKey) - if claimFound { - claims = append(claims, claim) - } - } - - return claims -} - -// GetClaimsByAddress returns all claims matching the given session id -func (k Keeper) GetClaimsBySession(ctx sdk.Context, sessionId string) (claims []types.Claim) { - sessionIdStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - - iterator := sdk.KVStorePrefixIterator(sessionIdStoreIndex, []byte(sessionId)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Claim - k.cdc.MustUnmarshal(iterator.Value(), &val) - claims = append(claims, val) - } - - return claims -} - -// getClaimByPrimaryKey is a helper that retrieves, if exists, the Claim associated with the key provided -func (k Keeper) getClaimByPrimaryKey(ctx sdk.Context, primaryKey []byte) (val types.Claim, found bool) { - primaryStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - b := primaryStore.Get(primaryKey) - if b == nil { - return val, false - } - k.cdc.MustUnmarshal(b, &val) - return val, true -} diff --git a/x/supplier/keeper/claim_test.go b/x/supplier/keeper/claim_test.go deleted file mode 100644 index 475350752..000000000 --- a/x/supplier/keeper/claim_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func createNClaims(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Claim { - claims := make([]types.Claim, n) - for i := range claims { - claims[i].SupplierAddress = sample.AccAddress() - claims[i].SessionHeader = &sessiontypes.SessionHeader{ - SessionId: fmt.Sprintf("session-%d", i), - SessionEndBlockHeight: int64(i), - } - claims[i].RootHash = []byte(fmt.Sprintf("rootHash-%d", i)) - keeper.UpsertClaim(ctx, claims[i]) - } - return claims -} - -func TestClaim_Get(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - for _, claim := range claims { - foundClaim, isClaimFound := keeper.GetClaim(ctx, - claim.GetSessionHeader().GetSessionId(), - claim.SupplierAddress, - ) - require.True(t, isClaimFound) - require.Equal(t, - nullify.Fill(&claim), - nullify.Fill(&foundClaim), - ) - } -} -func TestClaim_Remove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - for _, claim := range claims { - sessionId := claim.GetSessionHeader().GetSessionId() - keeper.RemoveClaim(ctx, - sessionId, - claim.SupplierAddress, - ) - _, isClaimFound := keeper.GetClaim(ctx, - sessionId, - claim.SupplierAddress, - ) - require.False(t, isClaimFound) - } -} - -func TestClaim_GetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all the claims and check if they match - allFoundClaims := keeper.GetAllClaims(ctx) - require.ElementsMatch(t, - nullify.Fill(claims), - nullify.Fill(allFoundClaims), - ) -} - -func TestClaim_GetAll_ByAddress(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all claims for a given address - allFoundClaimsByAddress := keeper.GetClaimsByAddress(ctx, claims[3].SupplierAddress) - require.ElementsMatch(t, - nullify.Fill([]types.Claim{claims[3]}), - nullify.Fill(allFoundClaimsByAddress), - ) -} - -func TestClaim_GetAll_ByHeight(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all claims for a given ending session block height - sessionEndHeight := claims[6].GetSessionHeader().GetSessionEndBlockHeight() - allFoundClaimsEndingAtHeight := keeper.GetClaimsByHeight(ctx, uint64(sessionEndHeight)) - require.ElementsMatch(t, - nullify.Fill([]types.Claim{claims[6]}), - nullify.Fill(allFoundClaimsEndingAtHeight), - ) -} - -func TestClaim_GetAll_BySession(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - claims := createNClaims(keeper, ctx, 10) - - // Get all claims for a given ending session block height - sessionId := claims[8].GetSessionHeader().GetSessionId() - allFoundClaimsForSession := keeper.GetClaimsBySession(ctx, sessionId) - require.ElementsMatch(t, - nullify.Fill([]types.Claim{claims[8]}), - nullify.Fill(allFoundClaimsForSession), - ) -} diff --git a/x/supplier/keeper/keeper.go b/x/supplier/keeper/keeper.go deleted file mode 100644 index 709c94c30..000000000 --- a/x/supplier/keeper/keeper.go +++ /dev/null @@ -1,60 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - bankKeeper types.BankKeeper - sessionKeeper types.SessionKeeper - } -) - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - bankKeeper types.BankKeeper, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// TODO_TECHDEBT: Evaluate if this is still necessary after the upgrade to cosmos 0.5x -// SupplySessionKeeper assigns the session keeper dependency of this supplier -// keeper. This MUST be done as a separate step from construction because there -// is a circular dependency between the supplier and session keepers. -func (k *Keeper) SupplySessionKeeper(sessionKeeper types.SessionKeeper) { - k.sessionKeeper = sessionKeeper -} diff --git a/x/supplier/keeper/msg_server.go b/x/supplier/keeper/msg_server.go deleted file mode 100644 index 83879071c..000000000 --- a/x/supplier/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/supplier/keeper/msg_server_create_claim.go b/x/supplier/keeper/msg_server_create_claim.go deleted file mode 100644 index 2ccd4f31e..000000000 --- a/x/supplier/keeper/msg_server_create_claim.go +++ /dev/null @@ -1,75 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k msgServer) CreateClaim(goCtx context.Context, msg *suppliertypes.MsgCreateClaim) (*suppliertypes.MsgCreateClaimResponse, error) { - // TODO_BLOCKER: Prevent Claim upserts after the ClaimWindow is closed. - // TODO_BLOCKER: Validate the signature on the Claim message corresponds to the supplier before Upserting. - - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "CreateClaim") - logger.Debug("creating claim") - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - session, err := k.queryAndValidateSessionHeader( - goCtx, - msg.GetSessionHeader(), - msg.GetSupplierAddress(), - ) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - logger. - With( - "session_id", session.GetSessionId(), - "session_end_height", msg.GetSessionHeader().GetSessionEndBlockHeight(), - "supplier", msg.GetSupplierAddress(), - ). - Debug("validated claim") - - /* - TODO_INCOMPLETE: - - ### Msg distribution validation (depends on sessionRes validation) - 1. [ ] governance-based earliest block offset - 2. [ ] pseudo-randomize earliest block offset - - ### Claim validation - 1. [x] sessionRes validation - 2. [ ] msg distribution validation - */ - - // Construct and upsert claim after all validation. - claim := suppliertypes.Claim{ - SupplierAddress: msg.GetSupplierAddress(), - SessionHeader: msg.GetSessionHeader(), - RootHash: msg.RootHash, - } - - // TODO_BLOCKER: check if this claim already exists and return an appropriate error - // in any case where the supplier should no longer be able to update the given proof. - k.Keeper.UpsertClaim(ctx, claim) - - logger. - With( - "session_id", claim.GetSessionHeader().GetSessionId(), - "session_end_height", claim.GetSessionHeader().GetSessionEndBlockHeight(), - "supplier", claim.GetSupplierAddress(), - ). - Debug("created claim") - - // TODO: return the claim in the response. - return &suppliertypes.MsgCreateClaimResponse{}, nil -} diff --git a/x/supplier/keeper/msg_server_create_claim_test.go b/x/supplier/keeper/msg_server_create_claim_test.go deleted file mode 100644 index 36efb5ded..000000000 --- a/x/supplier/keeper/msg_server_create_claim_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/supplier" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -const ( - testServiceId = "svc1" - testSessionId = "mock_session_id" -) - -func TestMsgServer_CreateClaim_Success(t *testing.T) { - appSupplierPair := supplier.AppSupplierPair{ - AppAddr: sample.AccAddress(), - SupplierAddr: sample.AccAddress(), - } - service := &sharedtypes.Service{Id: testServiceId} - sessionFixturesByAddr := supplier.NewSessionFixturesWithPairings(t, service, appSupplierPair) - - supplierKeeper, sdkCtx := keepertest.SupplierKeeper(t, sessionFixturesByAddr) - srv := keeper.NewMsgServerImpl(*supplierKeeper) - ctx := sdk.WrapSDKContext(sdkCtx) - - claimMsg := newTestClaimMsg(t, testSessionId) - claimMsg.SupplierAddress = appSupplierPair.SupplierAddr - claimMsg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - - createClaimRes, err := srv.CreateClaim(ctx, claimMsg) - require.NoError(t, err) - require.NotNil(t, createClaimRes) - - claimRes, err := supplierKeeper.AllClaims(sdkCtx, &types.QueryAllClaimsRequest{}) - require.NoError(t, err) - - claims := claimRes.GetClaim() - require.Lenf(t, claims, 1, "expected 1 claim, got %d", len(claims)) - require.Equal(t, claimMsg.SessionHeader.SessionId, claims[0].GetSessionHeader().GetSessionId()) - require.Equal(t, claimMsg.SupplierAddress, claims[0].GetSupplierAddress()) - require.Equal(t, claimMsg.SessionHeader.GetSessionEndBlockHeight(), claims[0].GetSessionHeader().GetSessionEndBlockHeight()) - require.Equal(t, claimMsg.RootHash, claims[0].GetRootHash()) -} - -func TestMsgServer_CreateClaim_Error(t *testing.T) { - service := &sharedtypes.Service{Id: testServiceId} - appSupplierPair := supplier.AppSupplierPair{ - AppAddr: sample.AccAddress(), - SupplierAddr: sample.AccAddress(), - } - sessionFixturesByAppAddr := supplier.NewSessionFixturesWithPairings(t, service, appSupplierPair) - - supplierKeeper, sdkCtx := keepertest.SupplierKeeper(t, sessionFixturesByAppAddr) - srv := keeper.NewMsgServerImpl(*supplierKeeper) - ctx := sdk.WrapSDKContext(sdkCtx) - - tests := []struct { - desc string - claimMsgFn func(t *testing.T) *types.MsgCreateClaim - expectedErr error - }{ - { - desc: "on-chain session ID must match claim msg session ID", - claimMsgFn: func(t *testing.T) *types.MsgCreateClaim { - msg := newTestClaimMsg(t, "invalid_session_id") - msg.SupplierAddress = appSupplierPair.SupplierAddr - msg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - - return msg - }, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidSessionId.Wrapf( - "session ID does not match on-chain session ID; expected %q, got %q", - testSessionId, - "invalid_session_id", - ).Error(), - ), - }, - { - desc: "claim msg supplier address must be in the session", - claimMsgFn: func(t *testing.T) *types.MsgCreateClaim { - msg := newTestClaimMsg(t, testSessionId) - msg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - - // Overwrite supplier address to one not included in the session fixtures. - msg.SupplierAddress = sample.AccAddress() - - return msg - }, - expectedErr: types.ErrSupplierNotFound, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - createClaimRes, err := srv.CreateClaim(ctx, tt.claimMsgFn(t)) - require.ErrorContains(t, err, tt.expectedErr.Error()) - require.Nil(t, createClaimRes) - }) - } -} - -func newTestClaimMsg(t *testing.T, sessionId string) *suppliertypes.MsgCreateClaim { - t.Helper() - - return suppliertypes.NewMsgCreateClaim( - sample.AccAddress(), - &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - SessionStartBlockHeight: 0, - SessionId: sessionId, - Service: &sharedtypes.Service{ - Id: "svc1", - Name: "svc1", - }, - }, - []byte{0, 0, 0, 0}, - ) -} diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go deleted file mode 100644 index edd8ecee8..000000000 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ /dev/null @@ -1,106 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k msgServer) StakeSupplier( - goCtx context.Context, - msg *types.MsgStakeSupplier, -) (*types.MsgStakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "StakeSupplier") - logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) - return nil, err - } - - // Check if the supplier already exists or not - var err error - var coinsToDelegate sdk.Coin - supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) - if !isSupplierFound { - logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) - supplier = k.createSupplier(ctx, msg) - coinsToDelegate = *msg.Stake - } else { - logger.Info(fmt.Sprintf("Supplier found. Updating supplier for address %s", msg.Address)) - currSupplierStake := *supplier.Stake - if err = k.updateSupplier(ctx, &supplier, msg); err != nil { - return nil, err - } - coinsToDelegate = (*msg.Stake).Sub(currSupplierStake) - } - - // Retrieve the address of the supplier - supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? - // Send the coins from the supplier to the staked supplier pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, supplierAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, supplierAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Supplier in the store - k.SetSupplier(ctx, supplier) - logger.Info(fmt.Sprintf("Successfully updated supplier stake for supplier: %+v", supplier)) - - return &types.MsgStakeSupplierResponse{}, nil -} - -func (k msgServer) createSupplier( - ctx sdk.Context, - msg *types.MsgStakeSupplier, -) sharedtypes.Supplier { - return sharedtypes.Supplier{ - Address: msg.Address, - Stake: msg.Stake, - Services: msg.Services, - } -} - -func (k msgServer) updateSupplier( - ctx sdk.Context, - supplier *sharedtypes.Supplier, - msg *types.MsgStakeSupplier, -) error { - // Checks if the the msg address is the same as the current owner - if msg.Address != supplier.Address { - return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) - } - - // Validate that the stake is not being lowered - if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") - } - if msg.Stake.IsLTE(*supplier.Stake) { - - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) - } - supplier.Stake = msg.Stake - - // Validate that the service configs maintain at least one service. - // Additional validation is done in `msg.ValidateBasic` above. - if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") - } - supplier.Services = msg.Services - - return nil -} diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go deleted file mode 100644 index bbc74cd6e..000000000 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ /dev/null @@ -1,236 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the supplier - addr := sample.AccAddress() - - // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) - - // Prepare the stakeMsg - stakeMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the supplier exists - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, addr, supplierFound.Address) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) - - // Prepare an updated supplier with a higher stake and a different URL for the service - updateMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(200)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Update the staked supplier - _, err = srv.StakeSupplier(wctx, updateMsg) - require.NoError(t, err) - supplierFound, isSupplierFound = k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, int64(200), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId2", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8082", supplierFound.Services[0].Endpoints[0].Url) -} - -func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - supplierAddr := sample.AccAddress() - - // Prepare the supplier stake message - stakeMsg := &types.MsgStakeSupplier{ - Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - - // Prepare the supplier stake message without any service endpoints - updateStakeMsg := &types.MsgStakeSupplier{ - Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svcId"}, - Endpoints: []*sharedtypes.SupplierEndpoint{}, - }, - }, - } - - // Fail updating the supplier when the list of service endpoints is empty - _, err = srv.StakeSupplier(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the supplierFound still exists and is staked for svc1 - supplierFound, isSupplierFound := k.GetSupplier(ctx, supplierAddr) - require.True(t, isSupplierFound) - require.Equal(t, supplierAddr, supplierFound.Address) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) - - // Prepare the supplier stake message with an invalid service ID - updateStakeMsg = &types.MsgStakeSupplier{ - Address: supplierAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, - }, - }, - } - - // Fail updating the supplier when the list of services is empty - _, err = srv.StakeSupplier(wctx, updateStakeMsg) - require.Error(t, err) - - // Verify the supplier still exists and is staked for svc1 - supplierFound, isSupplierFound = k.GetSupplier(ctx, supplierAddr) - require.True(t, isSupplierFound) - require.Equal(t, supplierAddr, supplierFound.Address) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) -} - -func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Prepare the supplier - addr := sample.AccAddress() - stakeMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier & verify that the supplier exists - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - - // Prepare an updated supplier with a lower stake - updateMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(50)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Verify that it fails - _, err = srv.StakeSupplier(wctx, updateMsg) - require.Error(t, err) - - // Verify that the supplier stake is unchanged - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) -} diff --git a/x/supplier/keeper/msg_server_submit_proof.go b/x/supplier/keeper/msg_server_submit_proof.go deleted file mode 100644 index 5455b190a..000000000 --- a/x/supplier/keeper/msg_server_submit_proof.go +++ /dev/null @@ -1,137 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k msgServer) SubmitProof(goCtx context.Context, msg *suppliertypes.MsgSubmitProof) (*suppliertypes.MsgSubmitProofResponse, error) { - // TODO_BLOCKER: Prevent Proof upserts after the tokenomics module has processes the respective session. - // TODO_BLOCKER: Validate the signature on the Proof message corresponds to the supplier before Upserting. - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "SubmitProof") - logger.Debug("submitting proof") - - /* - TODO_INCOMPLETE: Handling the message - - ## Actions (error if anything fails) - 1. Retrieve a fully hydrated `session` from on-chain store using `msg` metadata - 2. Retrieve a fully hydrated `claim` from on-chain store using `msg` metadata - 3. Retrieve `relay.Req` and `relay.Res` from deserializing `proof.ClosestValueHash` - - ## Basic Validations (metadata only) - 1. proof.sessionId == claim.sessionId - 2. msg.supplier in session.suppliers - 3. relay.Req.signer == session.appAddr - 4. relay.Res.signer == msg.supplier - - ## Msg distribution validation (governance based params) - 1. Validate Proof submission is not too early; governance-based param + pseudo-random variation - 2. Validate Proof submission is not too late; governance-based param + pseudo-random variation - - ## Relay Signature validation - 1. verify(relay.Req.Signature, appRing) - 2. verify(relay.Res.Signature, supplier.pubKey) - - ## Relay Mining validation - 1. verify(proof.path) is the expected path; pseudo-random variation using on-chain data - 2. verify(proof.ValueHash, expectedDiffictulty); governance based - 3. verify(claim.Root, proof.ClosestProof); verify the closest proof is correct - */ - - if err := msg.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - if _, err := k.queryAndValidateSessionHeader( - goCtx, - msg.GetSessionHeader(), - msg.GetSupplierAddress(), - ); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - // Construct and insert proof after all validation. - proof := suppliertypes.Proof{ - SupplierAddress: msg.GetSupplierAddress(), - SessionHeader: msg.GetSessionHeader(), - ClosestMerkleProof: msg.Proof, - } - - if err := k.queryAndValidateClaimForProof(ctx, &proof); err != nil { - return nil, status.Error(codes.FailedPrecondition, err.Error()) - } - - // TODO_BLOCKER: check if this proof already exists and return an appropriate error - // in any case where the supplier should no longer be able to update the given proof. - k.Keeper.UpsertProof(ctx, proof) - - // TODO_UPNEXT(@Olshansk, #359): Call `tokenomics.SettleSessionAccounting()` here - - logger. - With( - "session_id", proof.GetSessionHeader().GetSessionId(), - "session_end_height", proof.GetSessionHeader().GetSessionEndBlockHeight(), - "supplier", proof.GetSupplierAddress(), - ). - Debug("created proof") - - return &suppliertypes.MsgSubmitProofResponse{}, nil -} - -// queryAndValidateClaimForProof ensures that a claim corresponding to the given proof's -// session exists & has a matching supplier address and session header. -func (k msgServer) queryAndValidateClaimForProof(sdkCtx sdk.Context, proof *suppliertypes.Proof) error { - sessionId := proof.GetSessionHeader().GetSessionId() - // NB: no need to assert the testSessionId or supplier address as it is retrieved - // by respective values of the given proof. I.e., if the claim exists, then these - // values are guaranteed to match. - claim, found := k.GetClaim(sdkCtx, sessionId, proof.GetSupplierAddress()) - if !found { - return suppliertypes.ErrSupplierClaimNotFound.Wrapf("no claim found for session ID %q and supplier %q", sessionId, proof.GetSupplierAddress()) - } - - // Ensure session start heights match. - if claim.GetSessionHeader().GetSessionStartBlockHeight() != proof.GetSessionHeader().GetSessionStartBlockHeight() { - return suppliertypes.ErrSupplierInvalidSessionStartHeight.Wrapf( - "claim session start height %d does not match proof session start height %d", - claim.GetSessionHeader().GetSessionStartBlockHeight(), - proof.GetSessionHeader().GetSessionStartBlockHeight(), - ) - } - - // Ensure session end heights match. - if claim.GetSessionHeader().GetSessionEndBlockHeight() != proof.GetSessionHeader().GetSessionEndBlockHeight() { - return suppliertypes.ErrSupplierInvalidSessionEndHeight.Wrapf( - "claim session end height %d does not match proof session end height %d", - claim.GetSessionHeader().GetSessionEndBlockHeight(), - proof.GetSessionHeader().GetSessionEndBlockHeight(), - ) - } - - // Ensure application addresses match. - if claim.GetSessionHeader().GetApplicationAddress() != proof.GetSessionHeader().GetApplicationAddress() { - return suppliertypes.ErrSupplierInvalidAddress.Wrapf( - "claim application address %q does not match proof application address %q", - claim.GetSessionHeader().GetApplicationAddress(), - proof.GetSessionHeader().GetApplicationAddress(), - ) - } - - // Ensure service IDs match. - if claim.GetSessionHeader().GetService().GetId() != proof.GetSessionHeader().GetService().GetId() { - return suppliertypes.ErrSupplierInvalidService.Wrapf( - "claim service ID %q does not match proof service ID %q", - claim.GetSessionHeader().GetService().GetId(), - proof.GetSessionHeader().GetService().GetId(), - ) - } - - return nil -} diff --git a/x/supplier/keeper/msg_server_test.go b/x/supplier/keeper/msg_server_test.go deleted file mode 100644 index b337090e3..000000000 --- a/x/supplier/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx := keepertest.SupplierKeeper(t, nil) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go deleted file mode 100644 index 79f86db3f..000000000 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ /dev/null @@ -1,52 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// TODO(#73): Determine if an application needs an unbonding period after unstaking. -func (k msgServer) UnstakeSupplier( - goCtx context.Context, - msg *types.MsgUnstakeSupplier, -) (*types.MsgUnstakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - logger := k.Logger(ctx).With("method", "UnstakeSupplier") - logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // Check if the supplier already exists or not - supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) - if !isSupplierFound { - logger.Info(fmt.Sprintf("Supplier not found. Cannot unstake address %s", msg.Address)) - return nil, types.ErrSupplierNotFound - } - logger.Info(fmt.Sprintf("Supplier found. Unstaking supplier for address %s", msg.Address)) - - // Retrieve the address of the supplier - supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) - return nil, err - } - - // Send the coins from the supplier pool back to the supplier - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}) - if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", supplier.Stake, supplierAddress, types.ModuleName, err)) - return nil, err - } - - // Update the Supplier in the store - k.RemoveSupplier(ctx, supplierAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the supplier: %+v", supplier)) - return &types.MsgUnstakeSupplierResponse{}, nil -} diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go deleted file mode 100644 index 2999a5e3c..000000000 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the supplier - addr := sample.AccAddress() - - // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) - - // Prepare the supplier - initialStake := sdk.NewCoin("upokt", sdk.NewInt(100)) - stakeMsg := &types.MsgStakeSupplier{ - Address: addr, - Stake: &initialStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - } - - // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) - require.NoError(t, err) - - // Verify that the supplier exists - foundSupplier, isSupplierFound := k.GetSupplier(ctx, addr) - require.True(t, isSupplierFound) - require.Equal(t, addr, foundSupplier.Address) - require.Equal(t, initialStake.Amount, foundSupplier.Stake.Amount) - require.Len(t, foundSupplier.Services, 1) - - // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} - _, err = srv.UnstakeSupplier(wctx, unstakeMsg) - require.NoError(t, err) - - // Make sure the supplier can no longer be found after unstaking - _, isSupplierFound = k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) -} - -func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { - k, ctx := keepertest.SupplierKeeper(t, nil) - srv := keeper.NewMsgServerImpl(*k) - wctx := sdk.WrapSDKContext(ctx) - - // Generate an address for the supplier - addr := sample.AccAddress() - - // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) - - // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} - _, err := srv.UnstakeSupplier(wctx, unstakeMsg) - require.Error(t, err) - require.ErrorIs(t, err, types.ErrSupplierNotFound) - - _, isSupplierFound = k.GetSupplier(ctx, addr) - require.False(t, isSupplierFound) -} diff --git a/x/supplier/keeper/params.go b/x/supplier/keeper/params.go deleted file mode 100644 index 86ca01cbe..000000000 --- a/x/supplier/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go deleted file mode 100644 index 38f2e91b9..000000000 --- a/x/supplier/keeper/params_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.SupplierKeeper(t, nil) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/supplier/keeper/proof.go b/x/supplier/keeper/proof.go deleted file mode 100644 index 3aacbf273..000000000 --- a/x/supplier/keeper/proof.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// UpsertProof inserts or updates a specific proof in the store by index. -func (k Keeper) UpsertProof(ctx sdk.Context, proof types.Proof) { - logger := k.Logger(ctx).With("method", "UpsertProof") - - proofBz := k.cdc.MustMarshal(&proof) - parentStore := ctx.KVStore(k.storeKey) - - // Update the primary store containing the proof object. - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - sessionId := proof.GetSessionHeader().GetSessionId() - primaryKey := types.ProofPrimaryKey(sessionId, proof.GetSupplierAddress()) - primaryStore.Set(primaryKey, proofBz) - - logger.Info(fmt.Sprintf("upserted proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) - - // Update the address index: supplierAddress -> [ProofPrimaryKey] - addressStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofSupplierAddressPrefix)) - addressKey := types.ProofSupplierAddressKey(proof.GetSupplierAddress(), primaryKey) - addressStoreIndex.Set(addressKey, primaryKey) - - logger.Info(fmt.Sprintf("indexed Proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) - - // Update the session end height index: sessionEndHeight -> [ProofPrimaryKey] - sessionHeightStoreIndex := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofSessionEndHeightPrefix)) - sessionEndHeight := proof.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ProofSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) - sessionHeightStoreIndex.Set(heightKey, primaryKey) -} - -// GetProof returns a proof from its index -func (k Keeper) GetProof(ctx sdk.Context, sessionId, supplierAdd string) (val types.Proof, found bool) { - primaryKey := types.ProofPrimaryKey(sessionId, supplierAdd) - return k.getProofByPrimaryKey(ctx, primaryKey) -} - -// RemoveProof removes a proof from the store -func (k Keeper) RemoveProof(ctx sdk.Context, sessionId, supplierAddr string) { - parentStore := ctx.KVStore(k.storeKey) - proofPrimaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - proofPrimaryKey := types.ProofPrimaryKey(sessionId, supplierAddr) - proofPrimaryStore.Delete(proofPrimaryKey) -} - -// GetAllProofs returns all proof -func (k Keeper) GetAllProofs(ctx sdk.Context) (list []types.Proof) { - parentStore := ctx.KVStore(k.storeKey) - primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(primaryStore, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.Proof - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// getProofByPrimaryKey is a helper that retrieves, if exists, the Proof associated with the key provided -func (k Keeper) getProofByPrimaryKey(ctx sdk.Context, primaryKey []byte) (val types.Proof, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ProofPrimaryKeyPrefix)) - - proofBz := store.Get(primaryKey) - if proofBz == nil { - return val, false - } - - k.cdc.MustUnmarshal(proofBz, &val) - return val, true -} diff --git a/x/supplier/keeper/proof_test.go b/x/supplier/keeper/proof_test.go deleted file mode 100644 index bf34f7027..000000000 --- a/x/supplier/keeper/proof_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func createNProofs(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Proof { - proofs := make([]types.Proof, n) - for i := range proofs { - proofs[i] = types.Proof{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - Service: &sharedtypes.Service{Id: testServiceId}, - SessionId: fmt.Sprintf("session-%d", i), - SessionStartBlockHeight: 1, - SessionEndBlockHeight: 1 + sessionkeeper.NumBlocksPerSession, - }, - ClosestMerkleProof: nil, - } - - keeper.UpsertProof(ctx, proofs[i]) - } - return proofs -} - -func TestProofGet(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - proofs := createNProofs(keeper, ctx, 10) - for _, proof := range proofs { - rst, found := keeper.GetProof( - ctx, - proof.GetSessionHeader().GetSessionId(), - proof.GetSupplierAddress(), - ) - require.True(t, found) - require.Equal(t, - nullify.Fill(&proof), - nullify.Fill(&rst), - ) - } -} -func TestProofRemove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - proofs := createNProofs(keeper, ctx, 10) - for _, proof := range proofs { - sessionId := proof.GetSessionHeader().GetSessionId() - keeper.RemoveProof(ctx, sessionId, proof.GetSupplierAddress()) - _, found := keeper.GetProof(ctx, sessionId, proof.GetSupplierAddress()) - require.False(t, found) - } -} - -func TestProofGetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - items := createNProofs(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllProofs(ctx)), - ) -} diff --git a/x/supplier/keeper/query.go b/x/supplier/keeper/query.go deleted file mode 100644 index 2d1d5c18e..000000000 --- a/x/supplier/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/supplier/keeper/query_claim.go b/x/supplier/keeper/query_claim.go deleted file mode 100644 index 4dd294adc..000000000 --- a/x/supplier/keeper/query_claim.go +++ /dev/null @@ -1,103 +0,0 @@ -package keeper - -import ( - "context" - "encoding/binary" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) AllClaims(goCtx context.Context, req *types.QueryAllClaimsRequest) (*types.QueryAllClaimsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) - - // isCustomIndex is used to determined if we'll be using the store that points - // to the actual Claim values, or a secondary index that points to the primary keys. - var isCustomIndex bool - var keyPrefix []byte - switch filter := req.Filter.(type) { - case *types.QueryAllClaimsRequest_SupplierAddress: - isCustomIndex = true - keyPrefix = types.KeyPrefix(types.ClaimSupplierAddressPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SupplierAddress)...) - - case *types.QueryAllClaimsRequest_SessionEndHeight: - isCustomIndex = true - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, filter.SessionEndHeight) - - keyPrefix = types.KeyPrefix(types.ClaimSessionEndHeightPrefix) - keyPrefix = append(keyPrefix, heightBz...) - - case *types.QueryAllClaimsRequest_SessionId: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SessionId)...) - - default: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) - } - claimStore := prefix.NewStore(store, keyPrefix) - - var claims []types.Claim - pageRes, err := query.Paginate(claimStore, req.Pagination, func(key []byte, value []byte) error { - if isCustomIndex { - // We retrieve the primaryKey, and need to query the actual Claim before decoding it. - claim, claimFound := k.getClaimByPrimaryKey(ctx, value) - if claimFound { - claims = append(claims, claim) - } - } else { - // The value is an encoded Claim. - var claim types.Claim - if err := k.cdc.Unmarshal(value, &claim); err != nil { - return err - } - claims = append(claims, claim) - } - - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllClaimsResponse{Claim: claims, Pagination: pageRes}, nil -} - -func (k Keeper) Claim(goCtx context.Context, req *types.QueryGetClaimRequest) (*types.QueryGetClaimResponse, error) { - if req == nil { - err := types.ErrSupplierInvalidQueryRequest.Wrapf("request cannot be nil") - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetClaim( - ctx, - req.SessionId, - req.SupplierAddress, - ) - if !found { - err := types.ErrSupplierClaimNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) - return nil, status.Error(codes.NotFound, err.Error()) - } - - return &types.QueryGetClaimResponse{Claim: val}, nil -} diff --git a/x/supplier/keeper/query_claim_test.go b/x/supplier/keeper/query_claim_test.go deleted file mode 100644 index fac734a78..000000000 --- a/x/supplier/keeper/query_claim_test.go +++ /dev/null @@ -1,234 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestClaim_QuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - claims := createNClaims(keeper, ctx, 2) - - var wrongSupplierAddr = sample.AccAddress() - tests := []struct { - desc string - - request *types.QueryGetClaimRequest - - response *types.QueryGetClaimResponse - expectedErr error - }{ - { - desc: "First Claim", - - request: &types.QueryGetClaimRequest{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - SupplierAddress: claims[0].SupplierAddress, - }, - - response: &types.QueryGetClaimResponse{Claim: claims[0]}, - expectedErr: nil, - }, - { - desc: "Second Claim", - - request: &types.QueryGetClaimRequest{ - SessionId: claims[1].GetSessionHeader().GetSessionId(), - SupplierAddress: claims[1].SupplierAddress, - }, - - response: &types.QueryGetClaimResponse{Claim: claims[1]}, - expectedErr: nil, - }, - { - desc: "Claim Not Found - Random SessionId", - - request: &types.QueryGetClaimRequest{ - SessionId: "not a real session id", - SupplierAddress: claims[0].GetSupplierAddress(), - }, - - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - // TODO_CONSIDERATION: factor out error message format strings to constants. - "session ID %q and supplier %q", - "not a real session id", - claims[0].GetSupplierAddress(), - ).Error(), - ), - }, - { - desc: "Claim Not Found - Wrong Supplier Address", - - request: &types.QueryGetClaimRequest{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - SupplierAddress: wrongSupplierAddr, - }, - - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierClaimNotFound.Wrapf( - "session ID %q and supplier %q", - claims[0].GetSessionHeader().GetSessionId(), - wrongSupplierAddr, - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SessionId", - request: &types.QueryGetClaimRequest{ - // SessionId: Intentionally Omitted - SupplierAddress: claims[0].GetSupplierAddress(), - }, - - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidSessionId.Wrapf( - "invalid session ID for claim being retrieved %s", - "", - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SupplierAddress", - request: &types.QueryGetClaimRequest{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - // SupplierAddress: Intentionally Omitted, - }, - - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidAddress.Wrap( - "invalid supplier address for claim being retrieved ; (empty address string is not allowed)", - ).Error(), - ), - }, - { - desc: "InvalidRequest - nil QueryGetClaimRequest", - request: nil, - - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidQueryRequest.Wrap( - "request cannot be nil", - ).Error(), - ), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Claim(wctx, tc.request) - if tc.expectedErr != nil { - actualStatus, ok := status.FromError(err) - require.True(t, ok) - - require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) - require.ErrorContains(t, err, tc.expectedErr.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestClaim_QueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - claims := createNClaims(keeper, ctx, 10) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllClaimsRequest { - return &types.QueryAllClaimsRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(claims); i += step { - resp, err := keeper.AllClaims(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(claims); i += step { - resp, err := keeper.AllClaims(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Claim), step) - require.Subset(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.AllClaims(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(claims), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(claims), - nullify.Fill(resp.Claim), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.AllClaims(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) - - t.Run("BySupplierAddress", func(t *testing.T) { - req := request(nil, 0, 0, true) - req.Filter = &types.QueryAllClaimsRequest_SupplierAddress{ - SupplierAddress: claims[0].SupplierAddress, - } - resp, err := keeper.AllClaims(wctx, req) - require.NoError(t, err) - require.Equal(t, 1, int(resp.Pagination.Total)) - }) - - t.Run("BySessionId", func(t *testing.T) { - req := request(nil, 0, 0, true) - req.Filter = &types.QueryAllClaimsRequest_SessionId{ - SessionId: claims[0].GetSessionHeader().GetSessionId(), - } - resp, err := keeper.AllClaims(wctx, req) - require.NoError(t, err) - require.Equal(t, 1, int(resp.Pagination.Total)) - }) - - t.Run("BySessionEndHeight", func(t *testing.T) { - req := request(nil, 0, 0, true) - req.Filter = &types.QueryAllClaimsRequest_SessionEndHeight{ - SessionEndHeight: uint64(claims[0].GetSessionHeader().GetSessionEndBlockHeight()), - } - resp, err := keeper.AllClaims(wctx, req) - require.NoError(t, err) - require.Equal(t, 1, int(resp.Pagination.Total)) - }) -} diff --git a/x/supplier/keeper/query_params.go b/x/supplier/keeper/query_params.go deleted file mode 100644 index 67e2a17f4..000000000 --- a/x/supplier/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/supplier/keeper/query_params_test.go b/x/supplier/keeper/query_params_test.go deleted file mode 100644 index 37df8b949..000000000 --- a/x/supplier/keeper/query_params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/supplier/keeper/query_proof.go b/x/supplier/keeper/query_proof.go deleted file mode 100644 index cb8642679..000000000 --- a/x/supplier/keeper/query_proof.go +++ /dev/null @@ -1,101 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) AllProofs(goCtx context.Context, req *types.QueryAllProofsRequest) (*types.QueryAllProofsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) - - var ( - // isCustomIndex is used to determined if we'll be using the store that points - // to the actual Claim values, or a secondary index that points to the primary keys. - isCustomIndex bool - keyPrefix []byte - ) - - switch filter := req.Filter.(type) { - case *types.QueryAllProofsRequest_SupplierAddress: - isCustomIndex = true - keyPrefix = types.KeyPrefix(types.ProofSupplierAddressPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SupplierAddress)...) - case *types.QueryAllProofsRequest_SessionEndHeight: - isCustomIndex = true - keyPrefix = types.KeyPrefix(types.ProofSessionEndHeightPrefix) - keyPrefix = append(keyPrefix, []byte(fmt.Sprintf("%d", filter.SessionEndHeight))...) - case *types.QueryAllProofsRequest_SessionId: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ProofPrimaryKeyPrefix) - keyPrefix = append(keyPrefix, []byte(filter.SessionId)...) - default: - isCustomIndex = false - keyPrefix = types.KeyPrefix(types.ProofPrimaryKeyPrefix) - } - proofStore := prefix.NewStore(store, keyPrefix) - - var proofs []types.Proof - pageRes, err := query.Paginate(proofStore, req.Pagination, func(key []byte, value []byte) error { - if isCustomIndex { - // We retrieve the primaryKey, and need to query the actual proof before decoding it. - proof, proofFound := k.getProofByPrimaryKey(ctx, value) - if proofFound { - proofs = append(proofs, proof) - } - } else { - // The value is an encoded proof. - var proof types.Proof - if err := k.cdc.Unmarshal(value, &proof); err != nil { - return err - } - - proofs = append(proofs, proof) - } - - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllProofsResponse{Proof: proofs, Pagination: pageRes}, nil -} - -func (k Keeper) Proof(goCtx context.Context, req *types.QueryGetProofRequest) (*types.QueryGetProofResponse, error) { - if req == nil { - err := types.ErrSupplierInvalidQueryRequest.Wrap("request cannot be nil") - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - if err := req.ValidateBasic(); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetProof(ctx, req.GetSessionId(), req.GetSupplierAddress()) - if !found { - err := types.ErrSupplierProofNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) - return nil, status.Error(codes.NotFound, err.Error()) - } - - return &types.QueryGetProofResponse{Proof: val}, nil -} diff --git a/x/supplier/keeper/query_proof_test.go b/x/supplier/keeper/query_proof_test.go deleted file mode 100644 index 787b23d68..000000000 --- a/x/supplier/keeper/query_proof_test.go +++ /dev/null @@ -1,192 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestProofQuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - proofs := createNProofs(keeper, ctx, 2) - - var randSupplierAddr = sample.AccAddress() - tests := []struct { - desc string - request *types.QueryGetProofRequest - response *types.QueryGetProofResponse - expectedErr error - }{ - { - desc: "First", - request: &types.QueryGetProofRequest{ - SessionId: proofs[0].GetSessionHeader().GetSessionId(), - SupplierAddress: proofs[0].SupplierAddress, - }, - response: &types.QueryGetProofResponse{Proof: proofs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetProofRequest{ - SessionId: proofs[1].GetSessionHeader().GetSessionId(), - SupplierAddress: proofs[1].SupplierAddress, - }, - response: &types.QueryGetProofResponse{Proof: proofs[1]}, - }, - { - desc: "Proof Not Found - Random SessionId", - request: &types.QueryGetProofRequest{ - SessionId: "not a real session id", - SupplierAddress: proofs[0].GetSupplierAddress(), - }, - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierProofNotFound.Wrapf( - "session ID %q and supplier %q", - "not a real session id", - proofs[0].GetSupplierAddress(), - ).Error(), - ), - }, - { - desc: "Proof Not Found - Random Supplier Address", - request: &types.QueryGetProofRequest{ - SessionId: proofs[0].GetSessionHeader().GetSessionId(), - SupplierAddress: randSupplierAddr, - }, - expectedErr: status.Error( - codes.NotFound, - types.ErrSupplierProofNotFound.Wrapf( - "session ID %q and supplier %q", - proofs[0].GetSessionHeader().GetSessionId(), - randSupplierAddr, - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SessionId", - request: &types.QueryGetProofRequest{ - // SessionId: Intentionally Omitted - SupplierAddress: proofs[0].GetSupplierAddress(), - }, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidSessionId.Wrapf( - "invalid session ID for proof being retrieved %s", - "", - ).Error(), - ), - }, - { - desc: "InvalidRequest - Missing SupplierAddress", - request: &types.QueryGetProofRequest{ - SessionId: proofs[0].GetSessionHeader().GetSessionId(), - // SupplierAddress: Intentionally Omitted, - }, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidAddress.Wrap( - "invalid supplier address for proof being retrieved ; (empty address string is not allowed)", - ).Error(), - ), - }, - { - desc: "InvalidRequest - nil QueryGetProofRequest", - request: nil, - expectedErr: status.Error( - codes.InvalidArgument, - types.ErrSupplierInvalidQueryRequest.Wrap( - "request cannot be nil", - ).Error(), - ), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Proof(wctx, tc.request) - if tc.expectedErr != nil { - actualStatus, ok := status.FromError(err) - require.True(t, ok) - - require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) - require.ErrorContains(t, err, tc.expectedErr.Error()) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestProofQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNProofs(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllProofsRequest { - return &types.QueryAllProofsRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.AllProofs(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Proof), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Proof), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.AllProofs(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Proof), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Proof), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.AllProofs(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Proof), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.AllProofs(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go deleted file mode 100644 index c27e8e8f6..000000000 --- a/x/supplier/keeper/query_supplier.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var suppliers []sharedtypes.Supplier - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) - - pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { - var supplier sharedtypes.Supplier - if err := k.cdc.Unmarshal(value, &supplier); err != nil { - return err - } - - suppliers = append(suppliers, supplier) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllSupplierResponse{Supplier: suppliers, Pagination: pageRes}, nil -} - -func (k Keeper) Supplier(goCtx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - val, found := k.GetSupplier( - ctx, - req.Address, - ) - if !found { - // TODO_TECHDEBT(#181): conform to logging conventions once established - msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) - return nil, status.Error(codes.NotFound, msg) - } - - return &types.QueryGetSupplierResponse{Supplier: val}, nil -} diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go deleted file mode 100644 index bfd4f8019..000000000 --- a/x/supplier/keeper/query_supplier_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func TestSupplierQuerySingle(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNSupplier(keeper, ctx, 2) - tests := []struct { - desc string - request *types.QueryGetSupplierRequest - response *types.QueryGetSupplierResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetSupplierRequest{ - Address: msgs[0].Address, - }, - response: &types.QueryGetSupplierResponse{Supplier: msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetSupplierRequest{ - Address: msgs[1].Address, - }, - response: &types.QueryGetSupplierResponse{Supplier: msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetSupplierRequest{ - Address: strconv.Itoa(100000), - }, - err: status.Error(codes.NotFound, "supplier with address \"100000\""), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Supplier(wctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.NoError(t, err) - require.Equal(t, - nullify.Fill(tc.response), - nullify.Fill(response), - ) - } - }) - } -} - -func TestSupplierQueryPaginated(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNSupplier(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSupplierRequest { - return &types.QueryAllSupplierRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Supplier), - ) - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.SupplierAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - require.LessOrEqual(t, len(resp.Supplier), step) - require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Supplier), - ) - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.SupplierAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Supplier), - ) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.SupplierAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/supplier/keeper/session.go b/x/supplier/keeper/session.go deleted file mode 100644 index af24e52f0..000000000 --- a/x/supplier/keeper/session.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -// queryAndValidateSessionHeader ensures that a session with the sessionID of the given session -// header exists and that this session includes the supplier with the given address. -func (k msgServer) queryAndValidateSessionHeader( - goCtx context.Context, - sessionHeader *sessiontypes.SessionHeader, - supplierAddr string, -) (*sessiontypes.Session, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "SubmitProof") - - sessionReq := &sessiontypes.QueryGetSessionRequest{ - ApplicationAddress: sessionHeader.GetApplicationAddress(), - Service: sessionHeader.GetService(), - BlockHeight: sessionHeader.GetSessionStartBlockHeight(), - } - - // Get the on-chain session for the ground-truth against which the given - // session header is to be validated. - sessionRes, err := k.Keeper.sessionKeeper.GetSession(goCtx, sessionReq) - if err != nil { - return nil, err - } - onChainSession := sessionRes.GetSession() - - logger. - With( - "session_id", onChainSession.GetSessionId(), - "session_end_height", sessionHeader.GetSessionEndBlockHeight(), - "supplier", supplierAddr, - ). - Debug("got sessionId for proof") - - // Ensure that the given session header's session ID matches the on-chain onChainSession ID. - if sessionHeader.GetSessionId() != onChainSession.GetSessionId() { - return nil, suppliertypes.ErrSupplierInvalidSessionId.Wrapf( - "session ID does not match on-chain session ID; expected %q, got %q", - onChainSession.GetSessionId(), - sessionHeader.GetSessionId(), - ) - } - - // NB: it is redundant to assert that the service ID in the request matches the - // on-chain session service ID because the session is queried using the service - // ID as a parameter. Either a different session (i.e. different session ID) - // or an error would be returned depending on whether an application/supplier - // pair exists for the given service ID or not, respectively. - - // Ensure the given supplier is in the onChainSession supplier list. - if found := foundSupplier( - sessionRes.GetSession().GetSuppliers(), - supplierAddr, - ); !found { - return nil, suppliertypes.ErrSupplierNotFound.Wrapf( - "supplier address %q not found in session ID %q", - supplierAddr, - sessionHeader.GetSessionId(), - ) - } - - return onChainSession, nil -} - -// foundSupplier ensures that the given supplier address is in the given list of suppliers. -func foundSupplier(suppliers []*sharedtypes.Supplier, supplierAddr string) bool { - for _, supplier := range suppliers { - if supplier.Address == supplierAddr { - return true - } - } - return false -} diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go deleted file mode 100644 index c5edeefc4..000000000 --- a/x/supplier/keeper/supplier.go +++ /dev/null @@ -1,66 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// SetSupplier set a specific supplier in the store from its index -func (k Keeper) SetSupplier(ctx sdk.Context, supplier sharedtypes.Supplier) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - b := k.cdc.MustMarshal(&supplier) - store.Set(types.SupplierKey( - supplier.Address, - ), b) -} - -// GetSupplier returns a supplier from its index -func (k Keeper) GetSupplier( - ctx sdk.Context, - supplierAddr string, -) (supplier sharedtypes.Supplier, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - - b := store.Get(types.SupplierKey( - supplierAddr, - )) - if b == nil { - return supplier, false - } - - k.cdc.MustUnmarshal(b, &supplier) - return supplier, true -} - -// RemoveSupplier removes a supplier from the store -func (k Keeper) RemoveSupplier( - ctx sdk.Context, - supplierAddr string, -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - store.Delete(types.SupplierKey( - supplierAddr, - )) -} - -// GetAllSupplier returns all supplier -func (k Keeper) GetAllSupplier(ctx sdk.Context) (suppliers []sharedtypes.Supplier) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.SupplierKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var supplier sharedtypes.Supplier - k.cdc.MustUnmarshal(iterator.Value(), &supplier) - suppliers = append(suppliers, supplier) - } - - return -} - -// TODO_OPTIMIZE: Index suppliers by service so we can easily query `k.GetAllSupplier(ctx, Service)` -// func (k Keeper) GetAllSupplier(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go deleted file mode 100644 index 03b1e470a..000000000 --- a/x/supplier/keeper/supplier_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func init() { - cmd.InitSDKConfig() -} - -func createNSupplier(keeper *keeper.Keeper, ctx sdk.Context, n int) []sharedtypes.Supplier { - suppliers := make([]sharedtypes.Supplier, n) - for i := range suppliers { - supplier := &suppliers[i] - supplier.Address = sample.AccAddress() - supplier.Stake = &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(int64(i))} - supplier.Services = []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: fmt.Sprintf("http://localhost:%d", i), - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - } - keeper.SetSupplier(ctx, *supplier) - } - - return suppliers -} - -func TestSupplierGet(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - for _, supplier := range suppliers { - supplierFound, isSupplierFound := keeper.GetSupplier(ctx, - supplier.Address, - ) - require.True(t, isSupplierFound) - require.Equal(t, - nullify.Fill(&supplier), - nullify.Fill(&supplierFound), - ) - } -} -func TestSupplierRemove(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - for _, supplier := range suppliers { - keeper.RemoveSupplier(ctx, - supplier.Address, - ) - _, isSupplierFound := keeper.GetSupplier(ctx, - supplier.Address, - ) - require.False(t, isSupplierFound) - } -} - -func TestSupplierGetAll(t *testing.T) { - keeper, ctx := keepertest.SupplierKeeper(t, nil) - suppliers := createNSupplier(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(suppliers), - nullify.Fill(keeper.GetAllSupplier(ctx)), - ) -} - -// The application module address is derived off of its semantic name. -// This test is a helper for us to easily identify the underlying address. -func TestApplicationModuleAddress(t *testing.T) { - moduleAddress := authtypes.NewModuleAddress(types.ModuleName) - require.Equal(t, "pokt1j40dzzmn6cn9kxku7a5tjnud6hv37vesr5ccaa", moduleAddress.String()) -} diff --git a/x/supplier/module.go b/x/supplier/module.go deleted file mode 100644 index a39dc9303..000000000 --- a/x/supplier/module.go +++ /dev/null @@ -1,150 +0,0 @@ -package supplier - -import ( - "context" - "encoding/json" - "fmt" - - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "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/pokt-network/poktroll/x/supplier/client/cli" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/supplier/module_simulation.go b/x/supplier/module_simulation.go deleted file mode 100644 index eb30e7dd3..000000000 --- a/x/supplier/module_simulation.go +++ /dev/null @@ -1,157 +0,0 @@ -package supplier - -import ( - "math/rand" - - "github.com/pokt-network/poktroll/testutil/sample" - suppliersimulation "github.com/pokt-network/poktroll/x/supplier/simulation" - "github.com/pokt-network/poktroll/x/supplier/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = suppliersimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgStakeSupplier = "op_weight_msg_stake_supplier" - // TODO: Determine the simulation weight value - defaultWeightMsgStakeSupplier int = 100 - - opWeightMsgUnstakeSupplier = "op_weight_msg_unstake_supplier" - // TODO: Determine the simulation weight value - defaultWeightMsgUnstakeSupplier int = 100 - - opWeightMsgCreateClaim = "op_weight_msg_create_claim" - // TODO: Determine the simulation weight value - defaultWeightMsgCreateClaim int = 100 - - opWeightMsgSubmitProof = "op_weight_msg_submit_proof" - // TODO: Determine the simulation weight value - defaultWeightMsgSubmitProof int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - supplierGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&supplierGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgStakeSupplier int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgStakeSupplier, &weightMsgStakeSupplier, nil, - func(_ *rand.Rand) { - weightMsgStakeSupplier = defaultWeightMsgStakeSupplier - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgStakeSupplier, - suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUnstakeSupplier int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnstakeSupplier, &weightMsgUnstakeSupplier, nil, - func(_ *rand.Rand) { - weightMsgUnstakeSupplier = defaultWeightMsgUnstakeSupplier - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUnstakeSupplier, - suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgCreateClaim int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgCreateClaim, &weightMsgCreateClaim, nil, - func(_ *rand.Rand) { - weightMsgCreateClaim = defaultWeightMsgCreateClaim - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgCreateClaim, - suppliersimulation.SimulateMsgCreateClaim(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgSubmitProof int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgSubmitProof, &weightMsgSubmitProof, nil, - func(_ *rand.Rand) { - weightMsgSubmitProof = defaultWeightMsgSubmitProof - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgSubmitProof, - suppliersimulation.SimulateMsgSubmitProof(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgStakeSupplier, - defaultWeightMsgStakeSupplier, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUnstakeSupplier, - defaultWeightMsgUnstakeSupplier, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgCreateClaim, - defaultWeightMsgCreateClaim, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgCreateClaim(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgSubmitProof, - defaultWeightMsgSubmitProof, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgSubmitProof(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/supplier/simulation/create_claim.go b/x/supplier/simulation/create_claim.go deleted file mode 100644 index cae471c06..000000000 --- a/x/supplier/simulation/create_claim.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgCreateClaim( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgCreateClaim{ - SupplierAddress: simAccount.Address.String(), - } - - // TODO: Handling the CreateClaim simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "CreateClaim simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/simulation/helpers.go b/x/supplier/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/supplier/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/supplier/simulation/stake_supplier.go b/x/supplier/simulation/stake_supplier.go deleted file mode 100644 index 95fb7e8d6..000000000 --- a/x/supplier/simulation/stake_supplier.go +++ /dev/null @@ -1,31 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgStakeSupplier( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - stakeMsg := &types.MsgStakeSupplier{ - Address: simAccount.Address.String(), - // TODO: Update all stake message fields - } - - // TODO: Handling the StakeSupplier simulation - - return simtypes.NoOpMsg(types.ModuleName, stakeMsg.Type(), "StakeSupplier simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/simulation/submit_proof.go b/x/supplier/simulation/submit_proof.go deleted file mode 100644 index 3473f1c7b..000000000 --- a/x/supplier/simulation/submit_proof.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgSubmitProof( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgSubmitProof{ - SupplierAddress: simAccount.Address.String(), - } - - // TODO: Handling the SubmitProof simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "SubmitProof simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/simulation/unstake_supplier.go b/x/supplier/simulation/unstake_supplier.go deleted file mode 100644 index 3955b25db..000000000 --- a/x/supplier/simulation/unstake_supplier.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" -) - -func SimulateMsgUnstakeSupplier( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUnstakeSupplier{ - Address: simAccount.Address.String(), - } - - // TODO: Handling the UnstakeSupplier simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnstakeSupplier simulation not implemented"), nil, nil - } -} diff --git a/x/supplier/types/codec.go b/x/supplier/types/codec.go deleted file mode 100644 index 5dc59bf31..000000000 --- a/x/supplier/types/codec.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - "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/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgStakeSupplier{}, "supplier/StakeSupplier", nil) - cdc.RegisterConcrete(&MsgUnstakeSupplier{}, "supplier/UnstakeSupplier", nil) - cdc.RegisterConcrete(&MsgCreateClaim{}, "supplier/CreateClaim", nil) - cdc.RegisterConcrete(&MsgSubmitProof{}, "supplier/SubmitProof", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgStakeSupplier{}, - &MsgUnstakeSupplier{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateClaim{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgSubmitProof{}, - ) - // this line is used by starport scaffolding # 3 - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go deleted file mode 100644 index 61a56f566..000000000 --- a/x/supplier/types/errors.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/supplier module sentinel errors -var ( - ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") - ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") - ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") - ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") - ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") - ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") - ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") - ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") - ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") - ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") - ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") - ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") - ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") - ErrSupplierInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") - ErrSupplierInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") -) diff --git a/x/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go deleted file mode 100644 index f6f8b626c..000000000 --- a/x/supplier/types/expected_keepers.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/supplier/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,SessionKeeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} - -type SessionKeeper interface { - GetSession(context.Context, *sessiontypes.QueryGetSessionRequest) (*sessiontypes.QueryGetSessionResponse, error) -} diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go deleted file mode 100644 index 9d06b42ff..000000000 --- a/x/supplier/types/genesis.go +++ /dev/null @@ -1,67 +0,0 @@ -package types - -import ( - "fmt" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - SupplierList: []sharedtypes.Supplier{}, - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // Check for duplicated index in supplier - supplierIndexMap := make(map[string]struct{}) - for _, supplier := range gs.SupplierList { - index := string(SupplierKey(supplier.Address)) - if _, ok := supplierIndexMap[index]; ok { - return fmt.Errorf("duplicated index for supplier") - } - supplierIndexMap[index] = struct{}{} - } - - // Check that the stake value for the suppliers is valid - for _, supplier := range gs.SupplierList { - // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, - // similar to how we have `ValidateAppServiceConfigs` below - if supplier.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") - } - stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) - } - - // Validate the application service configs - if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) - } - } - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go deleted file mode 100644 index 5895fd717..000000000 --- a/x/supplier/types/genesis_test.go +++ /dev/null @@ -1,312 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdk.NewInt(100)) - serviceConfig1 := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - } - serviceList1 := []*sharedtypes.SupplierServiceConfig{serviceConfig1} - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdk.NewInt(100)) - serviceConfig2 := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - } - serviceList2 := []*sharedtypes.SupplierServiceConfig{serviceConfig2} - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: serviceList2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - zero supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to duplicated supplier address", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr1, - Stake: &stake2, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to nil supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: nil, - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to missing supplier stake", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - // Explicitly missing stake - Services: serviceList2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing services list", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - // Services: intentionally omitted - }, - }, - }, - valid: false, - }, - { - desc: "invalid - empty services list", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - invalid URL", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "invalid URL", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - invalid RPC Type", - genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ - { - Address: addr1, - Stake: &stake1, - Services: serviceList1, - }, - { - Address: addr2, - Stake: &stake2, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_UNKNOWN_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/supplier/types/key_claim.go b/x/supplier/types/key_claim.go deleted file mode 100644 index e570a2341..000000000 --- a/x/supplier/types/key_claim.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - "encoding/binary" -) - -var _ binary.ByteOrder - -const ( - - // ClaimPrimaryKeyPrefix is the prefix to retrieve the entire Claim object (the primary store) - ClaimPrimaryKeyPrefix = "Claim/value/" - - // ClaimSupplierAddressPrefix is the key to retrieve a Claim's Primary Key from the Address index - ClaimSupplierAddressPrefix = "Claim/address/" - - // ClaimSessionEndHeightPrefix is the key to retrieve a Claim's Primary Key from the Height index - ClaimSessionEndHeightPrefix = "Claim/height/" -) - -// ClaimPrimaryKey returns the primary store key used to retrieve a Claim by creating a composite key of the sessionId and supplierAddr. -func ClaimPrimaryKey(sessionId, supplierAddr string) []byte { - // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr) - // because every supplier can only have one claim per session. - return KeyComposite([]byte(sessionId), []byte(supplierAddr)) -} - -// ClaimSupplierAddressKey returns the key used to iterate through claims given a supplier Address. -func ClaimSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { - return KeyComposite([]byte(supplierAddr), primaryKey) -} - -// ClaimSupplierEndSessionHeightKey returns the key used to iterate through claims given a session end height. -func ClaimSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) - - return KeyComposite(heightBz, primaryKey) -} diff --git a/x/supplier/types/key_proof.go b/x/supplier/types/key_proof.go deleted file mode 100644 index f74bb7fa9..000000000 --- a/x/supplier/types/key_proof.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // ProofPrimaryKeyPrefix is the prefix to retrieve the entire Proof object (the primary store) - ProofPrimaryKeyPrefix = "Proof/value/" - - // ProofSupplierAddressPrefix is the key to retrieve a Proof's Primary Key from the Address index - ProofSupplierAddressPrefix = "Proof/address/" - - // ProofSessionEndHeightPrefix is the key to retrieve a Proof's Primary Key from the Height index - ProofSessionEndHeightPrefix = "Proof/height/" -) - -// ProofPrimaryKey returns the primary store key used to retrieve a Proof by creating a composite key of the sessionId and supplierAddr. -func ProofPrimaryKey(sessionId, supplierAddr string) []byte { - // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr). - // because every supplier can only have one Proof per session. - return KeyComposite([]byte(sessionId), []byte(supplierAddr)) -} - -// ProofSupplierAddressKey returns the key used to iterate through Proofs given a supplier Address. -func ProofSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { - return KeyComposite([]byte(supplierAddr), primaryKey) -} - -// ProofSupplierEndSessionHeightKey returns the key used to iterate through Proofs given a session end height. -func ProofSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { - heightBz := make([]byte, 8) - binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) - - return KeyComposite(heightBz, primaryKey) -} diff --git a/x/supplier/types/key_supplier.go b/x/supplier/types/key_supplier.go deleted file mode 100644 index 20f28a5c1..000000000 --- a/x/supplier/types/key_supplier.go +++ /dev/null @@ -1,23 +0,0 @@ -package types - -import "encoding/binary" - -var _ binary.ByteOrder - -const ( - // SupplierKeyPrefix is the prefix to retrieve all Supplier - SupplierKeyPrefix = "Supplier/value/" -) - -// SupplierKey returns the store key to retrieve a Supplier from the index fields -func SupplierKey( - address string, -) []byte { - var key []byte - - addressBytes := []byte(address) - key = append(key, addressBytes...) - key = append(key, []byte("/")...) - - return key -} diff --git a/x/supplier/types/keys.go b/x/supplier/types/keys.go deleted file mode 100644 index 138fd0f19..000000000 --- a/x/supplier/types/keys.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - "bytes" -) - -const ( - // ModuleName defines the module name - ModuleName = "supplier" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_supplier" -) - -// KeyDelimiter is the delimiter for composite keys. -var KeyDelimiter = []byte("/") - -// KeyPrefix returns the given prefix as a byte slice for use with the KVStore. -func KeyPrefix(prefix string) []byte { - return []byte(prefix) -} - -// KeyComposite combines the given keys into a single key for use with KVStore. -func KeyComposite(keys ...[]byte) []byte { - return bytes.Join(keys, KeyDelimiter) -} diff --git a/x/supplier/types/message_create_claim.go b/x/supplier/types/message_create_claim.go deleted file mode 100644 index 84d2a4b3a..000000000 --- a/x/supplier/types/message_create_claim.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" -) - -const TypeMsgCreateClaim = "create_claim" - -var _ sdk.Msg = (*MsgCreateClaim)(nil) - -func NewMsgCreateClaim( - supplierAddress string, - sessionHeader *sessiontypes.SessionHeader, - rootHash []byte, -) *MsgCreateClaim { - return &MsgCreateClaim{ - SupplierAddress: supplierAddress, - SessionHeader: sessionHeader, - RootHash: rootHash, - } -} - -func (msg *MsgCreateClaim) Route() string { - return RouterKey -} - -func (msg *MsgCreateClaim) Type() string { - return TypeMsgCreateClaim -} - -func (msg *MsgCreateClaim) GetSigners() []sdk.AccAddress { - supplierAddress, err := sdk.AccAddressFromBech32(msg.SupplierAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{supplierAddress} -} - -func (msg *MsgCreateClaim) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgCreateClaim) ValidateBasic() error { - // Validate the supplier address - _, err := sdk.AccAddressFromBech32(msg.GetSupplierAddress()) - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "%s", msg.GetSupplierAddress()) - } - - // Validate the session header - sessionHeader := msg.SessionHeader - if sessionHeader.SessionStartBlockHeight < 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidSessionStartHeight, "%d", sessionHeader.SessionStartBlockHeight) - } - if len(sessionHeader.SessionId) == 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidSessionId, "%s", sessionHeader.SessionId) - } - if !sharedhelpers.IsValidService(sessionHeader.Service) { - return sdkerrors.Wrapf(ErrSupplierInvalidService, "%v", sessionHeader.Service) - } - - // Validate the root hash - // TODO_IMPROVE: Only checking to make sure a non-nil hash was provided for now, but we can validate the length as well. - if len(msg.RootHash) == 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidClaimRootHash, "%v", msg.RootHash) - } - - return nil -} diff --git a/x/supplier/types/message_create_claim_test.go b/x/supplier/types/message_create_claim_test.go deleted file mode 100644 index 65a32726c..000000000 --- a/x/supplier/types/message_create_claim_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgCreateClaim_ValidateBasic(t *testing.T) { - tests := []struct { - desc string - - msg MsgCreateClaim - err error - }{ - { - desc: "invalid address", - - msg: MsgCreateClaim{ - SupplierAddress: "invalid_address", - }, - err: ErrSupplierInvalidAddress, - }, - { - desc: "valid address but invalid session start height", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: -1, // Invalid start height - }, - }, - err: ErrSupplierInvalidSessionStartHeight, - }, - { - desc: "valid address and session start height but invalid session ID", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "", // Invalid session ID - }, - }, - err: ErrSupplierInvalidSessionId, - }, - { - desc: "valid address, session start height, session ID but invalid service", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "valid_session_id", - Service: &sharedtypes.Service{ - Id: "invalid_service_id", // Assuming this ID is invalid - }, // Should trigger error - }, - }, - err: ErrSupplierInvalidService, - }, - { - desc: "valid address, session start height, session ID, service but invalid root hash", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "valid_session_id", - Service: &sharedtypes.Service{ - Id: "svcId", // Assuming this ID is valid - }, - }, - RootHash: []byte(""), // Invalid root hash - }, - err: ErrSupplierInvalidClaimRootHash, - }, - { - desc: "all valid inputs", - - msg: MsgCreateClaim{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: 100, - SessionId: "valid_session_id", - Service: &sharedtypes.Service{ - Id: "svcId", // Assuming this ID is valid - }, - }, - RootHash: []byte("valid_root_hash"), // Assuming this is valid - }, - err: nil, - }, - } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - } else { - require.NoError(t, err) - } - }) - } -} diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go deleted file mode 100644 index 7d1dbde07..000000000 --- a/x/supplier/types/message_stake_supplier.go +++ /dev/null @@ -1,81 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - - servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const TypeMsgStakeSupplier = "stake_supplier" - -var _ sdk.Msg = (*MsgStakeSupplier)(nil) - -func NewMsgStakeSupplier( - address string, - stake types.Coin, - services []*sharedtypes.SupplierServiceConfig, -) *MsgStakeSupplier { - return &MsgStakeSupplier{ - Address: address, - Stake: &stake, - Services: services, - } -} - -func (msg *MsgStakeSupplier) Route() string { - return RouterKey -} - -func (msg *MsgStakeSupplier) Type() string { - return TypeMsgStakeSupplier -} - -func (msg *MsgStakeSupplier) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgStakeSupplier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgStakeSupplier) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid supplier address %s; (%v)", msg.Address, err) - } - - // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code - // Validate the stake amount - if msg.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil supplier stake; (%v)", err) - } - stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) - if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid supplier stake %v; (%v)", msg.Stake, stake.Validate()) - } - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse supplier stake %v; (%v)", msg.Stake, err) - } - if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", msg.Stake) - } - if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", msg.Stake) - } - - // Validate the supplier service configs - if err := servicehelpers.ValidateSupplierServiceConfigs(msg.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) - } - - return nil -} diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go deleted file mode 100644 index 158fd8ff3..000000000 --- a/x/supplier/types/message_stake_supplier_test.go +++ /dev/null @@ -1,299 +0,0 @@ -package types - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO_CLEANUP: This test has a lot of copy-pasted code from test to test. -// It can be simplified by splitting it into smaller tests where the common -// fields don't need to be explicitly specified from test to test. -func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { - - defaultServicesList := []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }} - - tests := []struct { - name string - msg MsgStakeSupplier - err error - }{ - // address related tests - { - name: "invalid address - nil stake", - msg: MsgStakeSupplier{ - Address: "invalid_address", - // Stake explicitly nil - Services: defaultServicesList, - }, - err: ErrSupplierInvalidAddress, - }, - - // stake related tests - { - name: "valid address - nil stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - // Stake explicitly nil - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - valid stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - }, { - name: "valid address - zero stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(0)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - negative stake", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(-100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - invalid stake denom", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, { - name: "valid address - invalid stake missing denom", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdk.NewInt(100)}, - Services: defaultServicesList, - }, - err: ErrSupplierInvalidStake, - }, - - // service related tests - { - name: "valid service configs - multiple services", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId1", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8081", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - { - Service: &sharedtypes.Service{ - Id: "svcId2", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8082", - RpcType: sharedtypes.RPCType_GRPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - }, - { - name: "invalid service configs - omitted", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - // Services: intentionally omitted - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - empty", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{}, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service ID that's too long", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "123456790", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service Name that's too long", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid service ID that contains invalid characters", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "12 45 !", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - missing url", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - // Url: intentionally omitted - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - invalid url", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "I am not a valid URL", - RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - { - name: "invalid service configs - missing rpc type", - msg: MsgStakeSupplier{ - Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - Services: []*sharedtypes.SupplierServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svcId", - Name: "name", - }, - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://localhost:8080", - // RpcType: intentionally omitted, - Configs: make([]*sharedtypes.ConfigOption, 0), - }, - }, - }, - }, - }, - err: ErrSupplierInvalidServiceConfig, - }, - // TODO_TEST: Need to add more tests around config types - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/supplier/types/message_submit_proof.go b/x/supplier/types/message_submit_proof.go deleted file mode 100644 index 144872e05..000000000 --- a/x/supplier/types/message_submit_proof.go +++ /dev/null @@ -1,77 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -const TypeMsgSubmitProof = "submit_proof" - -var _ sdk.Msg = (*MsgSubmitProof)(nil) - -func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.SessionHeader, proof []byte) *MsgSubmitProof { - return &MsgSubmitProof{ - SupplierAddress: supplierAddress, - SessionHeader: sessionHeader, - Proof: proof, - } -} - -func (msg *MsgSubmitProof) Route() string { - return RouterKey -} - -func (msg *MsgSubmitProof) Type() string { - return TypeMsgSubmitProof -} - -func (msg *MsgSubmitProof) GetSigners() []sdk.AccAddress { - supplierAddress, err := sdk.AccAddressFromBech32(msg.SupplierAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{supplierAddress} -} - -func (msg *MsgSubmitProof) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -// ValidateBasic ensures that the bech32 address strings for the supplier and -// application addresses are valid and that the proof and service ID are not empty. -// -// TODO_TECHDEBT: Call `msg.GetSessionHeader().ValidateBasic()` once its implemented -func (msg *MsgSubmitProof) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.GetSupplierAddress()) - if err != nil { - return sdkerrors.ErrInvalidAddress.Wrapf( - "supplier address %q, error: %s", - msg.GetSupplierAddress(), - err, - ) - } - - _, err = sdk.AccAddressFromBech32(msg.GetSessionHeader().GetApplicationAddress()) - if err != nil { - return sdkerrors.ErrInvalidAddress.Wrapf( - "application address: %q, error: %s", - msg.GetSessionHeader().GetApplicationAddress(), - err, - ) - } - - if msg.GetSessionHeader().GetService().GetId() == "" { - return ErrSupplierInvalidService.Wrap("proof service ID %q cannot be empty") - } - - if len(msg.GetProof()) == 0 { - return ErrSupplierInvalidProof.Wrap("proof cannot be empty") - } - - // TODO_BLOCKER: attempt to deserialize the proof for additional validation. - - return nil -} diff --git a/x/supplier/types/message_submit_proof_test.go b/x/supplier/types/message_submit_proof_test.go deleted file mode 100644 index e7e2cbba6..000000000 --- a/x/supplier/types/message_submit_proof_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package types - -import ( - "testing" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -func TestMsgSubmitProof_ValidateBasic(t *testing.T) { - testService := &sharedtypes.Service{Id: "svc01"} - testClosestMerkleProof := []byte{1, 2, 3, 4} - - tests := []struct { - desc string - msg MsgSubmitProof - expectedErr error - }{ - { - desc: "application bech32 address is invalid", - msg: MsgSubmitProof{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: "not_a_bech32_address", - Service: testService, - SessionStartBlockHeight: 0, - SessionId: "mock_session_id", - SessionEndBlockHeight: 5, - }, - Proof: testClosestMerkleProof, - }, - expectedErr: sdkerrors.ErrInvalidAddress.Wrapf( - "application address: %q, error: %s", - "not_a_bech32_address", - "decoding bech32 failed: invalid separator index -1", - ), - }, - { - desc: "supplier bech32 address is invalid", - msg: MsgSubmitProof{ - SupplierAddress: "not_a_bech32_address", - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - Service: testService, - SessionStartBlockHeight: 0, - SessionId: "mock_session_id", - SessionEndBlockHeight: 5, - }, - Proof: testClosestMerkleProof, - }, - expectedErr: sdkerrors.ErrInvalidAddress.Wrapf( - "supplier address %q, error: %s", - "not_a_bech32_address", - "decoding bech32 failed: invalid separator index -1", - ), - }, - { - desc: "session service ID is empty", - msg: MsgSubmitProof{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - Service: &sharedtypes.Service{Id: ""}, - SessionStartBlockHeight: 0, - SessionId: "mock_session_id", - SessionEndBlockHeight: 5, - }, - Proof: testClosestMerkleProof, - }, - expectedErr: ErrSupplierInvalidService.Wrap("proof service ID %q cannot be empty"), - }, - { - desc: "valid message metadata", - msg: MsgSubmitProof{ - SupplierAddress: sample.AccAddress(), - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: sample.AccAddress(), - Service: testService, - SessionId: "mock_session_id", - SessionStartBlockHeight: 0, - SessionEndBlockHeight: 5, - }, - Proof: testClosestMerkleProof, - }, - }, - } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - require.ErrorContains(t, err, tt.expectedErr.Error()) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go deleted file mode 100644 index 884c21c36..000000000 --- a/x/supplier/types/message_unstake_supplier.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUnstakeSupplier = "unstake_supplier" - -var _ sdk.Msg = (*MsgUnstakeSupplier)(nil) - -func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { - return &MsgUnstakeSupplier{ - Address: address, - } -} - -func (msg *MsgUnstakeSupplier) Route() string { - return RouterKey -} - -func (msg *MsgUnstakeSupplier) Type() string { - return TypeMsgUnstakeSupplier -} - -func (msg *MsgUnstakeSupplier) GetSigners() []sdk.AccAddress { - address, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{address} -} - -func (msg *MsgUnstakeSupplier) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUnstakeSupplier) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid address address (%s)", err) - } - return nil -} diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go deleted file mode 100644 index b447397ed..000000000 --- a/x/supplier/types/message_unstake_supplier_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" -) - -func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgUnstakeSupplier - err error - }{ - { - name: "invalid address", - msg: MsgUnstakeSupplier{ - Address: "invalid_address", - }, - err: ErrSupplierInvalidAddress, - }, { - name: "missing address", - msg: MsgUnstakeSupplier{}, - err: ErrSupplierInvalidAddress, - }, { - name: "valid address", - msg: MsgUnstakeSupplier{ - Address: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/supplier/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/supplier/types/query_validation.go b/x/supplier/types/query_validation.go deleted file mode 100644 index 7111bc950..000000000 --- a/x/supplier/types/query_validation.go +++ /dev/null @@ -1,94 +0,0 @@ -package types - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// NOTE: Please note that these messages are not of type `sdk.Msg`, and are therefore not a message/request -// that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern -// allows us to localize & reuse validation logic. - -// ValidateBasic performs basic (non-state-dependant) validation on a QueryGetClaimRequest. -func (query *QueryGetClaimRequest) ValidateBasic() error { - // Validate the supplier address - if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for claim being retrieved %s; (%v)", query.SupplierAddress, err) - } - - // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it - if query.SessionId == "" { - return ErrSupplierInvalidSessionId.Wrapf("invalid session ID for claim being retrieved %s", query.SessionId) - } - - return nil -} - -// ValidateBasic performs basic (non-state-dependant) validation on a QueryAllClaimsRequest. -func (query *QueryAllClaimsRequest) ValidateBasic() error { - logger := polylog.Ctx(context.Background()) - - switch filter := query.Filter.(type) { - case *QueryAllClaimsRequest_SupplierAddress: - if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for claims being retrieved %s; (%v)", filter.SupplierAddress, err) - } - - case *QueryAllClaimsRequest_SessionId: - logger.Warn(). - Str("session_id", filter.SessionId). - Msg("TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it") - - case *QueryAllClaimsRequest_SessionEndHeight: - if filter.SessionEndHeight < 0 { - return ErrSupplierInvalidSessionEndHeight.Wrapf("invalid session end height for claims being retrieved %d", filter.SessionEndHeight) - } - } - - return nil -} - -func (query *QueryGetProofRequest) ValidateBasic() error { - // Validate the supplier address - if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for proof being retrieved %s; (%v)", query.SupplierAddress, err) - } - - // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it - if query.SessionId == "" { - return ErrSupplierInvalidSessionId.Wrapf("invalid session ID for proof being retrieved %s", query.SessionId) - } - - return nil -} - -func (query *QueryAllProofsRequest) ValidateBasic() error { - // TODO_TECHDEBT: update function signature to receive a context. - logger := polylog.Ctx(context.TODO()) - - switch filter := query.Filter.(type) { - case *QueryAllProofsRequest_SupplierAddress: - if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for proofs being retrieved %s; (%v)", filter.SupplierAddress, err) - } - - case *QueryAllProofsRequest_SessionId: - logger.Warn(). - Str("session_id", filter.SessionId). - Msg("TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it") - - case *QueryAllProofsRequest_SessionEndHeight: - if filter.SessionEndHeight < 0 { - return ErrSupplierInvalidSessionEndHeight.Wrapf("invalid session end height for proofs being retrieved %d", filter.SessionEndHeight) - } - - default: - // No filter is set - logger.Debug().Msg("No specific filter set when requesting proofs") - } - - return nil -} diff --git a/x/supplier/types/types.go b/x/supplier/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/supplier/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/tokenomics/client/cli/helpers_test.go b/x/tokenomics/client/cli/helpers_test.go deleted file mode 100644 index bbcee251e..000000000 --- a/x/tokenomics/client/cli/helpers_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Package cli_test provides unit tests for the CLI functionality. -package cli_test - -import ( - "strconv" - "testing" - - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -// Dummy variable to avoid unused import error. -var _ = strconv.IntSize - -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - -// networkWithDefaultConfig is a helper function to create a network for testing -// with a default tokenomics genesis state. -func networkWithDefaultConfig(t *testing.T) *network.Network { - t.Helper() - cfg := network.DefaultConfig() - tokenomicsGenesisState := network.DefaultTokenomicsModuleGenesisState(t) - buf, err := cfg.Codec.MarshalJSON(tokenomicsGenesisState) - require.NoError(t, err) - cfg.GenesisState[types.ModuleName] = buf - return network.New(t, cfg) -} diff --git a/x/tokenomics/client/cli/query.go b/x/tokenomics/client/cli/query.go deleted file mode 100644 index c11674331..000000000 --- a/x/tokenomics/client/cli/query.go +++ /dev/null @@ -1,31 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group tokenomics queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/tokenomics/client/cli/query_params.go b/x/tokenomics/client/cli/query_params.go deleted file mode 100644 index 16c3b3a8b..000000000 --- a/x/tokenomics/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/tokenomics/client/cli/tx.go b/x/tokenomics/client/cli/tx.go deleted file mode 100644 index 4aa62f068..000000000 --- a/x/tokenomics/client/cli/tx.go +++ /dev/null @@ -1,37 +0,0 @@ -package cli - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdUpdateParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} diff --git a/x/tokenomics/client/cli/tx_update_params.go b/x/tokenomics/client/cli/tx_update_params.go deleted file mode 100644 index a2b79a63b..000000000 --- a/x/tokenomics/client/cli/tx_update_params.go +++ /dev/null @@ -1,59 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var _ = strconv.Itoa(0) - -// TODO_BLOCKER(#322): Update the CLI once we determine settle on how to maintain and update parameters. -// TODO_TECHDEBT(@red-0ne): Add a config file for on-chain parameters. -func CmdUpdateParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-params ", - Short: "Update the parameters of the tokenomics module", - Long: `Update the parameters in the tokenomics module.", - -All parameters must be provided when updating. - -Example: -$ poktrolld tx tokenomics update-params --from pnf --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - // Parse computeUnitsToTokensMultiplier - computeUnitsToTokensMultiplier, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - // Get client context - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Create update params message - msg := types.NewMsgUpdateParams( - clientCtx.GetFromAddress().String(), - computeUnitsToTokensMultiplier, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - - res := tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - return res - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/tokenomics/client/cli/tx_update_params_test.go b/x/tokenomics/client/cli/tx_update_params_test.go deleted file mode 100644 index fdb7b7334..000000000 --- a/x/tokenomics/client/cli/tx_update_params_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/status" - "github.com/pokt-network/poktroll/testutil/network" - "github.com/pokt-network/poktroll/x/tokenomics/client/cli" - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -func TestCLI_UpdateParams(t *testing.T) { - net := networkWithDefaultConfig(t) - ctx := net.Validators[0].ClientCtx - - common := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - fmt.Sprintf("--%s=%s", flags.FlagFrom, net.Validators[0].Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, network.NewBondDenomCoins(t, net, 10)), - } - - tests := []struct { - desc string - args []string - expectedErr error - expectedExtraErrMsg string - }{ - { - desc: "valid update of all params", - args: []string{"42"}, - expectedErr: nil, - }, - { - desc: "invalid compute_units_to_tokens_multiplier update", - args: []string{"0"}, - expectedErr: types.ErrTokenomicsParamsInvalid, - expectedExtraErrMsg: "invalid ComputeUnitsToTokensMultiplier", - }, - } - - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := append(common, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdateParams(), args) - if tc.expectedErr != nil { - _, ok := status.FromError(tc.expectedErr) - require.True(t, ok) - require.ErrorIs(t, err, tc.expectedErr) - require.Contains(t, err.Error(), tc.expectedExtraErrMsg) - } else { - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp) - require.NotNil(t, resp.TxHash) - require.Equal(t, uint32(0), resp.Code) - } - }) - } -} diff --git a/x/tokenomics/genesis.go b/x/tokenomics/genesis.go deleted file mode 100644 index 6197d5960..000000000 --- a/x/tokenomics/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package tokenomics - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/tokenomics/genesis_test.go b/x/tokenomics/genesis_test.go deleted file mode 100644 index 65fbee07f..000000000 --- a/x/tokenomics/genesis_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package tokenomics_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/tokenomics" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx, _, _ := keepertest.TokenomicsKeeper(t) - tokenomics.InitGenesis(ctx, *k, genesisState) - got := tokenomics.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/tokenomics/keeper/keeper.go b/x/tokenomics/keeper/keeper.go deleted file mode 100644 index c07cbe767..000000000 --- a/x/tokenomics/keeper/keeper.go +++ /dev/null @@ -1,75 +0,0 @@ -package keeper - -import ( - "fmt" - - "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" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// Keeper is the structure that implements the `KeeperI` interface. - -// TODO_TECHDEBT(#240): See `x/nft/keeper.keeper.go` in the Cosmos SDK on how -// we should refactor all our keepers. This keeper has started following a small -// subset of those patterns. -type Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - - // keeper dependencies - appKeeper types.ApplicationKeeper - supplierKeeper types.SupplierKeeper - bankKeeper types.BankKeeper - - // the address capable of executing a MsgUpdateParams message. Typically, this - // should be the x/gov module account. - authority string -} - -func NewKeeper( - cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - - // keeper dependencies - bankKeeper types.BankKeeper, - appKeeper types.ApplicationKeeper, - supplierKeeper types.SupplierKeeper, - - authority string, -) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - - bankKeeper: bankKeeper, - appKeeper: appKeeper, - supplierKeeper: supplierKeeper, - - authority: authority, - } -} - -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} - -// GetAuthority returns the x/tokenomics module's authority. -func (k Keeper) GetAuthority() string { - return k.authority -} diff --git a/x/tokenomics/keeper/msg_server.go b/x/tokenomics/keeper/msg_server.go deleted file mode 100644 index ab7353c82..000000000 --- a/x/tokenomics/keeper/msg_server.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of the MsgServer interface -// for the provided Keeper. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -var _ types.MsgServer = msgServer{} diff --git a/x/tokenomics/keeper/msg_server_test.go b/x/tokenomics/keeper/msg_server_test.go deleted file mode 100644 index 189647006..000000000 --- a/x/tokenomics/keeper/msg_server_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package keeper_test - -import ( - "context" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) - return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) -} - -func TestMsgServer(t *testing.T) { - ms, ctx := setupMsgServer(t) - require.NotNil(t, ms) - require.NotNil(t, ctx) -} diff --git a/x/tokenomics/keeper/msg_server_update_params.go b/x/tokenomics/keeper/msg_server_update_params.go deleted file mode 100644 index c37b380c0..000000000 --- a/x/tokenomics/keeper/msg_server_update_params.go +++ /dev/null @@ -1,53 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx) - - if err := msg.ValidateBasic(); err != nil { - return nil, err - } - - // TODO_BLOCKER(@Olshansk): How do we validate this is the same address that signed the request? - // Do we have to use `msg.GetSigners()` explicitly during the check/validation or - // does the `cosmos.msg.v1.signer` tag in the protobuf definition enforce - // this somewhere in the Cosmos SDK? - if msg.Authority != k.GetAuthority() { - return nil, types.ErrTokenomicsAuthorityAddressMismatch - } - - prevParams := k.GetParams(ctx) - logger.Info("About to update params from [%v] to [%v]", prevParams, msg.Params) - k.SetParams(ctx, msg.Params) - logger.Info("Done updating params") - - return &types.MsgUpdateParamsResponse{}, nil -} - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.ComputeUnitsToTokensMultiplier(ctx), - ) -} - -// SetParams set the params -// TODO_IMPROVE: We are following a pattern from `Cosmos v0.50` that does not -// return errors. Opportunity to investigate better approaches. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} - -// ComputeUnitsToTokensMultiplier returns the ComputeUnitsToTokensMultiplier param -func (k Keeper) ComputeUnitsToTokensMultiplier(ctx sdk.Context) (param uint64) { - k.paramstore.Get(ctx, types.KeyComputeUnitsToTokensMultiplier, ¶m) - return -} diff --git a/x/tokenomics/keeper/msg_server_update_params_test.go b/x/tokenomics/keeper/msg_server_update_params_test.go deleted file mode 100644 index 3e601a49e..000000000 --- a/x/tokenomics/keeper/msg_server_update_params_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -func TestUpdateParams_Validity(t *testing.T) { - tokenomicsKeeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) - srv := keeper.NewMsgServerImpl(*tokenomicsKeeper) - - params := types.DefaultParams() - tokenomicsKeeper.SetParams(ctx, params) - - tests := []struct { - desc string - - req *types.MsgUpdateParams - - expectErr bool - expectedPanic bool - expErrMsg string - }{ - { - desc: "invalid authority address", - - req: &types.MsgUpdateParams{ - Authority: "invalid", - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - - expectErr: true, - expectedPanic: false, - expErrMsg: "invalid authority", - }, - { - desc: "incorrect authority address", - - req: &types.MsgUpdateParams{ - Authority: sample.AccAddress(), - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - - expectErr: true, - expectedPanic: false, - expErrMsg: "the provided authority address does not match the on-chain governance address", - }, - { - desc: "invalid ComputeUnitsToTokensMultiplier", - - req: &types.MsgUpdateParams{ - Authority: tokenomicsKeeper.GetAuthority(), - - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 0, - }, - }, - - expectErr: true, - expectedPanic: true, - expErrMsg: "invalid compute to tokens multiplier", - }, - { - desc: "successful param update", - - req: &types.MsgUpdateParams{ - Authority: tokenomicsKeeper.GetAuthority(), - - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1000000, - }, - }, - - expectedPanic: false, - expectErr: false, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - if tt.expectedPanic { - defer func() { - if r := recover(); r != nil { - _, err := srv.UpdateParams(ctx, tt.req) - require.Error(t, err) - } - }() - return - } - _, err := srv.UpdateParams(ctx, tt.req) - if tt.expectErr { - require.Error(t, err) - require.ErrorContains(t, err, tt.expErrMsg) - } else { - require.Nil(t, err) - } - }) - } -} - -func TestUpdateParams_ComputeUnitsToTokensMultiplier(t *testing.T) { - tokenomicsKeeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) - srv := keeper.NewMsgServerImpl(*tokenomicsKeeper) - - // Set the default params - tokenomicsKeeper.SetParams(ctx, types.DefaultParams()) - - // Verify the default value for ComputeUnitsToTokensMultiplier - getParamsReq := &types.QueryParamsRequest{} - getParamsRes, err := tokenomicsKeeper.Params(ctx, getParamsReq) - require.Nil(t, err) - require.Equal(t, uint64(42), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) - - // Update the value for ComputeUnitsToTokensMultiplier - updateParamsReq := &types.MsgUpdateParams{ - Authority: tokenomicsKeeper.GetAuthority(), - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 69, - }, - } - _, err = srv.UpdateParams(ctx, updateParamsReq) - require.Nil(t, err) - - // Verify that ComputeUnitsToTokensMultiplier was updated - getParamsRes, err = tokenomicsKeeper.Params(ctx, getParamsReq) - require.Nil(t, err) - require.Equal(t, uint64(69), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) -} diff --git a/x/tokenomics/keeper/query.go b/x/tokenomics/keeper/query.go deleted file mode 100644 index bb812a52f..000000000 --- a/x/tokenomics/keeper/query.go +++ /dev/null @@ -1,7 +0,0 @@ -package keeper - -import ( - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var _ types.QueryServer = Keeper{} diff --git a/x/tokenomics/keeper/query_params.go b/x/tokenomics/keeper/query_params.go deleted file mode 100644 index f8a4d0dc4..000000000 --- a/x/tokenomics/keeper/query_params.go +++ /dev/null @@ -1,20 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/tokenomics/keeper/query_params_test.go b/x/tokenomics/keeper/query_params_test.go deleted file mode 100644 index 456647091..000000000 --- a/x/tokenomics/keeper/query_params_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - testkeeper "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -func TestGetParams(t *testing.T) { - k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) - require.EqualValues(t, params.ComputeUnitsToTokensMultiplier, k.ComputeUnitsToTokensMultiplier(ctx)) -} - -func TestParamsQuery(t *testing.T) { - keeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/tokenomics/keeper/settle_session_accounting.go b/x/tokenomics/keeper/settle_session_accounting.go deleted file mode 100644 index b5c6c7130..000000000 --- a/x/tokenomics/keeper/settle_session_accounting.go +++ /dev/null @@ -1,158 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/smt" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -const ( - // TODO_TECHDEBT: Retrieve this from the SMT package - // The number of bytes expected to be contained in the root hash being - // claimed in order to represent both the digest and the sum. - smstRootSize = 40 -) - -// atomic.if this function is not atomic. - -// SettleSessionAccounting is responsible for all of the post-session accounting -// necessary to burn, mint or transfer tokens depending on the amount of work -// done. The amount of "work done" complete is dictated by `sum` of `root`. -// -// ASSUMPTION: It is assumed the caller of this function validated the claim -// against a proof BEFORE calling this function. -// -// TODO_BLOCKER(@Olshansk): Is there a way to limit who can call this function? -func (k Keeper) SettleSessionAccounting( - goCtx context.Context, - claim *suppliertypes.Claim, -) error { - // Parse the context - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger(ctx).With("method", "SettleSessionAccounting") - - if claim == nil { - logger.Error("received a nil claim") - return types.ErrTokenomicsClaimNil - } - - // Make sure the session header is not nil - sessionHeader := claim.SessionHeader - if sessionHeader == nil { - logger.Error("received a nil session header") - return types.ErrTokenomicsSessionHeaderNil - } - - // Validate the session header - if err := sessionHeader.ValidateBasic(); err != nil { - logger.Error("received an invalid session header", "error", err) - return types.ErrTokenomicsSessionHeaderInvalid - } - - // Decompose the claim into its constituent parts for readability - supplierAddress, err := sdk.AccAddressFromBech32(claim.SupplierAddress) - if err != nil { - return types.ErrTokenomicsSupplierAddressInvalid - } - applicationAddress, err := sdk.AccAddressFromBech32(claim.SessionHeader.ApplicationAddress) - if err != nil { - return types.ErrTokenomicsApplicationAddressInvalid - } - root := (smt.MerkleRoot)(claim.RootHash) - - if len(root) != smstRootSize { - logger.Error(fmt.Sprintf("received an invalid root hash of size: %d", len(root))) - return types.ErrTokenomicsRootHashInvalid - } - - // Retrieve the application - application, found := k.appKeeper.GetApplication(ctx, applicationAddress.String()) - if !found { - logger.Error(fmt.Sprintf("application for claim with address %s not found", applicationAddress)) - return types.ErrTokenomicsApplicationNotFound - } - - // Retrieve the sum of the root as a proxy into the amount of work done - claimComputeUnits := root.Sum() - - logger.Info(fmt.Sprintf("About to start settling claim for %d compute units", claimComputeUnits)) - - // Retrieve the existing tokenomics params - params := k.GetParams(ctx) - - // Calculate the amount of tokens to mint & burn - upokt := sdk.NewInt(int64(claimComputeUnits * params.ComputeUnitsToTokensMultiplier)) - upoktCoin := sdk.NewCoin("upokt", upokt) - upoktCoins := sdk.NewCoins(upoktCoin) - - logger.Info(fmt.Sprintf("%d compute units equate to %d uPOKT for session %s", claimComputeUnits, upokt, sessionHeader.SessionId)) - - // NB: We are doing a mint & burn + transfer, instead of a simple transfer - // of funds from the supplier to the application in order to enable second - // order economic effects with more optionality. This could include funds - // going to pnf, delegators, enabling bonuses/rebates, etc... - - // Mint uPOKT to the supplier module account - if err := k.bankKeeper.MintCoins(ctx, suppliertypes.ModuleName, upoktCoins); err != nil { - return types.ErrTokenomicsApplicationModuleFeeFailed - } - - logger.Info(fmt.Sprintf("minted %d uPOKT in the supplier module", upokt)) - - // Sent the minted coins to the supplier - if err := k.bankKeeper.SendCoinsFromModuleToAccount( - ctx, suppliertypes.ModuleName, supplierAddress, upoktCoins, - ); err != nil { - return types.ErrTokenomicsApplicationModuleFeeFailed - } - - logger.Info(fmt.Sprintf("sent %d uPOKT to supplier with address %s", upokt, supplierAddress)) - - // Verify that the application has enough uPOKT to pay for the services it consumed - if application.Stake.IsLT(upoktCoin) { - logger.Error(fmt.Sprintf("THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", applicationAddress, upoktCoins, application.Stake)) - // TODO_BLOCKER(@Olshansk, @RawthiL): The application was over-serviced in the last session so it basically - // goes "into debt". Need to design a way to handle this when we implement - // probabilistic proofs and add all the parameter logic. Do we touch the application balance? - // Do we just let it go into debt? Do we penalize the application? Do we unstake it? Etc... - upoktCoins = sdk.NewCoins(*application.Stake) - } - - // Undelegate the amount of coins that need to be burnt from the application stake. - // Since the application commits a certain amount of stake to the network to be able - // to pay for relay mining, this stake is taken from the funds "in escrow" rather - // than its balance. - if err := k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, apptypes.ModuleName, applicationAddress, upoktCoins); err != nil { - logger.Error(fmt.Sprintf("THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", applicationAddress, upoktCoins, application.Stake)) - - } - - // Send coins from the application to the application module account - if err := k.bankKeeper.SendCoinsFromAccountToModule( - ctx, applicationAddress, apptypes.ModuleName, upoktCoins, - ); err != nil { - return types.ErrTokenomicsApplicationModuleFeeFailed - } - - logger.Info(fmt.Sprintf("took %d uPOKT from application with address %s", upokt, applicationAddress)) - - // Burn uPOKT from the application module account - if err := k.bankKeeper.BurnCoins(ctx, apptypes.ModuleName, upoktCoins); err != nil { - return types.ErrTokenomicsApplicationModuleBurn - } - - logger.Info(fmt.Sprintf("burned %d uPOKT in the application module", upokt)) - - // Update the application's on-chain stake - newAppStake := (*application.Stake).Sub(upoktCoin) - application.Stake = &newAppStake - k.appKeeper.SetApplication(ctx, application) - - return nil -} diff --git a/x/tokenomics/module.go b/x/tokenomics/module.go deleted file mode 100644 index e54983755..000000000 --- a/x/tokenomics/module.go +++ /dev/null @@ -1,146 +0,0 @@ -package tokenomics - -import ( - "context" - "encoding/json" - "fmt" - - 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/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/x/tokenomics/client/cli" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the name of the module as a string -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) -} - -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(reg) -} - -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) -} - -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper -} - -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - } -} - -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} diff --git a/x/tokenomics/module_simulation.go b/x/tokenomics/module_simulation.go deleted file mode 100644 index 6c5e2eab6..000000000 --- a/x/tokenomics/module_simulation.go +++ /dev/null @@ -1,88 +0,0 @@ -package tokenomics - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/pokt-network/poktroll/testutil/sample" - tokenomicssimulation "github.com/pokt-network/poktroll/x/tokenomics/simulation" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -// avoid unused import issue -var ( - _ = sample.AccAddress - _ = tokenomicssimulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace - _ = rand.Rand{} -) - -const ( - opWeightMsgUpdateParams = "op_weight_msg_update_params" - // TODO: Determine the simulation weight value - defaultWeightMsgUpdateParams int = 100 - - // this line is used by starport scaffolding # simapp/module/const -) - -// GenerateGenesisState creates a randomized GenState of the module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - accs := make([]string, len(simState.Accounts)) - for i, acc := range simState.Accounts { - accs[i] = acc.Address.String() - } - tokenomicsGenesis := types.GenesisState{ - Params: types.DefaultParams(), - // this line is used by starport scaffolding # simapp/module/genesisState - } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&tokenomicsGenesis) -} - -// RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - operations := make([]simtypes.WeightedOperation, 0) - - var weightMsgUpdateParams int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUpdateParams, &weightMsgUpdateParams, nil, - func(_ *rand.Rand) { - weightMsgUpdateParams = defaultWeightMsgUpdateParams - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUpdateParams, - tokenomicssimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - // this line is used by starport scaffolding # simapp/module/operation - - return operations -} - -// ProposalMsgs returns msgs used for governance proposals for simulations. -func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { - return []simtypes.WeightedProposalMsg{ - simulation.NewWeightedProposalMsg( - opWeightMsgUpdateParams, - defaultWeightMsgUpdateParams, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - tokenomicssimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - // this line is used by starport scaffolding # simapp/module/OpMsg - } -} diff --git a/x/tokenomics/simulation/helpers.go b/x/tokenomics/simulation/helpers.go deleted file mode 100644 index c260f2fcd..000000000 --- a/x/tokenomics/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - addr, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, addr) -} diff --git a/x/tokenomics/simulation/update_params.go b/x/tokenomics/simulation/update_params.go deleted file mode 100644 index 87a1b03da..000000000 --- a/x/tokenomics/simulation/update_params.go +++ /dev/null @@ -1,29 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/pokt-network/poktroll/x/tokenomics/keeper" - "github.com/pokt-network/poktroll/x/tokenomics/types" -) - -func SimulateMsgUpdateParams( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUpdateParams{ - Authority: simAccount.Address.String(), - } - - // TODO: Handling the UpdateParams simulation - - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UpdateParams simulation not implemented"), nil, nil - } -} diff --git a/x/tokenomics/types/codec.go b/x/tokenomics/types/codec.go deleted file mode 100644 index 2fc398bd4..000000000 --- a/x/tokenomics/types/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - // this line is used by starport scaffolding # 1 - - "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/msgservice" -) - -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(Params{}, "tokenomics/Params", nil) - cdc.RegisterConcrete(&MsgUpdateParams{}, "tokenomics/UpdateParams", nil) - // this line is used by starport scaffolding # 2 -} - -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUpdateParams{}, - ) - - // this line is used by starport scaffolding # 3 - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go deleted file mode 100644 index 4e269fac3..000000000 --- a/x/tokenomics/types/errors.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// x/tokenomics module sentinel errors -var ( - ErrTokenomicsAuthorityAddressInvalid = sdkerrors.Register(ModuleName, 1, "the provided authority address is not a valid bech32 address") - ErrTokenomicsAuthorityAddressMismatch = sdkerrors.Register(ModuleName, 2, "the provided authority address does not match the on-chain governance address") - ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 3, "provided claim is nil") - ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 4, "provided claim's session header is nil") - ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 5, "provided claim's session header is invalid") - ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 6, "failed to mint uPOKT to supplier module account") - ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 7, "failed to send uPOKT from supplier module account to supplier") - ErrTokenomicsSupplierAddressInvalid = sdkerrors.Register(ModuleName, 8, "the supplier address in the claim is not a valid bech32 address") - ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 9, "application not found") - ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 10, "failed to burn uPOKT from application module account") - ErrTokenomicsApplicationModuleFeeFailed = sdkerrors.Register(ModuleName, 11, "failed to send uPOKT from application module account to application") - ErrTokenomicsApplicationUndelegationFailed = sdkerrors.Register(ModuleName, 12, "failed to undelegate uPOKT from the application module to the application account") - ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 13, "the application address in the claim is not a valid bech32 address") - ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 14, "provided params are invalid") - ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 15, "the root hash in the claim is invalid") -) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go deleted file mode 100644 index ba3e8ce22..000000000 --- a/x/tokenomics/types/expected_keepers.go +++ /dev/null @@ -1,35 +0,0 @@ -package types - -//go:generate mockgen -destination ../../../testutil/tokenomics/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface needed to retrieve account balances. -type BankKeeper interface { - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error -} - -type ApplicationKeeper interface { - GetApplication(ctx sdk.Context, appAddr string) (app apptypes.Application, found bool) - SetApplication(ctx sdk.Context, app apptypes.Application) -} - -type SupplierKeeper interface { - GetSupplier(ctx sdk.Context, suppAddr string) (supplier sharedtypes.Supplier, found bool) -} diff --git a/x/tokenomics/types/genesis.go b/x/tokenomics/types/genesis.go deleted file mode 100644 index 0af9b4416..000000000 --- a/x/tokenomics/types/genesis.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -import ( -// this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go deleted file mode 100644 index ad3aaa914..000000000 --- a/x/tokenomics/types/genesis_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid genesis state - ComputeUnitsToTokensMultiplier is 0", - genState: &types.GenesisState{ - Params: types.Params{ - ComputeUnitsToTokensMultiplier: 0, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/tokenomics/types/keys.go b/x/tokenomics/types/keys.go deleted file mode 100644 index c3664bad9..000000000 --- a/x/tokenomics/types/keys.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "tokenomics" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "mem_tokenomics" -) - -func KeyPrefix(p string) []byte { - return []byte(p) -} diff --git a/x/tokenomics/types/message_update_params.go b/x/tokenomics/types/message_update_params.go deleted file mode 100644 index 553032915..000000000 --- a/x/tokenomics/types/message_update_params.go +++ /dev/null @@ -1,66 +0,0 @@ -package types - -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const TypeMsgUpdateParams = "update_params" - -var _ sdk.Msg = (*MsgUpdateParams)(nil) - -func NewMsgUpdateParams( - authority string, - compute_units_to_tokens_multiplier uint64, -) *MsgUpdateParams { - return &MsgUpdateParams{ - Authority: authority, - Params: Params{ - ComputeUnitsToTokensMultiplier: compute_units_to_tokens_multiplier, - }, - } -} - -func (msg *MsgUpdateParams) Route() string { - return RouterKey -} - -func (msg *MsgUpdateParams) Type() string { - return TypeMsgUpdateParams -} - -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { - authority, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - panic(err) - } - return []sdk.AccAddress{authority} -} - -func (msg *MsgUpdateParams) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgUpdateParams) ValidateBasic() error { - // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - return sdkerrors.Wrapf(ErrTokenomicsAuthorityAddressInvalid, "invalid authority address %s; (%v)", msg.Authority, err) - } - - // Validate the params - if err := msg.Params.ValidateBasic(); err != nil { - return err - } - - return nil -} - -func (params *Params) ValidateBasic() error { - // Validate the ComputeUnitsToTokensMultiplier - if params.ComputeUnitsToTokensMultiplier == 0 { - return sdkerrors.Wrapf(ErrTokenomicsParamsInvalid, "invalid ComputeUnitsToTokensMultiplier; (%v)", params.ComputeUnitsToTokensMultiplier) - } - return nil -} diff --git a/x/tokenomics/types/message_update_params_test.go b/x/tokenomics/types/message_update_params_test.go deleted file mode 100644 index 0ac9863b7..000000000 --- a/x/tokenomics/types/message_update_params_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import ( - "testing" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/stretchr/testify/require" -) - -func TestMsgUpdateParams_ValidateBasic(t *testing.T) { - tests := []struct { - desc string - - msg MsgUpdateParams - - expectedErr error - }{ - { - desc: "invalid authority address", - msg: MsgUpdateParams{ - Authority: "invalid_address", - Params: Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - expectedErr: ErrTokenomicsAuthorityAddressInvalid, - }, { - desc: "valid address", - msg: MsgUpdateParams{ - Authority: sample.AccAddress(), - Params: Params{ - ComputeUnitsToTokensMultiplier: 1, - }, - }, - }, { - desc: "invalid ComputeUnitsToTokensMultiplier", - msg: MsgUpdateParams{ - Authority: sample.AccAddress(), - Params: Params{ - ComputeUnitsToTokensMultiplier: 0, - }, - }, - expectedErr: ErrTokenomicsParamsInvalid, - }, - } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/tokenomics/types/params.go b/x/tokenomics/types/params.go deleted file mode 100644 index 992cdd9ed..000000000 --- a/x/tokenomics/types/params.go +++ /dev/null @@ -1,73 +0,0 @@ -package types - -import ( - "fmt" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -var ( - KeyComputeUnitsToTokensMultiplier = []byte("ComputeUnitsToTokensMultiplier") - // TODO: Determine the default value - DefaultComputeUnitsToTokensMultiplier uint64 = 42 -) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams( - computeUnitsToTokensMultiplier uint64, -) Params { - return Params{ - ComputeUnitsToTokensMultiplier: computeUnitsToTokensMultiplier, - } -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams( - DefaultComputeUnitsToTokensMultiplier, - ) -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyComputeUnitsToTokensMultiplier, &p.ComputeUnitsToTokensMultiplier, validateComputeUnitsToTokensMultiplier), - } -} - -// Validate validates the set of params -func (p Params) Validate() error { - if err := validateComputeUnitsToTokensMultiplier(p.ComputeUnitsToTokensMultiplier); err != nil { - return err - } - - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// validateComputeUnitsToTokensMultiplier validates the ComputeUnitsToTokensMultiplier param -func validateComputeUnitsToTokensMultiplier(v interface{}) error { - computeUnitsToTokensMultiplier, ok := v.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - if computeUnitsToTokensMultiplier <= 0 { - return fmt.Errorf("invalid compute to tokens multiplier: %d", computeUnitsToTokensMultiplier) - } - - return nil -} diff --git a/x/tokenomics/types/types.go b/x/tokenomics/types/types.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/tokenomics/types/types.go +++ /dev/null @@ -1 +0,0 @@ -package types From 23eb974aaa01193f230fcbc95a58ec61aa154eae Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 25 Jan 2024 15:26:23 +0000 Subject: [PATCH 02/54] feat: comment out module mock generation code --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c893b6f04..b1493f336 100644 --- a/Makefile +++ b/Makefile @@ -226,12 +226,12 @@ itest: check_go_version ## Run tests iteratively (see usage for more) .PHONY: go_mockgen go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all the modules. find . -name "*_mock.go" | xargs --no-run-if-empty rm - go generate ./x/application/types/ - go generate ./x/gateway/types/ - go generate ./x/supplier/types/ - go generate ./x/session/types/ - go generate ./x/service/types/ - go generate ./x/tokenomics/types/ + # go generate ./x/application/types/ + # go generate ./x/gateway/types/ + # go generate ./x/supplier/types/ + # go generate ./x/session/types/ + # go generate ./x/service/types/ + # go generate ./x/tokenomics/types/ go generate ./pkg/client/interface.go go generate ./pkg/miner/interface.go go generate ./pkg/relayer/interface.go @@ -671,4 +671,4 @@ act_list: check_act ## List all github actions that can be executed locally with act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so: `GITHUB_TOKEN=$(gh auth token) make act_reviewdog` $(eval CONTAINER_ARCH := $(shell make -s detect_arch)) @echo "Detected architecture: $(CONTAINER_ARCH)" - act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) \ No newline at end of file + act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) From 321766bc212c45bc53352a98f8160fd99bf5443b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 12:47:55 +0100 Subject: [PATCH 03/54] chore: temporarily remove `testutil` pkg --- testutil/application/mocks/mocks.go | 11 - testutil/gateway/mocks/mocks.go | 11 - testutil/mockclient/mocks.go | 11 - testutil/mockcrypto/mock.go | 11 - testutil/mockrelayer/mocks.go | 11 - testutil/service/mocks/mocks.go | 11 - testutil/session/mocks/mocks.go | 10 - testutil/supplier/fixtures.go | 113 ----- testutil/supplier/mocks/mocks.go | 11 - testutil/testchannel/drain.go | 26 -- testutil/testclient/keyring.go | 31 -- testutil/testclient/localnet.go | 88 ---- testutil/testclient/testblock/client.go | 123 ------ testutil/testclient/testblock/godoc.go | 4 - testutil/testclient/testdelegation/client.go | 154 ------- testutil/testclient/testdelegation/godoc.go | 5 - testutil/testclient/testeventsquery/client.go | 125 ------ .../testclient/testeventsquery/connection.go | 115 ----- testutil/testclient/testeventsquery/godoc.go | 5 - testutil/testclient/testkeyring/keyring.go | 17 - .../testclient/testqueryclients/accquerier.go | 67 --- .../testclient/testqueryclients/appquerier.go | 90 ---- testutil/testclient/testqueryclients/godoc.go | 4 - .../testqueryclients/sessionquerier.go | 101 ----- .../testqueryclients/supplierquerier.go | 106 ----- testutil/testclient/testsupplier/client.go | 71 --- testutil/testclient/testtx/client.go | 95 ---- testutil/testclient/testtx/context.go | 275 ------------ testutil/testcrypto/rings/cache.go | 48 -- testutil/testcrypto/rings/godoc.go | 4 - testutil/testerrors/require.go | 11 - testutil/testkeyring/accounts.go | 118 ----- testutil/testkeyring/accounts_table.go | 111 ----- testutil/testkeyring/gen_accounts/gen.go | 79 ---- testutil/testkeyring/gen_accounts/template.go | 26 -- testutil/testkeyring/keyring.go | 47 -- testutil/testpolylog/event.go | 193 --------- testutil/testpolylog/logger.go | 21 - testutil/testproxy/jsonrpc.go | 24 - testutil/testproxy/relayerproxy.go | 409 ------------------ testutil/testrelayer/hash.go | 16 - testutil/testrelayer/miner.go | 34 -- testutil/testrelayer/options.go | 23 - testutil/testrelayer/proxy.go | 37 -- testutil/testrelayer/relays.go | 44 -- testutil/testrelayer/sessions_manager.go | 37 -- testutil/tokenomics/mocks/mocks.go | 11 - testutil/yaml/yaml.go | 31 -- 48 files changed, 3026 deletions(-) delete mode 100644 testutil/application/mocks/mocks.go delete mode 100644 testutil/gateway/mocks/mocks.go delete mode 100644 testutil/mockclient/mocks.go delete mode 100644 testutil/mockcrypto/mock.go delete mode 100644 testutil/mockrelayer/mocks.go delete mode 100644 testutil/service/mocks/mocks.go delete mode 100644 testutil/session/mocks/mocks.go delete mode 100644 testutil/supplier/fixtures.go delete mode 100644 testutil/supplier/mocks/mocks.go delete mode 100644 testutil/testchannel/drain.go delete mode 100644 testutil/testclient/keyring.go delete mode 100644 testutil/testclient/localnet.go delete mode 100644 testutil/testclient/testblock/client.go delete mode 100644 testutil/testclient/testblock/godoc.go delete mode 100644 testutil/testclient/testdelegation/client.go delete mode 100644 testutil/testclient/testdelegation/godoc.go delete mode 100644 testutil/testclient/testeventsquery/client.go delete mode 100644 testutil/testclient/testeventsquery/connection.go delete mode 100644 testutil/testclient/testeventsquery/godoc.go delete mode 100644 testutil/testclient/testkeyring/keyring.go delete mode 100644 testutil/testclient/testqueryclients/accquerier.go delete mode 100644 testutil/testclient/testqueryclients/appquerier.go delete mode 100644 testutil/testclient/testqueryclients/godoc.go delete mode 100644 testutil/testclient/testqueryclients/sessionquerier.go delete mode 100644 testutil/testclient/testqueryclients/supplierquerier.go delete mode 100644 testutil/testclient/testsupplier/client.go delete mode 100644 testutil/testclient/testtx/client.go delete mode 100644 testutil/testclient/testtx/context.go delete mode 100644 testutil/testcrypto/rings/cache.go delete mode 100644 testutil/testcrypto/rings/godoc.go delete mode 100644 testutil/testerrors/require.go delete mode 100644 testutil/testkeyring/accounts.go delete mode 100644 testutil/testkeyring/accounts_table.go delete mode 100644 testutil/testkeyring/gen_accounts/gen.go delete mode 100644 testutil/testkeyring/gen_accounts/template.go delete mode 100644 testutil/testkeyring/keyring.go delete mode 100644 testutil/testpolylog/event.go delete mode 100644 testutil/testpolylog/logger.go delete mode 100644 testutil/testproxy/jsonrpc.go delete mode 100644 testutil/testproxy/relayerproxy.go delete mode 100644 testutil/testrelayer/hash.go delete mode 100644 testutil/testrelayer/miner.go delete mode 100644 testutil/testrelayer/options.go delete mode 100644 testutil/testrelayer/proxy.go delete mode 100644 testutil/testrelayer/relays.go delete mode 100644 testutil/testrelayer/sessions_manager.go delete mode 100644 testutil/tokenomics/mocks/mocks.go delete mode 100644 testutil/yaml/yaml.go diff --git a/testutil/application/mocks/mocks.go b/testutil/application/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/application/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/gateway/mocks/mocks.go b/testutil/gateway/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/gateway/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/mockclient/mocks.go b/testutil/mockclient/mocks.go deleted file mode 100644 index d89152942..000000000 --- a/testutil/mockclient/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mockclient - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/mockcrypto/mock.go b/testutil/mockcrypto/mock.go deleted file mode 100644 index 277adca25..000000000 --- a/testutil/mockcrypto/mock.go +++ /dev/null @@ -1,11 +0,0 @@ -package mockcrypto - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/mockrelayer/mocks.go b/testutil/mockrelayer/mocks.go deleted file mode 100644 index 0abe65d56..000000000 --- a/testutil/mockrelayer/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mockrelayer - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/service/mocks/mocks.go b/testutil/service/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/service/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/session/mocks/mocks.go b/testutil/session/mocks/mocks.go deleted file mode 100644 index 423f63d3e..000000000 --- a/testutil/session/mocks/mocks.go +++ /dev/null @@ -1,10 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which requires `.go` files to compile. diff --git a/testutil/supplier/fixtures.go b/testutil/supplier/fixtures.go deleted file mode 100644 index b13f1d74d..000000000 --- a/testutil/supplier/fixtures.go +++ /dev/null @@ -1,113 +0,0 @@ -package supplier - -import ( - "testing" - - sdktypes "github.com/cosmos/cosmos-sdk/types" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - testSessionNumber = 1 - testBlockHeight = 1 - testBlocksPerSession = 4 - testSessionId = "mock_session_id" -) - -// SessionsByAppAddress is a map of session fixtures where the key is the -// application address and the value is the session fixture. -type SessionsByAppAddress map[string]sessiontypes.Session - -// AppSupplierPair is a pairing of an application and a supplier address. -type AppSupplierPair struct { - AppAddr string - SupplierAddr string -} - -// NewSessionFixturesWithPairings creates a map of session fixtures where the key -// is the application address and the value is the session fixture. App/supplier -// addresses are expected to be provided in alternating order (as pairs). The same -// app and/or supplier may be given more than once but only distinct pairs will -// be added to the session fixtures map. -func NewSessionFixturesWithPairings( - t *testing.T, - service *sharedtypes.Service, - appSupplierPairs ...AppSupplierPair, -) SessionsByAppAddress { - t.Helper() - - // Initialize the session fixtures map. - sessionFixturesByAppAddr := make(SessionsByAppAddress) - - // Iterate over the app and supplier address pairs (two indices at a time), - // and create a session fixture for each app address. - for _, appSupplierPair := range appSupplierPairs { - application := newApplication(t, appSupplierPair.AppAddr, service) - supplier := newSupplier(t, appSupplierPair.SupplierAddr, service) - - if session, ok := sessionFixturesByAppAddr[appSupplierPair.AppAddr]; ok { - session.Suppliers = append(session.Suppliers, supplier) - continue - } - - sessionFixturesByAppAddr[appSupplierPair.AppAddr] = sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - ApplicationAddress: appSupplierPair.AppAddr, - Service: service, - SessionStartBlockHeight: testBlockHeight, - SessionId: testSessionId, - SessionEndBlockHeight: testBlockHeight + testBlocksPerSession, - }, - SessionId: testSessionId, - SessionNumber: testSessionNumber, - NumBlocksPerSession: testBlocksPerSession, - Application: application, - Suppliers: []*sharedtypes.Supplier{ - newSupplier(t, appSupplierPair.SupplierAddr, service), - }, - } - } - - return sessionFixturesByAppAddr -} - -// newSuppliers configures a supplier for the services provided and nil endpoints. -func newSupplier(t *testing.T, addr string, services ...*sharedtypes.Service) *sharedtypes.Supplier { - t.Helper() - - serviceConfigs := make([]*sharedtypes.SupplierServiceConfig, len(services)) - for i, service := range services { - serviceConfigs[i] = &sharedtypes.SupplierServiceConfig{ - Service: service, - Endpoints: nil, - } - } - - return &sharedtypes.Supplier{ - Address: addr, - Stake: &sdktypes.Coin{}, - Services: serviceConfigs, - } -} - -// newApplication configures an application for the services provided. -func newApplication(t *testing.T, addr string, services ...*sharedtypes.Service) *apptypes.Application { - t.Helper() - - serviceConfigs := make([]*sharedtypes.ApplicationServiceConfig, len(services)) - for i, service := range services { - serviceConfigs[i] = &sharedtypes.ApplicationServiceConfig{ - Service: service, - } - } - - return &apptypes.Application{ - Address: addr, - Stake: &sdktypes.Coin{}, - ServiceConfigs: serviceConfigs, - DelegateeGatewayAddresses: nil, - } -} diff --git a/testutil/supplier/mocks/mocks.go b/testutil/supplier/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/supplier/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/testchannel/drain.go b/testutil/testchannel/drain.go deleted file mode 100644 index 4b7ff00a3..000000000 --- a/testutil/testchannel/drain.go +++ /dev/null @@ -1,26 +0,0 @@ -package testchannel - -import ( - "time" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// DrainChannel attempts to receive from the given channel, blocking, until it is -// empty. It returns an error if the channel is not closed by the time it's empty. -// TODO_CONSIDERATION: this function could easily take a timeout parameter and add -// a case which returns an error if the timeout is exceeded. This would prevent -// the case where the channel never stops receiving from looping indefinitely. -func DrainChannel[V any](ch <-chan V) error { - for { - select { - case _, ok := <-ch: - if ok { - continue - } - return nil - case <-time.After(time.Millisecond): - return observable.ErrObserverClosed - } - } -} diff --git a/testutil/testclient/keyring.go b/testutil/testclient/keyring.go deleted file mode 100644 index 59d54f908..000000000 --- a/testutil/testclient/keyring.go +++ /dev/null @@ -1,31 +0,0 @@ -package testclient - -import ( - "testing" - - cosmoshd "github.com/cosmos/cosmos-sdk/crypto/hd" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/stretchr/testify/require" -) - -// NewKey creates a new Secp256k1 key and mnemonic for the given name within -// the provided keyring. -func NewKey( - t *testing.T, - name string, - keyring cosmoskeyring.Keyring, -) (key *cosmoskeyring.Record, mnemonic string) { - t.Helper() - - key, mnemonic, err := keyring.NewMnemonic( - name, - cosmoskeyring.English, - "m/44'/118'/0'/0/0", - cosmoskeyring.DefaultBIP39Passphrase, - cosmoshd.Secp256k1, - ) - require.NoError(t, err) - require.NotNil(t, key) - - return key, mnemonic -} diff --git a/testutil/testclient/localnet.go b/testutil/testclient/localnet.go deleted file mode 100644 index 3e30318ed..000000000 --- a/testutil/testclient/localnet.go +++ /dev/null @@ -1,88 +0,0 @@ -package testclient - -import ( - "fmt" - "os" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/regen-network/gocuke" - "github.com/spf13/pflag" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/cmd/pocketd/cmd" -) - -var ( - // CometLocalTCPURL provides a default URL pointing to the localnet TCP endpoint. - CometLocalTCPURL = "tcp://localhost:36657" - - // CometLocalWebsocketURL provides a default URL pointing to the localnet websocket endpoint. - CometLocalWebsocketURL = "ws://localhost:36657/websocket" - - // EncodingConfig encapsulates encoding configurations for the Pocket application. - EncodingConfig = app.MakeEncodingConfig() -) - -// init initializes the SDK configuration upon package import. -func init() { - cmd.InitSDKConfig() - - // If SEQUENCER_RPC_ENDPOINT environment variable is set, use it to override the default localnet endpoint. - if endpoint := os.Getenv("SEQUENCER_RPC_ENDPOINT"); endpoint != "" { - CometLocalTCPURL = fmt.Sprintf("tcp://%s", endpoint) - CometLocalWebsocketURL = fmt.Sprintf("ws://%s/websocket", endpoint) - } -} - -// NewLocalnetClientCtx creates a client context specifically tailored for localnet -// environments. The returned client context is initialized with encoding -// configurations, a default home directory, a default account retriever, and -// command flags. -// -// Parameters: -// - t: The testing.T instance used for the current test. -// - flagSet: The set of flags to be read for initializing the client context. -// -// Returns: -// - A pointer to a populated client.Context instance suitable for localnet usage. -func NewLocalnetClientCtx(t gocuke.TestingT, flagSet *pflag.FlagSet) *client.Context { - t.Helper() - - homedir := app.DefaultNodeHome - clientCtx := client.Context{}. - WithCodec(EncodingConfig.Marshaler). - WithTxConfig(EncodingConfig.TxConfig). - WithHomeDir(homedir). - WithAccountRetriever(authtypes.AccountRetriever{}). - WithInterfaceRegistry(EncodingConfig.InterfaceRegistry) - - clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, flagSet) - require.NoError(t, err) - return &clientCtx -} - -// NewLocalnetFlagSet creates a set of predefined flags suitable for a localnet -// testing environment. -// -// Parameters: -// - t: The testing.T instance used for the current test. -// -// Returns: -// - A flag set populated with flags tailored for localnet environments. -func NewLocalnetFlagSet(t gocuke.TestingT) *pflag.FlagSet { - t.Helper() - - mockFlagSet := pflag.NewFlagSet("test", pflag.ContinueOnError) - // TODO_IMPROVE: It would be nice if the value could be set correctly based - // on whether the test using it is running in tilt or not. - mockFlagSet.String(flags.FlagNode, CometLocalTCPURL, "use localnet poktrolld node") - mockFlagSet.String(flags.FlagHome, "", "use localnet poktrolld node") - mockFlagSet.String(flags.FlagKeyringBackend, "test", "use test keyring") - err := mockFlagSet.Parse([]string{}) - require.NoError(t, err) - - return mockFlagSet -} diff --git a/testutil/testclient/testblock/client.go b/testutil/testclient/testblock/client.go deleted file mode 100644 index 91c1641b5..000000000 --- a/testutil/testclient/testblock/client.go +++ /dev/null @@ -1,123 +0,0 @@ -package testblock - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// NewLocalnetClient creates and returns a new BlockClient that's configured for -// use with the localnet sequencer. -func NewLocalnetClient(ctx context.Context, t *testing.T) client.BlockClient { - t.Helper() - - queryClient := testeventsquery.NewLocalnetClient(t) - require.NotNil(t, queryClient) - - deps := depinject.Supply(queryClient) - bClient, err := block.NewBlockClient(ctx, deps) - require.NoError(t, err) - - return bClient -} - -// NewAnyTimesCommittedBlocksSequenceBlockClient creates a new mock BlockClient. -// This mock BlockClient will expect any number of calls to CommittedBlocksSequence, -// and when that call is made, it returns the given EventsObservable[Block]. -func NewAnyTimesCommittedBlocksSequenceBlockClient( - t *testing.T, - blocksObs observable.Observable[client.Block], -) *mockclient.MockBlockClient { - t.Helper() - - // Create a mock for the block client which expects the LastNBlocks method to be called any number of times. - blockClientMock := NewAnyTimeLastNBlocksBlockClient(t, nil, 0) - - // Set up the mock expectation for the CommittedBlocksSequence method. When - // the method is called, it returns a new replay observable that publishes - // blocks sent on the given blocksPublishCh. - blockClientMock.EXPECT(). - CommittedBlocksSequence(gomock.Any()). - Return(blocksObs). - AnyTimes() - - return blockClientMock -} - -// NewOneTimeCommittedBlocksSequenceBlockClient creates a new mock BlockClient. -// This mock BlockClient will expect a call to CommittedBlocksSequence, and -// when that call is made, it returns a new BlocksObservable that is notified of -// blocks sent on the given blocksPublishCh. -// blocksPublishCh is the channel the caller can use to publish blocks the observable. -func NewOneTimeCommittedBlocksSequenceBlockClient( - t *testing.T, - blocksPublishCh chan client.Block, -) *mockclient.MockBlockClient { - t.Helper() - - // Create a mock for the block client which expects the LastNBlocks method to be called any number of times. - blockClientMock := NewAnyTimeLastNBlocksBlockClient(t, nil, 0) - - // Set up the mock expectation for the CommittedBlocksSequence method. When - // the method is called, it returns a new replay observable that publishes - // blocks sent on the given blocksPublishCh. - blockClientMock.EXPECT().CommittedBlocksSequence( - gomock.AssignableToTypeOf(context.Background()), - ).DoAndReturn(func(ctx context.Context) client.BlockReplayObservable { - // Create a new replay observable with a replay buffer size of 1. Blocks - // are published to this observable via the provided blocksPublishCh. - withPublisherOpt := channel.WithPublisher(blocksPublishCh) - obs, _ := channel.NewReplayObservable[client.Block]( - ctx, 1, withPublisherOpt, - ) - return obs - }) - - return blockClientMock -} - -// NewAnyTimeLastNBlocksBlockClient creates a mock BlockClient that expects -// calls to the LastNBlocks method any number of times. When the LastNBlocks -// method is called, it returns a mock Block with the provided hash and height. -func NewAnyTimeLastNBlocksBlockClient( - t *testing.T, - hash []byte, - height int64, -) *mockclient.MockBlockClient { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock block that returns the provided hash and height. - blockMock := NewAnyTimesBlock(t, hash, height) - // Create a mock block client that expects calls to LastNBlocks method and - // returns the mock block. - blockClientMock := mockclient.NewMockBlockClient(ctrl) - blockClientMock.EXPECT().LastNBlocks(gomock.Any(), gomock.Any()).Return([]client.Block{blockMock}).AnyTimes() - - return blockClientMock -} - -// NewAnyTimesBlock creates a mock Block that expects calls to Height and Hash -// methods any number of times. When the methods are called, they return the -// provided height and hash respectively. -func NewAnyTimesBlock(t *testing.T, hash []byte, height int64) *mockclient.MockBlock { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock block that returns the provided hash and height AnyTimes. - blockMock := mockclient.NewMockBlock(ctrl) - blockMock.EXPECT().Height().Return(height).AnyTimes() - blockMock.EXPECT().Hash().Return(hash).AnyTimes() - - return blockMock -} diff --git a/testutil/testclient/testblock/godoc.go b/testutil/testclient/testblock/godoc.go deleted file mode 100644 index 866bb4f70..000000000 --- a/testutil/testclient/testblock/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package testblock provides helper functions for constructing real (e.g. localnet) -// and mock BlockClient objects with pre-configured and/or parameterized call -// arguments, return value(s), and/or expectations thereof. Intended for use in tests. -package testblock diff --git a/testutil/testclient/testdelegation/client.go b/testutil/testclient/testdelegation/client.go deleted file mode 100644 index 4d490e376..000000000 --- a/testutil/testclient/testdelegation/client.go +++ /dev/null @@ -1,154 +0,0 @@ -package testdelegation - -import ( - "context" - "fmt" - "testing" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// NewLocalnetClient creates and returns a new DelegationClient that's configured for -// use with the localnet sequencer. -func NewLocalnetClient(ctx context.Context, t *testing.T) client.DelegationClient { - t.Helper() - - queryClient := testeventsquery.NewLocalnetClient(t) - require.NotNil(t, queryClient) - - deps := depinject.Supply(queryClient) - dClient, err := delegation.NewDelegationClient(ctx, deps) - require.NoError(t, err) - - return dClient -} - -// NewAnyTimesRedelegationsSequence creates a new mock DelegationClient. -// This mock DelegationClient will expect any number of calls to RedelegationsSequence, -// and when that call is made, it returns the given EventsObservable[Redelegation]. -func NewAnyTimesRedelegationsSequence( - ctx context.Context, - t *testing.T, - appAddress string, - redelegationObs observable.Observable[client.Redelegation], -) *mockclient.MockDelegationClient { - t.Helper() - - // Create a mock for the delegation client which expects the - // LastNRedelegations method to be called any number of times. - delegationClientMock := NewAnyTimeLastNRedelegationsClient(t, appAddress) - - // Set up the mock expectation for the RedelegationsSequence method. When - // the method is called, it returns a new replay observable that publishes - // redelegation events sent on the given redelegationObs. - delegationClientMock.EXPECT(). - RedelegationsSequence(ctx). - Return(redelegationObs). - AnyTimes() - - return delegationClientMock -} - -// NewOneTimeRedelegationsSequenceDelegationClient creates a new mock -// DelegationClient. This mock DelegationClient will expect a call to -// RedelegationsSequence, and when that call is made, it returns a new -// RedelegationReplayObservable that publishes Redelegation events sent on -// the given redelegationPublishCh. -// redelegationPublishCh is the channel the caller can use to publish -// Redelegation events to the observable. -func NewOneTimeRedelegationsSequenceDelegationClient( - ctx context.Context, - t *testing.T, - redelegationPublishCh chan client.Redelegation, -) *mockclient.MockDelegationClient { - t.Helper() - - // Create a mock for the delegation client which expects the - // LastNRedelegations method to be called any number of times. - delegationClientMock := NewAnyTimeLastNRedelegationsClient(t, "") - - // Set up the mock expectation for the RedelegationsSequence method. When - // the method is called, it returns a new replay observable that publishes - // delegation changes sent on the given redelegationPublishCh. - delegationClientMock.EXPECT().RedelegationsSequence(ctx). - DoAndReturn(func(ctx context.Context) client.RedelegationReplayObservable { - // Create a new replay observable with a replay buffer size of 1. - // Redelegation events are published to this observable via the - // provided redelegationPublishCh. - withPublisherOpt := channel.WithPublisher(redelegationPublishCh) - obs, _ := channel.NewReplayObservable[client.Redelegation]( - ctx, 1, withPublisherOpt, - ) - return obs - }).Times(1) - - delegationClientMock.EXPECT().Close().AnyTimes() - - return delegationClientMock -} - -// NewAnyTimeLastNRedelegationsClient creates a mock DelegationClient that -// expects calls to the LastNRedelegations method any number of times. When -// the LastNRedelegations method is called, it returns a mock Redelegation -// with the provided appAddress. -func NewAnyTimeLastNRedelegationsClient( - t *testing.T, - appAddress string, -) *mockclient.MockDelegationClient { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock redelegation that returns the provided appAddress - redelegation := NewAnyTimesRedelegation(t, appAddress, "") - // Create a mock delegation client that expects calls to - // LastNRedelegations method and returns the mock redelegation. - delegationClientMock := mockclient.NewMockDelegationClient(ctrl) - delegationClientMock.EXPECT(). - LastNRedelegations(gomock.Any(), gomock.Any()). - Return([]client.Redelegation{redelegation}).AnyTimes() - delegationClientMock.EXPECT().Close().AnyTimes() - - return delegationClientMock -} - -// NewAnyTimesRedelegation creates a mock Redelegation that expects calls -// to the AppAddress method any number of times. When the method is called, it -// returns the provided app address. -func NewAnyTimesRedelegation( - t *testing.T, - appAddress string, - gatewayAddress string, -) *mockclient.MockRedelegation { - t.Helper() - ctrl := gomock.NewController(t) - - // Create a mock redelegation that returns the provided address AnyTimes. - redelegation := mockclient.NewMockRedelegation(ctrl) - redelegation.EXPECT().GetAppAddress().Return(appAddress).AnyTimes() - redelegation.EXPECT().GetGatewayAddress().Return(gatewayAddress).AnyTimes() - - return redelegation -} - -// NewRedelegationEventBytes returns a byte slice containing a JSON string -// that mocks the event bytes returned from the events query client for a -// Redelegation event. -func NewRedelegationEventBytes( - t *testing.T, - appAddress string, - gatewayAddress string, -) []byte { - t.Helper() - jsonTemplate := `{"tx":"SGVsbG8sIHdvcmxkIQ==","result":{"events":[{"type":"message","attributes":[{"key":"action","value":"/pocket.application.MsgDelegateToGateway"},{"key":"sender","value":"pokt1exampleaddress"},{"key":"module","value":"application"}]},{"type":"pocket.application.EventRedelegation","attributes":[{"key":"app_address","value":"\"%s\""},{"key":"gateway_address","value":"\"%s\""}]}]}}` - json := fmt.Sprintf(jsonTemplate, appAddress, gatewayAddress) - return []byte(json) -} diff --git a/testutil/testclient/testdelegation/godoc.go b/testutil/testclient/testdelegation/godoc.go deleted file mode 100644 index 4c7e7387d..000000000 --- a/testutil/testclient/testdelegation/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package testdelegation provides helper functions for constructing real (e.g. -// localnet) and mock DelegationClient objects with pre-configured and/or -// parameterised call arguments, return value(s), and/or expectations thereof. -// Intended for use in tests. -package testdelegation diff --git a/testutil/testclient/testeventsquery/client.go b/testutil/testclient/testeventsquery/client.go deleted file mode 100644 index 3d4251162..000000000 --- a/testutil/testclient/testeventsquery/client.go +++ /dev/null @@ -1,125 +0,0 @@ -package testeventsquery - -import ( - "context" - "fmt" - "sync" - "testing" - "time" - - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient" -) - -// NewLocalnetClient creates and returns a new events query client that's configured -// for use with the localnet sequencer. Any options provided are applied to the client. -func NewLocalnetClient(t *testing.T, opts ...client.EventsQueryClientOption) client.EventsQueryClient { - t.Helper() - - return events.NewEventsQueryClient(testclient.CometLocalWebsocketURL, opts...) -} - -// NewOneTimeEventsQuery creates a mock of the EventsQueryClient which expects -// a single call to the EventsBytes method. It returns a mock client whose event -// bytes method always constructs a new observable. query is the query string -// for which event bytes subscription is expected to be for. -// The caller can simulate blockchain events by sending on publishCh, the value -// of which is set to the publish channel of the events bytes observable publish -// channel. -func NewOneTimeEventsQuery( - ctx context.Context, - t *testing.T, - query string, - publishChMu *sync.Mutex, - publishCh *chan<- either.Bytes, -) *mockclient.MockEventsQueryClient { - t.Helper() - ctrl := gomock.NewController(t) - - eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) - eventsQueryClient.EXPECT().EventsBytes(gomock.Eq(ctx), gomock.Eq(query)). - DoAndReturn(func( - ctx context.Context, - query string, - ) (eventsBzObservable client.EventsBytesObservable, err error) { - publishChMu.Lock() - eventsBzObservable, *publishCh = channel.NewObservable[either.Bytes]() - publishChMu.Unlock() - return eventsBzObservable, nil - }).Times(1) - return eventsQueryClient -} - -// NewOneTimeTxEventsQueryClient creates a mock of the Events that expects to to -// a single call to the EventsBytes method where the query is for transaction -// events for sender address matching that of the given key. -// The caller can simulate blockchain events by sending on publishCh, the value -// of which is set to the publish channel of the events bytes observable publish -// channel. -func NewOneTimeTxEventsQueryClient( - ctx context.Context, - t *testing.T, - key *cosmoskeyring.Record, - publishChMu *sync.Mutex, - publishCh *chan<- either.Bytes, -) *mockclient.MockEventsQueryClient { - t.Helper() - - signingAddr, err := key.GetAddress() - require.NoError(t, err) - - expectedEventsQuery := fmt.Sprintf( - "tm.event='Tx' AND message.sender='%s'", - signingAddr, - ) - return NewOneTimeEventsQuery( - ctx, t, - expectedEventsQuery, - publishChMu, - publishCh, - ) -} - -// NewAnyTimesEventsBytesEventsQueryClient returns a new events query client which -// is configured to return the expected event bytes when queried with the expected -// query, any number of times. The returned client also expects to be closed once. -func NewAnyTimesEventsBytesEventsQueryClient( - ctx context.Context, - t *testing.T, - expectedQuery string, - expectedEventBytes []byte, -) client.EventsQueryClient { - t.Helper() - - ctrl := gomock.NewController(t) - eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) - eventsQueryClient.EXPECT().Close().Times(1) - eventsQueryClient.EXPECT(). - EventsBytes(gomock.AssignableToTypeOf(ctx), gomock.Eq(expectedQuery)). - DoAndReturn( - func(ctx context.Context, query string) (client.EventsBytesObservable, error) { - bytesObsvbl, bytesPublishCh := channel.NewReplayObservable[either.Bytes](ctx, 1) - - // Now that the observable is set up, publish the expected event bytes. - // Only need to send once because it's a ReplayObservable. - bytesPublishCh <- either.Success(expectedEventBytes) - - // Wait a tick for the observables to be set up. This isn't strictly - // necessary but is done to mitigate test flakiness. - time.Sleep(10 * time.Millisecond) - - return bytesObsvbl, nil - }, - ). - AnyTimes() - - return eventsQueryClient -} diff --git a/testutil/testclient/testeventsquery/connection.go b/testutil/testclient/testeventsquery/connection.go deleted file mode 100644 index e51b31a81..000000000 --- a/testutil/testclient/testeventsquery/connection.go +++ /dev/null @@ -1,115 +0,0 @@ -package testeventsquery - -import ( - "sync/atomic" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/testutil/mockclient" -) - -// NewOneTimeMockConnAndDialer returns a new mock connection and mock dialer that -// will return the mock connection when DialContext is called. The mock dialer -// will expect DialContext to be called exactly once. The connection mock will -// expect Close to be called exactly once. -// Callers must mock the Receive method with an EXPECT call before the connection -// mock can be used. -func NewOneTimeMockConnAndDialer(t *testing.T) ( - *mockclient.MockConnection, - *mockclient.MockDialer, -) { - ctrl := gomock.NewController(t) - connMock := mockclient.NewMockConnection(ctrl) - connMock.EXPECT().Close(). - Return(nil). - Times(1) - - dialerMock := NewOneTimeMockDialer(t, either.Success(connMock)) - - return connMock, dialerMock -} - -// NewOneTimeMockDialer returns a mock dialer that will return either the given -// connection mock or error when DialContext is called. The mock dialer will -// expect DialContext to be called exactly once. -func NewOneTimeMockDialer( - t *testing.T, - eitherConnMock either.Either[*mockclient.MockConnection], -) *mockclient.MockDialer { - ctrl := gomock.NewController(t) - dialerMock := mockclient.NewMockDialer(ctrl) - - connMock, err := eitherConnMock.ValueOrError() - dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). - Return(connMock, err). - Times(1) - - return dialerMock -} - -// NewNTimesReconnectMockConnAndDialer returns a new mock connection and mock -// dialer that will return the mock connection when DialContext is called. The -// mock dialer will expect DialContext to be called any times. The connection -// mock will expect Close and Send to be called exactly N times. -func NewNTimesReconnectMockConnAndDialer( - t *testing.T, - n int, - connClosed *atomic.Bool, - delayEvent *atomic.Bool, -) (*mockclient.MockConnection, *mockclient.MockDialer) { - connMock := NewNTimesReconnectConnectionMock(t, n, connClosed, delayEvent) - dialerMock := NewAnyTimesMockDailer(t, connMock) - return connMock, dialerMock -} - -// NewNTimesReconnectConnectionMock returns a mock connection that will expect -// Close and Send to be called exactly N times. The connection mock will set the -// connClosed atomic to true when Close is called and false when Send is called. -// The connection mock will set the delayEvent atomic to false when Send is -// called. This is to allow the caller to subscribe to the first event emitted -func NewNTimesReconnectConnectionMock( - t *testing.T, - n int, - connClosed *atomic.Bool, - delayEvent *atomic.Bool, -) *mockclient.MockConnection { - ctrl := gomock.NewController(t) - connMock := mockclient.NewMockConnection(ctrl) - // Expect the connection to be closed and the dialer to be re-established - connMock.EXPECT(). - Close(). - DoAndReturn(func() error { - connClosed.CompareAndSwap(false, true) - return nil - }). - Times(n) - // Expect the subscription to be re-established any number of times - connMock.EXPECT(). - Send(gomock.Any()). - DoAndReturn(func(eventBz []byte) error { - if connClosed.Load() { - connClosed.CompareAndSwap(true, false) - } - delayEvent.CompareAndSwap(true, false) - return nil - }). - Times(n) - return connMock -} - -// NewAnyTimesMockDailer returns a mock dialer that will return the given -// connection mock when DialContext is called. The mock dialer will expect -// DialContext to be called any number of times. -func NewAnyTimesMockDailer( - t *testing.T, - connMock *mockclient.MockConnection, -) *mockclient.MockDialer { - ctrl := gomock.NewController(t) - dialerMock := mockclient.NewMockDialer(ctrl) - dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). - Return(connMock, nil). - AnyTimes() - return dialerMock -} diff --git a/testutil/testclient/testeventsquery/godoc.go b/testutil/testclient/testeventsquery/godoc.go deleted file mode 100644 index 0caa02997..000000000 --- a/testutil/testclient/testeventsquery/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package testeventsquery provides helper functions for constructing real -// (e.g. localnet) and mock EventsQueryClient objects with pre-configured and/or -// parameterized call arguments, return value(s), and/or expectations thereof. -// Intended for use in tests. -package testeventsquery diff --git a/testutil/testclient/testkeyring/keyring.go b/testutil/testclient/testkeyring/keyring.go deleted file mode 100644 index bb83baf88..000000000 --- a/testutil/testclient/testkeyring/keyring.go +++ /dev/null @@ -1,17 +0,0 @@ -package testkeyring - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/crypto/keyring" - - "github.com/pokt-network/poktroll/testutil/testclient" -) - -// NewTestKeyringWithKey creates a new in-memory keyring with a test key -// with testSigningKeyName as its name. -func NewTestKeyringWithKey(t *testing.T, keyName string) (keyring.Keyring, *keyring.Record) { - keyring := keyring.NewInMemory(testclient.EncodingConfig.Marshaler) - key, _ := testclient.NewKey(t, keyName, keyring) - return keyring, key -} diff --git a/testutil/testclient/testqueryclients/accquerier.go b/testutil/testclient/testqueryclients/accquerier.go deleted file mode 100644 index 6924dc963..000000000 --- a/testutil/testclient/testqueryclients/accquerier.go +++ /dev/null @@ -1,67 +0,0 @@ -package testqueryclients - -import ( - "context" - "testing" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" -) - -// addressAccountMap is a map of: -// -// addresses -> public keys. -// -// If an address is not present in the map or if the public key associated -// with an address is nil it is assumed that it does not exist on chain. -var addressAccountMap map[string]cryptotypes.PubKey - -func init() { - addressAccountMap = make(map[string]cryptotypes.PubKey) -} - -// NewTestAccountQueryClient creates a mock of the AccountQueryClient -// which allows the caller to call GetApplication any times and will return -// an application with the given address. -func NewTestAccountQueryClient( - t *testing.T, -) *mockclient.MockAccountQueryClient { - ctrl := gomock.NewController(t) - - accoutQuerier := mockclient.NewMockAccountQueryClient(ctrl) - accoutQuerier.EXPECT().GetAccount(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - address string, - ) (account accounttypes.AccountI, err error) { - anyPk := (*codectypes.Any)(nil) - if pk, ok := addressAccountMap[address]; ok { - anyPk, err = codectypes.NewAnyWithValue(pk) - if err != nil { - return nil, err - } - } - return &accounttypes.BaseAccount{ - Address: address, - PubKey: anyPk, - }, nil - }). - AnyTimes() - - return accoutQuerier -} - -// addAddressToAccountMap adds the given address to the addressAccountMap -// to mock it "existing" on chain, it will also remove the address from the -// map when the test is cleaned up. -func addAddressToAccountMap(t *testing.T, address string, pubkey cryptotypes.PubKey) { - t.Helper() - addressAccountMap[address] = pubkey - t.Cleanup(func() { - delete(addressAccountMap, address) - }) -} diff --git a/testutil/testclient/testqueryclients/appquerier.go b/testutil/testclient/testqueryclients/appquerier.go deleted file mode 100644 index 85432f35c..000000000 --- a/testutil/testclient/testqueryclients/appquerier.go +++ /dev/null @@ -1,90 +0,0 @@ -package testqueryclients - -import ( - "context" - "testing" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// appToGatewayMap is a map of: -// -// applicationAddresses -> list of the app's delegated gateway addresses. -// -// All addresses are assumed to exist on chain. -var appToGatewayMap map[string][]string - -func init() { - appToGatewayMap = make(map[string][]string) -} - -// NewTestApplicationQueryClient creates a mock of the ApplicationQueryClient -// which allows the caller to call GetApplication any times and will return -// an application with the given address. -func NewTestApplicationQueryClient( - t *testing.T, -) *mockclient.MockApplicationQueryClient { - ctrl := gomock.NewController(t) - - applicationQuerier := mockclient.NewMockApplicationQueryClient(ctrl) - applicationQuerier.EXPECT().GetApplication(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - appAddress string, - ) (application apptypes.Application, err error) { - delegateeAddresses, ok := appToGatewayMap[appAddress] - if !ok { - return apptypes.Application{}, apptypes.ErrAppNotFound - } - return apptypes.Application{ - Address: appAddress, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - { - Service: &sharedtypes.Service{ - Id: "svc1", - Name: "service one", - }, - }, - }, - DelegateeGatewayAddresses: delegateeAddresses, - }, nil - }). - AnyTimes() - - return applicationQuerier -} - -// AddAddressToApplicationMap adds the given address to the addressApplicationMap -// with the given delegated gateways addresses. It also adds it to the -// addressAccountMap so that the account will be deemed to exist on chain. -func AddAddressToApplicationMap( - t *testing.T, - address string, pubkey cryptotypes.PubKey, - delegateeAccounts map[string]cryptotypes.PubKey, -) { - t.Helper() - addAddressToAccountMap(t, address, pubkey) - delegateeAddresses := make([]string, 0) - for delegateeAddress, delegateePubKey := range delegateeAccounts { - delegateeAddresses = append(delegateeAddresses, delegateeAddress) - addAddressToAccountMap(t, delegateeAddress, delegateePubKey) - } - appToGatewayMap[address] = delegateeAddresses - t.Cleanup(func() { - delete(appToGatewayMap, address) - }) -} - -// RemoveAddressFromApplicationMap removes the given address from the -// addressApplicationMap. -func RemoveAddressFromApplicationMap(t *testing.T, address string) { - t.Helper() - delete(appToGatewayMap, address) -} diff --git a/testutil/testclient/testqueryclients/godoc.go b/testutil/testclient/testqueryclients/godoc.go deleted file mode 100644 index 4148a0e17..000000000 --- a/testutil/testclient/testqueryclients/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package testqueryclients provides helper functions for contstructing mock -// AccountQueryClient objects parameterized call arguments, return value(s), -// and/or expectations thereof. Intended for use in tests. -package testqueryclients diff --git a/testutil/testclient/testqueryclients/sessionquerier.go b/testutil/testclient/testqueryclients/sessionquerier.go deleted file mode 100644 index c8c24770a..000000000 --- a/testutil/testclient/testqueryclients/sessionquerier.go +++ /dev/null @@ -1,101 +0,0 @@ -package testqueryclients - -import ( - "context" - "encoding/hex" - "fmt" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/testutil/mockclient" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// blockHashBz is the []byte representation of the block hash used in the tests. -var blockHashBz []byte - -// sessionsMap is a map of: sessionId -> Session. -// If a sessionId is not present in the map, it implies we have not encountered -// that session yet. -var sessionsMap map[string]*sessiontypes.Session - -func init() { - sessionsMap = make(map[string]*sessiontypes.Session) - - var err error - if blockHashBz, err = hex.DecodeString("1B1051B7BF236FEA13EFA65B6BE678514FA5B6EA0AE9A7A4B68D45F95E4F18E0"); err != nil { - panic(fmt.Errorf("error while trying to decode block hash: %w", err)) - } -} - -// NewTestSessionQueryClient creates a mock of the SessionQueryClient -// which allows the caller to call GetSession any times and will return -// the session matching the app address, serviceID and the blockHeight passed. -func NewTestSessionQueryClient( - t *testing.T, -) *mockclient.MockSessionQueryClient { - ctrl := gomock.NewController(t) - - sessionQuerier := mockclient.NewMockSessionQueryClient(ctrl) - sessionQuerier.EXPECT().GetSession(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - address string, - serviceId string, - blockHeight int64, - ) (session *sessiontypes.Session, err error) { - sessionId, _ := sessionkeeper.GetSessionId(address, serviceId, blockHashBz, blockHeight) - - session, ok := sessionsMap[sessionId] - if !ok { - return nil, fmt.Errorf("error while trying to retrieve a session") - } - - return session, nil - }). - AnyTimes() - - return sessionQuerier -} - -// AddToExistingSessions adds the given session to the sessionsMap to mock it "existing" -// on chain, it will also remove the sessions from the map when the test is cleaned up. -func AddToExistingSessions( - t *testing.T, - appAddress string, - serviceId string, - blockHeight int64, - suppliersAddress []string, -) { - t.Helper() - - sessionId, _ := sessionkeeper.GetSessionId(appAddress, serviceId, blockHashBz, blockHeight) - - session := sessiontypes.Session{ - Header: &sessiontypes.SessionHeader{ - Service: &sharedtypes.Service{Id: serviceId}, - ApplicationAddress: appAddress, - SessionId: sessionId, - SessionStartBlockHeight: sessionkeeper.GetSessionStartBlockHeight(blockHeight), - SessionEndBlockHeight: sessionkeeper.GetSessionEndBlockHeight(blockHeight), - }, - NumBlocksPerSession: sessionkeeper.NumBlocksPerSession, - SessionNumber: sessionkeeper.GetSessionNumber(blockHeight), - SessionId: sessionId, - Suppliers: []*sharedtypes.Supplier{}, - } - - for _, supplierAddress := range suppliersAddress { - supplier := &sharedtypes.Supplier{Address: supplierAddress} - session.Suppliers = append(session.Suppliers, supplier) - } - - sessionsMap[sessionId] = &session - - t.Cleanup(func() { - delete(sessionsMap, sessionId) - }) -} diff --git a/testutil/testclient/testqueryclients/supplierquerier.go b/testutil/testclient/testqueryclients/supplierquerier.go deleted file mode 100644 index 6dd6b32b1..000000000 --- a/testutil/testclient/testqueryclients/supplierquerier.go +++ /dev/null @@ -1,106 +0,0 @@ -package testqueryclients - -import ( - "context" - "errors" - "testing" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/mockclient" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// suppliersProvidedServicesMap is a map of maps: -// -// supplierAddress -> {service -> []SupplierEndpoint} -// -// If an address is not present in the map it is then assumed that the supplier does -// not exist (has not staked) -var suppliersProvidedServicesMap map[string]map[string][]*sharedtypes.SupplierEndpoint - -func init() { - suppliersProvidedServicesMap = make(map[string]map[string][]*sharedtypes.SupplierEndpoint) -} - -// NewTestSupplierQueryClient creates a mock of the SupplierQueryClient -// which allows the caller to call GetSupplier any times and will return -// an application with the given address. -func NewTestSupplierQueryClient( - t *testing.T, -) *mockclient.MockSupplierQueryClient { - ctrl := gomock.NewController(t) - - supplierQuerier := mockclient.NewMockSupplierQueryClient(ctrl) - supplierQuerier.EXPECT().GetSupplier(gomock.Any(), gomock.Any()). - DoAndReturn(func( - _ context.Context, - address string, - ) (supplier sharedtypes.Supplier, err error) { - supplierProvidedServices, ok := suppliersProvidedServicesMap[address] - if !ok { - return sharedtypes.Supplier{}, errors.New("address not found") - } - - services := []*sharedtypes.SupplierServiceConfig{} - - for serviceId, providedService := range supplierProvidedServices { - serviceConfig := &sharedtypes.SupplierServiceConfig{ - Service: &sharedtypes.Service{ - Id: serviceId, - }, - Endpoints: []*sharedtypes.SupplierEndpoint{}, - } - - for _, endpointConfig := range providedService { - endpoint := &sharedtypes.SupplierEndpoint{ - Url: endpointConfig.Url, - RpcType: endpointConfig.RpcType, - } - serviceConfig.Endpoints = append(serviceConfig.Endpoints, endpoint) - } - - services = append(services, serviceConfig) - } - - return sharedtypes.Supplier{ - Address: address, - Services: services, - }, nil - }). - AnyTimes() - - return supplierQuerier -} - -// AddSupplierWithServiceEndpoints adds the given address and ServiceEndpoints -// to the suppliersProvidedServicesMap to mock it "existing" on chain, -// it will also remove the address from the map when the test is cleaned up. -func AddSuppliersWithServiceEndpoints( - t *testing.T, - address, service string, - endpoints []*sharedtypes.SupplierEndpoint, -) { - t.Helper() - require.NotEmpty(t, endpoints) - - supplier, ok := suppliersProvidedServicesMap[address] - if !ok { - supplier = make(map[string][]*sharedtypes.SupplierEndpoint) - } - - serviceEndpoints, ok := supplier[service] - if !ok { - serviceEndpoints = []*sharedtypes.SupplierEndpoint{} - } - - serviceEndpoints = append(serviceEndpoints, endpoints...) - - supplier[service] = serviceEndpoints - suppliersProvidedServicesMap[address] = supplier - - t.Cleanup(func() { - delete(addressAccountMap, address) - }) -} diff --git a/testutil/testclient/testsupplier/client.go b/testutil/testclient/testsupplier/client.go deleted file mode 100644 index 841cfc024..000000000 --- a/testutil/testclient/testsupplier/client.go +++ /dev/null @@ -1,71 +0,0 @@ -package testsupplier - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/pokt-network/smt" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/supplier" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// NewLocalnetClient creates and returns a new supplier client that connects to -// the localnet sequencer. -func NewLocalnetClient( - t *testing.T, - signingKeyName string, -) client.SupplierClient { - t.Helper() - - txClientOpt := tx.WithSigningKeyName(signingKeyName) - supplierClientOpt := supplier.WithSigningKeyName(signingKeyName) - - txCtx := testtx.NewLocalnetContext(t) - txClient := testtx.NewLocalnetClient(t, txClientOpt) - - deps := depinject.Supply( - txCtx, - txClient, - ) - - supplierClient, err := supplier.NewSupplierClient(deps, supplierClientOpt) - require.NoError(t, err) - return supplierClient -} - -func NewOneTimeClaimProofSupplierClient( - ctx context.Context, - t *testing.T, -) *mockclient.MockSupplierClient { - t.Helper() - - ctrl := gomock.NewController(t) - supplierClientMock := mockclient.NewMockSupplierClient(ctrl) - supplierClientMock.EXPECT(). - CreateClaim( - gomock.Eq(ctx), - gomock.AssignableToTypeOf(sessiontypes.SessionHeader{}), - gomock.AssignableToTypeOf([]byte{}), - ). - Return(nil). - Times(1) - - supplierClientMock.EXPECT(). - SubmitProof( - gomock.Eq(ctx), - gomock.AssignableToTypeOf(sessiontypes.SessionHeader{}), - gomock.AssignableToTypeOf((*smt.SparseMerkleClosestProof)(nil)), - ). - Return(nil). - Times(1) - - return supplierClientMock -} diff --git a/testutil/testclient/testtx/client.go b/testutil/testclient/testtx/client.go deleted file mode 100644 index 405c24a2e..000000000 --- a/testutil/testclient/testtx/client.go +++ /dev/null @@ -1,95 +0,0 @@ -package testtx - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -type signAndBroadcastFn func(context.Context, cosmostypes.Msg) either.AsyncError - -// TODO_CONSIDERATION: functions like these (NewLocalnetXXX) could probably accept -// and return depinject.Config arguments to support shared dependencies. - -// NewLocalnetClient creates and returns a new client for use with the localnet -// sequencer. -func NewLocalnetClient(t *testing.T, opts ...client.TxClientOption) client.TxClient { - t.Helper() - - ctx := context.Background() - txCtx := NewLocalnetContext(t) - eventsQueryClient := testeventsquery.NewLocalnetClient(t) - blockClient := testblock.NewLocalnetClient(ctx, t) - - deps := depinject.Supply( - txCtx, - eventsQueryClient, - blockClient, - ) - - txClient, err := tx.NewTxClient(ctx, deps, opts...) - require.NoError(t, err) - - return txClient -} - -// NewOneTimeDelayedSignAndBroadcastTxClient constructs a mock TxClient with the -// expectation to perform a SignAndBroadcast operation with a specified delay. -func NewOneTimeDelayedSignAndBroadcastTxClient( - t *testing.T, - ctx context.Context, - delay time.Duration, -) *mockclient.MockTxClient { - t.Helper() - - signAndBroadcast := newSignAndBroadcastSucceedsDelayed(delay) - return NewOneTimeSignAndBroadcastTxClient(t, ctx, signAndBroadcast) -} - -// NewOneTimeSignAndBroadcastTxClient constructs a mock TxClient with the -// expectation to perform a SignAndBroadcast operation, which will call and receive -// the return from the given signAndBroadcast function. -func NewOneTimeSignAndBroadcastTxClient( - t *testing.T, - ctx context.Context, - signAndBroadcast signAndBroadcastFn, -) *mockclient.MockTxClient { - t.Helper() - - ctrl := gomock.NewController(t) - - txClient := mockclient.NewMockTxClient(ctrl) - txClient.EXPECT().SignAndBroadcast( - gomock.Eq(ctx), - gomock.Any(), - ).DoAndReturn(signAndBroadcast).Times(1) - - return txClient -} - -// newSignAndBroadcastSucceedsDelayed returns a signAndBroadcastFn that succeeds -// after the given delay. -func newSignAndBroadcastSucceedsDelayed(delay time.Duration) signAndBroadcastFn { - return func(ctx context.Context, msg cosmostypes.Msg) either.AsyncError { - errCh := make(chan error) - - go func() { - time.Sleep(delay) - close(errCh) - }() - - return either.AsyncErr(errCh) - } -} diff --git a/testutil/testclient/testtx/context.go b/testutil/testclient/testtx/context.go deleted file mode 100644 index aa255d650..000000000 --- a/testutil/testclient/testtx/context.go +++ /dev/null @@ -1,275 +0,0 @@ -package testtx - -import ( - "context" - "fmt" - "testing" - - "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" - cometbytes "github.com/cometbft/cometbft/libs/bytes" - cometrpctypes "github.com/cometbft/cometbft/rpc/core/types" - comettypes "github.com/cometbft/cometbft/types" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmostx "github.com/cosmos/cosmos-sdk/client/tx" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/tx" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient" -) - -// NewLocalnetContext creates and returns a new transaction context configured -// for use with the localnet sequencer. -func NewLocalnetContext(t *testing.T) client.TxContext { - t.Helper() - - flagSet := testclient.NewLocalnetFlagSet(t) - clientCtx := testclient.NewLocalnetClientCtx(t, flagSet) - txFactory, err := cosmostx.NewFactoryCLI(*clientCtx, flagSet) - require.NoError(t, err) - require.NotEmpty(t, txFactory) - - deps := depinject.Supply( - *clientCtx, - txFactory, - ) - - txCtx, err := tx.NewTxContext(deps) - require.NoError(t, err) - - return txCtx -} - -// TODO_IMPROVE: these mock constructor helpers could include parameters for the -// "times" (e.g. exact, min, max) values which are passed to their respective -// gomock.EXPECT() method calls (i.e. Times(), MinTimes(), MaxTimes()). -// When implementing such a pattern, be careful about making assumptions about -// correlations between these "times" values and the contexts in which the expected -// methods may be called. - -// NewOneTimeErrTxTimeoutTxContext creates a mock transaction context designed to -// simulate a specific timeout error scenario during transaction broadcasting. -// expectedErrMsg is populated with the same error message which is presented in -// the result from the QueryTx method so that it can be asserted against. -func NewOneTimeErrTxTimeoutTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, - signingKeyName string, - expectedErrMsg *string, -) *mockclient.MockTxContext { - t.Helper() - - signerKey, err := keyring.Key(signingKeyName) - require.NoError(t, err) - - signerAddr, err := signerKey.GetAddress() - require.NoError(t, err) - - *expectedErrMsg = fmt.Sprintf( - "fee payer address: %s does not exist: unknown address", - signerAddr.String(), - ) - - var expectedTx cometbytes.HexBytes - txCtxMock := NewBaseTxContext( - t, signingKeyName, - keyring, - &expectedTx, - ) - - // intercept #BroadcastTx() call to mock response and prevent actual broadcast - txCtxMock.EXPECT().BroadcastTx(gomock.Any()). - DoAndReturn( - func(txBytes []byte) (*cosmostypes.TxResponse, error) { - var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() - return &cosmostypes.TxResponse{ - Height: 1, - TxHash: expectedTxHash.String(), - }, nil - }, - ).Times(1) - - txCtxMock.EXPECT().QueryTx( - gomock.AssignableToTypeOf(context.Background()), - gomock.AssignableToTypeOf([]byte{}), - gomock.AssignableToTypeOf(false), - ).DoAndReturn( - func( - ctx context.Context, - txHash []byte, - _ bool, - ) (*cometrpctypes.ResultTx, error) { - return &cometrpctypes.ResultTx{ - Hash: txHash, - Height: 1, - TxResult: abci.ResponseDeliverTx{ - Code: 1, - Log: *expectedErrMsg, - Codespace: "test_codespace", - }, - Tx: expectedTx.Bytes(), - }, nil - }, - ) - - return txCtxMock -} - -// NewOneTimeErrCheckTxTxContext creates a mock transaction context to simulate -// a specific error scenario during the ABCI check-tx phase (i.e., during initial -// validation before the transaction is included in the block). -// expectedErrMsg is populated with the same error message which is presented in -// the result from the QueryTx method so that it can be asserted against. -func NewOneTimeErrCheckTxTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, - signingKeyName string, - expectedErrMsg *string, -) *mockclient.MockTxContext { - t.Helper() - - signerKey, err := keyring.Key(signingKeyName) - require.NoError(t, err) - - signerAddr, err := signerKey.GetAddress() - require.NoError(t, err) - - *expectedErrMsg = fmt.Sprintf( - "fee payer address: %s does not exist: unknown address", - signerAddr.String(), - ) - - var expectedTx cometbytes.HexBytes - txCtxMock := NewBaseTxContext( - t, signingKeyName, - keyring, - &expectedTx, - ) - - // intercept #BroadcastTx() call to mock response and prevent actual broadcast - txCtxMock.EXPECT().BroadcastTx(gomock.Any()). - DoAndReturn( - func(txBytes []byte) (*cosmostypes.TxResponse, error) { - var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() - return &cosmostypes.TxResponse{ - Height: 1, - TxHash: expectedTxHash.String(), - RawLog: *expectedErrMsg, - Code: 1, - Codespace: "test_codespace", - }, nil - }, - ).Times(1) - - return txCtxMock -} - -// NewOneTimeTxTxContext creates a mock transaction context primed to respond with -// a single successful transaction response. -func NewOneTimeTxTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, - signingKeyName string, - expectedTx *cometbytes.HexBytes, -) *mockclient.MockTxContext { - t.Helper() - - txCtxMock := NewBaseTxContext( - t, signingKeyName, - keyring, - expectedTx, - ) - - // intercept #BroadcastTx() call to mock response and prevent actual broadcast - txCtxMock.EXPECT().BroadcastTx(gomock.Any()). - DoAndReturn( - func(txBytes []byte) (*cosmostypes.TxResponse, error) { - var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() - return &cosmostypes.TxResponse{ - Height: 1, - TxHash: expectedTxHash.String(), - }, nil - }, - ).Times(1) - - return txCtxMock -} - -// NewBaseTxContext creates a mock transaction context that's configured to expect -// calls to NewTxBuilder, SignTx, and EncodeTx methods, any number of times. -// EncodeTx is used to intercept the encoded transaction bytes and store them in -// the expectedTx output parameter. Each of these methods proxies to the corresponding -// method on a real transaction context. -func NewBaseTxContext( - t *testing.T, - signingKeyName string, - keyring cosmoskeyring.Keyring, - expectedTx *cometbytes.HexBytes, -) *mockclient.MockTxContext { - t.Helper() - - txCtxMock, txCtx := NewAnyTimesTxTxContext(t, keyring) - txCtxMock.EXPECT().NewTxBuilder(). - DoAndReturn(txCtx.NewTxBuilder). - AnyTimes() - txCtxMock.EXPECT().SignTx( - gomock.Eq(signingKeyName), - gomock.AssignableToTypeOf(txCtx.NewTxBuilder()), - gomock.Eq(false), gomock.Eq(false), - ).DoAndReturn(txCtx.SignTx).AnyTimes() - txCtxMock.EXPECT().EncodeTx(gomock.Any()). - DoAndReturn( - func(txBuilder cosmosclient.TxBuilder) (_ []byte, err error) { - // intercept cosmosTxContext#EncodeTx to get the encoded tx cometbytes - *expectedTx, err = txCtx.EncodeTx(txBuilder) - require.NoError(t, err) - return expectedTx.Bytes(), nil - }, - ).AnyTimes() - - return txCtxMock -} - -// NewAnyTimesTxTxContext initializes a mock transaction context that's configured to allow -// arbitrary calls to certain predefined interactions, primarily concerning the retrieval -// of account numbers and sequences. -func NewAnyTimesTxTxContext( - t *testing.T, - keyring cosmoskeyring.Keyring, -) (*mockclient.MockTxContext, client.TxContext) { - t.Helper() - - var ( - ctrl = gomock.NewController(t) - flagSet = testclient.NewLocalnetFlagSet(t) - ) - - // intercept #GetAccountNumberSequence() call to mock response and prevent actual query - accountRetrieverMock := mockclient.NewMockAccountRetriever(ctrl) - accountRetrieverMock.EXPECT().GetAccountNumberSequence(gomock.Any(), gomock.Any()). - Return(uint64(1), uint64(1), nil). - AnyTimes() - - clientCtx := testclient.NewLocalnetClientCtx(t, flagSet). - WithKeyring(keyring). - WithAccountRetriever(accountRetrieverMock) - - txFactory, err := cosmostx.NewFactoryCLI(clientCtx, flagSet) - require.NoError(t, err) - require.NotEmpty(t, txFactory) - - txClientCtx := txtypes.Context(clientCtx) - txCtxDeps := depinject.Supply(txFactory, txClientCtx) - txCtx, err := tx.NewTxContext(txCtxDeps) - require.NoError(t, err) - txCtxMock := mockclient.NewMockTxContext(ctrl) - txCtxMock.EXPECT().GetKeyring().Return(keyring).AnyTimes() - - return txCtxMock, txCtx -} diff --git a/testutil/testcrypto/rings/cache.go b/testutil/testcrypto/rings/cache.go deleted file mode 100644 index ef25eb21b..000000000 --- a/testutil/testcrypto/rings/cache.go +++ /dev/null @@ -1,48 +0,0 @@ -package testrings - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/testutil/mockclient" -) - -// NewRingCacheWithMockDependencies creates a new "real" RingCache with the given -// mock Account and Application queriers supplied as dependencies. A Delegation -// client is required as a dependency and depending on how it is used will -// require a different function to generate the delegations client. -// The queriers are expected to maintain their respective mocked states: -// - Account querier: the account addresses and public keys -// - Application querier: the application addresses delegatee gateway addresses -// -// See: -// -// testutil/testclient/testqueryclients/accquerier.go -// testutil/testclient/testqueryclients/appquerier.go -// testutil/testclient/testdelegation/client.go -// -// for methods to create these queriers and maintain their states. -func NewRingCacheWithMockDependencies( - ctx context.Context, - t *testing.T, - accQuerier *mockclient.MockAccountQueryClient, - appQuerier *mockclient.MockApplicationQueryClient, - delegationClient *mockclient.MockDelegationClient, -) crypto.RingCache { - t.Helper() - - // Create the dependency injector with the mock queriers - logger := polylog.Ctx(ctx) - deps := depinject.Supply(logger, accQuerier, appQuerier, delegationClient) - - ringCache, err := rings.NewRingCache(deps) - require.NoError(t, err) - - return ringCache -} diff --git a/testutil/testcrypto/rings/godoc.go b/testutil/testcrypto/rings/godoc.go deleted file mode 100644 index 3d1e8f2c8..000000000 --- a/testutil/testcrypto/rings/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package testrings provides helper functions for constructing real (e.g. localnet) -// and mock RingCache objects with pre-configured and/or parameterized call -// arguments, return value(s), and/or expectations thereof. Intended for use in tests. -package testrings diff --git a/testutil/testerrors/require.go b/testutil/testerrors/require.go deleted file mode 100644 index 624cdaf6e..000000000 --- a/testutil/testerrors/require.go +++ /dev/null @@ -1,11 +0,0 @@ -package testerrors - -import errorsmod "cosmossdk.io/errors" - -var ( - // ErrAsync is returned when a test assertion fails in a goroutine other than - // the main test goroutine. This is done to avoid concurrent usage of - // t.Fatal() which can cause the test binary to exit before cleanup is complete. - ErrAsync = errorsmod.Register(codespace, 1, "required assertion failed") - codespace = "testerrors" -) diff --git a/testutil/testkeyring/accounts.go b/testutil/testkeyring/accounts.go deleted file mode 100644 index f71fe665d..000000000 --- a/testutil/testkeyring/accounts.go +++ /dev/null @@ -1,118 +0,0 @@ -package testkeyring - -import ( - "encoding/base64" - "encoding/json" - "sync/atomic" - - sdktypes "github.com/cosmos/cosmos-sdk/types" -) - -// PreGeneratedAccount holds the address and mnemonic of an account which was -// pre-generated by the `gen_accounts` package. It is intended to be used ONLY -// in tests. It is useful for scenarios where it is necessary to know the address -// of a specific key in a separate context from that of keyring and/or module -// genesis state construction. -type PreGeneratedAccount struct { - Address sdktypes.AccAddress `json:"address"` - Mnemonic string `json:"mnemonic"` -} - -// PreGeneratedAccountIterator is an iterator over the pre-generated accounts. -// A new iterator populated with existing pre-generated accounts can be created -// with the PreGeneratedAccounts function. Alternatively, a new iterator can be -// created with the NewPreGeneratedAccountIterator function, to which a list of -// pre-generated accounts to be iterated over must be provided. -type PreGeneratedAccountIterator struct { - accounts []*PreGeneratedAccount - nextIndex uint32 -} - -// PreGeneratedAccountAtIndex returns the pre-generated account at the given index. -// It returns nil and false if the index is out of range. -func PreGeneratedAccountAtIndex(index uint32) (_ *PreGeneratedAccount, ok bool) { - if preGeneratedAccounts.nextIndex >= uint32(len(preGeneratedAccounts.accounts)) { - return nil, false - } - - return preGeneratedAccounts.accounts[index], true -} - -// MustPreGeneratedAccountAtIndex returns the pre-generated account at the given index. -// It panics on error; i.e. if the index is out of range. -func MustPreGeneratedAccountAtIndex(index uint32) *PreGeneratedAccount { - account, ok := PreGeneratedAccountAtIndex(index) - if !ok { - panic("index out of range of pre-generated accounts list") - } - return account -} - -// PreGeneratedAccounts returns a new PreGeneratedAccountIterator with the -// accounts which were pre-generated by the `gen_accounts` package (i.e. accounts_table.go). -func PreGeneratedAccounts() *PreGeneratedAccountIterator { - return preGeneratedAccounts.Clone() -} - -// NewPreGeneratedAccountIterator returns a new PreGeneratedAccountIterator with -// the given accounts. It is primarily used by the generated code to initially -// construct the preGeneratedAccounts variable. -func NewPreGeneratedAccountIterator(accounts ...*PreGeneratedAccount) *PreGeneratedAccountIterator { - return &PreGeneratedAccountIterator{ - accounts: accounts, - nextIndex: 0, - } -} - -// Next returns the next account in the iterator. It is safe to call -// concurrently and is guaranteed to return a unique account on each call. -// If the iterator index goes out of range, it returns nil and false. -func (iter *PreGeneratedAccountIterator) Next() (_ *PreGeneratedAccount, ok bool) { - // NB: instead of loading and incrementing in separate steps, just increment - // and use nextIndex-1 for the current index. - nextIndex := atomic.AddUint32(&iter.nextIndex, 1) - currentIndex := nextIndex - 1 - - if currentIndex > uint32(len(iter.accounts)) { - return nil, false - } - - return iter.accounts[currentIndex], true -} - -// Clone returns a new PreGeneratedAccountIterator with the same accounts as the -// receiver but with its nextIndex reset to 0. -func (iter *PreGeneratedAccountIterator) Clone() *PreGeneratedAccountIterator { - return NewPreGeneratedAccountIterator(iter.accounts...) -} - -// Marshal returns the base64 and JSON encoded account string. -func (pga *PreGeneratedAccount) Marshal() (string, error) { - accountJson, err := json.Marshal(pga) - if err != nil { - return "", err - } - - accountStr := base64.StdEncoding.EncodeToString(accountJson) - return accountStr, nil -} - -// UnmarshalString parses the given base64 and JSON encoded account string into -// the PreGeneratedAccount receiver. -func (pga *PreGeneratedAccount) UnmarshalString(encodedAccountStr string) error { - accountJson, err := base64.StdEncoding.DecodeString(encodedAccountStr) - if err != nil { - return err - } - return json.Unmarshal(accountJson, pga) -} - -// mustParsePreGeneratedAccount parses the given base64 and JSON encoded account -// string into a PreGeneratedAccount. It panics on error. -func mustParsePreGeneratedAccount(accountStr string) *PreGeneratedAccount { - account := new(PreGeneratedAccount) - if err := account.UnmarshalString(accountStr); err != nil { - panic(err) - } - return account -} diff --git a/testutil/testkeyring/accounts_table.go b/testutil/testkeyring/accounts_table.go deleted file mode 100644 index 711a25018..000000000 --- a/testutil/testkeyring/accounts_table.go +++ /dev/null @@ -1,111 +0,0 @@ -// DO NOT EDIT. This Code is generated by gen_accounts/gen.go, -// changes will be overwritten upon regeneration. -// -// To regenerate this file, use make go_testgen_accounts or go generate ./testutil/network/keyring.go. - -package testkeyring - -var ( - preGeneratedAccounts = NewPreGeneratedAccountIterator( - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRwZzN5YWU5OWc4bHJ3Nzl3dzBrZzJ6YTg0MzY2ZDZ0NjNrdTdkIiwiTW5lbW9uaWMiOiJsaWtlIGhpcCBzd2FtcCBmb3VuZCBjcnlzdGFsIGZsYW1lIGRlY3JlYXNlIGNydXNoIGNvaW4gY29uZHVjdCBhZmZhaXIgdmlsbGFnZSBjcnVlbCBtb250aCBob3N0IGdsb2JlIHJlZnVzZSByaWdpZCBmZWJydWFyeSBvdmVuIGNvcmUgY3JvcCBpbnB1dCBndWlsdCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczYzI2dG05enp2MnVnbGNhdmFkMGd3dG02azd0cTN0MmtzN2s4IiwiTW5lbW9uaWMiOiJyb2JvdCBzdW5ueSBoaWxsIHNvY2NlciB0b2JhY2NvIHBhbmVsIGluY2x1ZGUgdGFibGUgaW52aXRlIHNoeSB3b3JsZCBwZXJzb24gZG9vciBwdW5jaCBzdGluZyBkZWNvcmF0ZSB3aW5rIHNjaXNzb3JzIG94eWdlbiB0aG91Z2h0IGxpZnQgZGVjbGluZSBtb29uIGxvYW4ifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBzbTVlcDUzaGt5a2RnM3p0NHNwZ214amZ0YXJ6czh1ZjBkZXdqIiwiTW5lbW9uaWMiOiJzdG9uZSBwcmVzZW50IGdvbGQgYmFyZ2FpbiBsZWFmIHJlY2VpdmUgYmFyZ2FpbiByYXcgc2luY2Ugc2hvdmUgYWRqdXN0IGRlcHV0eSByb2NrZXQgZm9sbG93IGxhd3N1aXQgbWFuZ28gc3RhZ2UgcnVud2F5IGRvZyBiZWF1dHkgZ2FzIHNlbnNlIGRpYWdyYW0gdGFzayJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR1bHp3Z3RnN2xkeDJ6dGgzbXNtbXB1d3phN2tsZDUyOTJkenh1IiwiTW5lbW9uaWMiOiJkb25hdGUgYWxpZW4gcGxhbmV0IGRlZXIgbWFuc2lvbiBiZWdpbiBub3RoaW5nIGd1aWx0IGdvb3NlIGNpdmlsIGdhdGUgcHJvZHVjZSBvbGQgZXJyb3IgYmVoYXZlIG1ha2UgZmx1c2ggYmFubmVyIGNyaWNrZXQgbGFrZSBoaXN0b3J5IGxhbXAgdmljdG9yeSB0dW1ibGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTRmODRqbGc3ZHFrNHlmNXY3bDg5cHh2a2FyczZtM2czbGRyYXM0IiwiTW5lbW9uaWMiOiJlbGRlciBncmllZiBmYXRhbCBzaXggY291c2luIHByb2JsZW0gdGlnZXIgdmFsdmUgaGVhdnkgY2hyb25pYyBkZXB0aCBnYXRoZXIgZmljdGlvbiBjaGltbmV5IGNyaXNwIGVjb2xvZ3kgbWFuc2lvbiBleGN1c2UgbGV0dGVyIGZhbGwgZXZva2UgY3Jhd2wgaWdub3JlIG9wZXJhIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWNwY25oanU0MDR6NDQ3Z2x4ZzlxdTNsN3c1ZHdzcGQ1emQ0NWhyIiwiTW5lbW9uaWMiOiJ3aGF0IGVtZXJnZSBob3NwaXRhbCBrZXkgZHV0Y2ggZXhhbXBsZSB1cG9uIGdvb2Qgbm9vZGxlIHNldHRsZSB3aXNlIGNvbm5lY3QgdGlwIGFsbCByb29mIGNvbWJpbmUgZXhwbGFpbiBjaGVzdCBsYWJlbCBsb2dpYyB3YWxrIGZvbGQgdHJheSByYWNjb29uIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNrcm11ZGpldDNrY2xjZGVtMG5qaGdodzloMnBsZnFncmNqdnRlIiwiTW5lbW9uaWMiOiJraXdpIG9wcG9zZSBxdWVzdGlvbiBtb250aCByYW5kb20gZXh0cmEgZW1wb3dlciBiYW5hbmEgd29ydGggYXBhcnQgcmlzayBiZXR3ZWVuIGluc2FuZSByaXZhbCBkdWNrIGxlZyB0cmF2ZWwgcmVuZXcgc29jY2VyIGFkanVzdCBnb2RkZXNzIGNyb3VjaCBkaXNhZ3JlZSB0b3BpYyJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXozZ3NrdjdlNjR5MzZ2eDN6Y3M3ZDYzbnJ1bWRhZnRzNjZ1MjluIiwiTW5lbW9uaWMiOiJtb3ZlIGZsaWdodCBjb21pYyB5b3V0aCBkcmFmdCB0cnV0aCB0cmFzaCBiYXNpYyBsYXdzdWl0IHdpbGQgcHJpZGUgdGlzc3VlIGFwYXJ0IGluaGFsZSB6ZWJyYSBmdWVsIHRyZWF0IGhvdXIgcGhvdG8gdG9zcyB2aXNpdCB0b3AgYWxsZXkgc3R1bWJsZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTh1eHV2djA0MmUzbjd5d3FzMmZmODNzaDM2YzdkOXhuOGx1NmsyIiwiTW5lbW9uaWMiOiJ3b3J0aCBjaGlja2VuIGFybW9yIGNhbG0gaGVuIHRvaWxldCBldm9rZSByb3V0ZSBwYXRjaCBmYW1lIHBvcnRpb24gaG9iYnkgZXhjZXNzIG1hbmRhdGUgd29ybGQgdW5oYXBweSBoYXJkIG1vbSBvbHltcGljIGNyeXN0YWwgb2ZmaWNlIHJlbGllZiBmYXNoaW9uIHN1Y2gifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWtqcGRneG0waHN5YWhxcTQ5NHVocGt3d2w4cXZ5N3JudG12OGxoIiwiTW5lbW9uaWMiOiJva2F5IHBvZW0gYm9vc3QgYmxlYWsgc3F1ZWV6ZSBwaXBlIHRvb2wgZmlsdGVyIHRpbWJlciBzbGFiIGdhaW4gcGVvcGxlIG5ldCBhcnJlc3Qgc2VjdXJpdHkgZGVjYWRlIGNyYWZ0IGFwcGVhciBzbW9rZSBib2R5IGFzc2F1bHQgYmVhY2ggZXhvdGljIGFsdGVyIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXVudXJnd3Zna2s1NmwzM2d3bjA3MjM3NTkwODluOGU0ajRweXJmIiwiTW5lbW9uaWMiOiJ1cmJhbiBicm9jY29saSBncml0IG1lcnJ5IHJvbWFuY2UgbXl0aCBqb2IgZm9jdXMgY2xpY2sgc2h5IHByaW9yaXR5IGFzc2V0IGJyaXNrIHJlY29yZCByZW5ldyB0aW1iZXIgc3RlYWsgZmF0IGd1YXJkIG1vdGhlciBoYW5kIG5vdmVsIGN1cnZlIGxhdmEifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTY1ejRqc3Nncjl5dXNuZXNwdjd2YXk1bjcyNmNoMnYwdHF6dTU1IiwiTW5lbW9uaWMiOiJ0dW5uZWwgaHVtb3IgbWltaWMgZ2F0ZSBwaWxsIGJyZWFkIHRpbnkgc21vb3RoIHRvcGljIHdpc2UgdHdpY2Ugc3VnZ2VzdCBzb3VsIGxpbWl0IGluY3JlYXNlIGFyZWEgb3JhbmdlIHNoZXJpZmYgcHVyc2UgaW5jb21lIGphZ3VhciB3aWZlIG9yZGluYXJ5IHZpb2xpbiJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW12cHl1OTV6bndscnprdDV0ZTdhZXMyeXN5eGhmZHptN3hlbWVsIiwiTW5lbW9uaWMiOiJsYXJnZSBiYW5hbmEgZ3JhcGUgbW9ua2V5IHVwcGVyIGdpYW50IGFjdGlvbiBtdXR1YWwgdGhlb3J5IGJlbmVmaXQgaW5kaWNhdGUgdGF0dG9vIHVwZ3JhZGUgb3BlcmEgY2hhb3MgcGFyYWRlIHNvbWVvbmUgZWR1Y2F0ZSBoYW5kIG5vYmxlIGpva2UgcmViZWwgcmFjY29vbiBhcm0ifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTcwbmFrYTVnd2swOG5xdzVqYXZtZ3A3c3VnMzUwMHMyM242ZzZmIiwiTW5lbW9uaWMiOiJlbGRlciByYXRlIGJ1c2luZXNzIGdvYXQgdGFuayBtYXR0ZXIgdXBncmFkZSByaW5nIHNob3ZlIGVjb25vbXkgYXJ0aXN0IGJhY2hlbG9yIGZsYXZvciBicmlzayBmYW1pbHkgdGVuIGJ1ZGR5IHJvYm90IHJlcXVpcmUgYWRhcHQgc3VjaCBzYWQgc2libGluZyBwaXN0b2wifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTlxcW5yNWE1M2R2azBodGgyNGRobjVhYXMwdm53bHpwbnZyNm1oIiwiTW5lbW9uaWMiOiJrYW5nYXJvbyBsaWNlbnNlIGdvb2Qgb3ZlciBxdWVzdGlvbiBzY3JhcCBhY3Jvc3MgZGVjb3JhdGUgZnJlc2ggaGFtbWVyIG1lcmdlIGNvbmZpcm0gZm9sZCB1bmFibGUgY3JhbSBzcXVlZXplIHN1cHBseSBiaXJ0aCBob3JzZSBkZXRhaWwgd2F2ZSBsaW1pdCBpbmNsdWRlIGhhaXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnN2Z6OWV2YWE4OGd2Nm1nNHA3dmM3Y2hzaGh3Nmg1NmRyM25lIiwiTW5lbW9uaWMiOiJ3aWRlIGJhdHRsZSBsZW9wYXJkIGxlbmQgcmFpbCBkaXZlcnQgZm9nIG9ycGhhbiBvY2VhbiBlbmZvcmNlIHRydWUgY29tcGFueSBkcmF3IGVuam95IHRoYXQgY29yYWwgYmxvdXNlIGZyb250IHNwb25zb3IgY29udHJvbCBjb2xvciB0b3JuYWRvIHBpbmsgYWRhcHQifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZ3cXgwNHJqdmEzdjh4NWYzdnZtbXlwOW1mOHkzajJ1bDk3NmZhIiwiTW5lbW9uaWMiOiJncmllZiBhY3R1YWwgaW5wdXQgYmVsdCBicmFpbiB3aW5nIGp1bmsgeW91bmcgZ2VuaXVzIHBhcmsgY2lnYXIgaHVyZGxlIGxlYWRlciBkZWNlbWJlciB0d2VsdmUgbWl4dHVyZSBjb252aW5jZSB1bmZhaXIgZmxhZyBzY3JpcHQgY2hhb3Mgc3dvcmQgbWlkZGxlIGplbGx5In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWFjMm52eHZ4aHhkaDlrc3U1M2VxdzQzMzg3emM0ajNjNHhrdW52IiwiTW5lbW9uaWMiOiJhbWF6aW5nIGh1bmdyeSBkdXN0IGVycm9yIHNjcnViIG1vcmFsIHdhdGVyIG9idGFpbiBib251cyBwdW5jaCBjbGVyayBicm9jY29saSBwcm91ZCBqdXN0IGNydWlzZSB0dXJrZXkgaWRsZSB0dW5uZWwgc2FsYWQgd2luZG93IHJlbnQgc3RvdmUgc2hhbGxvdyBydWcifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN2eXQ4OGtrYXNkM213ZnhmcWFnbnk0c21oeHA5a2g0Y2FncjAwIiwiTW5lbW9uaWMiOiJyZWFkeSBsaXF1aWQgbW9ua2V5IGluZG9vciBjYWJiYWdlIHRyb3BoeSBidXJkZW4gcGxheSBhbmdsZSByZXZpZXcgdW5sb2NrIGhhaXIgcGFyZW50IGhhcmQgaGFsZiBuZWdhdGl2ZSBwZXJtaXQgcmVndWxhciB0cmFkZSBmcm9zdCBsYWR5IGZ1cnkgcmVndWxhciBzcXVhcmUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXZocWNobTlkNnBybWU1enFsdHlzODYwZ3I3YWNka2RodGtnNnJhIiwiTW5lbW9uaWMiOiJpbnF1aXJ5IGxpYXIgaW1pdGF0ZSBzY2FuIHByZXBhcmUgc3RhdGUgZmluZSBjdXJyZW50IHZpcnVzIHBheW1lbnQgc2hvdmUgbm9ybWFsIGRvdWJsZSB2YXVsdCB0cmF5IGhlYWx0aCByZXNwb25zZSB3YXZlIHJlbmRlciByaXZlciBmbGF0IHNraXJ0IGxlY3R1cmUgdGVuYW50In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxkcTVrbHhjNmw1cjl5Mnc2NXJ2OGdrbmV4YXNkbjBmZzJwemxtIiwiTW5lbW9uaWMiOiJhZGQgaG9ja2V5IGJvb3N0IGNoYXQgc2lsZW50IGVyb2RlIGZsYW1lIGJhdHRsZSBwdXp6bGUgcm91Z2ggc2VjdGlvbiBiZWVmIGxpZ2h0IGZpbmQgcm91dGUgcmFiYml0IHZvaWQgYXJtZWQgbW9yYWwgcmlvdCBjaGFtcGlvbiBkcmlsbCBoYXphcmQgYm9vc3QifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR0ZTA4aHNueWowcmt6em1mcnk4ZXplYWFkcGVkeHQ3eTg1N3c2IiwiTW5lbW9uaWMiOiJoaWRkZW4gc3BhcmUgbW90aW9uIG5pZ2h0IGZhdCB0ZW4gb2J2aW91cyBwdXp6bGUgYWRkcmVzcyBtZWxvZHkgamFja2V0IGVsc2UgaW5mbGljdCBhYmlsaXR5IGtleSB2YWxsZXkgZHJlc3MgcG93ZXIgbXVzaWMgYXdmdWwgc29vbiB1bmRlciBzb3VsIGFybW9yIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTM4dnIwY3hqcHhsbGs1YXVhdWM0Z3V3eGxseWd0MzczOG1jcTBwIiwiTW5lbW9uaWMiOiJ0cmFwIGNvdXNpbiBzaGFsbG93IGZpcnN0IHJveWFsIHRvZ2V0aGVyIHZpYWJsZSBiYW1ib28gYm9tYiBvY3RvYmVyIHZhY2FudCBjYW1wIGZyYW1lIGRpc2FncmVlIGN1cCBjaHVja2xlIHN5bWJvbCBtYXRlcmlhbCBhdWd1c3QgYmVzdCBtYW5hZ2Ugcm9vZiBmbGF2b3IgaW5zaWRlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXIwcDB4eTA3dXhmNngzcDNrZ25yeGN3bjdjNjczY3hlZzJtc240IiwiTW5lbW9uaWMiOiJpZ25vcmUgdG9hc3QgcmluZyBob21lIGFoZWFkIGRlY2VtYmVyIGJpY3ljbGUgbW91c2UgZ2VudGxlIGZsb2F0IG5hbWUgZW1iYXJrIGxhcmdlIGNodXJuIGVtYnJhY2Ugc3dhbXAgZnVybmFjZSBjcmFkbGUgcHVwcHkgYW5jaWVudCBub3NlIGRlc3Ryb3kgb3JkZXIgdmVoaWNsZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW13MjlueXVndWFsNjd5d3E5c2N1NGMzNXZuaHdtcG1zampwNW5hIiwiTW5lbW9uaWMiOiJkYW5nZXIgd2ViIGxlbmQgZXJhc2UgaWdub3JlIHRyYWZmaWMgZGV2b3RlIGtuaWZlIGRvY3VtZW50IHNsZWVwIGludm9sdmUgdHJpcCB3aW5lIHNvbmcgZmVhdHVyZSBtYXJpbmUgbWlzZXJ5IGFyZWEgY2FuZHkgcmFkYXIgYm9tYiBkZXN0cm95IHJlbWVtYmVyIHNpdHVhdGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWs3dzNkbWdrdG1oc3kwa2xoeTlhazBqcjQ1ajdoMzNra3B5anZ4IiwiTW5lbW9uaWMiOiJtZW50aW9uIGp1bXAgaWRlbnRpZnkgY2FwaXRhbCBtZW51IGNvcm4gY2FuY2VsIHJvYWQgZXF1aXAgZW5kb3JzZSB3aW4gYnVyZGVuIGZvc3RlciBsb3ZlIGNsZXJrIHByb2R1Y2UgZ3JlYXQgdGhlcmUgZ2FsYXh5IGRvbmtleSBzZW50ZW5jZSB0cnVjayBqb3VybmV5IHJvdXRlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWQ2cWpqZTlzc3c0cTN6dzkzM3g5OXhkZTZrMzQ4bmx6cHcybThoIiwiTW5lbW9uaWMiOiJjeWNsZSBzdHVtYmxlIGRheSByZXNpc3QgYnVpbGQgY290dG9uIHZlcmIgcG93ZGVyIGFjY291bnQgdml0YWwgdmlicmFudCBzaW1pbGFyIGZhbWlseSBhZmZvcmQgc2FtZSBtdXR1YWwgcGVsaWNhbiBiYW5hbmEgYnJvdGhlciByb3VnaCBiYXJlbHkgaXNsYW5kIGF3ZXNvbWUgbHVuYXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5xcWZmd2xnZ3YyZzR3dWFzenU1M3QycWZjd3E5cHZlNHBtdTRjIiwiTW5lbW9uaWMiOiJwYXRpZW50IHNtYWxsIG11dHVhbCBhcmVuYSBmZXcgYm91bmNlIHRvbmUgYXV0aG9yIGJyb29tIGx5cmljcyBiZWdpbiByZXBhaXIgbWV0aG9kIGJyb256ZSBob3RlbCBwbGF0ZSB3aW50ZXIgZHdhcmYgaGFyYm9yIGNhZ2Ugc3Rvb2wgc25pZmYgc29hcCBleGNsdWRlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWprMHVyaGRsYWF0enJwZjJzY3l3MmhjeHN5eGVyeHAyazV5ODlnIiwiTW5lbW9uaWMiOiJtaW5kIG1hbmRhdGUgYXNzYXVsdCB0ZXJtIGdsb29tIGJsYWRlIGNodXJuIHZlcmlmeSBicmlkZ2UgZ3JhbnQgYWhlYWQgZGljZSBqZWFucyBib3kgcGljdHVyZSBiaXJ0aCBleHBlY3QgaHVycnkgc2NhbGUgb2JzZXJ2ZSB0aHJlZSBhbG9uZSBtaXggdmVsdmV0In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXd5d3Y5OTh5emxqcXZmNzNkMGVncm5qejVzdTZubGh1enFrM3plIiwiTW5lbW9uaWMiOiJ0dXJuIGVuZm9yY2UgZmFjZSBtdWNoIHV0aWxpdHkgcGF0aWVudCBhcnQgYnJvd24gYm94IHVwc2V0IGxhYm9yIGVuZG9yc2UgdGFnIGVhcnRoIG9mZmljZSBsb3VuZ2UgZGl2b3JjZSBiYXNlIGdsYXJlIGx1bWJlciB0b2UgdG93biBwaXRjaCBzaXN0ZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBoeXhnaGN4NGZ5bnZydDR5NG52eW5kenhoMGRyOWZ4N3NrNXA3IiwiTW5lbW9uaWMiOiJyaXZhbCB0d28gbWFyZ2luIGh1bnQgYnVkZ2V0IHdhaXQgdHJpYmUgc3VubnkgcGlnZW9uIHB1bHAgc2hvb3QgdHJlYXQga2V5IGRpc2FncmVlIHVtYnJlbGxhIG9yaWVudCBuYXR1cmUgdG9tb3Jyb3cgbGVjdHVyZSBsb2dpYyByYW5jaCBzaGFmdCBmb3NzaWwgY2FuY2VsIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5kejRsNHN1OWRjcWVxcjd1eDR3enJzY3c0dmVoZ2hxNXo4cnBoIiwiTW5lbW9uaWMiOiJ0aW1iZXIgdGVuYW50IHNpbmcgbHVuY2ggc2VlZCBiZWx0IGxldHRlciBydWxlIHNjYXR0ZXIgZmFsc2Ugcm90YXRlIGl0ZW0gY2xldmVyIHNsaWdodCBmaWx0ZXIgZmVlIHRyeSBibG9zc29tIGZsb2NrIGdyZWVuIHVudXN1YWwgbmV0IHNuYXAgYXdmdWwifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWd5dGt5aDJoZHk0YzNqNzJxZGRrMjNjNmNsenV4emszMHRlY3ByIiwiTW5lbW9uaWMiOiJoYXZlIGxhbmd1YWdlIGhvcGUgY2hvaWNlIGZlZGVyYWwgYmljeWNsZSBxdWl0IGFsbGV5IHBhcmsgcGxlZGdlIHJlcG9ydCBhbm51YWwgc2hydWcgaG9yc2UgYWNjZXNzIGZvcnVtIGJsdWUgc29mdCBtaWRuaWdodCBsYXRpbiB3aWZlIGh1cnJ5IGVyb3Npb24gc2VnbWVudCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVxeXdzOGx2eWRrandsN2VtM2c2ODVjcXZzMGU4amE5NmNjdXRkIiwiTW5lbW9uaWMiOiJub3RhYmxlIGlsbCBkcmFtYSBsdW5jaCBmb3JjZSBib21iIG1hcmdpbiBpZGxlIGZpbmUgdGFzdGUgZGlzaCBub3RhYmxlIHB1c2ggZXhpdCBhaXJwb3J0IGNhc2lubyBzY2hvb2wgY2FnZSBzdHVtYmxlIHRvd24ga2lkIHN1cHJlbWUgYWxhcm0gdGhleSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWN0NDV6a3RnNDd2a3I3a3lyNmVlNG54eWdndzU1c3R4c3ZkN2E5IiwiTW5lbW9uaWMiOiJldmlkZW5jZSBqb2luIHJhdGUgdW5rbm93biBzcG90IHNob2Ugd2hpc3BlciBzZWVkIGNpdmlsIG1haWQgbmVydmUgZG9ub3IgYmFsY29ueSBjcm91Y2ggc29jY2VyIG9rYXkgb2ZmZXIgamVsbHkgYWdlbnQgY3Jhd2wgY2FudmFzIGVsZGVyIHNhbmQgZGF1Z2h0ZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXh5bGEzbjNtY2RnOGdmbHJ4dmR3cG1ycDlhYWQ1eGZmcTY4eDY3IiwiTW5lbW9uaWMiOiJzb29uIGdvc3BlbCBmcmFnaWxlIHNhbG1vbiBnb29kIGVjaG8gcGFycm90IGRpbGVtbWEgc3BhcmUgZmF0aWd1ZSB0d2luIGVzY2FwZSBwYW50aGVyIHRyaXAgZXh0ZW5kIGVuYWN0IGJlYW4gbGVnYWwgYmlydGggY29uZmlybSBlbXBsb3kgY29sbGVjdCBtZWRhbCB2aXRhbCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXNrN2N1YWhxemd2aGRqdWE5djZhcW43eHBkc2c5azVqcWw2ZGx2IiwiTW5lbW9uaWMiOiJwcmlzb24gY2VudHVyeSBwdWRkaW5nIGZyaW5nZSBwcm9maXQgYWxwaGEgZGV2aWNlIGxvY2sgZW1wdHkgYWJvdXQgY3J5IG96b25lIGZlYXR1cmUgdmlvbGluIHlvdXRoIGRlY2lkZSByYXZlbiBkaXNwbGF5IHRhbGVudCB1c2FnZSBsb25lbHkgaGludCBoYWlyIHZpbnRhZ2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw4dXYydXRkZXJmNDczYW14Zno3bGw1djBlNWpnbWtqaGc5MHJyIiwiTW5lbW9uaWMiOiJ2b2lkIHNpYmxpbmcgd2FybSBmZWJydWFyeSBiaWN5Y2xlIGJlaGF2ZSBydXJhbCBjaHJvbmljIGNoZXJyeSBmYW1lIGRpc29yZGVyIHN3aXRjaCBicm93biBzYW1lIGNsaWVudCBnb29zZSBkcmlmdCB0b3NzIGFyZWEgcGVybWl0IGRlY3JlYXNlIHJpdHVhbCBpbmhhbGUgYmlydGgifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhncXduZzM4MGdka25xdHcza2ZyOXRweXE4em5ldHVrcWdrbTBoIiwiTW5lbW9uaWMiOiJ2aWN0b3J5IHdvcnRoIHllYXIgcmVkdWNlIGxlYWRlciBleGl0IHJhcGlkIHRydWNrIHNjYW4gbWl4ZWQgbGltaXQgbWFyaW5lIGluc3BpcmUgdGVzdCB3b3J0aCByZXBhaXIgY29tbW9uIHNpbWlsYXIgZ2hvc3QgY29uZ3Jlc3Mgc2NhcmUgZmluZ2VyIGFyY3RpYyBkb3NlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNkcW05M2poZDI5anJqdjl6eWFxOGtteTk2d3RqcXgycDh5ZnltIiwiTW5lbW9uaWMiOiJzaG92ZSBwcm92aWRlIG1lYXN1cmUgbGVhZiBkb25vciBnb3Zlcm4gcmViZWwgcmV0aXJlIGNvcHkgb25jZSBuYXN0eSBzdWJqZWN0IHNldHRsZSBjcnkgZmF2b3JpdGUgd2VhciBkaXNtaXNzIGFzdGhtYSBrZWVwIGZpbmFsIG1vZGVsIHRyaWdnZXIgbGF0ZXIgYmFycmVsIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBjN2x3am5rejlrZnNsdmZyOHJrOTk0amh6dmowMDIyeXpoazU1IiwiTW5lbW9uaWMiOiJzbGlnaHQgbGFiIGNyZXcgZGVmZW5zZSBjb2FjaCB1cG9uIGZhY3VsdHkgYXJlYSB3b2xmIGV4cGxhaW4gbWFudWFsIGdvcmlsbGEgbW9uc3RlciBmbGlwIGV4YWN0IGR1c3QgYmxvb2QgdG95IHBsYXRlIHNhbG1vbiBkaXJlY3QgYWdlIGJ1bGIgdG9uZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWY5c3IyN3Frajk4ZTJ5bXB2MHhjZDJ1Zmsyd2VqbGRsZnpmNHc3IiwiTW5lbW9uaWMiOiJjYW1wIGdhdGUgZ2lhbnQgbWFjaGluZSBwdW1wa2luIHNpYmxpbmcgaHViIHVuaWZvcm0gbGljZW5zZSB1bmRlciBjdXJ2ZSBsYW5ndWFnZSBkZXBhcnQgYXNzdW1lIGFtYXRldXIgZ3JvdyBkaWFsIG11dHVhbCByaWIgdm95YWdlIGdvZGRlc3MgY3JlZWsgYXNrIGNhc2gifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXkwOWM0cmhndDJybWxjenhld2c3eTQ4cmp4aG1qZXM2NTc3dmRzIiwiTW5lbW9uaWMiOiJweXJhbWlkIHJlbmV3IGlsbCBzdG9jayBtYXJibGUgbnV0IGdvcmlsbGEgZGlydCBleGhhdXN0IHNoYWRvdyBjb3JuIGdvc3BlbCBpbnNpZGUgbnVyc2UgZWFydGggZm9vZCBwYXRoIGJ1eWVyIHNhdG9zaGkgY3JhZGxlIHBpZ2VvbiBsZWFmIHNlYXNvbiBzY3J1YiJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTk0ZHZmN2F4ZjB4MnB1cG01ZXh0ejIyd242dWtmNGZrNWozZGhnIiwiTW5lbW9uaWMiOiJ0b3VyaXN0IHVuaWZvcm0gc2tpIHN1cnZleSBpbm5vY2VudCBvYmxpZ2UgZm9yY2UgYmVjb21lIGFjcXVpcmUgcmVtYWluIG11c2hyb29tIGJhbGNvbnkgY2hhcmdlIG1hc3RlciBjaGVlc2UgZW1wbG95IHJpZGUgYmFyIHJvYnVzdCB0aW1iZXIgc29jayB0b3VyaXN0IHVwcGVyIHJlc2lzdCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTQ1dTV3bnZnNXlzd3hqcmx1bXhsbmpjaDJxZndyMjUyem1yZGVqIiwiTW5lbW9uaWMiOiJiZXR3ZWVuIHRyYW5zZmVyIGxpZmUgcm91Z2ggc3RvY2sgaW5oZXJpdCBvdXRlciBza2F0ZSBhbmNpZW50IHRoZXkgYmluZCBjdWJlIG92ZXIgbXlzZWxmIHJlY3ljbGUgc2Vzc2lvbiB2ZW50dXJlIGJvaWwgZW1wdHkgbG9jayBicmVhZCBleHBsYWluIGFyZ3VlIG1hZCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw1bHE1dTh6emc0Z2dyc2Y5ZmdxbDJsODBscjhxYWRmY3F5MGFuIiwiTW5lbW9uaWMiOiJweXJhbWlkIGd1biB2YXBvciBkZXBlbmQgcHVtcGtpbiBwZW4gY3JlZWsga2V0Y2h1cCBjYWxsIGJvb3N0IGNhcGFibGUgbmFwa2luIGF1ZGl0IGFtdXNlZCBzb2x1dGlvbiBsaXR0bGUgbWFwbGUgb2NlYW4gaGlsbCBsb29wIGxpbmsgZ2FsbGVyeSBib3ggc3RlcCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWFkbXdkMjQzbmo0Zmo1MGZsOHcyY2hqdnZucjZqbmduMno5NHkwIiwiTW5lbW9uaWMiOiJsZWdhbCBoZWFydCBva2F5IGFpcnBvcnQgYWdlIGhlZGdlaG9nIHNsZWVwIHJlcGVhdCBhY2N1c2Ugc3ltcHRvbSBmb3N0ZXIgYmluZCBkcmlsbCBjcnVtYmxlIGVmZm9ydCBmbG9jayBtYXJibGUgY3Jvd2QgZ3J1bnQgZ3JhYiBvcmlnaW5hbCBlc3RhdGUgYWRkcmVzcyBwdXNoIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTh5eGo2M3kwdXhtM2U5dzl4ZGE0cGxodzAyZnU4MDA1M2FtenU5IiwiTW5lbW9uaWMiOiJtZW50aW9uIHBsYXkgYmF0dGxlIGxveWFsIHVuZm9sZCBmb3VuZCBjZW50dXJ5IGVuZCBjb21lIGNsdXRjaCB3YWxsIHdvb2QgZW5yaWNoIGVxdWlwIGFybW9yIGJvbnVzIGhlbiB2aWRlbyBtb3JhbCBkb2xsIGFuZ2VyIHNraXJ0IHNvZGEgc2F2ZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczZHQydTdnOW1udWU4amZnamN3ZzZucXA2NjJsdTRjNm0zcHlsIiwiTW5lbW9uaWMiOiJjb25kdWN0IGludGFjdCBhaXNsZSBjaGFvcyBxdWFsaXR5IHRoZW9yeSBjaHVuayBqdWljZSBjcnVpc2UgZmVlIHJpcHBsZSBsaW1pdCBnYXVnZSBmb3Jlc3QgY2hhbmdlIHNhdXNhZ2UgZXh0cmEgYWxwaGEgdXNhZ2UgZXhvdGljIGRyaWZ0IGJyYXNzIGdvcmlsbGEgdGFzdGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBsenR3Z3Qzc2c1dmszbHNtbGtsOTV1cmw1ZDR0bGd4Y3RkZGU5IiwiTW5lbW9uaWMiOiJvYmplY3QgYmFyIGNhbG0gbXl0aCBmZWUgdG9vbCBmaW5nZXIganVuZ2xlIHNpbXBsZSBiYWcgem9uZSBjaGFzZSBzY2hvb2wgYmVuY2ggYmVsdCB0aW1lIHdlYXRoZXIgZXhwcmVzcyBhZmZhaXIgc2NpZW5jZSB2ZXJiIHJlY29yZCBpbnRhY3QgZGFyaW5nIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhsZDhrYTBxaDY3ZjJuNWV4bXplY3RlNjRhd3VkNTNkMGY3bnhhIiwiTW5lbW9uaWMiOiJob2xpZGF5IGxpdHRsZSBwb2xhciBzdWRkZW4gY29uZmlybSBzb25nIGRpYW1vbmQgcHJpZGUganVzdCBkb3ZlIG5vYmxlIGZhdm9yaXRlIGNlbnR1cnkgcnVyYWwgZmFpbnQgYWxpZW4gYWN0dWFsIGhvbGUgZHJpZnQgcG9vbCBhcnJhbmdlIGFscGhhIGJvdHRvbSBlbnRyeSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXc2YzBleW56Zm5zd2RhNXpnOHRta3hrem1sbjNkZHY3cGd5enZ0IiwiTW5lbW9uaWMiOiJ0b25pZ2h0IGZpbGUgZGVmZW5zZSByZW5ldyBjb2lsIHVuY2xlIHBpZyBub2lzZSBibHVyIGVsc2UgZ2xvdmUgcmVtYWluIHJ1ZyBjdXJ0YWluIGNvbmZpcm0gb3JkaW5hcnkgYnVpbGQgY3J1c2ggY2FyZCBsZWF2ZSBmbGF0IGp1bmlvciBkZWJhdGUgd2F0ZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxybTB1dXM5Mzdxeng4Y3hnNXNmNWo5Z2VnanFmd3B6dHAydWd6IiwiTW5lbW9uaWMiOiJzdGF0ZSBvcmNoYXJkIGZ1biBlY29ub215IGxhZGRlciBvY2VhbiBmb3ggYm95IGN1cmlvdXMgYWxidW0gdGVzdCBzdGFpcnMgcG9ldCBlaWdodCBiZXN0IHN0cmVldCBhdXRob3Igc3Bpa2UgdGlueSBmYW4gc2F1c2FnZSBub3RhYmxlIGNydW5jaCBzaG9ydCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNobDdteGN0Y3QyZ2w2cDlnZTc2c2VjZDBtNG14dmp4ZGZmdWQ4IiwiTW5lbW9uaWMiOiJidWxsZXQgZ2lybCBtYXNrIHNhdXNhZ2UgdHJvdWJsZSBhZmZhaXIgcHJlc2VudCBvdmVuIGRpZXNlbCBlcm9zaW9uIHByb2dyYW0gY2hpbW5leSBsYXB0b3AgcGhvbmUgc291cmNlIGh5YnJpZCBidWJibGUgc2hpbmUgaGludCBzdXJ2ZXkgdG9ydG9pc2UgdmF1bHQgcGlhbm8gdGVuYW50In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTI2M2ZkbjQ0dnQwcjBzeWN0MGh1NXMzeTZmeTVsYzIycWN6ZHNyIiwiTW5lbW9uaWMiOiJwYXRjaCBhbmltYWwgZGVicmlzIGltbXVuZSBhcmVhIGRvY3RvciB1dGlsaXR5IHJpYmJvbiByZXZpZXcga2l0dGVuIHByb2dyYW0gY2l0aXplbiBtb3RoZXIgYWxtb3N0IGRlZmluZSB3aGVlbCBhYm92ZSB5ZWxsb3cgdHVpdGlvbiBpZGxlIG1vcmFsIG91dGRvb3Igc3B5IHdpbGwifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTQ4a2NhamY1dzZnZW04dmE5dmhncDl5Nmxxa3JmdXN2Z3Zqc2R6IiwiTW5lbW9uaWMiOiJtYXRyaXggYnVkZ2V0IGNsYWltIHJldGlyZSBnb2xkIGluc3RhbGwgdHJhdmVsIHN0dW1ibGUgbGF0ZXIgcmVzb3VyY2UgY3Jpc3AgY2xhcmlmeSBza2F0ZSB0b3Agc3BvcnQgZ2VucmUgbWFuYWdlIHNvYXAgZnVuIHRyaWdnZXIgZmluZ2VyIGJvcmRlciByZWFkeSBmb3JjZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRlY3M1bHY3OHV0a2V5aHUzc2h6N3cyaGd2MDhmOXk1dm03M2V4IiwiTW5lbW9uaWMiOiJwb29sIHNtYXJ0IGNpZ2FyIG1ldGhvZCBkaXp6eSB0YWxrIG1hbmdvIGJpbmQgd29vbCBicmFja2V0IGZpeCBlYXJseSBwZWFyIGVudmVsb3BlIGFlcm9iaWMgZXZva2UgdHJpZ2dlciBpbmNvbWUgbXlzZWxmIGhlbiBiaXJkIHBvc2l0aW9uIGhvbmV5IGFtb25nIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJ2cXR0dmo5eDAwZW1kYXJxODk2eXJmMmFwYXN4Z3prZnJqOHJmIiwiTW5lbW9uaWMiOiJhZG1pdCB1c2FnZSBjb21wYW55IHJlY2VpdmUgcGF0dGVybiBjcnVlbCBzdW5ueSBuZWVkIGltcHJvdmUgbWlub3IgZGFuY2UgZXNzZW5jZSBzaGFsbG93IGVhcnRoIGlucXVpcnkgbm9vZGxlIGtuZWUgcmVzaXN0IGNvbWJpbmUgdm9pY2Ugc25ha2UgZGl6enkgbWFuIHBpYW5vIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWdkczR5NzRka3owY2pwdWRuZHM2MDY1Zzl4Mng4NHpxbmo2OWNjIiwiTW5lbW9uaWMiOiJ0b2RheSBxdWFydGVyIGludGFjdCBoZWFydCBtb3VzZSBncm91cCBleGN1c2UgbmVhciBmaWxtIHNob2Uga25vdyBjb21pYyB0cm9waHkgcmFpc2UgZm9zdGVyIHN1Z2dlc3QgbWF4aW11bSBvY3RvYmVyIGRpcnQgYXJteSBjdXJ0YWluIGVydXB0IGF0dGVuZCBmb2cifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVmdHZyNWV0dXRocHN0aHJyOWN0M3I0NWFwZ3dqN2tncmM4eGRkIiwiTW5lbW9uaWMiOiJ0aGFuayBmbHkgZGl2b3JjZSBzaHJpbXAgbGFrZSBzaWxrIGd1YXJkIHN5c3RlbSBjYXJ0IGVtYnJhY2UgZWRpdCBwYXBlciB0aWx0IHJpc2sgYmV0dGVyIG1vdG9yIHRvcnRvaXNlIGFjcXVpcmUgZWNobyBmb29kIG9yZGVyIG1hbW1hbCB0d2VsdmUgdm9pY2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW4wMDhycGt5aHlyZHA5c2Z2ZDYyd3p0cHhseXU0eGc5YTVnanR2IiwiTW5lbW9uaWMiOiJjYXNlIGxlc3NvbiBzdXJmYWNlIHNjaXNzb3JzIGNpdmlsIHNvcnJ5IG5lc3QgZXRoaWNzIG1lc3NhZ2UgaG9ybiBhZmZhaXIgZGVtaXNlIGJsb3Nzb20gbXVmZmluIGRyaWZ0IGZhbWUgYmluZCBzaGFyZSBtaWRkbGUgc3BvbnNvciBkZW55IHByZXBhcmUgbGlnaHQgc2hpZnQifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXhkdXc0YWFuanNteXIzZ2s4OGt2OXVjNHA4eG1lbGQzcWxsOXJxIiwiTW5lbW9uaWMiOiJydWRlIGJhc2tldCB0dXJrZXkgZWFybiBpbnNpZGUgYmVjb21lIGF3YWtlIG1vdmUgbGF5ZXIgYmFycmVsIHBlbmNpbCB1bmRvIGxhYm9yIGF2ZXJhZ2UgZHVuZSBjaGFuZ2UgYmFyZ2FpbiBwcmV0dHkgbGl0dGxlIGx1Y2t5IHN1aXQgcmVnaW9uIG1lbW9yeSBsYXp5In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTU4NXA1ZzMyeHZ5N21weDA3eGhkeWF3NHZnZXN2YzRjZ3l5dThsIiwiTW5lbW9uaWMiOiJwYXRjaCB1bmxvY2sgdGhlcmUgY29weSBzaWxlbnQgcmVhZHkgcHVuY2ggdmVyYiBhZ2VudCBpbnZlc3QgbXl0aCByZXZlYWwgZHVuZSBsb25nIGNoaWxkIHN1bnNldCBrbmlmZSBzbWlsZSBtYWQgcm9vbSBtZXJjeSBhdWd1c3QgZ3JhY2UgcmVzb3VyY2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXprNWtkNXA2Z2xlOHJsdzVqZ2huaDh2aHI2ZWNuYXdqbXpucHN3IiwiTW5lbW9uaWMiOiJlY2hvIHdpc2UgY2hhdCBkb2xwaGluIGhhcHB5IG5leHQgdGltZSBmaWN0aW9uIGlkbGUgZmxhdCBwcm9maXQgYXJyb3cgZGlmZmVyIGJlaGF2ZSB0YXN0ZSBmbGlwIGNyb3AgZ2xhbmNlIGNvbmdyZXNzIGZldGNoIGNhcnBldCBzcGljZSBzdGVyZW8gZXZpZGVuY2UifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWY0MDU0azYwZjY5eXVtZnh6ZWc5dmNlbTRzeTByZWQ2cTRza2R5IiwiTW5lbW9uaWMiOiJqYXp6IG5hbWUgYmx1ZSBhbGJ1bSBhc3NldCBjaW5uYW1vbiBwZW5hbHR5IHJ1cmFsIG1hcGxlIGhlYWx0aCBzaWxseSBmbG9hdCBob3Jyb3Iga25pZmUgY2FuYWwgY3ViZSB3aGF0IHRvcHBsZSBlbXB0eSBqZWFucyBzcGhlcmUgYWdyZWUgYmxpbmQgdHJheSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTMwcjNwNG1nOWg1Z3FnanZ5d2hyazh3MDMwOXdkZzl6MmR1Z3ByIiwiTW5lbW9uaWMiOiJjb2FjaCBzZWdtZW50IHBhcnJvdCB1cmJhbiBjbG9jayBleHByZXNzIGp1ZGdlIGRhbWFnZSB2b3lhZ2Ugd2VhciByb3VnaCBoZWFydCBsaXF1aWQgZ3J1bnQgc29jY2VyIHBvaW50IGlkbGUgdGlkZSBzYXRvc2hpIGdpcmwgYmFnIG1hY2hpbmUgaW1wb3NlIGJyb3RoZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXdnNWdjZHg0ZTRoemRwenpkajNuM2hneTNqZHlkbDI1ZGFrbWVlIiwiTW5lbW9uaWMiOiJrbmVlIGNyaXRpYyBwcm92aWRlIGRvZyBvc3RyaWNoIGxhd3N1aXQgYm9uZSBzbWFydCBwcm9qZWN0IGluZGV4IGZhaW50IHNwb2lsIGRlY3JlYXNlIGV4aWxlIGNhdHRsZSBodXJ0IGJsYW5rZXQgYXJ0d29yayBkcnVtIHdhZ29uIHNvdXRoIHVwb24gb3JiaXQgcGhvbmUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVnZjNnZTZ5cW55cjJneHRyNHo3dXI3dnpuN3NsNzZ2NnB0NTJ1IiwiTW5lbW9uaWMiOiJjdXAgY291bnRyeSB0cnVtcGV0IGFjdCBhc3RobWEgdXBwZXIgaW5wdXQgd2FsbnV0IGZsYWcgcHJhY3RpY2Ugc3RhYmxlIGN1dGUgbWlsbGlvbiBmaWd1cmUgbGFkeSBkaXJ0IHNoYXJlIHByZXZlbnQgb2ZmIGFkanVzdCBzdGluZyB0b3JuYWRvIGd1biBqdW5nbGUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXE4c214aDRtY3BlcDNucWE0bHMyd2p3eXlxOXo3cmdhemhxZ2c1IiwiTW5lbW9uaWMiOiJlY2hvIGJhc2UgY2FiYmFnZSBleGhpYml0IGluamVjdCBpY2UgY3JlZGl0IGhhdCBzdGVhayB3YXJmYXJlIGRlc2lnbiBqZXdlbCBjaHVuayBzdGVlbCB1bmRvIGVucmljaCBrZXRjaHVwIHNpeCB0aG91Z2h0IGplYW5zIG11c2V1bSBzZWN1cml0eSBlbGJvdyByb29mIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTk3ZHhmNzMyd3c1M2RwdXl4em4wcThjZ3d0Z3ZmeHZ1dnprZGw3IiwiTW5lbW9uaWMiOiJwaWxvdCBhYmFuZG9uIG11c3QgcmFpbiBkZXNrIGdsb3cgd29ycnkgc2VtaW5hciBncmFpbiByaHl0aG0gZGF3biBsaXF1aWQgd2lsZCBlbm91Z2ggZm9zdGVyIGVuam95IHdyZXN0bGUgZXllYnJvdyBpbnZlc3QgcmVsYXggYmFyIHByb3VkIHN1YmplY3Qgc3R1ZGVudCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnOGQ2dnhnbXNybGd4bXZqeHI2Y2R6dTdqYzQ0aG11dXptNTBmIiwiTW5lbW9uaWMiOiJjbGVhbiBub21pbmVlIHByb29mIGJvbWIga2lkbmV5IHByb2JsZW0gd2lsZCBpc29sYXRlIGhhcmQgYmljeWNsZSBzdXJ2ZXkgbm93IHJlZ3VsYXIgZGlyZWN0IHN1bm55IGNvbmdyZXNzIGFibGUgam91cm5leSBwb3dkZXIgZmF1bHQgbW90aW9uIHRhY2tsZSB2aXZpZCBqb3VybmV5In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJsNGVzcGFsZ3NxZTk4czRzMnd4dmdhY3BhaDNyMnRxZTNneXF4IiwiTW5lbW9uaWMiOiJjbG9nIGxhYiBkb3VibGUgc2VjdGlvbiBkaXp6eSBicmFpbiBpbnRhY3QgZGV2ZWxvcCBtb2RpZnkgaGVkZ2Vob2cgdG93ZXIgc2x1c2ggY2F1Z2h0IGRpdmlkZSBzcGFjZSBsaXR0bGUgdGFzayB0ZXJtIGF0dHJhY3QgbWlkZGxlIHNoaWZ0IGNsdWIgY3VsdHVyZSBodW1hbiJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXgwYXlwYW10ZjN5bjRmbHQ2NjN2dmN0Zmd4d24yZnRucWozM2dzIiwiTW5lbW9uaWMiOiJiYWJ5IGJvcmluZyB3YWdlIHF1YWxpdHkgY2xpbmljIHNpZGUgYWZyYWlkIGtpbmQgd2FsbCBpbm5vY2VudCBzdGluZyBpZGVudGlmeSBjdWJlIG5pY2Ugc2xlZXAgcmFuZ2UgZmVlZCBjYXNpbm8gc3R1bWJsZSB1c2VmdWwgZWRpdCBob3N0IGZyb3N0IGJsaW5kIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWVtZ2ZjZWM4N3o1dXV0MnA5ZHFsYTVtNncwZ3luNzc4eHdwOTN0IiwiTW5lbW9uaWMiOiJidXJzdCBzaWNrIHR3byB0cnVtcGV0IGRyaWZ0IGJvdHRvbSBzaWJsaW5nIGNsb2NrIHllbGxvdyBtYXhpbXVtIGtpc3Mgc2hvY2sgaGVpZ2h0IHRlYWNoIHNhbHV0ZSBpZ25vcmUgY2F1dGlvbiBlYWdlciBmaW5kIGFwb2xvZ3kgc2F0b3NoaSBzcG9vbiBzYWRuZXNzIG1hdHRlciJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWh2Y3Nmc2xzZXQzcXI0ODRocGxuN3FhY2x5cnpyZXc1ejcyd3d0IiwiTW5lbW9uaWMiOiJhaXNsZSBpbnB1dCB0ZW4gZ3JlZW4gbWFuYWdlIHZpYnJhbnQgZmFtZSBidXNpbmVzcyBibGluZCByYWNjb29uIHNsaW0gdHJhaW4gYnVzaW5lc3MgZW5nYWdlIGRlc3Ryb3kgaW1wb3NlIHBsdWcgcG90YXRvIGFib3ZlIHZlc3NlbCBhdmVyYWdlIGFncmVlIHN0ZWVsIGNhdGFsb2cifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxqNmhnaDkzamRjZ2c5NGowNWtnc3ZuYzl2OTd3c3BlcXRjNHU1IiwiTW5lbW9uaWMiOiJiYXR0bGUgYm9udXMgbnVyc2UgYWRkcmVzcyBzZWxsIHRvb3RoIGxhcmdlIGN5Y2xlIHB1ZGRpbmcgZXJhc2UgZGVwb3NpdCBtZWFkb3cgb2JzY3VyZSB0YWcgYWN0IGJhbGwgYXR0cmFjdCBjb3lvdGUgcmVwbGFjZSBpbm1hdGUgb3Bwb3NlIGFyb3VuZCByYXZlbiBwYXBlciJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXhobTVyNTRobHR2M2FzM2hna3d0cW5xdXUybXE0bXdyZ3B6anpzIiwiTW5lbW9uaWMiOiJuZWl0aGVyIGdhbGF4eSB2aXJ1cyBwbGF5IHN1biBiZWxpZXZlIG9ycGhhbiBmaW5nZXIgYnVsayBzaG9jayBsZWcgY2FwdGFpbiBicnVzaCBzcGluIG1pZG5pZ2h0IGx1Y2t5IHVnbHkgcmV1bmlvbiB3ZWVrZW5kIHdvcmQgYnVkZ2V0IHZhbiBzY3JlZW4gc2xlbmRlciJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN4Nm5oZXNsa3RrczV3cXRlOThhYWhxbnVsZGNseG5sZ3ZtdHRtIiwiTW5lbW9uaWMiOiJjYXN0bGUgZW5nYWdlIHNoaWVsZCByb29raWUgY2hlZXNlIHB1enpsZSBiZXR3ZWVuIGZlZWQgbGlvbiBhY2N1c2UgYWhlYWQgY2FudmFzIGltYWdlIGluc3BpcmUgb21pdCBtb3JlIGNyYW5lIGRyYXN0aWMgc3Rvb2wgYmVjb21lIGhvbGUgcGx1Y2sgY29yZSB0cm9waHkifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXE3cDdlYTQ2bGZkaGU0cncycThucGM1cGh2bTJhY2x5bm0wM3R0IiwiTW5lbW9uaWMiOiJhc3N1bWUgdmFuaXNoIHVwcGVyIGdvZGRlc3MgY29taWMgd3JlY2sgdGVhY2ggd3Jpc3QgbWlzZXJ5IGd1ZXNzIHJlbnQgaGF3ayB0ZXh0IHNhbG1vbiBlcXVpcCBnZW51aW5lIGJsdXNoIHZlcmIgY29pbCByb3V0ZSB1cGdyYWRlIGJhZGdlIHN1bm55IHNwZW5kIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW12d3loN2x0NnI5NXJseHBoN3UyMnB3OTZnemp1MDcwZHNycGd3IiwiTW5lbW9uaWMiOiJyYWJiaXQgd2F0ZXIgcGVuY2lsIHRvcm5hZG8gbmFycm93IGV4YWN0IGVuZG9yc2UgZmluZSBnaXJhZmZlIHB1cGlsIG1vbmtleSB2YWNhbnQgd2VpcmQgb2N0b2JlciB0aG91Z2h0IHN0ZWFrIGRlcGVuZCB2b2x1bWUgbmFzdHkgdG9iYWNjbyBzbGVlcCB3ZWFzZWwgYmxvb2QgdGFpbCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWF3M2twcXV6Z2x0c2F1NTRoOWtxZGxuaG1ldjVkNmNudnM1a25rIiwiTW5lbW9uaWMiOiJwb3RhdG8gc3dhcm0geW91dGggY2FzdWFsIHVzZWxlc3MgZ2FyZGVuIGRheSBzZXR0bGUgdG9wcGxlIGZsb2NrIG9idmlvdXMgcmViZWwgYnJpY2sgdmV0ZXJhbiBnbHVlIGZyZXF1ZW50IGJlaGF2ZSBzZW50ZW5jZSBjb29sIHN1cmdlIHVuaWZvcm0gYXR0ZW5kIG1lbnUgZGV2aWNlIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXV3OGwwcHFqNGxxZGFqbnN3NHB1bTd4dHR3c3E0azNqYXh3NnZqIiwiTW5lbW9uaWMiOiJtb3JuaW5nIGZsYXQgb3duIGJhcnJlbCBmcm9nIHNpeCBpbm1hdGUgY2xvd24gcHVkZGluZyBuZWdhdGl2ZSBleG90aWMgaG9ycm9yIHNoZWxsIGNyaW1lIHJpdmFsIGJlc3QgYnJva2VuIGNsaWNrIHN1bnNldCB0YWxlbnQgY2FibGUgZW1wb3dlciBhcm1vciBoZWFkIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXU5dDdjcXJwY3R2bHB5ZGRtMnBkbHJwNm45bDA4bWVyMjd1aHQ4IiwiTW5lbW9uaWMiOiJsZXNzb24gY29yZSBkaXNhZ3JlZSBkaWFsIHNhZCBoaXJlIG1ha2UgbGF0ZXIgZW52ZWxvcGUgaG9tZSBiZWF1dHkgYmVhY2ggYWZmYWlyIHZvdGUgdHJpYWwgZnJvd24gcmF0ZSBjYXN0bGUgcmVjZWl2ZSBvY2N1ciBodW1ibGUgd2VsY29tZSB1bnZlaWwgdW5rbm93biJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXY4aHQwNThyOGM2czJlaGE2bjQyeDZueHBrZnE3cjJ3NjhnejlnIiwiTW5lbW9uaWMiOiJjb29sIGdvc3BlbCBkaXNoIG1ha2UgaGFyZCB3aXNkb20gYmVhY2ggdmlkZW8gYmFyZWx5IGNhdGNoIHNvbGFyIHN0ZXJlbyBmdW5ueSByb2FkIGFubnVhbCBib251cyBnYXRlIGFkanVzdCBsdW5jaCBmbGF0IGV4aXN0IGZldmVyIHN0cm9uZyByb3V0ZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMThoeWg0bnk5Nzh2bTQ3YXN4eXluM3VxeDNkOXJkaDN1aGx1a2hoIiwiTW5lbW9uaWMiOiJjYW1wIGJpZCBtYXplIG9seW1waWMgYmFsYW5jZSBzaWRlIGd1YXJkIHNwYXRpYWwgYXJyZXN0IG1lcnJ5IHBsYXkgc3VtbWVyIGdhdGUgbXVzaHJvb20gc2NpZW5jZSByaXBwbGUgcmVqZWN0IHRvcnRvaXNlIGZsb2NrIHN3YWxsb3cgcnVuIGNodWNrbGUgZWFnbGUgcmVmb3JtIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZmZWRtOXpxMnBndnU1NXczZ2Z0NWRqcWNsa3Vubnc5NHBzZ2RlIiwiTW5lbW9uaWMiOiJ3aGFsZSBiYXJnYWluIGRpdmVydCBzb29uIGVyYXNlIGxvbmVseSBjbG90aCBidWRkeSBzY2llbmNlIHZhcG9yIG1pc3MgcXVvdGUgZml4IGxvb3AgZmllbGQgY2hlY2sgaGlzdG9yeSBwbHVjayB0b2RkbGVyIGltcHVsc2UgbWlyYWNsZSBiZWx0IHBvb2wgaW1tdW5lIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTRuMmU5bWN4dHZxN2xoeWNmZWhrc2YzYXYzMnJ2dTl5d3ZsMjcwIiwiTW5lbW9uaWMiOiJidWxiIGdhcmFnZSBhZGRpY3QgYXJjdGljIHN1YmplY3QgcmF2ZW4gdG9vbCBoZWxtZXQgY2FwYWJsZSBjb3VwbGUgYmFzZSBpbnZlc3QgYmVnaW4gY2FsbCBmYXRpZ3VlIGFsdGVyIGVhc3kgdXNlbGVzcyBnZW5pdXMgdW52ZWlsIGJlZWYga2luZ2RvbSBjb252aW5jZSBkYW5nZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXlwcXk0dHN1NHUwZHhnM2d6OTdyNmtxY2dmNjg0dWN4cGptbWxhIiwiTW5lbW9uaWMiOiJsYXB0b3AgcHJvY2VzcyBub3NlIHRlYWNoIGJhcmVseSBqZXdlbCBpbml0aWFsIGF2b2NhZG8gZGlubmVyIGNoYWxrIHRyYW5zZmVyIG5lYXIgc3dpdGNoIGNhYmJhZ2UgYWJvdXQgY2hhbGsgY2hhaXIgYXNwZWN0IGd1biBsaWJlcnR5IGhvb2Qgc2VsZWN0IGJyYW5kIGthbmdhcm9vIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTByZmwwOG5heWRjZnc4cWtnNmNjdXB6YWRrdGVlZXRkMmx1NmpzIiwiTW5lbW9uaWMiOiJ0d2luIGdsYWQgc2VydmljZSBmaWd1cmUgcm9hc3QgY3JlZWsgb3lzdGVyIHB1bGwgY2xheSBhdXRvIGNsb3VkIGtldGNodXAgYm91bmNlIGZpZWxkIGdlbnRsZSBncmlkIGJyYW5kIHN0YWdlIGhlbG1ldCBzcGF0aWFsIHNwb2lsIHRleHQgY2FydCBzcHJpbmcifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBhZTI4bDNua3FtN25saG5tczBwNnc4OHEyYWdzNWd1MHNrNjZ5IiwiTW5lbW9uaWMiOiJyZWd1bGFyIHdvb2wgb3JhbmdlIGlzbGFuZCBzaXJlbiB1bWJyZWxsYSBjcnVpc2UgYWxsZXkgdGlkZSBmbGlwIHNsYWIgdmVyaWZ5IHNob3VsZGVyIHR3aW4gbWV0YWwga2l0dGVuIGN1cGJvYXJkIGFjcXVpcmUgYWJsZSBzdXJmYWNlIHRlbGwgdW5kbyBiZXN0IGxlZ2VuZCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxoNWhjeG1nOWNna3Bkcm10NzZkeXJheGtwdzhndDR3aHR3ZnQ1IiwiTW5lbW9uaWMiOiJ2b2xjYW5vIGJyb256ZSBzcHJlYWQgbnVtYmVyIHdlYWx0aCBkZWZ5IGNpdGl6ZW4gd2luZSBlZmZvcnQgbmV4dCBoYW1zdGVyIGJldHRlciBsb2NrIHN5bXB0b20gaHVzYmFuZCB1bmlmb3JtIGhvdXIgdmF1bHQgcGl0Y2ggd2FzcCBzd2lmdCBpbmRpY2F0ZSBhZXJvYmljIHRvd2FyZCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWZhNjA0bTdoa3NucXZoc2YydWpjbHFqZ3k1cDIwdXU1c3FoMHltIiwiTW5lbW9uaWMiOiJ3ZWFyIGJhbGwgaW52b2x2ZSBndWVzcyBzcG9uc29yIGVwaXNvZGUgZmljdGlvbiBjcmltZSBib3JpbmcgbWF0aCB3ZWIgc2NlbmUgYm95IGZsaWdodCBhY3RyZXNzIGltYWdlIG1hbnVhbCBxdWljayBtZWNoYW5pYyBiZWNhdXNlIGdyb3cgcnVkZSBub3JtYWwgYW50aXF1ZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNwamZ1YWd3MnRlZDBhbjVhcWhtdDJsOGhrM3Q2YTk1czcyZzV5IiwiTW5lbW9uaWMiOiJzbG93IGRlZmVuc2UgZHJ5IGNyYW0gbHVtYmVyIGdpYW50IGRhdWdodGVyIG1ldGFsIGJyZWV6ZSBmb3J3YXJkIG5ldCB3b2xmIGZsYW1lIGRhbXAgcGxhY2UgdHdpc3QgZWxpdGUgcHJvb2YgZWFybHkgcG90dGVyeSBzb25nIGNveW90ZSBsaXphcmQgc29tZW9uZSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTgwODJnZzU3dHlwd3ZxM2N0YWNhZzljcWg5ejJqZjdkbDJzeDlhIiwiTW5lbW9uaWMiOiJsb3ZlIG1lbHQgZ3JpZCBzaGFsbG93IGZhY3VsdHkgdG9zcyBzdXJyb3VuZCBpbWl0YXRlIG5lY2sgY2F0IGJhc2ljIHNsaWdodCBqYWd1YXIgYWNyb3NzIGdpdmUgYWJzZW50IHJlZ2lvbiBncmF2aXR5IGVuZG9yc2UgYnJpZ2h0IHNpbXBsZSBvY3RvYmVyIHJldW5pb24gc3RvcnkifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxqd3Jsczg3MnB4MnEwNWFyZmdrazZnajQ0YXBxOHM1ajk5Z3Q1IiwiTW5lbW9uaWMiOiJzY291dCBtb2JpbGUgcmVjYWxsIG1lbWJlciByYWxseSB0aWx0IGNhcmQgaW50byB1bWJyZWxsYSBmZWVkIHZlcnNpb24gbm92ZWwgZ2lyYWZmZSBoYW1tZXIgem9uZSBrZWVuIG9yaWVudCBoYWxmIGRpc2FncmVlIGJlYWNoIHBvZXQgaW1wYWN0IGRpbm5lciBtYXNrIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVzYTc4eTRkZ2tlc3oyN3k5bTZyNDByMDBzZTdtd2h5MjU2dGxoIiwiTW5lbW9uaWMiOiJnb2RkZXNzIGZpeCBjcmFuZSByaWdpZCBjYXN1YWwgd2hlYXQgc3ByYXkgY3JlYW0gY29pbiBsZWFmIGRpc3BsYXkgaHVyZGxlIGVuc3VyZSBhcm1lZCBjb3JyZWN0IGJ1bmtlciBpZGVudGlmeSBkb25hdGUgc3Bpa2UgZmFudGFzeSByZWxpZWYgZGlzYWdyZWUgZ3JhcGUgc2hvdWxkZXIifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTN6OWNteHVrdzdoaHYzNXgweDU0YXZhbXJuOXA2NWF0cGcybmR4IiwiTW5lbW9uaWMiOiJtb25zdGVyIGxhbmd1YWdlIHZvY2FsIGZseSBtYXJjaCBqb2tlIG5ldXRyYWwgamVsbHkgY2h1cm4gZ29kZGVzcyB3ZWFyIGNhbG0gdmFsaWQgbm93IGF1dHVtbiBsaWFyIHdhbnQgc3Bvb24gZ2xvb20gaGlnaCBqdXN0IHNvbWVvbmUgbWFudWFsIGVuZXJneSJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZjdTB4cTRyeDhlZWZqN3BrMmY5cHJmcmttejhtM3g1bWtyNjZyIiwiTW5lbW9uaWMiOiJtb3JuaW5nIG9mdGVuIGxhdGVyIGVjaG8geW91bmcgZGlsZW1tYSB1bnZlaWwgc3Vuc2V0IGdsYW5jZSBzaG9wIG9ic2VydmUgZXhwaXJlIHN0YWdlIG1lbWJlciBzaGlmdCBhY291c3RpYyBjb25maXJtIHJhZGlvIGp1ZGdlIGxhYiBtdWZmaW4gdHJpbSBnZW51aW5lIGJ1aWxkIn0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXQzcnVxZmN6aGp5cjRycDU5amNkdjZ4dmgwNnNhcDZuMzBjc2FhIiwiTW5lbW9uaWMiOiJsdW5jaCBib3Jyb3cgZGVmeSBwb29sIGxvY2FsIGdyYW50IHNoaXAgbXVzaHJvb20gYXdrd2FyZCBpbmNsdWRlIGtpZCBiZWx0IHBhaXIgaW50byBsZW5zIHRyYXZlbCByZWZsZWN0IHJvdXRlIG1pbmQgZW5hYmxlIG5lY2sga25lZSBzaXggd2lkdGgifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWg4MmVnOXBuN3pzM2w1bHRqdHN6ejN0MGdkNWVhejdnd3lyN2M1IiwiTW5lbW9uaWMiOiJzeXN0ZW0gdHJ5IGVhZ2VyIGNhcmQgbGVzc29uIGN1cnRhaW4gYmVjYXVzZSBmbGFtZSBpbWl0YXRlIHNpemUgc2libGluZyBsYXRlciBoaWdoIHNhbXBsZSBjbGF3IHNjYXR0ZXIgdXNlIHNlcmllcyBiYWNoZWxvciBwZXBwZXIgbmV4dCBhZ2FpbiBhbmdyeSBsb2dpYyJ9"), - ) -) diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go deleted file mode 100644 index 8b05da7d2..000000000 --- a/testutil/testkeyring/gen_accounts/gen.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build ignore - -package main - -import ( - "bytes" - "flag" - "fmt" - "log" - "os" - "strings" - - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - - "github.com/pokt-network/poktroll/testutil/testkeyring" - - "github.com/pokt-network/poktroll/app" -) - -var ( - flagOut string - flagAccountsLimit int - defaultOutPath = "accounts_table.go" -) - -func init() { - flag.StringVar(&flagOut, "out", defaultOutPath, "the path to the generated go source of pre-generated accounts.") - flag.IntVar(&flagAccountsLimit, "limit", 100, "the number of accounts to generate.") -} - -func main() { - flag.Parse() - - kr := keyring.NewInMemory(app.MakeEncodingConfig().Marshaler) - - preGeneratedAccountLines := make([]string, flagAccountsLimit) - for i := range preGeneratedAccountLines { - record, mnemonic, err := kr.NewMnemonic( - fmt.Sprintf("key-%d", i), - keyring.English, - types.FullFundraiserPath, - keyring.DefaultBIP39Passphrase, - hd.Secp256k1, - ) - addr, err := record.GetAddress() - if err != nil { - log.Fatal(err) - } - - preGeneratedAccount := &testkeyring.PreGeneratedAccount{ - Address: addr, - Mnemonic: mnemonic, - } - - preGeneratedAccountStr, err := preGeneratedAccount.Marshal() - if err != nil { - log.Fatal(err) - } - - preGeneratedAccountLines[i] = fmt.Sprintf(preGeneratedAccountLineFmt, preGeneratedAccountStr) - } - - newPreGeneratedAccountIteratorArgLines := strings.Join(preGeneratedAccountLines, "\n") - outputBuffer := new(bytes.Buffer) - if err := accountsTableTemplate.Execute( - outputBuffer, - map[string]any{ - "newPreGeneratedAccountIteratorArgLines": newPreGeneratedAccountIteratorArgLines, - }, - ); err != nil { - log.Fatal(err) - } - - if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { - log.Fatal(err) - } -} diff --git a/testutil/testkeyring/gen_accounts/template.go b/testutil/testkeyring/gen_accounts/template.go deleted file mode 100644 index e7dfb5b57..000000000 --- a/testutil/testkeyring/gen_accounts/template.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build ignore - -package main - -import "text/template" - -var ( - preGeneratedAccountLineFmt = "\t\tmustParsePreGeneratedAccount(%q)," - accountsTableTemplate = template.Must( - template.New("accounts_table.go").Parse( - `// DO NOT EDIT. This Code is generated by gen_accounts/gen.go, -// changes will be overwritten upon regeneration. -// -// To regenerate this file, use make go_testgen_accounts or go generate ./testutil/testkeyring/keyring.go. - -package testkeyring - -var ( - preGeneratedAccounts = NewPreGeneratedAccountIterator( -{{.newPreGeneratedAccountIteratorArgLines}} - ) -) -`, - ), - ) -) diff --git a/testutil/testkeyring/keyring.go b/testutil/testkeyring/keyring.go deleted file mode 100644 index f6c503d8e..000000000 --- a/testutil/testkeyring/keyring.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:generate go run ./gen_accounts/gen.go ./gen_accounts/template.go - -package testkeyring - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" -) - -// CreatePreGeneratedKeyringAccounts uses the mnemonic from limit number of -// pre-generated accounts to populated the provided keyring, kr. It then returns -// the pre-generated accounts which were used. -// -// TODO_CONSIDERATION: Returning a new PreGeneratedAccountIterator instead of -// the slice of accounts could be more idiomatic. It would only contain keys which -// are known to be in the keyring. -func CreatePreGeneratedKeyringAccounts( - t *testing.T, - kr keyring.Keyring, - limit int, -) []*PreGeneratedAccount { - t.Helper() - - accounts := make([]*PreGeneratedAccount, limit) - for i := range accounts { - preGeneratedAccount := MustPreGeneratedAccountAtIndex(uint32(i)) - - uid := fmt.Sprintf("key-%d", i) - _, err := kr.NewAccount( - uid, - preGeneratedAccount.Mnemonic, - keyring.DefaultBIP39Passphrase, - types.FullFundraiserPath, - hd.Secp256k1, - ) - assert.NoError(t, err) - - accounts[i] = preGeneratedAccount - } - - return accounts[:limit] -} diff --git a/testutil/testpolylog/event.go b/testutil/testpolylog/event.go deleted file mode 100644 index c41708c13..000000000 --- a/testutil/testpolylog/event.go +++ /dev/null @@ -1,193 +0,0 @@ -package testpolylog - -import ( - "bytes" - "fmt" - "reflect" - "strings" - "testing" - - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -type ( - // NewLoggerAndOutputFn is called in the test helper to create a new logger - // configured with the given level and options. It returns the logger and - // the buffer to which the logger writes. It is useful for decoupling test - // helpers from a specific logger implementation and reducing boilerplate - // code in various tests. - NewLoggerAndOutputFn func( - *testing.T, - polylog.Level, - ...polylog.LoggerOption, - ) (polylog.Logger, *bytes.Buffer) - - // NewEventWithLevelFn is called in the test helper to create a new event - // at the given level from the given logger. It is useful for decoupling - // test helpers from a specific logger implementation so that we can - // call `logger.() without knowing the concrete logger - // type nor the level. - NewEventWithLevelFn func( - *testing.T, - polylog.Logger, - polylog.Level, - ) polylog.Event -) - -// EventFuncSpy is a mock which implements a #Fn() method that is intended to be -// used in tests to assert that the function passed to polylog.Event#Func() is -// called with the expected arg(s). -type EventFuncSpy struct{ mock.Mock } - -// Fn is a mock method which can be asserted on via the mock.Mock API. -// See: https://pkg.go.dev/github.com/stretchr/testify@v1.8.4/mock#Mock. -func (m *EventFuncSpy) Fn(event polylog.Event) { - m.Called(event) -} - -// EventMethodTestCase is a test case for expressing and exercising polylog.Event -// methods in a concise way. -type EventMethodTestCase struct { - // Msg is the string to pass to polylog.Event#Msg(), which will be called - // after the event method under test. Usage of Msg is mutually exclusive - // with MsgFmt. If neither are provided, then polylog.Event#Send() is called - // after the event method instead. - Msg string - - // MsgFmt is the format string to pass to polylog.Event#Msgf(), which will - // be called on the event returned from the event method under test. Usage - // of MsgFmt is mutually exclusive with Msg. If neither are provided, then - // polylog.Event#Send() is called after the event method instead. - MsgFmt string - - // MsgFmtArgs are the args to pass to polylog.Event#Msgf(). It is an error - // to provide MsgFmtArgs without also providing MsgFmt or while providing - // Msg. - MsgFmtArgs []any - - // Key is the key to pass to the event method under test. - Key string - - // Value is the value to pass to the event method under test. - Value any - - // EventMethodName is the name of the event method to call on the logger. - EventMethodName string - - // ExpectedOutputContains is the string that is expected to be contained - // in the log output. - ExpectedOutputContains string -} - -// RunEventMethodTests runs a set of tests for a given level. -func RunEventMethodTests( - t *testing.T, - level polylog.Level, - tests []EventMethodTestCase, - newLoggerAndOutput NewLoggerAndOutputFn, - newEventWithLevel NewEventWithLevelFn, - getExpectedLevelOutputContains func(level polylog.Level) string, -) { - t.Helper() - - // Title-case level string so that it can be used as the name of the - // method to call on the logger using reflect and for the sub-test - // descriptions. - // - // TODO_TECHDEBT/TODO_COMMUNITY: `strings.Title()` is deprecated. Follow - // migration guidance in godocs: https://pkg.go.dev/strings@go1.21.4#Title. - levelMethodName := strings.Title(level.String()) - - for _, tt := range tests { - var ( - eventMethodArgs []reflect.Value - doneMethodName string - doneMethodArgs []reflect.Value - ) - - // Ensure that calls to #Msg(), #Msgf(), and #Send() are mutually exclusive. - switch { - case tt.Msg != "": - require.Emptyf(t, tt.MsgFmt, "Msg and MsgFmt are mutually exclusive but MsgFmt was not empty: %s", tt.MsgFmt) - require.Emptyf(t, tt.MsgFmtArgs, "Msg and MsgFmt are mutually exclusive but MsgFmtArgs was not empty: %v", tt.MsgFmtArgs) - - // Set up call args for polylog.Event#Msg() if tt.msg is not empty. - doneMethodName = "Msg" - doneMethodArgs = append(doneMethodArgs, reflect.ValueOf(tt.Msg)) - case tt.MsgFmt != "": - // Set up call args for polylog.Event#Msgf() if tt.msgFmt is not empty. - doneMethodName = "Msgf" - doneMethodArgs = append( - doneMethodArgs, - reflect.ValueOf(tt.MsgFmt), - reflect.ValueOf(tt.MsgFmtArgs), - ) - default: - // Default to calling polylog.Event#Send() if tt.msg and tt.msgFmt are - // both empty. - doneMethodName = "Send" - } - - // Test description for this sub-test is interpolated based on the logger - // level, event, and "done" method names (e.g. `Debug().Msg()` or `Info().Str()`). - // If the event method name is not empty, the done method name is omitted. - // This is done for brevity as not every permutation of event method and done - // method is exercised (nor need they be). - // If the event method name is empty, then the test description is interpolated - // using the level method name and the "done" method name (e.g. `Error().Msg()` - // or `Warn().Send()`). - descMethodName := tt.EventMethodName - if tt.EventMethodName == "" { - descMethodName = doneMethodName - } - testDesc := fmt.Sprintf("%s().%s()", levelMethodName, descMethodName) - - // Run this sub-test for the current level. - t.Run(testDesc, func(t *testing.T) { - logger, logOutput := newLoggerAndOutput(t, level) - - // Need to use reflection in order to minimize the test code necessary - // to exercise all the permutations of logger level and event type methods. - logEvent := newEventWithLevel(t, logger, level) - logEventValue := reflect.ValueOf(logEvent) - - // If tt.EventMethodName is not empty, build the args and call it. - if tt.EventMethodName != "" { - // Append tt.key to polylog.Event#() call args. - if tt.Key != "" { - eventMethodArgs = append(eventMethodArgs, reflect.ValueOf(tt.Key)) - } - // Append tt.value to polylog.Event#() call args. - if tt.Value != nil { - eventMethodArgs = append(eventMethodArgs, reflect.ValueOf(tt.Value)) - } - - // E.g.: logEvent := logger.Debug().Str("str", "str_value") - // or: logEvent := logger.Debug().Bool("bool", true) - logEventValue. - MethodByName(tt.EventMethodName). - Call(eventMethodArgs) - } - - // E.g.: logEvent.Send() - // or: logEvent.Msg("msg") - // or: logEvent.Msgf("meaning of life: %d", 42) - logEventValue. - MethodByName(doneMethodName). - Call(doneMethodArgs) - - // Assert that each line contains the expected prefix. - require.Contains(t, logOutput.String(), getExpectedLevelOutputContains(level)) - - // Assert that the log output contains the expected messages. Split the log - // output into lines and iterate over them. - require.Contains(t, logOutput.String(), tt.ExpectedOutputContains) - - // Print log output for manual inspection. - t.Log(logOutput.String()) - }) - } -} diff --git a/testutil/testpolylog/logger.go b/testutil/testpolylog/logger.go deleted file mode 100644 index d5abf37fc..000000000 --- a/testutil/testpolylog/logger.go +++ /dev/null @@ -1,21 +0,0 @@ -package testpolylog - -import ( - "context" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func NewLoggerWithCtx( - ctx context.Context, - level polylog.Level, -) (polylog.Logger, context.Context) { - levelOpt := polyzero.WithLevel(zerolog.Level(level.Int())) - logger := polyzero.NewLogger(levelOpt) - ctx = logger.WithContext(ctx) - - return logger, ctx -} diff --git a/testutil/testproxy/jsonrpc.go b/testutil/testproxy/jsonrpc.go deleted file mode 100644 index 7aace4f30..000000000 --- a/testutil/testproxy/jsonrpc.go +++ /dev/null @@ -1,24 +0,0 @@ -package testproxy - -// JSONRpcError is the error struct for the JSON RPC response -type JSONRpcError struct { - Code int32 `json:"code"` - Message string `json:"message"` -} - -// JSONRpcErrorReply is the error reply struct for the JSON RPC response -type JSONRpcErrorReply struct { - Id int32 `json:"id"` - Jsonrpc string `json:"jsonrpc"` - Error *JSONRpcError -} - -// prepareJsonRPCResponsePayload prepares a hard-coded JsonRPC payload for a specific response. -func prepareJsonRPCResponsePayload() []byte { - return []byte(`{"jsonrpc":"2.0","id":1,"result":"some result"}`) -} - -// PrepareJsonRPCRequestPayload prepares a hard-coded JsonRPC payload for a specific request. -func PrepareJsonRPCRequestPayload() []byte { - return []byte(`{"method":"someMethod","id":1,"jsonrpc":"2.0","params":["someParam"]}`) -} diff --git a/testutil/testproxy/relayerproxy.go b/testutil/testproxy/relayerproxy.go deleted file mode 100644 index ba1101abf..000000000 --- a/testutil/testproxy/relayerproxy.go +++ /dev/null @@ -1,409 +0,0 @@ -package testproxy - -import ( - "bytes" - "context" - "encoding/hex" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "testing" - - "cosmossdk.io/depinject" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ringtypes "github.com/athanorlabs/go-dleq/types" - keyringtypes "github.com/cosmos/cosmos-sdk/crypto/keyring" - secp256k1 "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/types/bech32" - "github.com/noot/ring-go" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/pkg/signer" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" - testkeyring "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testqueryclients" - testrings "github.com/pokt-network/poktroll/testutil/testcrypto/rings" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TestBehavior is a struct that holds the test context and mocks -// for the relayer proxy tests. -// It is used to provide the context needed by the instrumentation functions -// in order to isolate specific execution paths of the subject under test. -type TestBehavior struct { - ctx context.Context - t *testing.T - // Deps is exported so it can be used by the dependency injection framework - // from the pkg/relayer/proxy/proxy_test.go - Deps depinject.Config - - proxiedServices map[string]*http.Server -} - -// blockHeight is the default block height used in the tests. -const blockHeight = 1 - -// blockHashBz is the []byte representation of the block hash used in the tests. -var blockHashBz []byte - -func init() { - var err error - if blockHashBz, err = hex.DecodeString("1B1051B7BF236FEA13EFA65B6BE678514FA5B6EA0AE9A7A4B68D45F95E4F18E0"); err != nil { - panic(fmt.Errorf("error while trying to decode block hash: %w", err)) - } -} - -// NewRelayerProxyTestBehavior creates a TestBehavior with the provided set of -// behavior function that are used to instrument the tested subject's dependencies -// and isolate specific execution pathways. -func NewRelayerProxyTestBehavior( - ctx context.Context, - t *testing.T, - behaviors ...func(*TestBehavior), -) *TestBehavior { - test := &TestBehavior{ - ctx: ctx, - t: t, - proxiedServices: make(map[string]*http.Server), - } - - for _, behavior := range behaviors { - behavior(test) - } - - return test -} - -// WithRelayerProxyDependenciesForBlockHeight creates the dependencies for the relayer proxy -// from the TestBehavior.mocks so they have the right interface and can be -// used by the dependency injection framework. -// blockHeight being the block height that will be returned by the block client's -// LastNBlock method -func WithRelayerProxyDependenciesForBlockHeight( - keyName string, - blockHeight int64, -) func(*TestBehavior) { - return func(test *TestBehavior) { - logger := polylog.Ctx(test.ctx) - accountQueryClient := testqueryclients.NewTestAccountQueryClient(test.t) - applicationQueryClient := testqueryclients.NewTestApplicationQueryClient(test.t) - sessionQueryClient := testqueryclients.NewTestSessionQueryClient(test.t) - supplierQueryClient := testqueryclients.NewTestSupplierQueryClient(test.t) - - blockClient := testblock.NewAnyTimeLastNBlocksBlockClient(test.t, []byte{}, blockHeight) - keyring, _ := testkeyring.NewTestKeyringWithKey(test.t, keyName) - - redelegationObs, _ := channel.NewReplayObservable[client.Redelegation](test.ctx, 1) - delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(test.ctx, test.t, "", redelegationObs) - ringCache := testrings.NewRingCacheWithMockDependencies(test.ctx, test.t, accountQueryClient, applicationQueryClient, delegationClient) - - deps := depinject.Supply( - logger, - accountQueryClient, - ringCache, - blockClient, - sessionQueryClient, - supplierQueryClient, - keyring, - ) - - test.Deps = deps - } -} - -// WithRelayerProxiedServices creates the services that the relayer proxy will -// proxy requests to. -// It creates an HTTP server for each service and starts listening on the -// provided host. -func WithRelayerProxiedServices( - proxiedServices map[string]*config.RelayMinerProxyConfig, -) func(*TestBehavior) { - return func(test *TestBehavior) { - for _, proxy := range proxiedServices { - for serviceId, service := range proxy.Suppliers { - server := &http.Server{Addr: service.ServiceConfig.Url.Host} - server.Handler = http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { - w.Write(prepareJsonRPCResponsePayload()) - }) - go func() { server.ListenAndServe() }() - go func() { - <-test.ctx.Done() - server.Shutdown(test.ctx) - }() - - test.proxiedServices[serviceId] = server - } - } - } -} - -// WithDefaultSupplier creates the default staked supplier for the test -func WithDefaultSupplier( - supplierKeyName string, - supplierEndpoints map[string][]*sharedtypes.SupplierEndpoint, -) func(*TestBehavior) { - return func(test *TestBehavior) { - var keyring keyringtypes.Keyring - - err := depinject.Inject(test.Deps, &keyring) - require.NoError(test.t, err) - - supplierAccount, err := keyring.Key(supplierKeyName) - require.NoError(test.t, err) - - supplierAccAddress, err := supplierAccount.GetAddress() - require.NoError(test.t, err) - - supplierAddress := supplierAccAddress.String() - - for serviceId, endpoints := range supplierEndpoints { - testqueryclients.AddSuppliersWithServiceEndpoints( - test.t, - supplierAddress, - serviceId, - endpoints, - ) - } - } -} - -// WithDefaultApplication creates the default staked application actor for the test -func WithDefaultApplication(appPrivateKey *secp256k1.PrivKey) func(*TestBehavior) { - return func(test *TestBehavior) { - appPubKey := appPrivateKey.PubKey() - appAddress := GetAddressFromPrivateKey(test, appPrivateKey) - delegateeAccounts := map[string]cryptotypes.PubKey{} - - testqueryclients.AddAddressToApplicationMap( - test.t, - appAddress, - appPubKey, - delegateeAccounts, - ) - } -} - -// WithDefaultSessionSupplier adds the default staked supplier to the -// application's current session -// If the supplierKeyName is empty, the supplier will not be staked so we can -// test the case where the supplier is not in the application's session's supplier list. -func WithDefaultSessionSupplier( - supplierKeyName string, - serviceId string, - appPrivateKey *secp256k1.PrivKey, -) func(*TestBehavior) { - return func(test *TestBehavior) { - if supplierKeyName == "" { - return - } - - appAddress := GetAddressFromPrivateKey(test, appPrivateKey) - - sessionSuppliers := []string{} - var keyring keyringtypes.Keyring - err := depinject.Inject(test.Deps, &keyring) - require.NoError(test.t, err) - - supplierAccount, err := keyring.Key(supplierKeyName) - require.NoError(test.t, err) - - supplierAccAddress, err := supplierAccount.GetAddress() - require.NoError(test.t, err) - - supplierAddress := supplierAccAddress.String() - sessionSuppliers = append(sessionSuppliers, supplierAddress) - - testqueryclients.AddToExistingSessions( - test.t, - appAddress, - serviceId, - blockHeight, - sessionSuppliers, - ) - } -} - -// WithSuccessiveSessions creates sessions with SessionNumber 0 through SessionCount -1 -// and adds all of them to the sessionMap. -// Each session is configured for the same serviceId and application provided. -func WithSuccessiveSessions( - supplierKeyName string, - serviceId string, - appPrivateKey *secp256k1.PrivKey, - sessionsCount int, -) func(*TestBehavior) { - return func(test *TestBehavior) { - appAddress := GetAddressFromPrivateKey(test, appPrivateKey) - - sessionSuppliers := []string{} - var keyring keyringtypes.Keyring - err := depinject.Inject(test.Deps, &keyring) - require.NoError(test.t, err) - - supplierAccount, err := keyring.Key(supplierKeyName) - require.NoError(test.t, err) - - supplierAccAddress, err := supplierAccount.GetAddress() - require.NoError(test.t, err) - - supplierAddress := supplierAccAddress.String() - sessionSuppliers = append(sessionSuppliers, supplierAddress) - - // Adding `sessionCount` sessions to the sessionsMap to make them available - // to the MockSessionQueryClient. - for i := 0; i < sessionsCount; i++ { - testqueryclients.AddToExistingSessions( - test.t, - appAddress, - serviceId, - sessionkeeper.NumBlocksPerSession*int64(i), - sessionSuppliers, - ) - } - } -} - -// TODO_TECHDEBT(@red-0ne): This function only supports JSON-RPC requests and -// needs to have its http.Request "Content-Type" header passed-in as a parameter -// and take out the GetRelayResponseError function which parses JSON-RPC responses -// to make it RPC-type agnostic. - -// MarshalAndSend marshals the request and sends it to the provided service. -func MarshalAndSend( - test *TestBehavior, - proxiedServices map[string]*config.RelayMinerProxyConfig, - proxyServeName string, - serviceId string, - request *servicetypes.RelayRequest, -) (errCode int32, errorMessage string) { - reqBz, err := request.Marshal() - require.NoError(test.t, err) - - var scheme string - switch proxiedServices[proxyServeName].Type { - case config.ProxyTypeHTTP: - scheme = "http" - default: - require.FailNow(test.t, "unsupported proxy type") - } - - reader := io.NopCloser(bytes.NewReader(reqBz)) - req := &http.Request{ - Method: http.MethodPost, - Header: http.Header{ - "Content-Type": []string{"application/json"}, - }, - URL: &url.URL{Scheme: scheme, Host: proxiedServices[proxyServeName].Host}, - Host: proxiedServices[proxyServeName].Suppliers[serviceId].Hosts[0], - Body: reader, - } - res, err := http.DefaultClient.Do(req) - require.NoError(test.t, err) - require.NotNil(test.t, res) - - return GetRelayResponseError(test.t, res) -} - -// GetRelayResponseError returns the error code and message from the relay response. -// If the response is not an error, it returns `0, ""`. -func GetRelayResponseError(t *testing.T, res *http.Response) (errCode int32, errMsg string) { - responseBody, err := io.ReadAll(res.Body) - require.NoError(t, err) - - relayResponse := &servicetypes.RelayResponse{} - err = relayResponse.Unmarshal(responseBody) - if err != nil { - return 0, "cannot unmarshal request body" - } - - var payload JSONRpcErrorReply - err = json.Unmarshal(relayResponse.Payload, &payload) - if err != nil { - return 0, "cannot unmarshal request payload" - } - - if payload.Error == nil { - return 0, "" - } - - return payload.Error.Code, payload.Error.Message -} - -// GetApplicationRingSignature crafts a ring signer for test purposes and uses -// it to sign the relay request -func GetApplicationRingSignature( - t *testing.T, - req *servicetypes.RelayRequest, - appPrivateKey *secp256k1.PrivKey, -) []byte { - publicKey := appPrivateKey.PubKey() - curve := ring_secp256k1.NewCurve() - - point, err := curve.DecodeToPoint(publicKey.Bytes()) - require.NoError(t, err) - - // At least two points are required to create a ring signer so we are reusing - // the same key for it - points := []ringtypes.Point{point, point} - pointsRing, err := ring.NewFixedKeyRingFromPublicKeys(curve, points) - require.NoError(t, err) - - scalar, err := curve.DecodeToScalar(appPrivateKey.Bytes()) - require.NoError(t, err) - - signer := signer.NewRingSigner(pointsRing, scalar) - - signableBz, err := req.GetSignableBytesHash() - require.NoError(t, err) - - signature, err := signer.Sign(signableBz) - require.NoError(t, err) - - return signature -} - -// GetAddressFromPrivateKey returns the address of the provided private key -func GetAddressFromPrivateKey(test *TestBehavior, privKey *secp256k1.PrivKey) string { - addressBz := privKey.PubKey().Address() - address, err := bech32.ConvertAndEncode("pokt", addressBz) - require.NoError(test.t, err) - return address -} - -// GenerateRelayRequest generates a relay request with the provided parameters -func GenerateRelayRequest( - test *TestBehavior, - privKey *secp256k1.PrivKey, - serviceId string, - blockHeight int64, - payload []byte, -) *servicetypes.RelayRequest { - appAddress := GetAddressFromPrivateKey(test, privKey) - sessionId, _ := sessionkeeper.GetSessionId(appAddress, serviceId, blockHashBz, blockHeight) - - return &servicetypes.RelayRequest{ - Meta: &servicetypes.RelayRequestMetadata{ - SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: appAddress, - SessionId: string(sessionId[:]), - Service: &sharedtypes.Service{Id: serviceId}, - SessionStartBlockHeight: sessionkeeper.GetSessionStartBlockHeight(blockHeight), - SessionEndBlockHeight: sessionkeeper.GetSessionEndBlockHeight(blockHeight), - }, - // The returned relay is unsigned and must be signed elsewhere for functionality - Signature: []byte(""), - }, - Payload: payload, - } -} diff --git a/testutil/testrelayer/hash.go b/testutil/testrelayer/hash.go deleted file mode 100644 index d8c78e64e..000000000 --- a/testutil/testrelayer/hash.go +++ /dev/null @@ -1,16 +0,0 @@ -package testrelayer - -import ( - "hash" - "testing" - - "github.com/stretchr/testify/require" -) - -// TODO_TECHDEBT(@h5law): Retrieve the relay hasher mechanism from the `smt` repo. -func HashBytes(t *testing.T, newHasher func() hash.Hash, relayBz []byte) []byte { - hasher := newHasher() - _, err := hasher.Write(relayBz) - require.NoError(t, err) - return hasher.Sum(nil) -} diff --git a/testutil/testrelayer/miner.go b/testutil/testrelayer/miner.go deleted file mode 100644 index 2a73c865c..000000000 --- a/testutil/testrelayer/miner.go +++ /dev/null @@ -1,34 +0,0 @@ -package testrelayer - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/mockrelayer" -) - -// NewMockOneTimeMiner creates a new mock Miner. This mock Miner will expect a -// call to MinedRelays with the given context and expectedRelayObs args. When -// that call is made, returnedMinedRelaysObs is returned. -func NewMockOneTimeMiner( - ctx context.Context, - t *testing.T, - expectedRelaysObs relayer.RelaysObservable, - returnedMinedRelaysObs relayer.MinedRelaysObservable, -) *mockrelayer.MockMiner { - t.Helper() - - ctrl := gomock.NewController(t) - minerMock := mockrelayer.NewMockMiner(ctrl) - minerMock.EXPECT(). - MinedRelays( - gomock.Eq(ctx), - gomock.Eq(expectedRelaysObs), - ). - Return(returnedMinedRelaysObs). - Times(1) - return minerMock -} diff --git a/testutil/testrelayer/options.go b/testutil/testrelayer/options.go deleted file mode 100644 index a63518293..000000000 --- a/testutil/testrelayer/options.go +++ /dev/null @@ -1,23 +0,0 @@ -package testrelayer - -import ( - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/session" -) - -func WithTempStoresDirectory(t *testing.T) relayer.RelayerSessionsManagerOption { - tmpDirPattern := fmt.Sprintf("%s_smt_kvstore", t.Name()) - tmpStoresDir, err := os.MkdirTemp("", tmpDirPattern) - require.NoError(t, err) - - // Delete all temporary files and directories created by the test on completion. - t.Cleanup(func() { _ = os.RemoveAll(tmpStoresDir) }) - - return session.WithStoresDirectory(tmpStoresDir) -} diff --git a/testutil/testrelayer/proxy.go b/testutil/testrelayer/proxy.go deleted file mode 100644 index a876ebec3..000000000 --- a/testutil/testrelayer/proxy.go +++ /dev/null @@ -1,37 +0,0 @@ -package testrelayer - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/mockrelayer" -) - -// NewMockOneTimeRelayerProxy creates a new mock RelayerProxy. This mock -// RelayerProxy will expect a call to ServedRelays with the given context, and -// when that call is made, returnedRelaysObs is returned. It also expects a call -// to Start and Stop with the given context. -func NewMockOneTimeRelayerProxy( - ctx context.Context, - t *testing.T, - returnedRelaysObs relayer.RelaysObservable, -) *mockrelayer.MockRelayerProxy { - t.Helper() - - ctrl := gomock.NewController(t) - relayerProxyMock := mockrelayer.NewMockRelayerProxy(ctrl) - relayerProxyMock.EXPECT(). - Start(gomock.Eq(ctx)). - Times(1) - relayerProxyMock.EXPECT(). - Stop(gomock.Eq(ctx)). - Times(1) - relayerProxyMock.EXPECT(). - ServedRelays(). - Return(returnedRelaysObs). - Times(1) - return relayerProxyMock -} diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go deleted file mode 100644 index 53ddbadc2..000000000 --- a/testutil/testrelayer/relays.go +++ /dev/null @@ -1,44 +0,0 @@ -package testrelayer - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// NewMinedRelay returns a new mined relay with the given session start and end -// heights on the session header, and the bytes and hash fields populated. -func NewMinedRelay( - t *testing.T, - sessionStartHeight int64, - sessionEndHeight int64, -) *relayer.MinedRelay { - relay := servicetypes.Relay{ - Req: &servicetypes.RelayRequest{ - Meta: &servicetypes.RelayRequestMetadata{ - SessionHeader: &sessiontypes.SessionHeader{ - SessionStartBlockHeight: sessionStartHeight, - SessionEndBlockHeight: sessionEndHeight, - }, - }, - }, - Res: &servicetypes.RelayResponse{}, - } - - // TODO_BLOCKER: use canonical codec to serialize the relay - relayBz, err := relay.Marshal() - require.NoError(t, err) - - relayHash := HashBytes(t, miner.DefaultRelayHasher, relayBz) - - return &relayer.MinedRelay{ - Relay: relay, - Bytes: relayBz, - Hash: relayHash, - } -} diff --git a/testutil/testrelayer/sessions_manager.go b/testutil/testrelayer/sessions_manager.go deleted file mode 100644 index b65e0a191..000000000 --- a/testutil/testrelayer/sessions_manager.go +++ /dev/null @@ -1,37 +0,0 @@ -package testrelayer - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/mockrelayer" -) - -// NewMockOneTimeRelayerSessionsManager creates a new mock RelayerSessionsManager. -// This mock RelayerSessionsManager will expect a call to InsertRelays with the -// given context and expectedMinedRelaysObs args. When that call is made, -// returnedMinedRelaysObs is returned. It also expects a call to Start with the -// given context, and stop. -func NewMockOneTimeRelayerSessionsManager( - ctx context.Context, - t *testing.T, - expectedMinedRelaysObs relayer.MinedRelaysObservable, -) *mockrelayer.MockRelayerSessionsManager { - t.Helper() - - ctrl := gomock.NewController(t) - relayerSessionsManagerMock := mockrelayer.NewMockRelayerSessionsManager(ctrl) - relayerSessionsManagerMock.EXPECT(). - InsertRelays(gomock.Eq(expectedMinedRelaysObs)). - Times(1) - relayerSessionsManagerMock.EXPECT(). - Start(gomock.Eq(ctx)). - Times(1) - relayerSessionsManagerMock.EXPECT(). - Stop(). - Times(1) - return relayerSessionsManagerMock -} diff --git a/testutil/tokenomics/mocks/mocks.go b/testutil/tokenomics/mocks/mocks.go deleted file mode 100644 index 595954e65..000000000 --- a/testutil/tokenomics/mocks/mocks.go +++ /dev/null @@ -1,11 +0,0 @@ -package mocks - -// This file is in place to declare the package for dynamically generated structs. -// -// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests -// -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. diff --git a/testutil/yaml/yaml.go b/testutil/yaml/yaml.go deleted file mode 100644 index 56a29cc89..000000000 --- a/testutil/yaml/yaml.go +++ /dev/null @@ -1,31 +0,0 @@ -package yaml - -import "strings" - -// YAML is indentation sensitive, so we need to remove the extra indentation from the test cases and make sure -// it is space-indented instead of tab-indented, otherwise the YAML parser will fail -func NormalizeYAMLIndentation(rawContent string) string { - var processedContent = rawContent - // Remove extra newlines - processedContent = strings.TrimPrefix(processedContent, "\n") - - // Replace tab indentation with 2 spaces as our code is tab-indented but YAML is expecting double spaces - processedContent = strings.ReplaceAll(processedContent, "\t", " ") - - // Get the extra indentation from the first line that will serve as the basis for the rest of the lines - extraIndentationCount := len(processedContent) - len(strings.TrimLeft(processedContent, " ")) - - // Create a prefix to trim from the beginning of each line - extraIndentation := strings.Repeat(" ", extraIndentationCount) - - // Split the content into lines, trim the extra indentation from each line, and rejoin the lines - lines := strings.Split(processedContent, "\n") - for i := range lines { - lines[i] = strings.TrimPrefix(lines[i], extraIndentation) - } - - // Recover the processed content - processedContent = strings.Trim(strings.Join(lines, "\n"), "\n") - - return processedContent -} From fe497117a5196f8f1c1e47f18383abc47db92139 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 12:48:33 +0100 Subject: [PATCH 04/54] chore: temporarily remove `pkg` pkgs --- pkg/appgateserver/cmd/cmd.go | 200 --- .../config/appgate_configs_reader.go | 106 -- .../config/appgate_configs_reader_test.go | 176 --- pkg/appgateserver/config/errors.go | 13 - pkg/appgateserver/endpoint_selector.go | 35 - pkg/appgateserver/error_reply.go | 33 - pkg/appgateserver/errors.go | 12 - pkg/appgateserver/options.go | 19 - pkg/appgateserver/server.go | 266 ---- pkg/appgateserver/synchronous.go | 60 - pkg/client/block/block.go | 48 - pkg/client/block/client.go | 77 - pkg/client/block/client_integration_test.go | 79 - pkg/client/block/client_test.go | 130 -- pkg/client/block/godoc.go | 5 - pkg/client/delegation/client.go | 89 -- .../delegation/client_integration_test.go | 171 --- pkg/client/delegation/client_test.go | 100 -- pkg/client/delegation/godoc.go | 5 - pkg/client/delegation/redelegation.go | 99 -- pkg/client/events/errors.go | 15 - pkg/client/events/godoc.go | 12 - pkg/client/events/options.go | 11 - pkg/client/events/query_client.go | 293 ---- .../events/query_client_integration_test.go | 60 - pkg/client/events/query_client_test.go | 392 ----- pkg/client/events/replay_client.go | 302 ---- .../events/replay_client_example_test.go | 105 -- .../events/replay_client_integration_test.go | 146 -- pkg/client/events/websocket/connection.go | 35 - pkg/client/events/websocket/dialer.go | 35 - pkg/client/events/websocket/errors.go | 11 - pkg/client/events/websocket/godoc.go | 3 - pkg/client/godoc.go | 12 - pkg/client/interface.go | 264 ---- pkg/client/keyring/errors.go | 19 - pkg/client/keyring/keyring.go | 29 - pkg/client/query/accquerier.go | 58 - pkg/client/query/appquerier.go | 64 - pkg/client/query/codec.go | 20 - pkg/client/query/errors.go | 12 - pkg/client/query/godoc.go | 4 - pkg/client/query/sessionquerier.go | 66 - pkg/client/query/supplierquerier.go | 56 - pkg/client/query/types/context.go | 12 - pkg/client/services.go | 19 - pkg/client/supplier/client.go | 151 -- .../supplier/client_integration_test.go | 36 - pkg/client/supplier/client_test.go | 201 --- pkg/client/supplier/options.go | 14 - pkg/client/tx/client.go | 506 ------- pkg/client/tx/client_integration_test.go | 67 - pkg/client/tx/client_test.go | 423 ------ pkg/client/tx/context.go | 100 -- pkg/client/tx/encoding.go | 18 - pkg/client/tx/errors.go | 41 - pkg/client/tx/options.go | 22 - pkg/client/tx/types/context.go | 12 - pkg/crypto/godoc.go | 5 - pkg/crypto/interface.go | 30 - pkg/crypto/rings/cache.go | 278 ---- pkg/crypto/rings/cache_test.go | 307 ---- pkg/crypto/rings/errors.go | 10 - pkg/crypto/rings/godoc.go | 6 - pkg/deps/config/godoc.go | 5 - pkg/deps/config/suppliers.go | 363 ----- pkg/either/either.go | 43 - pkg/either/errors.go | 35 - pkg/either/types.go | 12 - pkg/observable/channel/collect.go | 34 - pkg/observable/channel/map.go | 130 -- pkg/observable/channel/map_test.go | 109 -- pkg/observable/channel/observable.go | 101 -- pkg/observable/channel/observable_test.go | 371 ----- pkg/observable/channel/observation_test.go | 52 - pkg/observable/channel/observer.go | 152 -- pkg/observable/channel/observer_manager.go | 152 -- pkg/observable/channel/observer_test.go | 89 -- pkg/observable/channel/replay.go | 243 ---- pkg/observable/channel/replay_test.go | 240 ---- pkg/observable/errors.go | 8 - pkg/observable/filter/either.go | 62 - pkg/observable/interface.go | 41 - pkg/observable/logging/logging.go | 22 - pkg/observable/types.go | 5 - pkg/partials/errors.go | 11 - pkg/partials/interface.go | 32 - pkg/partials/partial.go | 71 - pkg/partials/partials_test.go | 87 -- pkg/partials/payloads/godoc.go | 8 - pkg/partials/payloads/jsonrpc.go | 82 -- pkg/partials/payloads/rest.go | 51 - pkg/polylog/LICENSE | 32 - pkg/polylog/context.go | 39 - pkg/polylog/context_example_test.go | 43 - pkg/polylog/context_test.go | 43 - pkg/polylog/godoc.go | 17 - pkg/polylog/interface.go | 193 --- pkg/polylog/polyzero/default.go | 15 - pkg/polylog/polyzero/event.go | 205 --- pkg/polylog/polyzero/godoc.go | 9 - pkg/polylog/polyzero/levels.go | 47 - pkg/polylog/polyzero/logger.go | 109 -- pkg/polylog/polyzero/logger_example_test.go | 37 - pkg/polylog/polyzero/logger_test.go | 392 ----- pkg/polylog/polyzero/options.go | 51 - pkg/polylog/polyzero/test_logger.go | 18 - pkg/polylog/types.go | 3 - pkg/relayer/cmd/cmd.go | 345 ----- pkg/relayer/config/errors.go | 14 - .../config/pocket_node_config_hydrator.go | 56 - pkg/relayer/config/proxies_config_hydrator.go | 63 - .../config/proxy_http_config_parser.go | 73 - .../config/relayminer_configs_reader.go | 84 -- .../config/relayminer_configs_reader_test.go | 1265 ----------------- pkg/relayer/config/supplier_hydrator.go | 82 -- .../config/suppliers_config_hydrator.go | 51 - pkg/relayer/config/types.go | 163 --- pkg/relayer/interface.go | 151 -- pkg/relayer/miner/gen/gen_fixtures.go | 304 ---- pkg/relayer/miner/gen/template.go | 37 - pkg/relayer/miner/miner.go | 137 -- pkg/relayer/miner/miner_test.go | 145 -- pkg/relayer/miner/options.go | 11 - pkg/relayer/miner/relay_fixtures_test.go | 33 - pkg/relayer/protocol/block_heights.go | 68 - pkg/relayer/protocol/difficulty.go | 42 - pkg/relayer/protocol/difficulty_test.go | 56 - pkg/relayer/protocol/errors.go | 8 - pkg/relayer/proxy/error_reply.go | 46 - pkg/relayer/proxy/errors.go | 20 - pkg/relayer/proxy/options.go | 21 - pkg/relayer/proxy/proxy.go | 172 --- pkg/relayer/proxy/proxy_test.go | 765 ---------- pkg/relayer/proxy/relay_builders.go | 53 - pkg/relayer/proxy/relay_signer.go | 34 - pkg/relayer/proxy/relay_verifier.go | 168 --- pkg/relayer/proxy/server_builder.go | 109 -- pkg/relayer/proxy/synchronous.go | 285 ---- pkg/relayer/relayminer.go | 98 -- pkg/relayer/relayminer_test.go | 59 - pkg/relayer/session/claim.go | 140 -- pkg/relayer/session/errors.go | 13 - pkg/relayer/session/options.go | 13 - pkg/relayer/session/proof.go | 120 -- pkg/relayer/session/session.go | 274 ---- pkg/relayer/session/session_test.go | 86 -- pkg/relayer/session/sessiontree.go | 225 --- pkg/relayer/session/sessiontree_test.go | 3 - pkg/relayer/types.go | 10 - pkg/retry/retry.go | 77 - pkg/retry/retry_test.go | 337 ----- pkg/sdk/deps_builder.go | 94 -- pkg/sdk/errors.go | 17 - pkg/sdk/interface.go | 32 - pkg/sdk/relay_verifier.go | 82 -- pkg/sdk/sdk.go | 115 -- pkg/sdk/send_relay.go | 109 -- pkg/sdk/session.go | 114 -- pkg/sdk/urls.go | 10 - pkg/signer/interface.go | 9 - pkg/signer/ring_signer.go | 34 - pkg/signer/simple_signer.go | 23 - 163 files changed, 16824 deletions(-) delete mode 100644 pkg/appgateserver/cmd/cmd.go delete mode 100644 pkg/appgateserver/config/appgate_configs_reader.go delete mode 100644 pkg/appgateserver/config/appgate_configs_reader_test.go delete mode 100644 pkg/appgateserver/config/errors.go delete mode 100644 pkg/appgateserver/endpoint_selector.go delete mode 100644 pkg/appgateserver/error_reply.go delete mode 100644 pkg/appgateserver/errors.go delete mode 100644 pkg/appgateserver/options.go delete mode 100644 pkg/appgateserver/server.go delete mode 100644 pkg/appgateserver/synchronous.go delete mode 100644 pkg/client/block/block.go delete mode 100644 pkg/client/block/client.go delete mode 100644 pkg/client/block/client_integration_test.go delete mode 100644 pkg/client/block/client_test.go delete mode 100644 pkg/client/block/godoc.go delete mode 100644 pkg/client/delegation/client.go delete mode 100644 pkg/client/delegation/client_integration_test.go delete mode 100644 pkg/client/delegation/client_test.go delete mode 100644 pkg/client/delegation/godoc.go delete mode 100644 pkg/client/delegation/redelegation.go delete mode 100644 pkg/client/events/errors.go delete mode 100644 pkg/client/events/godoc.go delete mode 100644 pkg/client/events/options.go delete mode 100644 pkg/client/events/query_client.go delete mode 100644 pkg/client/events/query_client_integration_test.go delete mode 100644 pkg/client/events/query_client_test.go delete mode 100644 pkg/client/events/replay_client.go delete mode 100644 pkg/client/events/replay_client_example_test.go delete mode 100644 pkg/client/events/replay_client_integration_test.go delete mode 100644 pkg/client/events/websocket/connection.go delete mode 100644 pkg/client/events/websocket/dialer.go delete mode 100644 pkg/client/events/websocket/errors.go delete mode 100644 pkg/client/events/websocket/godoc.go delete mode 100644 pkg/client/godoc.go delete mode 100644 pkg/client/interface.go delete mode 100644 pkg/client/keyring/errors.go delete mode 100644 pkg/client/keyring/keyring.go delete mode 100644 pkg/client/query/accquerier.go delete mode 100644 pkg/client/query/appquerier.go delete mode 100644 pkg/client/query/codec.go delete mode 100644 pkg/client/query/errors.go delete mode 100644 pkg/client/query/godoc.go delete mode 100644 pkg/client/query/sessionquerier.go delete mode 100644 pkg/client/query/supplierquerier.go delete mode 100644 pkg/client/query/types/context.go delete mode 100644 pkg/client/services.go delete mode 100644 pkg/client/supplier/client.go delete mode 100644 pkg/client/supplier/client_integration_test.go delete mode 100644 pkg/client/supplier/client_test.go delete mode 100644 pkg/client/supplier/options.go delete mode 100644 pkg/client/tx/client.go delete mode 100644 pkg/client/tx/client_integration_test.go delete mode 100644 pkg/client/tx/client_test.go delete mode 100644 pkg/client/tx/context.go delete mode 100644 pkg/client/tx/encoding.go delete mode 100644 pkg/client/tx/errors.go delete mode 100644 pkg/client/tx/options.go delete mode 100644 pkg/client/tx/types/context.go delete mode 100644 pkg/crypto/godoc.go delete mode 100644 pkg/crypto/interface.go delete mode 100644 pkg/crypto/rings/cache.go delete mode 100644 pkg/crypto/rings/cache_test.go delete mode 100644 pkg/crypto/rings/errors.go delete mode 100644 pkg/crypto/rings/godoc.go delete mode 100644 pkg/deps/config/godoc.go delete mode 100644 pkg/deps/config/suppliers.go delete mode 100644 pkg/either/either.go delete mode 100644 pkg/either/errors.go delete mode 100644 pkg/either/types.go delete mode 100644 pkg/observable/channel/collect.go delete mode 100644 pkg/observable/channel/map.go delete mode 100644 pkg/observable/channel/map_test.go delete mode 100644 pkg/observable/channel/observable.go delete mode 100644 pkg/observable/channel/observable_test.go delete mode 100644 pkg/observable/channel/observation_test.go delete mode 100644 pkg/observable/channel/observer.go delete mode 100644 pkg/observable/channel/observer_manager.go delete mode 100644 pkg/observable/channel/observer_test.go delete mode 100644 pkg/observable/channel/replay.go delete mode 100644 pkg/observable/channel/replay_test.go delete mode 100644 pkg/observable/errors.go delete mode 100644 pkg/observable/filter/either.go delete mode 100644 pkg/observable/interface.go delete mode 100644 pkg/observable/logging/logging.go delete mode 100644 pkg/observable/types.go delete mode 100644 pkg/partials/errors.go delete mode 100644 pkg/partials/interface.go delete mode 100644 pkg/partials/partial.go delete mode 100644 pkg/partials/partials_test.go delete mode 100644 pkg/partials/payloads/godoc.go delete mode 100644 pkg/partials/payloads/jsonrpc.go delete mode 100644 pkg/partials/payloads/rest.go delete mode 100644 pkg/polylog/LICENSE delete mode 100644 pkg/polylog/context.go delete mode 100644 pkg/polylog/context_example_test.go delete mode 100644 pkg/polylog/context_test.go delete mode 100644 pkg/polylog/godoc.go delete mode 100644 pkg/polylog/interface.go delete mode 100644 pkg/polylog/polyzero/default.go delete mode 100644 pkg/polylog/polyzero/event.go delete mode 100644 pkg/polylog/polyzero/godoc.go delete mode 100644 pkg/polylog/polyzero/levels.go delete mode 100644 pkg/polylog/polyzero/logger.go delete mode 100644 pkg/polylog/polyzero/logger_example_test.go delete mode 100644 pkg/polylog/polyzero/logger_test.go delete mode 100644 pkg/polylog/polyzero/options.go delete mode 100644 pkg/polylog/polyzero/test_logger.go delete mode 100644 pkg/polylog/types.go delete mode 100644 pkg/relayer/cmd/cmd.go delete mode 100644 pkg/relayer/config/errors.go delete mode 100644 pkg/relayer/config/pocket_node_config_hydrator.go delete mode 100644 pkg/relayer/config/proxies_config_hydrator.go delete mode 100644 pkg/relayer/config/proxy_http_config_parser.go delete mode 100644 pkg/relayer/config/relayminer_configs_reader.go delete mode 100644 pkg/relayer/config/relayminer_configs_reader_test.go delete mode 100644 pkg/relayer/config/supplier_hydrator.go delete mode 100644 pkg/relayer/config/suppliers_config_hydrator.go delete mode 100644 pkg/relayer/config/types.go delete mode 100644 pkg/relayer/interface.go delete mode 100644 pkg/relayer/miner/gen/gen_fixtures.go delete mode 100644 pkg/relayer/miner/gen/template.go delete mode 100644 pkg/relayer/miner/miner.go delete mode 100644 pkg/relayer/miner/miner_test.go delete mode 100644 pkg/relayer/miner/options.go delete mode 100644 pkg/relayer/miner/relay_fixtures_test.go delete mode 100644 pkg/relayer/protocol/block_heights.go delete mode 100644 pkg/relayer/protocol/difficulty.go delete mode 100644 pkg/relayer/protocol/difficulty_test.go delete mode 100644 pkg/relayer/protocol/errors.go delete mode 100644 pkg/relayer/proxy/error_reply.go delete mode 100644 pkg/relayer/proxy/errors.go delete mode 100644 pkg/relayer/proxy/options.go delete mode 100644 pkg/relayer/proxy/proxy.go delete mode 100644 pkg/relayer/proxy/proxy_test.go delete mode 100644 pkg/relayer/proxy/relay_builders.go delete mode 100644 pkg/relayer/proxy/relay_signer.go delete mode 100644 pkg/relayer/proxy/relay_verifier.go delete mode 100644 pkg/relayer/proxy/server_builder.go delete mode 100644 pkg/relayer/proxy/synchronous.go delete mode 100644 pkg/relayer/relayminer.go delete mode 100644 pkg/relayer/relayminer_test.go delete mode 100644 pkg/relayer/session/claim.go delete mode 100644 pkg/relayer/session/errors.go delete mode 100644 pkg/relayer/session/options.go delete mode 100644 pkg/relayer/session/proof.go delete mode 100644 pkg/relayer/session/session.go delete mode 100644 pkg/relayer/session/session_test.go delete mode 100644 pkg/relayer/session/sessiontree.go delete mode 100644 pkg/relayer/session/sessiontree_test.go delete mode 100644 pkg/relayer/types.go delete mode 100644 pkg/retry/retry.go delete mode 100644 pkg/retry/retry_test.go delete mode 100644 pkg/sdk/deps_builder.go delete mode 100644 pkg/sdk/errors.go delete mode 100644 pkg/sdk/interface.go delete mode 100644 pkg/sdk/relay_verifier.go delete mode 100644 pkg/sdk/sdk.go delete mode 100644 pkg/sdk/send_relay.go delete mode 100644 pkg/sdk/session.go delete mode 100644 pkg/sdk/urls.go delete mode 100644 pkg/signer/interface.go delete mode 100644 pkg/signer/ring_signer.go delete mode 100644 pkg/signer/simple_signer.go diff --git a/pkg/appgateserver/cmd/cmd.go b/pkg/appgateserver/cmd/cmd.go deleted file mode 100644 index f8a439716..000000000 --- a/pkg/appgateserver/cmd/cmd.go +++ /dev/null @@ -1,200 +0,0 @@ -package cmd - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/url" - "os" - - "cosmossdk.io/depinject" - cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/rs/zerolog" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/cmd/signals" - "github.com/pokt-network/poktroll/pkg/appgateserver" - appgateconfig "github.com/pokt-network/poktroll/pkg/appgateserver/config" - "github.com/pokt-network/poktroll/pkg/deps/config" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -// We're `explicitly omitting default` so that the appgateserver crashes if these aren't specified. -const omittedDefaultFlagValue = "explicitly omitting default" - -var ( - // flagAppGateConfig is the variable containing the AppGate config filepath - // sourced from the `--config` flag. - flagAppGateConfig string - // flagNodeRPCURL is the variable containing the Cosmos node RPC URL flag value. - flagNodeRPCURL string - // flagNodeGRPCURL is the variable containing the Cosmos node GRPC URL flag value. - flagNodeGRPCURL string -) - -// AppGateServerCmd returns the Cobra command for running the AppGate server. -func AppGateServerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "appgate-server", - Short: "Starts the AppGate server", - Long: `Starts the AppGate server that listens for incoming relay requests and handles -the necessary on-chain interactions (sessions, suppliers, etc) to receive the -respective relay response. - --- App Mode -- -If the server is started with a defined 'self-signing' configuration directive, -it will behave as an Application. Any incoming requests will be signed by using -the private key and ring associated with the 'signing_key' configuration directive. - --- Gateway Mode -- -If the 'self_signing' configuration directive is not provided, the server will -behave as a Gateway. -It will sign relays on behalf of any Application sending it relays, provided -that the address associated with 'signing_key' has been delegated to. This is -necessary for the application<->gateway ring signature to function. - --- App Mode (HTTP) -- -If an application doesn't provide the 'self_signing' configuration directive, -it can still send relays to the AppGate server and function as an Application, -provided that: -1. Each request contains the '?applicationAddr=[address]' query parameter -2. The key associated with the 'signing_key' configuration directive belongs - to the address provided in the request, otherwise the ring signature will not be valid.`, - Args: cobra.NoArgs, - RunE: runAppGateServer, - } - - // Custom flags - cmd.Flags().StringVar(&flagAppGateConfig, "config", "", "The path to the appgate config file") - - // Cosmos flags - // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. - cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query context correctly. It can be used to override the `QueryNodeUrl` field in the config file if specified.") - cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCUrl` field in the config file if specified.") - cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") - - return cmd -} - -func runAppGateServer(cmd *cobra.Command, _ []string) error { - // Create a context that is canceled when the command is interrupted - ctx, cancelCtx := context.WithCancel(cmd.Context()) - defer cancelCtx() - - // Handle interrupt and kill signals asynchronously. - signals.GoOnExitSignal(cancelCtx) - - configContent, err := os.ReadFile(flagAppGateConfig) - if err != nil { - return err - } - - // TODO_TECHDEBT: add logger level and output options to the config. - appGateConfigs, err := appgateconfig.ParseAppGateServerConfigs(configContent) - if err != nil { - return err - } - - // TODO_TECHDEBT: populate logger from the config (ideally, from viper). - loggerOpts := []polylog.LoggerOption{ - polyzero.WithLevel(zerolog.DebugLevel), - polyzero.WithOutput(os.Stderr), - } - - // Construct a logger and associate it with the command context. - logger := polyzero.NewLogger(loggerOpts...) - ctx = logger.WithContext(ctx) - cmd.SetContext(ctx) - - // Setup the AppGate server dependencies. - appGateServerDeps, err := setupAppGateServerDependencies(ctx, cmd, appGateConfigs) - if err != nil { - return fmt.Errorf("failed to setup AppGate server dependencies: %w", err) - } - - logger.Info().Msg("Creating AppGate server...") - - // Create the AppGate server. - appGateServer, err := appgateserver.NewAppGateServer( - appGateServerDeps, - appgateserver.WithSigningInformation(&appgateserver.SigningInformation{ - // provide the name of the key to use for signing all incoming requests - SigningKeyName: appGateConfigs.SigningKey, - // provide whether the appgate server should sign all incoming requests - // with its own ring (for applications) or not (for gateways) - SelfSigning: appGateConfigs.SelfSigning, - }), - appgateserver.WithListeningUrl(appGateConfigs.ListeningEndpoint), - ) - if err != nil { - return fmt.Errorf("failed to create AppGate server: %w", err) - } - - logger.Info(). - Str("listening_endpoint", appGateConfigs.ListeningEndpoint.String()). - Msg("Starting AppGate server...") - - if appGateConfigs.Metrics.Enabled { - err = appGateServer.ServeMetrics(appGateConfigs.Metrics.Addr) - if err != nil { - return fmt.Errorf("failed to start metrics endpoint: %w", err) - } - } - - // Start the AppGate server. - if err := appGateServer.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) { - return fmt.Errorf("failed to start app gate server: %w", err) - } else if errors.Is(err, http.ErrServerClosed) { - logger.Info().Msg("AppGate server stopped") - } - - return nil -} - -func setupAppGateServerDependencies( - ctx context.Context, - cmd *cobra.Command, - appGateConfig *appgateconfig.AppGateServerConfig, -) (_ depinject.Config, err error) { - queryNodeRPCURL := appGateConfig.QueryNodeRPCUrl - queryNodeGRPCURL := appGateConfig.QueryNodeGRPCUrl - - // Override the config file's `QueryNodeGRPCUrl` field - // with the `--grpc-addr` flag if it was specified. - // TODO_TECHDEBT(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeGRPCURL != omittedDefaultFlagValue { - queryNodeGRPCURL, err = url.Parse(flagNodeGRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse grpc query URL: %w", err) - } - } - - // Override the config file's `QueryNodeRPCURL` field - // with the `--node` flag if it was specified. - // TODO_TECHDEBT(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeRPCURL != omittedDefaultFlagValue { - queryNodeRPCURL, err = url.Parse(flagNodeRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse rpc query URL: %w", err) - } - } - - supplierFuncs := []config.SupplierFn{ - config.NewSupplyLoggerFromCtx(ctx), - config.NewSupplyEventsQueryClientFn(queryNodeRPCURL), // leaf - config.NewSupplyBlockClientFn(), // leaf - config.NewSupplyQueryClientContextFn(queryNodeGRPCURL), // leaf - config.NewSupplyDelegationClientFn(), // leaf - config.NewSupplyAccountQuerierFn(), // leaf - config.NewSupplyApplicationQuerierFn(), // leaf - config.NewSupplySessionQuerierFn(), // leaf - config.NewSupplyRingCacheFn(), - - config.NewSupplyPOKTRollSDKFn(appGateConfig.SigningKey), - } - - return config.SupplyConfig(ctx, cmd, supplierFuncs) -} diff --git a/pkg/appgateserver/config/appgate_configs_reader.go b/pkg/appgateserver/config/appgate_configs_reader.go deleted file mode 100644 index 5d59c9e52..000000000 --- a/pkg/appgateserver/config/appgate_configs_reader.go +++ /dev/null @@ -1,106 +0,0 @@ -package config - -import ( - "net/url" - - "gopkg.in/yaml.v2" -) - -// YAMLAppGateServerConfig is the structure used to unmarshal the AppGateServer config file -// TODO_DOCUMENT(@red-0ne): Add proper README documentation for yaml config files. -type YAMLAppGateServerConfig struct { - ListeningEndpoint string `yaml:"listening_endpoint"` - Metrics YAMLAppGateServerMetricsConfig `yaml:"metrics"` - QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` - QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` - SelfSigning bool `yaml:"self_signing"` - SigningKey string `yaml:"signing_key"` -} - -// YAMLAppGateServerMetricsConfig is the structure used to unmarshal the metrics -// section of the AppGateServer config file -type YAMLAppGateServerMetricsConfig struct { - Enabled bool `yaml:"enabled"` - Addr string `yaml:"addr"` -} - -// AppGateServerConfig is the structure describing the AppGateServer config -type AppGateServerConfig struct { - ListeningEndpoint *url.URL - Metrics *AppGateServerMetricsConfig - QueryNodeGRPCUrl *url.URL - QueryNodeRPCUrl *url.URL - SelfSigning bool - SigningKey string -} - -// AppGateServerMetricsConfig is the structure resulting from parsing the metrics -// section of the AppGateServer config file -type AppGateServerMetricsConfig struct { - Enabled bool - Addr string -} - -// ParseAppGateServerConfigs parses the stake config file into a AppGateConfig -// NOTE: If SelfSigning is not defined in the config file, it will default to false -func ParseAppGateServerConfigs(configContent []byte) (*AppGateServerConfig, error) { - var yamlAppGateServerConfig YAMLAppGateServerConfig - - if len(configContent) == 0 { - return nil, ErrAppGateConfigEmpty - } - - // Unmarshal the stake config file into a yamlAppGateConfig - if err := yaml.Unmarshal(configContent, &yamlAppGateServerConfig); err != nil { - return nil, ErrAppGateConfigUnmarshalYAML.Wrap(err.Error()) - } - - if len(yamlAppGateServerConfig.SigningKey) == 0 { - return nil, ErrAppGateConfigEmptySigningKey - } - - if len(yamlAppGateServerConfig.ListeningEndpoint) == 0 { - return nil, ErrAppGateConfigInvalidListeningEndpoint - } - - listeningEndpoint, err := url.Parse(yamlAppGateServerConfig.ListeningEndpoint) - if err != nil { - return nil, ErrAppGateConfigInvalidListeningEndpoint.Wrap(err.Error()) - } - - if len(yamlAppGateServerConfig.QueryNodeGRPCUrl) == 0 { - return nil, ErrAppGateConfigInvalidQueryNodeGRPCUrl - } - - queryNodeGRPCUrl, err := url.Parse(yamlAppGateServerConfig.QueryNodeGRPCUrl) - if err != nil { - return nil, ErrAppGateConfigInvalidQueryNodeGRPCUrl.Wrap(err.Error()) - } - - if len(yamlAppGateServerConfig.QueryNodeRPCUrl) == 0 { - return nil, ErrAppGateConfigInvalidQueryNodeRPCUrl - } - - queryNodeRPCUrl, err := url.Parse(yamlAppGateServerConfig.QueryNodeRPCUrl) - if err != nil { - return nil, ErrAppGateConfigInvalidQueryNodeRPCUrl.Wrap(err.Error()) - } - - // Populate the appGateServerConfig with the values from the yamlAppGateServerConfig - appGateServerConfig := &AppGateServerConfig{ - QueryNodeRPCUrl: queryNodeRPCUrl, - QueryNodeGRPCUrl: queryNodeGRPCUrl, - SigningKey: yamlAppGateServerConfig.SigningKey, - SelfSigning: yamlAppGateServerConfig.SelfSigning, - ListeningEndpoint: listeningEndpoint, - } - - // Not doing additinal validation on metrics, as the server would not start if the value is invalid, - // providing the user with a descriptive error message. - appGateServerConfig.Metrics = &AppGateServerMetricsConfig{ - Enabled: yamlAppGateServerConfig.Metrics.Enabled, - Addr: yamlAppGateServerConfig.Metrics.Addr, - } - - return appGateServerConfig, nil -} diff --git a/pkg/appgateserver/config/appgate_configs_reader_test.go b/pkg/appgateserver/config/appgate_configs_reader_test.go deleted file mode 100644 index 82ee6e53f..000000000 --- a/pkg/appgateserver/config/appgate_configs_reader_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package config_test - -import ( - "net/url" - "testing" - - sdkerrors "cosmossdk.io/errors" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/appgateserver/config" - "github.com/pokt-network/poktroll/testutil/yaml" -) - -func Test_ParseAppGateConfigs(t *testing.T) { - tests := []struct { - desc string - - inputConfigYAML string - - expectedError *sdkerrors.Error - expectedConfig *config.AppGateServerConfig - }{ - // Valid Configs - { - desc: "valid: AppGateServer config", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: nil, - expectedConfig: &config.AppGateServerConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - SigningKey: "app1", - SelfSigning: true, - ListeningEndpoint: &url.URL{Scheme: "http", Host: "localhost:42069"}, - }, - }, - { - desc: "valid: AppGateServer config with undefined self signing", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - listening_endpoint: http://localhost:42069 - `, - - expectedError: nil, - expectedConfig: &config.AppGateServerConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - SigningKey: "app1", - SelfSigning: false, - ListeningEndpoint: &url.URL{Scheme: "http", Host: "localhost:42069"}, - }, - }, - // Invalid Configs - { - desc: "invalid: empty AppGateServer config", - - inputConfigYAML: ``, - - expectedError: config.ErrAppGateConfigEmpty, - }, - { - desc: "invalid: no signing key", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - # NB: explicitly missing signing key - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigEmptySigningKey, - }, - { - desc: "invalid: invalid listening endpoint", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: l&ocalhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidListeningEndpoint, - }, - { - desc: "invalid: invalid query node grpc url", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: 1&27.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, - }, - { - desc: "invalid: missing query node grpc url", - - inputConfigYAML: ` - query_node_rpc_url: tcp://127.0.0.1:36657 - # NB: explicitly missing query_node_grpc_url - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, - }, - { - desc: "invalid: invalid query node rpc url", - - inputConfigYAML: ` - query_node_rpc_url: 1&27.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, - }, - { - desc: "invalid: missing query node rpc url", - - inputConfigYAML: ` - # NB: explicitly missing query_node_rpc_url - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key: app1 - self_signing: true - listening_endpoint: http://localhost:42069 - `, - - expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, - }, - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) - config, err := config.ParseAppGateServerConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.ErrorIs(t, err, tt.expectedError) - require.Nil(t, config) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, config) - return - } - - require.NoError(t, err) - - require.Equal(t, tt.expectedConfig.SelfSigning, config.SelfSigning) - require.Equal(t, tt.expectedConfig.SigningKey, config.SigningKey) - require.Equal(t, tt.expectedConfig.ListeningEndpoint.String(), config.ListeningEndpoint.String()) - require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) - require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) - }) - } -} diff --git a/pkg/appgateserver/config/errors.go b/pkg/appgateserver/config/errors.go deleted file mode 100644 index 450c75378..000000000 --- a/pkg/appgateserver/config/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "appgate_config" - ErrAppGateConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrAppGateConfigEmptySigningKey = sdkerrors.Register(codespace, 2, "empty signing key in AppGateServer config") - ErrAppGateConfigInvalidListeningEndpoint = sdkerrors.Register(codespace, 3, "invalid listening endpoint in AppGateServer config") - ErrAppGateConfigInvalidQueryNodeGRPCUrl = sdkerrors.Register(codespace, 4, "invalid query node grpc url in AppGateServer config") - ErrAppGateConfigInvalidQueryNodeRPCUrl = sdkerrors.Register(codespace, 5, "invalid query node rpc url in AppGateServer config") - ErrAppGateConfigEmpty = sdkerrors.Register(codespace, 6, "empty AppGateServer config") -) diff --git a/pkg/appgateserver/endpoint_selector.go b/pkg/appgateserver/endpoint_selector.go deleted file mode 100644 index 821b18018..000000000 --- a/pkg/appgateserver/endpoint_selector.go +++ /dev/null @@ -1,35 +0,0 @@ -package appgateserver - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/sdk" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO_IMPROVE: This implements a naive greedy approach that defaults to the -// first available supplier. -// Future optimizations (e.g. Quality-of-Service) can be introduced here. -// TODO(@h5law): Look into different endpoint selection depending on their suitability. -// getRelayerUrl gets the URL of the relayer for the given service. -func (app *appGateServer) getRelayerUrl( - ctx context.Context, - serviceId string, - rpcType sharedtypes.RPCType, - supplierEndpoints []*sdk.SingleSupplierEndpoint, -) (supplierEndpoint *sdk.SingleSupplierEndpoint, err error) { - for _, supplierEndpoint := range supplierEndpoints { - // Skip services that don't match the requested serviceId. - if supplierEndpoint.Header.Service.Id != serviceId { - continue - } - - // Return the first endpoint url that matches the request's RpcType. - if supplierEndpoint.RpcType == rpcType { - return supplierEndpoint, nil - } - } - - // Return an error if no relayer endpoints were found. - return nil, ErrAppGateNoRelayEndpoints -} diff --git a/pkg/appgateserver/error_reply.go b/pkg/appgateserver/error_reply.go deleted file mode 100644 index bac599f3d..000000000 --- a/pkg/appgateserver/error_reply.go +++ /dev/null @@ -1,33 +0,0 @@ -package appgateserver - -import ( - "context" - "net/http" - - "github.com/pokt-network/poktroll/pkg/partials" -) - -// replyWithError replies to the application with an error response and writes -// it to the writer provided. -// NOTE: This method is used to reply with an "internal" error that is related -// to the appgateserver itself and not to the relay request. -func (app *appGateServer) replyWithError( - ctx context.Context, - payloadBz []byte, - writer http.ResponseWriter, - serviceId string, - requestType string, - err error, -) { - relaysErrorsTotal.With("service_id", serviceId, "request_type", requestType).Add(1) - responseBz, err := partials.GetErrorReply(ctx, payloadBz, err) - if err != nil { - app.logger.Error().Err(err).Str("service_id", serviceId).Msg("failed getting error reply") - return - } - - if _, err = writer.Write(responseBz); err != nil { - app.logger.Error().Err(err).Str("service_id", serviceId).Msg("failed writing relay response") - return - } -} diff --git a/pkg/appgateserver/errors.go b/pkg/appgateserver/errors.go deleted file mode 100644 index 17f5456d6..000000000 --- a/pkg/appgateserver/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package appgateserver - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "appgateserver" - ErrAppGateNoRelayEndpoints = sdkerrors.Register(codespace, 1, "no relay endpoints found") - ErrAppGateMissingAppAddress = sdkerrors.Register(codespace, 2, "missing application address") - ErrAppGateMissingSigningInformation = sdkerrors.Register(codespace, 3, "missing app client signing information") - ErrAppGateMissingListeningEndpoint = sdkerrors.Register(codespace, 4, "missing app client listening endpoint") - ErrAppGateHandleRelay = sdkerrors.Register(codespace, 5, "internal error handling relay request") -) diff --git a/pkg/appgateserver/options.go b/pkg/appgateserver/options.go deleted file mode 100644 index fb164029b..000000000 --- a/pkg/appgateserver/options.go +++ /dev/null @@ -1,19 +0,0 @@ -package appgateserver - -import ( - "net/url" -) - -// WithSigningInformation sets the signing information for the appgate server. -func WithSigningInformation(signingInfo *SigningInformation) appGateServerOption { - return func(appGateServer *appGateServer) { - appGateServer.signingInformation = signingInfo - } -} - -// WithListeningUrl sets the listening URL for the appgate server. -func WithListeningUrl(listeningUrl *url.URL) appGateServerOption { - return func(appGateServer *appGateServer) { - appGateServer.listeningEndpoint = listeningUrl - } -} diff --git a/pkg/appgateserver/server.go b/pkg/appgateserver/server.go deleted file mode 100644 index 5befd5dda..000000000 --- a/pkg/appgateserver/server.go +++ /dev/null @@ -1,266 +0,0 @@ -package appgateserver - -import ( - "bytes" - "context" - "fmt" - "io" - "net" - "net/http" - "net/url" - "strings" - - "cosmossdk.io/depinject" - "github.com/prometheus/client_golang/prometheus/promhttp" - metrics "github.com/slok/go-http-metrics/metrics/prometheus" - metricsmiddleware "github.com/slok/go-http-metrics/middleware" - middlewarestd "github.com/slok/go-http-metrics/middleware/std" - - querytypes "github.com/pokt-network/poktroll/pkg/client/query/types" - "github.com/pokt-network/poktroll/pkg/partials" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/sdk" -) - -// SigningInformation is a struct that holds information related to the signing -// of relay requests, used by the appGateServer to determine how they will sign -// relay requests (with either their own ring or the rign of the application). -type SigningInformation struct { - // SelfSigning indicates whether the server is running in self-signing mode - SelfSigning bool - - // SigningKeyName is the name of the key in the keyring that corresponds to the - // private key used to sign relay requests. - SigningKeyName string - - // AppAddress is the address of the application that the server is serving if - // If it is nil, then the application address must be included in each request via a query parameter. - AppAddress string -} - -// appGateServer is the server that listens for application requests and relays them to the supplier. -// It is responsible for maintaining the current session for the application, signing the requests, -// and verifying the response signatures. -// The appGateServer is the basis for both applications and gateways, depending on whether the application -// is running their own instance of the appGateServer or they are sending requests to a gateway running an -// instance of the appGateServer, they will need to either include the application address in the request or not. -type appGateServer struct { - logger polylog.Logger - - // signing information holds the signing key and application address for the server - signingInformation *SigningInformation - - // clientCtx is the client context for the application. - // It is used to query for the application's account to unmarshal the supplier's account - // and get the public key to verify the relay response signature. - clientCtx querytypes.Context - - // sdk is the POKTRollSDK that the appGateServer uses to query for the current session - // and send relay requests to the supplier. - sdk sdk.POKTRollSDK - - // listeningEndpoint is the endpoint that the appGateServer will listen on. - listeningEndpoint *url.URL - - // server is the HTTP server that will be used capture application requests - // so that they can be signed and relayed to the supplier. - server *http.Server -} - -// NewAppGateServer creates a new appGateServer instance with the given dependencies. -// -// Required dependencies: -// - polylog.Logger -// - sdkclient.Context -// - client.BlockClient -// - client.AccountQueryClient -// - crypto.RingCache -func NewAppGateServer( - deps depinject.Config, - opts ...appGateServerOption, -) (*appGateServer, error) { - app := &appGateServer{} - - if err := depinject.Inject( - deps, - &app.logger, - &app.clientCtx, - &app.sdk, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(app) - } - - if err := app.validateConfig(); err != nil { - return nil, err - } - - keyRecord, err := app.clientCtx.Keyring.Key(app.signingInformation.SigningKeyName) - if err != nil { - return nil, fmt.Errorf("failed to get key from keyring: %w", err) - } - - appAddress, err := keyRecord.GetAddress() - if err != nil { - return nil, fmt.Errorf("failed to get address from key: %w", err) - } - if app.signingInformation.SelfSigning { - app.signingInformation.AppAddress = appAddress.String() - } - - // TODO_CONSIDERATION: Use app.listeningEndpoint scheme to determine which - // kind of server to create (HTTP, HTTPS, TCP, UNIX, etc...) - app.server = &http.Server{Addr: app.listeningEndpoint.Host} - - return app, nil -} - -// Start starts the appgate server and blocks until the context is done -// or the server returns an error. -func (app *appGateServer) Start(ctx context.Context) error { - // Shutdown the HTTP server when the context is done. - go func() { - <-ctx.Done() - app.server.Shutdown(ctx) - }() - - // This hooks https://github.com/slok/go-http-metrics to the appgate server HTTP server. - mm := metricsmiddleware.New(metricsmiddleware.Config{ - Recorder: metrics.NewRecorder(metrics.Config{}), - }) - - // Set the HTTP handler. - app.server.Handler = middlewarestd.Handler("", mm, app) - - // Start the HTTP server. - return app.server.ListenAndServe() -} - -// Stop stops the appgate server and returns any error that occurred. -func (app *appGateServer) Stop(ctx context.Context) error { - return app.server.Shutdown(ctx) -} - -// ServeHTTP is the HTTP handler for the appgate server. -// It captures the application request, signs it, and sends it to the supplier. -// After receiving the response from the supplier, it verifies the response signature -// before returning the response to the application. -// The serviceId is extracted from the request path. -// The request's path should be of the form: -// -// "://host:port/serviceId[/other/path/segments]?applicationAddr=" -// -// where the serviceId is the id of the service that the application is requesting -// and the other (possible) path segments are the JSON RPC request path. -// TODO_TECHDEBT: Revisit the requestPath above based on the SDK that'll be exposed in the future. -func (app *appGateServer) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - ctx := app.logger.WithContext(request.Context()) - - // Extract the serviceId from the request path. - path := request.URL.Path - serviceId := strings.Split(path, "/")[1] - - // Read the request body bytes. - requestPayloadBz, err := io.ReadAll(request.Body) - if err != nil { - app.replyWithError( - ctx, - requestPayloadBz, - writer, - serviceId, - "unknown", - ErrAppGateHandleRelay.Wrapf("reading relay request body: %s", err), - ) - // TODO_IMPROVE: log additional info? - app.logger.Error().Err(err).Msg("failed reading relay request body") - - return - } - app.logger.Debug(). - Str("service_id", serviceId). - Str("payload", string(requestPayloadBz)). - Msg("handling relay") - - // TODO_IMPROVE: log additional info? - app.logger.Debug().Msg("determining request type") - - // Get the type of the request by doing a partial unmarshal of the payload - requestType, err := partials.GetRequestType(ctx, requestPayloadBz) - if err != nil { - app.replyWithError(ctx, requestPayloadBz, writer, serviceId, "unknown", ErrAppGateHandleRelay) - // TODO_IMPROVE: log additional info? - app.logger.Error().Err(err).Msg("failed getting request type") - - return - } - - // Determine the application address. - appAddress := app.signingInformation.AppAddress - if appAddress == "" { - appAddress = request.URL.Query().Get("applicationAddr") - } - if appAddress == "" { - app.replyWithError(ctx, requestPayloadBz, writer, serviceId, requestType.String(), ErrAppGateMissingAppAddress) - // TODO_IMPROVE: log additional info? - app.logger.Error().Msg("no application address provided") - - return - } - - // Put the request body bytes back into the request body. - request.Body = io.NopCloser(bytes.NewBuffer(requestPayloadBz)) - - // TODO(@h5law, @red0ne): Add support for asynchronous relays, and switch on - // the request type here. - // TODO_RESEARCH: Should this be started in a goroutine, to allow for - // concurrent requests from numerous applications? - if err := app.handleSynchronousRelay( - ctx, appAddress, serviceId, requestPayloadBz, requestType, request, writer); err != nil { - - // Reply with an error response if there was an error handling the relay. - app.replyWithError(ctx, requestPayloadBz, writer, serviceId, requestType.String(), err) - // TODO_IMPROVE: log additional info? - app.logger.Error().Err(err).Msg("failed handling relay") - - return - } - - // TODO_IMPROVE: log additional info? - app.logger.Info().Msg("request serviced successfully") -} - -// validateConfig validates the appGateServer configuration. -func (app *appGateServer) validateConfig() error { - if app.signingInformation == nil { - return ErrAppGateMissingSigningInformation - } - if app.listeningEndpoint == nil { - return ErrAppGateMissingListeningEndpoint - } - return nil -} - -// Starts a metrics server on the given address. -func (app *appGateServer) ServeMetrics(addr string) error { - ln, err := net.Listen("tcp", addr) - if err != nil { - app.logger.Error().Err(err).Msg("failed to listen on address for metrics") - return err - } - - // If no error, start the server in a new goroutine - go func() { - app.logger.Info().Str("endpoint", addr).Msg("serving metrics") - if err := http.Serve(ln, promhttp.Handler()); err != nil { - app.logger.Error().Err(err).Msg("metrics server failed") - return - } - }() - - return nil -} - -type appGateServerOption func(*appGateServer) diff --git a/pkg/appgateserver/synchronous.go b/pkg/appgateserver/synchronous.go deleted file mode 100644 index e0b2f5d10..000000000 --- a/pkg/appgateserver/synchronous.go +++ /dev/null @@ -1,60 +0,0 @@ -package appgateserver - -import ( - "context" - "net/http" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// handleSynchronousRelay handles relay requests for synchronous protocols, where -// there is a one-to-one correspondance between the request and response. -// It does everything from preparing, signing and sending the request. -// It then blocks on the response to come back and forward it to the provided writer. -func (app *appGateServer) handleSynchronousRelay( - ctx context.Context, - appAddress, serviceId string, - payloadBz []byte, - requestType sharedtypes.RPCType, - request *http.Request, - writer http.ResponseWriter, -) error { - relaysTotal.With("service_id", serviceId, "request_type", requestType.String()).Add(1) - - // TODO_IMPROVE: log additional info? - app.logger.Debug(). - Str("request_type", requestType.String()). - Msg("got request type") - - sessionSuppliers, err := app.sdk.GetSessionSupplierEndpoints(ctx, appAddress, serviceId) - if err != nil { - return ErrAppGateHandleRelay.Wrapf("getting current session: %s", err) - } - - // Get a supplier URL and address for the given service and session. - supplierEndpoint, err := app.getRelayerUrl( - ctx, - serviceId, - requestType, - sessionSuppliers.SuppliersEndpoints, - ) - if err != nil { - return ErrAppGateHandleRelay.Wrapf("getting supplier URL: %s", err) - } - - relayResponse, err := app.sdk.SendRelay(ctx, supplierEndpoint, request) - if err != nil { - return err - } - - app.logger.Debug(). - Str("relay_response_payload", string(relayResponse.Payload)). - Msg("writing relay response payload") - - // Reply with the RelayResponse payload. - if _, err := writer.Write(relayResponse.Payload); err != nil { - return ErrAppGateHandleRelay.Wrapf("writing relay response payload: %s", err) - } - - return nil -} diff --git a/pkg/client/block/block.go b/pkg/client/block/block.go deleted file mode 100644 index 82c34aa2b..000000000 --- a/pkg/client/block/block.go +++ /dev/null @@ -1,48 +0,0 @@ -package block - -import ( - "encoding/json" - - "github.com/cometbft/cometbft/types" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -// cometBlockEvent is used to deserialize incoming committed block event messages -// from the respective events query subscription. It implements the client.Block -// interface by loosely wrapping cometbft's block type, into which messages are -// deserialized. -type cometBlockEvent struct { - Block types.Block `json:"block"` -} - -// Height returns the block's height. -func (blockEvent *cometBlockEvent) Height() int64 { - return blockEvent.Block.Height -} - -// Hash returns the binary representation of the block's hash as a byte slice. -func (blockEvent *cometBlockEvent) Hash() []byte { - return blockEvent.Block.LastBlockID.Hash.Bytes() -} - -// newCometBlockEvent is a function that attempts to deserialize the given bytes -// into a comet block. If the resulting block has a height of zero, assume the event -// was not a block event and return an ErrUnmarshalBlockEvent error. -func newCometBlockEvent(blockMsgBz []byte) (client.Block, error) { - blockMsg := new(cometBlockEvent) - if err := json.Unmarshal(blockMsgBz, blockMsg); err != nil { - return nil, err - } - - // The header height should never be zero. If it is, it means that blockMsg - // does not match the expected format which led unmarshaling to fail, - // and blockHeader.height to have a default value. - if blockMsg.Block.Header.Height == 0 { - return nil, events.ErrEventsUnmarshalEvent. - Wrapf("with block data: %s", string(blockMsgBz)) - } - - return blockMsg, nil -} diff --git a/pkg/client/block/client.go b/pkg/client/block/client.go deleted file mode 100644 index 1e3bd21ea..000000000 --- a/pkg/client/block/client.go +++ /dev/null @@ -1,77 +0,0 @@ -package block - -import ( - "context" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -const ( - // committedBlocksQuery is the query used to subscribe to new committed block - // events used by the EventsQueryClient to subscribe to new block events from - // the chain. - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events - committedBlocksQuery = "tm.event='NewBlock'" - - // defaultBlocksReplayLimit is the number of blocks that the replay - // observable returned by LastNBlocks() will be able to replay. - // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient - // struct that defaults to this but can be overridden via an option. - defaultBlocksReplayLimit = 100 -) - -// NewBlockClient creates a new block client from the given dependencies and -// cometWebsocketURL. It uses a pre-defined committedBlocksQuery to subscribe to -// newly committed block events which are mapped to Block objects. -// -// This lightly wraps the EventsReplayClient[Block] generic to correctly mock -// the interface. -// -// Required dependencies: -// - client.EventsQueryClient -func NewBlockClient( - ctx context.Context, - deps depinject.Config, -) (client.BlockClient, error) { - client, err := events.NewEventsReplayClient[client.Block]( - ctx, - deps, - committedBlocksQuery, - newCometBlockEvent, - defaultBlocksReplayLimit, - ) - if err != nil { - return nil, err - } - return &blockClient{eventsReplayClient: client}, nil -} - -// blockClient is a wrapper around an EventsReplayClient that implements the -// BlockClient interface for use with cosmos-sdk networks. -type blockClient struct { - // eventsReplayClient is the underlying EventsReplayClient that is used to - // subscribe to new committed block events. It uses both the Block type - // and the BlockReplayObservable type as its generic types. - // These enable the EventsReplayClient to correctly map the raw event bytes - // to Block objects and to correctly return a BlockReplayObservable - eventsReplayClient client.EventsReplayClient[client.Block] -} - -// CommittedBlocksSequence returns a replay observable of new block events. -func (b *blockClient) CommittedBlocksSequence(ctx context.Context) client.BlockReplayObservable { - return b.eventsReplayClient.EventsSequence(ctx) -} - -// LatestsNBlocks returns the last n blocks observed by the BockClient. -func (b *blockClient) LastNBlocks(ctx context.Context, n int) []client.Block { - return b.eventsReplayClient.LastNEvents(ctx, n) -} - -// Close closes the underlying websocket connection for the EventsQueryClient -// and closes all downstream connections. -func (b *blockClient) Close() { - b.eventsReplayClient.Close() -} diff --git a/pkg/client/block/client_integration_test.go b/pkg/client/block/client_integration_test.go deleted file mode 100644 index 375142f36..000000000 --- a/pkg/client/block/client_integration_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package block_test - -import ( - "context" - "fmt" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" -) - -// TODO(#255): Refactor this integration test to use an in-memory simulated network - -const blockIntegrationSubTimeout = 5 * time.Second - -func TestBlockClient_LastNBlocks(t *testing.T) { - t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") - ctx := context.Background() - - blockClient := testblock.NewLocalnetClient(ctx, t) - require.NotNil(t, blockClient) - - block := blockClient.LastNBlocks(ctx, 1) - require.NotEmpty(t, block) -} - -func TestBlockClient_BlocksObservable(t *testing.T) { - t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") - ctx := context.Background() - - blockClient := testblock.NewLocalnetClient(ctx, t) - require.NotNil(t, blockClient) - - blockSub := blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx) - - var ( - blockMu sync.Mutex - blockCounter int - blocksToRecv = 2 - errCh = make(chan error, 1) - ) - go func() { - var previousBlock client.Block - for block := range blockSub.Ch() { - if previousBlock != nil { - if !assert.Equal(t, previousBlock.Height()+1, block.Height()) { - errCh <- fmt.Errorf("expected block height %d, got %d", previousBlock.Height()+1, block.Height()) - return - } - } - previousBlock = block - - require.NotEmpty(t, block) - blockMu.Lock() - blockCounter++ - if blockCounter >= blocksToRecv { - errCh <- nil - return - } - blockMu.Unlock() - } - }() - - select { - case err := <-errCh: - require.NoError(t, err) - require.Equal(t, blocksToRecv, blockCounter) - case <-time.After(blockIntegrationSubTimeout): - t.Fatalf( - "timed out waiting for block subscription; expected %d blocks, got %d", - blocksToRecv, blockCounter, - ) - } -} diff --git a/pkg/client/block/client_test.go b/pkg/client/block/client_test.go deleted file mode 100644 index e44c8f32f..000000000 --- a/pkg/client/block/client_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package block_test - -import ( - "context" - "encoding/json" - "testing" - "time" - - "cosmossdk.io/depinject" - comettypes "github.com/cometbft/cometbft/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -const ( - testTimeoutDuration = 100 * time.Millisecond - - // duplicates pkg/client/block/client.go's committedBlocksQuery for testing purposes - committedBlocksQuery = "tm.event='NewBlock'" -) - -func TestBlockClient(t *testing.T) { - var ( - expectedHeight = int64(1) - expectedHash = []byte("test_hash") - expectedBlockEvent = &testBlockEvent{ - Block: comettypes.Block{ - Header: comettypes.Header{ - Height: 1, - Time: time.Now(), - LastBlockID: comettypes.BlockID{ - Hash: expectedHash, - }, - }, - }, - } - ctx = context.Background() - ) - - expectedEventBz, err := json.Marshal(expectedBlockEvent) - require.NoError(t, err) - - eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( - ctx, t, - committedBlocksQuery, - expectedEventBz, - ) - - deps := depinject.Supply(eventsQueryClient) - - // Set up block client. - blockClient, err := block.NewBlockClient(ctx, deps) - require.NoError(t, err) - require.NotNil(t, blockClient) - - tests := []struct { - name string - fn func() client.Block - }{ - { - name: "LastNBlocks(1) successfully returns latest block", - fn: func() client.Block { - lastBlock := blockClient.LastNBlocks(ctx, 1)[0] - return lastBlock - }, - }, - { - name: "CommittedBlocksSequence successfully returns latest block", - fn: func() client.Block { - blockObservable := blockClient.CommittedBlocksSequence(ctx) - require.NotNil(t, blockObservable) - - // Ensure that the observable is replayable via Last. - lastBlock := blockObservable.Last(ctx, 1)[0] - require.Equal(t, expectedHeight, lastBlock.Height()) - require.Equal(t, expectedHash, lastBlock.Hash()) - - return lastBlock - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualBlockCh := make(chan client.Block, 10) - - // Run test functions asynchronously because they can block, leading - // to an unresponsive test. If any of the methods under test hang, - // the test will time out in the select statement that follows. - go func(fn func() client.Block) { - actualBlockCh <- fn() - close(actualBlockCh) - }(tt.fn) - - select { - case actualBlock := <-actualBlockCh: - require.Equal(t, expectedHeight, actualBlock.Height()) - require.Equal(t, expectedHash, actualBlock.Hash()) - case <-time.After(testTimeoutDuration): - t.Fatal("timed out waiting for block event") - } - }) - } - - blockClient.Close() -} - -/* -TODO_TECHDEBT/TODO_CONSIDERATION(#XXX): this duplicates the unexported block event - -type from pkg/client/block/block.go. We seem to have some conflicting preferences -which result in the need for this duplication until a preferred direction is -identified: - - - We should prefer tests being in their own pkgs (e.g. block_test) - - this would resolve if this test were in the block package instead. - - We should prefer to not export types which don't require exporting for API - consumption. - - This test is the only external (to the block pkg) dependency of cometBlockEvent. - - We could use the //go:build test constraint on a new file which exports it - for testing purposes. - - This would imply that we also add -tags=test to all applicable tooling - and add a test which fails if the tag is absent. -*/ -type testBlockEvent struct { - Block comettypes.Block `json:"block"` -} diff --git a/pkg/client/block/godoc.go b/pkg/client/block/godoc.go deleted file mode 100644 index 01d829f2e..000000000 --- a/pkg/client/block/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package block contains a light wrapper of the EventsReplayClient[Block] -// generic which listens for committed block events on chain and emits them -// through a ReplayObservable. This enables consumers to listen for newly -// committed blocks and react to them asynchronously. -package block diff --git a/pkg/client/delegation/client.go b/pkg/client/delegation/client.go deleted file mode 100644 index 013b094df..000000000 --- a/pkg/client/delegation/client.go +++ /dev/null @@ -1,89 +0,0 @@ -package delegation - -import ( - "context" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -const ( - // delegationEventQuery is the query used by the EventsQueryClient to subscribe - // to all application module events in order to filter for redelegation events. - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events - // And: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events - // TODO_HACK(#280): Instead of listening to all events and doing a verbose - // filter, we should subscribe to both MsgDelegateToGateway and MsgUndelegateFromGateway - // messages directly, and filter those for the EventRedelegation event types. - // This would save the delegation client from listening to a lot of unnecessary - // events, that it filters out. - // NB: This is not currently possible because the observer pattern does not - // support multiplexing multiple observables into a single observable, that - // can supply the EventsReplayClient with both the MsgDelegateToGateway and - // MsgUndelegateFromGateway events. - delegationEventQuery = "tm.event='Tx' AND message.module='application'" - - // defaultRedelegationsReplayLimit is the number of redelegations that the - // replay observable returned by LastNRedelegations() will be able to replay. - // TODO_TECHDEBT/TODO_FUTURE: add a `redelegationsReplayLimit` field to the - // delegation client struct that defaults to this but can be overridden via - // an option in future work. - defaultRedelegationsReplayLimit = 100 -) - -// NewDelegationClient creates a new delegation client from the given -// dependencies and cometWebsocketURL. It uses a pre-defined delegationEventQuery -// to subscribe to newly emitted redelegation events which are mapped to -// Redelegation objects. -// -// This lightly wraps the EventsReplayClient[Redelegation] generic to -// correctly mock the interface. -// -// Required dependencies: -// - client.EventsQueryClient -func NewDelegationClient( - ctx context.Context, - deps depinject.Config, -) (client.DelegationClient, error) { - client, err := events.NewEventsReplayClient[client.Redelegation]( - ctx, - deps, - delegationEventQuery, - newRedelegationEventFactoryFn(), - defaultRedelegationsReplayLimit, - ) - if err != nil { - return nil, err - } - return &delegationClient{eventsReplayClient: client}, nil -} - -// delegationClient is a wrapper around an EventsReplayClient that implements -// the DelegationClient interface for use with cosmos-sdk networks. -type delegationClient struct { - // eventsReplayClient is the underlying EventsReplayClient that is used to - // subscribe to new delegation events. It uses both the Redelegation type - // and the RedelegationReplayObservable type as its generic types. - // These enable the EventsReplayClient to correctly map the raw event bytes - // to Redelegation objects and to correctly return a RedelegationReplayObservable - eventsReplayClient client.EventsReplayClient[client.Redelegation] -} - -// RedelegationsSequence returns a replay observable of Redelgation events -// observed by the DelegationClient. -func (b *delegationClient) RedelegationsSequence(ctx context.Context) client.RedelegationReplayObservable { - return b.eventsReplayClient.EventsSequence(ctx) -} - -// LastNRedelegations returns the latest n redelegation events from the DelegationClient. -func (b *delegationClient) LastNRedelegations(ctx context.Context, n int) []client.Redelegation { - return b.eventsReplayClient.LastNEvents(ctx, n) -} - -// Close closes the underlying websocket connection for the EventsQueryClient -// and closes all downstream connections. -func (b *delegationClient) Close() { - b.eventsReplayClient.Close() -} diff --git a/pkg/client/delegation/client_integration_test.go b/pkg/client/delegation/client_integration_test.go deleted file mode 100644 index 1ea3cbaec..000000000 --- a/pkg/client/delegation/client_integration_test.go +++ /dev/null @@ -1,171 +0,0 @@ -package delegation_test - -// TODO(@h5law): Figure out how to use real components of the localnet -// - Create app and gateway actors -// - Stake them -// - Delegate to the gateway -// - Undelegate from the gateway -// Currently this test doesn't work, because (I think) it is using a mock -// keeper etc and this isn't actually interacting with the localnet where -// the DelegationClient is listening for events from. - -import ( - "context" - "sync" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/testutil/network" - apptypes "github.com/pokt-network/poktroll/x/application/types" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" -) - -const ( - delegationIntegrationSubTimeout = 180 * time.Second -) - -// TODO_UPNEXT(@h5law): Figure out the correct way to subscribe to events on the -// simulated localnet. Currently this test doesn't work. Although the delegation -// client subscribes it doesn't receive any events. -func TestDelegationClient_RedelegationsObservables(t *testing.T) { - t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") - // Create the network with 2 applications and 1 gateway - net, appAddresses, gatewayAddr := createNetworkWithApplicationsAndGateways(t) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Create the delegation client - evtQueryClient := events.NewEventsQueryClient("ws://localhost:26657/websocket") - deps := depinject.Supply(evtQueryClient) - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - require.NoError(t, err) - require.NotNil(t, delegationClient) - t.Cleanup(func() { - delegationClient.Close() - }) - - // Subscribe to the delegation events - delegationSub := delegationClient.RedelegationsSequence(ctx).Subscribe(ctx) - - var ( - delegationMu = sync.Mutex{} // mutext to protect delegationChangeCounter - delegationChangeCounter int // counter to keep track of the number of delegation changes - expectedChanges = 4 // expected number of delegation changes - errCh = make(chan error, 1) // channel to signal the test to stop - ) - go func() { - // The test will delegate from app1 to gateway, then from app2 to gateway - // and then undelegate app1 from gateway and then undelegate app2 from gateway - // We expect to receive 4 delegation changes where the address of the - // Redelegation event alternates between app1 and app2 - var previousRedelegation client.Redelegation - for change := range delegationSub.Ch() { - t.Logf("received delegation change: %+v", change) - // Verify that the Redelegation event is valid and that the address - // of the Redelegation event alternates between app1 and app2 - if previousRedelegation != nil { - require.NotEqual(t, previousRedelegation.GetAppAddress(), change.GetAppAddress()) - if previousRedelegation.GetAppAddress() == appAddresses[0] { - require.Equal(t, appAddresses[1], change.GetAppAddress()) - } else { - require.Equal(t, appAddresses[0], change.GetAppAddress()) - } - } - previousRedelegation = change - - require.NotEmpty(t, change) - delegationMu.Lock() - delegationChangeCounter++ - if delegationChangeCounter >= expectedChanges { - errCh <- nil - return - } - delegationMu.Unlock() - } - }() - - // Delegate from app1 to gateway - t.Log(time.Now().String()) - t.Logf("delegating from app %s to gateway %s", appAddresses[0], gatewayAddr) - network.DelegateAppToGateway(t, net, appAddresses[0], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - // Delegate from app2 to gateway - t.Logf("delegating from app %s to gateway %s", appAddresses[1], gatewayAddr) - network.DelegateAppToGateway(t, net, appAddresses[1], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - // Undelegate from app1 to gateway - t.Logf("undelegating from app %s to gateway %s", appAddresses[0], gatewayAddr) - network.UndelegateAppFromGateway(t, net, appAddresses[0], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - // Undelegate from app2 to gateway - t.Logf("undelegating from app %s to gateway %s", appAddresses[1], gatewayAddr) - network.UndelegateAppFromGateway(t, net, appAddresses[1], gatewayAddr) - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - - select { - case err := <-errCh: - require.NoError(t, err) - require.Equal(t, expectedChanges, delegationChangeCounter) - case <-time.After(delegationIntegrationSubTimeout): - t.Log(time.Now().String()) - t.Fatalf( - "timed out waiting for delegation subscription; expected %d delegation events, got %d", - expectedChanges, delegationChangeCounter, - ) - } -} - -// createNetworkWithApplicationsAndGateways creates a network with 2 applications -// and 1 gateway. It returns the network with all accounts initialized via a -// transaction from the first validator. -func createNetworkWithApplicationsAndGateways( - t *testing.T, -) (net *network.Network, appAddresses []string, gatewayAddress string) { - // Prepare the network - cfg := network.DefaultConfig() - net = network.New(t, cfg) - ctx := net.Validators[0].ClientCtx - - // Prepare the keyring for the 2 applications and 1 gateway account - kr := ctx.Keyring - accounts := testutil.CreateKeyringAccounts(t, kr, 3) - ctx = ctx.WithKeyring(kr) - - // Initialize all the accounts - for i, account := range accounts { - signatureSequenceNumber := i + 1 - network.InitAccountWithSequence(t, net, account.Address, signatureSequenceNumber) - } - // need to wait for the account to be initialized in the next block - require.NoError(t, net.WaitForNextBlock()) - - addresses := make([]string, len(accounts)) - for i, account := range accounts { - addresses[i] = account.Address.String() - } - - // Create two applications - appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, addresses[0:2]) - buf, err := cfg.Codec.MarshalJSON(appGenesisState) - require.NoError(t, err) - cfg.GenesisState[apptypes.ModuleName] = buf - - // Create a single gateway - gatewayGenesisState := network.GatewayModuleGenesisStateWithAddresses(t, addresses[2:3]) - buf, err = cfg.Codec.MarshalJSON(gatewayGenesisState) - require.NoError(t, err) - cfg.GenesisState[gatewaytypes.ModuleName] = buf - - return net, addresses[0:2], addresses[2] -} diff --git a/pkg/client/delegation/client_test.go b/pkg/client/delegation/client_test.go deleted file mode 100644 index f9b82ffb5..000000000 --- a/pkg/client/delegation/client_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package delegation_test - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -const ( - testTimeoutDuration = 100 * time.Millisecond - - // duplicates pkg/client/delegation/client.go's delegationEventQuery for testing purposes. - delegationEventQuery = "tm.event='Tx' AND message.module='application'" -) - -func TestDelegationClient(t *testing.T) { - var ( - expectedAppAddress = sample.AccAddress() - expectedGatewayAddress = sample.AccAddress() - ctx = context.Background() - ) - - expectedEventBz := testdelegation.NewRedelegationEventBytes(t, expectedAppAddress, expectedGatewayAddress) - - eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( - ctx, t, - delegationEventQuery, - expectedEventBz, - ) - - deps := depinject.Supply(eventsQueryClient) - - // Set up delegation client. - // NB: the URL passed to `NewDelegationClient` is irrelevant here because `eventsQueryClient` is a mock. - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - require.NoError(t, err) - require.NotNil(t, delegationClient) - - tests := []struct { - name string - fn func() client.Redelegation - }{ - { - name: "LastNRedelegations successfully returns latest redelegation", - fn: func() client.Redelegation { - lastRedelegation := delegationClient.LastNRedelegations(ctx, 1)[0] - require.Equal(t, expectedAppAddress, lastRedelegation.GetAppAddress()) - require.Equal(t, expectedGatewayAddress, lastRedelegation.GetGatewayAddress()) - return lastRedelegation - }, - }, - { - name: "RedelegationsSequence successfully returns latest redelegation", - fn: func() client.Redelegation { - redelegationObs := delegationClient.RedelegationsSequence(ctx) - require.NotNil(t, redelegationObs) - - // Ensure that the observable is replayable via Last. - lastRedelegation := redelegationObs.Last(ctx, 1)[0] - require.Equal(t, expectedAppAddress, lastRedelegation.GetAppAddress()) - require.Equal(t, expectedGatewayAddress, lastRedelegation.GetGatewayAddress()) - - return lastRedelegation - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualRedelegationCh := make(chan client.Redelegation, 10) - - // Run test functions asynchronously because they can block, leading - // to an unresponsive test. If any of the methods under test hang, - // the test will time out in the select statement that follows. - go func(fn func() client.Redelegation) { - actualRedelegationCh <- fn() - close(actualRedelegationCh) - }(tt.fn) - - select { - case actualRedelegation := <-actualRedelegationCh: - require.Equal(t, expectedAppAddress, actualRedelegation.GetAppAddress()) - require.Equal(t, expectedGatewayAddress, actualRedelegation.GetGatewayAddress()) - case <-time.After(testTimeoutDuration): - t.Fatal("timed out waiting for redelegation event") - } - }) - } - - delegationClient.Close() -} diff --git a/pkg/client/delegation/godoc.go b/pkg/client/delegation/godoc.go deleted file mode 100644 index 1d5b00139..000000000 --- a/pkg/client/delegation/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package delegation contains a light wrapper of the EventsReplayClient[Redelegation] -// generic which listens for redelegation events on chain and emits them -// through a ReplayObservable. This enables consumers to listen for on-chain -// application redelegation events and react to them asynchronously. -package delegation diff --git a/pkg/client/delegation/redelegation.go b/pkg/client/delegation/redelegation.go deleted file mode 100644 index 86af6906f..000000000 --- a/pkg/client/delegation/redelegation.go +++ /dev/null @@ -1,99 +0,0 @@ -package delegation - -// TODO_TECHDEBT(#280): Refactor to use merged observables and subscribe to -// MsgDelegateToGateway and MsgUndelegateFromGateway messages directly, instead -// of listening to all events and doing a verbose filter. - -import ( - "encoding/json" - "strconv" - - "cosmossdk.io/api/tendermint/abci" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" -) - -// redelegationEventType is the type of the EventRedelegation event emitted by -// both the MsgDelegateToGateway and MsgUndelegateFromGateway messages. -const redelegationEventType = "pocket.application.EventRedelegation" - -var _ client.Redelegation = (*redelegation)(nil) - -// TxEvent is an alias for the CometBFT TxResult type used to decode the -// response bytes from the EventsQueryClient's subscription -type TxEvent = abci.TxResult - -// redelegation wraps the EventRedelegation event emitted by the application -// module, for use in the observable, it is one of the log entries embedded -// within the log field of the response struct from the app module's query. -type redelegation struct { - AppAddress string `json:"app_address"` - GatewayAddress string `json:"gateway_address"` -} - -// GetAppAddress returns the application address of the redelegation event -func (d redelegation) GetAppAddress() string { - return d.AppAddress -} - -// GetGatewayAddress returns the gateway address of the redelegation event -func (d redelegation) GetGatewayAddress() string { - return d.GatewayAddress -} - -// newRedelegationEventFactoryFn is a factory function that returns a -// function that attempts to deserialize the given bytes into a redelegation -// struct. If the delegate struct has an empty app address then an -// ErrUnmarshalRedelegation error is returned. Otherwise if deserialisation -// fails then the error is returned. -func newRedelegationEventFactoryFn() events.NewEventsFn[client.Redelegation] { - return func(eventBz []byte) (client.Redelegation, error) { - txEvent := new(TxEvent) - // Try to deserialize the provided bytes into a TxEvent. - if err := json.Unmarshal(eventBz, txEvent); err != nil { - return nil, err - } - // Check if the TxEvent has empty transaction bytes, which indicates - // the message is probably not a valid transaction event. - if len(txEvent.Tx) == 0 { - return nil, events.ErrEventsUnmarshalEvent.Wrap("empty transaction bytes") - } - // Iterate through the log entries to find EventRedelegation - for _, event := range txEvent.Result.Events { - if event.GetType_() != redelegationEventType { - continue - } - var redelegationEvent redelegation - for _, attr := range event.Attributes { - switch attr.Key { - case "app_address": - appAddr, err := unescape(attr.Value) - if err != nil { - return nil, events.ErrEventsUnmarshalEvent.Wrapf("cannot retrieve app address: %v", err) - } - redelegationEvent.AppAddress = appAddr - case "gateway_address": - gatewayAddr, err := unescape(attr.Value) - if err != nil { - return nil, events.ErrEventsUnmarshalEvent.Wrapf("cannot retrieve gateway address: %v", err) - } - redelegationEvent.GatewayAddress = gatewayAddr - default: - return nil, events.ErrEventsUnmarshalEvent.Wrapf("unknown attribute key: %s", attr.Key) - } - } - // Handle the redelegation event - if redelegationEvent.AppAddress == "" || redelegationEvent.GatewayAddress == "" { - return nil, events.ErrEventsUnmarshalEvent. - Wrapf("empty redelegation event: %s", string(eventBz)) - } - return redelegationEvent, nil - } - return nil, events.ErrEventsUnmarshalEvent.Wrap("no redelegation event found") - } -} - -func unescape(s string) (string, error) { - return strconv.Unquote(s) -} diff --git a/pkg/client/events/errors.go b/pkg/client/events/errors.go deleted file mode 100644 index 838b9dbec..000000000 --- a/pkg/client/events/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package events - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "events" - - ErrEventsDial = sdkerrors.Register(codespace, 1, "dialing for connection failed") - ErrEventsConnClosed = sdkerrors.Register(codespace, 2, "connection closed") - ErrEventsSubscribe = sdkerrors.Register(codespace, 3, "failed to subscribe to events") - ErrEventsUnmarshalEvent = sdkerrors.Register(codespace, 4, "failed to unmarshal event bytes") - ErrEventsConsClosed = sdkerrors.Register(codespace, 5, "eventsqueryclient connection closed") -) diff --git a/pkg/client/events/godoc.go b/pkg/client/events/godoc.go deleted file mode 100644 index b5bbf685f..000000000 --- a/pkg/client/events/godoc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package events provides a generic client for subscribing to on-chain events -// via an EventsQueryClient and transforming the received events into the type -// defined by the EventsReplayClient's generic type parameter. -// -// The EventsQueryClient emits ReplayObservables which are of the type defined -// by the EventsReplayClient's generic type parameter. -// -// The usage of of ReplayObservables allows the EventsReplayClient to be always -// provide the latest event data to the caller, even if the connection to the -// EventsQueryClient is lost and re-established, without the caller having to -// re-subscribe to the EventsQueryClient. -package events diff --git a/pkg/client/events/options.go b/pkg/client/events/options.go deleted file mode 100644 index 41fca7548..000000000 --- a/pkg/client/events/options.go +++ /dev/null @@ -1,11 +0,0 @@ -package events - -import "github.com/pokt-network/poktroll/pkg/client" - -// WithDialer returns a client.EventsQueryClientOption which sets the given dialer on the -// resulting eventsQueryClient when passed to NewEventsQueryClient(). -func WithDialer(dialer client.Dialer) client.EventsQueryClientOption { - return func(evtClient client.EventsQueryClient) { - evtClient.(*eventsQueryClient).dialer = dialer - } -} diff --git a/pkg/client/events/query_client.go b/pkg/client/events/query_client.go deleted file mode 100644 index 5524f52dc..000000000 --- a/pkg/client/events/query_client.go +++ /dev/null @@ -1,293 +0,0 @@ -package events - -import ( - "context" - "crypto/rand" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "sync" - - "go.uber.org/multierr" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events/websocket" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" -) - -var _ client.EventsQueryClient = (*eventsQueryClient)(nil) - -// TODO_TECHDEBT: the cosmos-sdk CLI code seems to use a cometbft RPC client -// which includes a `#Subscribe()` method for a similar purpose. Perhaps we could -// replace this custom websocket client with that. -// See: -// - https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110 -// - https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L656 -// - https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114 -// - https://github.com/pokt-network/poktroll/pull/64#discussion_r1372378241 - -// eventsQueryClient implements the EventsQueryClient interface. -type eventsQueryClient struct { - // cometWebsocketURL is the websocket URL for the cometbft node. It is assigned - // in NewEventsQueryClient. - cometWebsocketURL string - // dialer is responsible for creating the connection instance which - // facilitates communication with the cometbft node via message passing. - dialer client.Dialer - // eventsBytesAndConnsMu protects the eventsBytesAndConns map. - eventsBytesAndConnsMu sync.RWMutex - // eventsBytesAndConns maps event subscription queries to their respective - // eventsBytes observable, connection, and isClosed status. - eventsBytesAndConns map[string]*eventsBytesAndConn -} - -// eventsBytesAndConn is a struct which holds an eventsBytes observable & the -// corresponding connection which produces its inputs. -type eventsBytesAndConn struct { - // eventsBytes is an observable which is notified about chain event messages - // matching the given query. It receives an either.Bytes which is - // either an error or the event message bytes. - eventsBytes observable.Observable[either.Bytes] - conn client.Connection - isClosed bool -} - -// Close unsubscribes all observers of eventsBytesAndConn's observable and also -// closes its connection. -func (ebc *eventsBytesAndConn) Close() { - ebc.eventsBytes.UnsubscribeAll() - _ = ebc.conn.Close() -} - -// NewEventsQueryClient returns a new events query client which is used to -// subscribe to on-chain events matching the given query. -// -// Available options: -// - WithDialer -func NewEventsQueryClient(cometWebsocketURL string, opts ...client.EventsQueryClientOption) client.EventsQueryClient { - evtClient := &eventsQueryClient{ - cometWebsocketURL: cometWebsocketURL, - eventsBytesAndConns: make(map[string]*eventsBytesAndConn), - } - - for _, opt := range opts { - opt(evtClient) - } - - if evtClient.dialer == nil { - // default to using the websocket dialer - evtClient.dialer = websocket.NewWebsocketDialer() - } - - return evtClient -} - -// EventsBytes returns an eventsBytes observable which is notified about chain -// event messages matching the given query. It receives an either.Bytes -// which is either an error or the event message bytes. -// (see: https://pkg.go.dev/github.com/cometbft/cometbft/types#pkg-constants) -// (see: https://docs.cosmos.network/v0.47/core/events#subscribing-to-events) -func (eqc *eventsQueryClient) EventsBytes( - ctx context.Context, - query string, -) (client.EventsBytesObservable, error) { - // Must (write) lock eventsBytesAndConnsMu so that we can safely check for - // existing subscriptions to the given query or add a new eventsBytes to the - // observableConns map. - // The lock must be held for both checking and adding to prevent concurrent - // calls to this function from racing. - eqc.eventsBytesAndConnsMu.Lock() - // Deferred (write) unlock. - defer eqc.eventsBytesAndConnsMu.Unlock() - - // Check if an event subscription already exists for the given query. - if eventsBzConn := eqc.eventsBytesAndConns[query]; eventsBzConn != nil { - // If found it is returned. - return eventsBzConn.eventsBytes, nil - } - - // Otherwise, create a new event subscription for the given query. - eventsBzConn, err := eqc.newEventsBytesAndConn(ctx, query) - if err != nil { - return nil, err - } - - // Insert the new eventsBytes into the eventsBytesAndConns map. - eqc.eventsBytesAndConns[query] = eventsBzConn - - // Unsubscribe from the eventsBytes when the context is done. - go eqc.goUnsubscribeOnDone(ctx, query) - - // Return the new eventsBytes observable for the given query. - return eventsBzConn.eventsBytes, nil -} - -// Close unsubscribes all observers from all event subscription observables. -func (eqc *eventsQueryClient) Close() { - eqc.close() -} - -// close unsubscribes all observers from all event subscription observables. -func (eqc *eventsQueryClient) close() { - eqc.eventsBytesAndConnsMu.Lock() - defer eqc.eventsBytesAndConnsMu.Unlock() - - for query, eventsBzConn := range eqc.eventsBytesAndConns { - // Unsubscribe all observers of the eventsBzConn observable and close the - // connection for the given query. - eventsBzConn.Close() - // remove isClosed eventsBytesAndConns - delete(eqc.eventsBytesAndConns, query) - } -} - -// newEventwsBzAndConn creates a new eventsBytes and connection for the given query. -func (eqc *eventsQueryClient) newEventsBytesAndConn( - ctx context.Context, - query string, -) (*eventsBytesAndConn, error) { - // Get a connection for the query. - conn, err := eqc.openEventsBytesAndConn(ctx, query) - if err != nil { - return nil, err - } - - // Construct an eventsBytes for the given query. - eventsBzObservable, eventsBzPublishCh := channel.NewObservable[either.Bytes]() - - // Publish either events bytes or an error received from the connection to - // the eventsBz observable. - // NB: intentionally not retrying on error, leaving that to the caller. - // (see: https://github.com/pokt-network/poktroll/pull/64#discussion_r1373826542) - go eqc.goPublishEventsBz(ctx, conn, eventsBzPublishCh) - - return &eventsBytesAndConn{ - eventsBytes: eventsBzObservable, - conn: conn, - }, nil -} - -// openEventsBytesAndConn gets a connection using the configured dialer and sends -// an event subscription request on it, returning the connection. -func (eqc *eventsQueryClient) openEventsBytesAndConn( - ctx context.Context, - query string, -) (client.Connection, error) { - // Get a request for subscribing to events matching the given query. - req, err := eqc.eventSubscriptionRequest(query) - if err != nil { - return nil, err - } - - // Get a connection from the dialer. - conn, err := eqc.dialer.DialContext(ctx, eqc.cometWebsocketURL) - if err != nil { - return nil, ErrEventsDial.Wrapf("%s", err) - } - - // Send the event subscription request on the connection. - if err := conn.Send(req); err != nil { - subscribeErr := ErrEventsSubscribe.Wrapf("%s", err) - // assume the connection is bad - closeErr := conn.Close() - return nil, multierr.Combine(subscribeErr, closeErr) - } - return conn, nil -} - -// goPublishEventsBz blocks on reading messages from a websocket connection. -// It is intended to be called from within a go routine. -func (eqc *eventsQueryClient) goPublishEventsBz( - ctx context.Context, - conn client.Connection, - eventsBzPublishCh chan<- either.Bytes, -) { - // Read and handle messages from the websocket. This loop will exit when the - // websocket connection is isClosed and/or returns an error. - for { - eventBz, err := conn.Receive() - if err != nil { - // TODO_CONSIDERATION: should we close the publish channel here too? - - // Stop this goroutine if there's an error. - // - // See gorilla websocket `Conn#NextReader()` docs: - // | Applications must break out of the application's read loop when this method - // | returns a non-nil error value. Errors returned from this method are - // | permanent. Once this method returns a non-nil error, all subsequent calls to - // | this method return the same error. - - // Only propagate error if it's not a context cancellation error. - if !errors.Is(ctx.Err(), context.Canceled) { - // Populate the error side (left) of the either and publish it. - eventsBzPublishCh <- either.Error[[]byte](err) - } - - eqc.close() - - return - } - - // Populate the []byte side (right) of the either and publish it. - eventsBzPublishCh <- either.Success(eventBz) - } -} - -// goUnsubscribeOnDone unsubscribes from the subscription when the context is done. -// It is intended to be called in a goroutine. -func (eqc *eventsQueryClient) goUnsubscribeOnDone( - ctx context.Context, - query string, -) { - // Wait for the context to be done. - <-ctx.Done() - // Only close the eventsBytes for the given query. - eqc.eventsBytesAndConnsMu.Lock() - defer eqc.eventsBytesAndConnsMu.Unlock() - - if eventsBzConn, ok := eqc.eventsBytesAndConns[query]; ok { - // Unsubscribe all observers of the given query's eventsBzConn's observable - // and close its connection. - eventsBzConn.Close() - // Remove the eventsBytesAndConn for the given query. - delete(eqc.eventsBytesAndConns, query) - } -} - -// eventSubscriptionRequest returns a JSON-RPC request for subscribing to events -// matching the given query. The request is serialized as JSON to a byte slice. -// (see: https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110) -// (see: https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114) -func (eqc *eventsQueryClient) eventSubscriptionRequest(query string) ([]byte, error) { - requestJson := map[string]any{ - "jsonrpc": "2.0", - "method": "subscribe", - "id": randRequestId(), - "params": map[string]interface{}{ - "query": query, - }, - } - requestBz, err := json.Marshal(requestJson) - if err != nil { - return nil, err - } - return requestBz, nil -} - -// randRequestId returns a random 8 byte, base64 request ID which is intended -// for in JSON-RPC requests to uniquely identify distinct RPC requests. -// These request IDs only need to be unique to the extent that they are useful -// to this client for identifying distinct RPC requests. Their size and keyspace -// are arbitrary. -func randRequestId() string { - requestIdBz := make([]byte, 8) // 8 bytes = 64 bits = uint64 - if _, err := rand.Read(requestIdBz); err != nil { - panic(fmt.Sprintf( - "failed to generate random request ID: %s", err, - )) - } - return base64.StdEncoding.EncodeToString(requestIdBz) -} diff --git a/pkg/client/events/query_client_integration_test.go b/pkg/client/events/query_client_integration_test.go deleted file mode 100644 index cbd9c426b..000000000 --- a/pkg/client/events/query_client_integration_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build integration - -package events_test - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// The query use to subscribe for new block events on the websocket endpoint exposed by CometBFT nodes -const committedBlockEventsQuery = "tm.event='NewBlock'" - -func TestQueryClient_EventsObservable_Integration(t *testing.T) { - const ( - eventReceiveTimeout = 5 * time.Second - observedEventsLimit = 3 - ) - ctx := context.Background() - - queryClient := testeventsquery.NewLocalnetClient(t) - require.NotNil(t, queryClient) - - // Start a subscription to the committed block events query. This begins - // publishing events to the returned observable. - eventsObservable, err := queryClient.EventsBytes(ctx, committedBlockEventsQuery) - require.NoError(t, err) - - eventsObserver := eventsObservable.Subscribe(ctx) - - var ( - eventCounter int - done = make(chan struct{}, 1) - ) - go func() { - for range eventsObserver.Ch() { - eventCounter++ - - if eventCounter >= observedEventsLimit { - done <- struct{}{} - return - } - } - }() - - select { - case <-done: - require.NoError(t, err) - require.Equal(t, observedEventsLimit, eventCounter) - case <-time.After(eventReceiveTimeout): - t.Fatalf( - "timed out waiting for block subscription; expected %d blocks, got %d", - observedEventsLimit, eventCounter, - ) - } -} diff --git a/pkg/client/events/query_client_test.go b/pkg/client/events/query_client_test.go deleted file mode 100644 index 2c868ac42..000000000 --- a/pkg/client/events/query_client_test.go +++ /dev/null @@ -1,392 +0,0 @@ -package events_test - -import ( - "context" - "errors" - "fmt" - "sync" - "sync/atomic" - "testing" - "time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/events/websocket" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testchannel" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" - "github.com/pokt-network/poktroll/testutil/testerrors" -) - -func TestEventsQueryClient_Subscribe_Succeeds(t *testing.T) { - var ( - readObserverEventsTimeout = time.Second - queryCounter int - queryLimit = 5 - connMocks = make([]*mockclient.MockConnection, queryLimit) - ctrl = gomock.NewController(t) - rootCtx, cancelRoot = context.WithCancel(context.Background()) - ) - t.Cleanup(cancelRoot) - - dialerMock := mockclient.NewMockDialer(ctrl) - // `Dialer#DialContext()` should be called once for each subscription (subtest). - dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). - DoAndReturn(func(_ context.Context, _ string) (*mockclient.MockConnection, error) { - // Return the connection mock for the subscription with the given query. - // It should've been created in the respective test function. - connMock := connMocks[queryCounter] - queryCounter++ - return connMock, nil - }). - Times(queryLimit) - - // Set up events query client. - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - t.Cleanup(queryClient.Close) - - for queryIdx := 0; queryIdx < queryLimit; queryIdx++ { - t.Run(testQuery(queryIdx), func(t *testing.T) { - var ( - // ReadEventCounter is the number of eventsBytesAndConns which have been - // received from the connection since the subtest started. - readEventCounter int - // HandleEventsLimit is the total number of eventsBytesAndConns to send and - // receive through the query client's eventsBytes for this subtest. - handleEventsLimit = 250 - // delayFirstEvent runs once (per test case) to delay the first event - // published by the mocked connection's Receive method to give the test - // ample time to subscribe to the events bytes observable before it - // starts receiving events, otherwise they will be dropped. - delayFirstEvent sync.Once - connClosed atomic.Bool - queryCtx, cancelQuery = context.WithCancel(rootCtx) - ) - - // Must set up connection mock before calling EventsBytes() - connMock := mockclient.NewMockConnection(ctrl) - // `Connection#Close()` should be called once for each subscription. - connMock.EXPECT().Close(). - DoAndReturn(func() error { - // Simulate closing the connection. - connClosed.CompareAndSwap(false, true) - return nil - }). - Times(1) - // `Connection#Send()` should be called once for each subscription. - connMock.EXPECT().Send(gomock.Any()). - Return(nil). - Times(1) - // `Connection#Receive()` should be called once for each message plus - // one as it blocks in the loop which calls msgHandler after reading the - // last message. - connMock.EXPECT().Receive(). - DoAndReturn(func() (any, error) { - delayFirstEvent.Do(func() { time.Sleep(50 * time.Millisecond) }) - - // Simulate ErrConnClosed if connection is isClosed. - if connClosed.Load() { - return nil, events.ErrEventsConnClosed - } - - event := testEvent(int32(readEventCounter)) - readEventCounter++ - - // Simulate IO delay between sequential events. - time.Sleep(10 * time.Microsecond) - - return event, nil - }). - MinTimes(handleEventsLimit) - connMocks[queryIdx] = connMock - - // Set up events bytes observer for this query. - eventObservable, err := queryClient.EventsBytes(queryCtx, testQuery(queryIdx)) - require.NoError(t, err) - - eventObserver := eventObservable.Subscribe(queryCtx) - - onLimit := func() { - // Cancelling the context should close the connection. - cancelQuery() - // Closing the connection happens asynchronously, so we need to wait a bit - // for the connection to close to satisfy the connection mock expectations. - time.Sleep(10 * time.Millisecond) - - // Drain the observer channel and assert that it's isClosed. - err := testchannel.DrainChannel(eventObserver.Ch()) - require.NoError(t, err, "eventsBytesAndConns observer channel should be isClosed") - } - - // Concurrently consume eventsBytesAndConns from the observer channel. - behavesLikeEitherObserver( - t, eventObserver, - handleEventsLimit, - events.ErrEventsConnClosed, - readObserverEventsTimeout, - onLimit, - ) - }) - } -} - -func TestEventsQueryClient_Subscribe_Close(t *testing.T) { - var ( - firstEventDelay = 50 * time.Millisecond - readAllEventsTimeout = 50*time.Millisecond + firstEventDelay - handleEventsLimit = 10 - readEventCounter int - // delayFirstEvent runs once (per test case) to delay the first event - // published by the mocked connection's Receive method to give the test - // ample time to subscribe to the events bytes observable before it - // starts receiving events, otherwise they will be dropped. - delayFirstEvent sync.Once - connClosed atomic.Bool - ctx = context.Background() - ) - - connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) - connMock.EXPECT().Send(gomock.Any()).Return(nil). - Times(1) - connMock.EXPECT().Receive(). - DoAndReturn(func() (any, error) { - delayFirstEvent.Do(func() { time.Sleep(firstEventDelay) }) - - if connClosed.Load() { - return nil, events.ErrEventsConnClosed - } - - event := testEvent(int32(readEventCounter)) - readEventCounter++ - - // Simulate IO delay between sequential events. - time.Sleep(10 * time.Microsecond) - - return event, nil - }). - MinTimes(handleEventsLimit) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - - // set up query observer - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.NoError(t, err) - - eventsObserver := eventsObservable.Subscribe(ctx) - - onLimit := func() { - // cancelling the context should close the connection - queryClient.Close() - // closing the connection happens asynchronously, so we need to wait a bit - // for the connection to close to satisfy the connection mock expectations. - time.Sleep(10 * time.Millisecond) - } - - // concurrently consume eventsBytesAndConns from the observer channel - behavesLikeEitherObserver( - t, eventsObserver, - handleEventsLimit, - events.ErrEventsConnClosed, - readAllEventsTimeout, - onLimit, - ) -} - -func TestEventsQueryClient_Subscribe_DialError(t *testing.T) { - ctx := context.Background() - - eitherErrDial := either.Error[*mockclient.MockConnection](events.ErrEventsDial) - dialerMock := testeventsquery.NewOneTimeMockDialer(t, eitherErrDial) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.Nil(t, eventsObservable) - require.True(t, errors.Is(err, events.ErrEventsDial)) -} - -func TestEventsQueryClient_Subscribe_RequestError(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - - connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) - connMock.EXPECT().Send(gomock.Any()). - Return(fmt.Errorf("mock send error")). - Times(1) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("url_ignored", dialerOpt) - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.Nil(t, eventsObservable) - require.True(t, errors.Is(err, events.ErrEventsSubscribe)) - - // cancelling the context should close the connection - cancel() - // closing the connection happens asynchronously, so we need to wait a bit - // for the connection to close to satisfy the connection mock expectations. - time.Sleep(10 * time.Millisecond) -} - -// TODO_INVESTIGATE: why this test fails? -func TestEventsQueryClient_Subscribe_ReceiveError(t *testing.T) { - t.Skip("TODO_INVESTIGATE: why this test fails") - - var ( - handleEventLimit = 10 - readAllEventsTimeout = 100 * time.Millisecond - readEventCounter int - ) - - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) - connMock.EXPECT().Send(gomock.Any()).Return(nil). - Times(1) - connMock.EXPECT().Receive(). - DoAndReturn(func() (any, error) { - if readEventCounter >= handleEventLimit { - return nil, websocket.ErrEventsWebsocketReceive - } - - event := testEvent(int32(readEventCounter)) - readEventCounter++ - time.Sleep(10 * time.Microsecond) - - return event, nil - }). - MinTimes(handleEventLimit) - - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - - // set up query observer - eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) - require.NoError(t, err) - - eventsObserver := eventsObservable.Subscribe(ctx) - // concurrently consume eventsBytesAndConns from the observer channel - behavesLikeEitherObserver( - t, eventsObserver, - handleEventLimit, - websocket.ErrEventsWebsocketReceive, - readAllEventsTimeout, - nil, - ) -} - -// TODO_TECHDEBT: add test coverage for multiple observers with distinct and overlapping queries -func TestEventsQueryClient_EventsBytes_MultipleObservers(t *testing.T) { - t.Skip("TODO_TECHDEBT: add test coverage for multiple observers with distinct and overlapping queries") -} - -// behavesLikeEitherObserver asserts that the given observer behaves like an -// observable.Observer[either.Either[V]] by consuming notifications from the -// observer channel and asserting that they match the expected notification. -// It also asserts that the observer channel is isClosed after the expected number -// of eventsBytes have been received. -// If onLimit is not nil, it is called when the expected number of events have -// been received. -// Otherwise, the observer channel is drained and the test fails if it is not -// isClosed after the timeout duration. -func behavesLikeEitherObserver[V any]( - t *testing.T, - observer observable.Observer[either.Either[V]], - notificationsLimit int, - expectedErr error, - timeout time.Duration, - onLimit func(), -) { - t.Helper() - - var ( - // eventsCounter is the number of events which have been received from the - // eventsBytes since this function was called. - eventsCounter int32 - // errCh is used to signal when the test completes and/or produces an error - errCh = make(chan error, 1) - ) - - go func() { - for eitherEvent := range observer.Ch() { - event, err := eitherEvent.ValueOrError() - if err != nil { - switch expectedErr { - case nil: - if !assert.NoError(t, err) { - errCh <- testerrors.ErrAsync - return - } - default: - if !assert.ErrorIs(t, err, expectedErr) { - errCh <- testerrors.ErrAsync - return - } - } - } - - currentEventCount := atomic.LoadInt32(&eventsCounter) - if int(currentEventCount) >= notificationsLimit { - // signal completion - errCh <- nil - return - } - - // TODO_IMPROVE: to make this test helper more generic, it should accept - // a generic function which generates the expected event for the given - // index. Perhaps this function could use an either type which could be - // used to consolidate the expectedErr and expectedEvent arguments. - expectedEvent := testEvent(currentEventCount) - // Require calls t.Fatal internally, which shouldn't happen in a - // goroutine other than the test function's. - // Use assert instead and stop the test by sending on errCh and - // returning. - if !assert.Equal(t, expectedEvent, event) { - errCh <- testerrors.ErrAsync - return - } - - atomic.AddInt32(&eventsCounter, 1) - - // unbounded consumption here can result in the condition below never - // being met due to the connection being isClosed before the "last" event - // is received - time.Sleep(10 * time.Microsecond) - } - }() - - select { - case err := <-errCh: - require.NoError(t, err) - require.Equal(t, notificationsLimit, int(atomic.LoadInt32(&eventsCounter))) - - // TODO_THIS_COMMIT: is this necessary? - time.Sleep(10 * time.Millisecond) - - if onLimit != nil { - onLimit() - } - case <-time.After(timeout): - t.Fatalf( - "timed out waiting for next event; expected %d events, got %d", - notificationsLimit, atomic.LoadInt32(&eventsCounter), - ) - } - - err := testchannel.DrainChannel(observer.Ch()) - require.NoError(t, err, "eventsBytesAndConns observer should be isClosed") -} - -func testEvent(idx int32) []byte { - return []byte(fmt.Sprintf("message_%d", idx)) -} - -func testQuery(idx int) string { - return fmt.Sprintf("query_%d", idx) -} diff --git a/pkg/client/events/replay_client.go b/pkg/client/events/replay_client.go deleted file mode 100644 index 4313213e5..000000000 --- a/pkg/client/events/replay_client.go +++ /dev/null @@ -1,302 +0,0 @@ -package events - -import ( - "context" - "fmt" - "time" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/retry" -) - -const ( - // eventsBytesRetryDelay is the delay between retry attempts when the events - // bytes observable returns an error. - eventsBytesRetryDelay = time.Second - // eventsBytesRetryLimit is the maximum number of times to attempt to - // re-establish the events query bytes subscription when the events bytes - // observable returns an error or closes. - eventsBytesRetryLimit = 10 - eventsBytesRetryResetTimeout = 10 * time.Second - // replayObsCacheBufferSize is the replay buffer size of the - // replayObsCache replay observable which is used to cache the replay - // observable that is notified of new events. - // It, replayObsCache, is updated with a new "active" observable when a new - // events query subscription is created, for example, after a non-persistent - // connection error. - replayObsCacheBufferSize = 1 -) - -// Enforce the EventsReplayClient interface is implemented by the replayClient type. -var _ client.EventsReplayClient[any] = (*replayClient[any])(nil) - -// NewEventsFn is a function that takes a byte slice and returns a new instance -// of the generic type T. -type NewEventsFn[T any] func([]byte) (T, error) - -// replayClient implements the EventsReplayClient interface for a generic type T, -// and replay observable for type T. -type replayClient[T any] struct { - // queryString is the query string used to subscribe to events of the - // desired type. - // See: https://docs.cosmos.network/main/learn/advanced/events#subscribing-to-events - // and: https://docs.cosmos.network/main/learn/advanced/events#default-events - queryString string - // eventsClient is the events query client which is used to subscribe to - // newly committed block events. It emits an either value which may contain - // an error, at most, once and closes immediately after if it does. - eventsClient client.EventsQueryClient - // eventDecoder is a function which decodes event subscription - // message bytes into the type defined by the EventsReplayClient's generic type - // parameter. - eventDecoder NewEventsFn[T] - // replayObsBufferSize is the buffer size for the replay observable returned - // by EventsSequence, this can be any integer and it refers to the number of - // notifications the replay observable will hold in its buffer, that can be - // replayed to new observers. - // NB: This is not the buffer size of the replayObsCache - replayObsBufferSize int - // replayObsCache is a replay observable with a buffer size of 1, which - // holds the "active latest replay observable" which is notified when new - // events are received by the events query client subscription created in - // goPublishEvents. This observable (and the one it emits) closes when the - // events bytes observable returns an error and is updated with a new - // "active" observable after a new events query subscription is created. - // - // TODO_REFACTOR(@h5law): Look into making this a regular observable as - // we may no longer depend on it being replayable. - replayObsCache observable.ReplayObservable[observable.ReplayObservable[T]] - // replayObsCachePublishCh is the publish channel for replayObsCache. - // It's used to set and subsequently update replayObsCache the events replay - // observable; - // For example when the connection is re-established after erroring. - replayObsCachePublishCh chan<- observable.ReplayObservable[T] -} - -// NewEventsReplayClient creates a new EventsReplayClient from the given -// dependencies, cometWebsocketURL and subscription query string. It requires a -// decoder function to be provided which decodes event subscription message -// bytes into the type defined by the EventsReplayClient's generic type parameter. -// The replayObsBufferSize is the replay buffer size of the replay observable -// which is notified of new events. -// -// Required dependencies: -// - client.EventsQueryClient -func NewEventsReplayClient[T any]( - ctx context.Context, - deps depinject.Config, - queryString string, - newEventFn NewEventsFn[T], - replayObsBufferSize int, -) (client.EventsReplayClient[T], error) { - // Initialize the replay client - rClient := &replayClient[T]{ - queryString: queryString, - eventDecoder: newEventFn, - replayObsBufferSize: replayObsBufferSize, - } - // TODO_REFACTOR(@h5law): Look into making this a regular observable as - // we may no longer depend on it being replayable. - replayObsCache, replayObsCachePublishCh := channel.NewReplayObservable[observable.ReplayObservable[T]]( - ctx, - // Buffer size of 1 as the cache only needs to hold the latest - // active replay observable. - replayObsCacheBufferSize, - ) - rClient.replayObsCache = replayObsCache - rClient.replayObsCachePublishCh = replayObsCachePublishCh - - // Inject dependencies - if err := depinject.Inject(deps, &rClient.eventsClient); err != nil { - return nil, err - } - - // Concurrently publish events to the observable emitted by replayObsCache. - go rClient.goPublishEvents(ctx) - - return rClient, nil -} - -// EventsSequence returns a new ReplayObservable, with the buffer size provided -// during the EventsReplayClient construction, which is notified when new -// events are received by the encapsulated EventsQueryClient. -func (rClient *replayClient[T]) EventsSequence(ctx context.Context) observable.ReplayObservable[T] { - // Create a new replay observable and publish channel for event type T with - // a buffer size matching that provided during the EventsReplayClient - // construction. - eventTypeObs, replayEventTypeObsPublishCh := channel.NewReplayObservable[T]( - ctx, - rClient.replayObsBufferSize, - ) - - // Ensure that the subscribers of the returned eventTypeObs receive - // notifications from the latest open replay observable. - go rClient.goRemapEventsSequence(ctx, replayEventTypeObsPublishCh) - - // Return the event type observable. - return eventTypeObs -} - -// goRemapEventsSequence publishes events observed by the most recent cached -// events type replay observable to the given publishCh -func (rClient *replayClient[T]) goRemapEventsSequence(ctx context.Context, publishCh chan<- T) { - var prevEventTypeObs observable.ReplayObservable[T] - channel.ForEach[observable.ReplayObservable[T]]( - ctx, - rClient.replayObsCache, - func(ctx context.Context, eventTypeObs observable.ReplayObservable[T]) { - if prevEventTypeObs != nil { - // Just in case the assumption that all transport errors are - // persistent (i.e. they occur once and do not repeat) does not - // hold, unsubscribe from the previous event type observable in - // order to prevent unexpected and/or duplicate notifications - // on the observable returned by this function. - prevEventTypeObs.UnsubscribeAll() - } else { - prevEventTypeObs = eventTypeObs - } - eventObserver := eventTypeObs.Subscribe(ctx) - for event := range eventObserver.Ch() { - publishCh <- event - } - }, - ) -} - -// LastNEvents returns the last N typed events that have been received by the -// corresponding events query subscription. -// It blocks until at least one event has been received. -func (rClient *replayClient[T]) LastNEvents(ctx context.Context, n int) []T { - return rClient.EventsSequence(ctx).Last(ctx, n) -} - -// Close unsubscribes all observers of the committed blocks sequence observable -// and closes the events query client. -func (rClient *replayClient[T]) Close() { - // Closing eventsClient will cascade unsubscribe and close downstream observers. - rClient.eventsClient.Close() -} - -// goPublishEvents runs the work function returned by retryPublishEventsFactory, -// re-invoking it according to the arguments to retry.OnError when the events bytes -// observable returns an asynchronous error. -// This function is intended to be called in a goroutine. -func (rClient *replayClient[T]) goPublishEvents(ctx context.Context) { - // React to errors by getting a new events bytes observable, re-mapping it, - // and send it to replayObsCachePublishCh such that - // replayObsCache.Last(ctx, 1) will return it. - publishError := retry.OnError( - ctx, - eventsBytesRetryLimit, - eventsBytesRetryDelay, - eventsBytesRetryResetTimeout, - "goPublishEvents", - rClient.retryPublishEventsFactory(ctx), - ) - - // If we get here, the retry limit was reached and the retry loop exited. - // Since this function runs in a goroutine, we can't return the error to the - // caller. Instead, we panic. - if publishError != nil { - panic(fmt.Errorf("EventsReplayClient[%T].goPublishEvents should never reach this spot: %w", *new(T), publishError)) - } -} - -// retryPublishEventsFactory returns a function which is intended to be passed -// to retry.OnError. The returned function pipes event bytes from the events -// query client, maps them to typed events, and publishes them to the -// replayObsCache replay observable. -func (rClient *replayClient[T]) retryPublishEventsFactory(ctx context.Context) func() chan error { - return func() chan error { - errCh := make(chan error, 1) - eventsBytesObs, err := rClient.eventsClient.EventsBytes(ctx, rClient.queryString) - if err != nil { - errCh <- err - return errCh - } - - // NB: must cast back to generic observable type to use with Map. - eventsBzObs := observable.Observable[either.Either[[]byte]](eventsBytesObs) - typedObs := channel.MapReplay( - ctx, - replayObsCacheBufferSize, - eventsBzObs, - rClient.newMapEventsBytesToTFn(errCh), - ) - - // Subscribe to the eventBzObs and block until the channel closes. - // Then pass this as an error to force the retry.OnError to resubscribe. - go func() { - eventsBzObserver := eventsBzObs.Subscribe(ctx) - for range eventsBzObserver.Ch() { - // Wait for the channel to close. - continue - } - // UnsubscribeAll downstream observers, as the source observable has - // closed and will not emit any more values. - typedObs.UnsubscribeAll() - // Publish an error to the error channel to initiate a retry - errCh <- ErrEventsConsClosed - }() - - // Initially set replayObsCache and update if after retrying on error. - rClient.replayObsCachePublishCh <- typedObs - - return errCh - } -} - -// newMapEventsBytesToTFn is a factory for a function which is intended -// to be used as a transformFn in a channel.Map() call. Since the map function -// is called asynchronously, this factory creates a closure around an error -// channel which can be used for asynchronous error signaling from within the -// map function, and handling from the Map call context. -// -// The map function itself attempts to deserialize the given byte slice as a -// the EventsReplayClient's generic typed event, using the decoder function provided. -// If the events bytes observable contained an error, this value is not emitted -// (skipped) on the destination observable of the map operation. -// -// If deserialisation failed because the event bytes were for a different event -// type, this value is also skipped. If deserialisation failed for some other -// reason, this function panics. -func (rClient *replayClient[T]) newMapEventsBytesToTFn(errCh chan<- error) func( - context.Context, - either.Bytes, -) (T, bool) { - return func( - _ context.Context, - eitherEventBz either.Bytes, - ) (_ T, skip bool) { - eventBz, err := eitherEventBz.ValueOrError() - if err != nil { - errCh <- err - // Don't publish (skip) if eitherEventBz contained an error. - // eitherEventBz should automatically close itself in this case. - // (i.e. no more values should be mapped to this transformFn's respective - // dstObservable). - return *new(T), true - } - - // attempt to decode the event bytes using the decoder function provided - // during the EventsReplayClient's construction. - event, err := rClient.eventDecoder(eventBz) - if err != nil { - if ErrEventsUnmarshalEvent.Is(err) { - // Don't publish (skip) if the message was not the correct event. - return *new(T), true - } - - panic(fmt.Sprintf( - "unexpected error deserialising event: %v; eventBz: %s", - err, string(eventBz), - )) - } - return event, false - } -} diff --git a/pkg/client/events/replay_client_example_test.go b/pkg/client/events/replay_client_example_test.go deleted file mode 100644 index d11685de2..000000000 --- a/pkg/client/events/replay_client_example_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package events_test - -import ( - "context" - "encoding/json" - "fmt" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -const ( - // Define a query string to provide to the EventsQueryClient - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events - // And: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events - eventQueryString = "message.action='messageActionName'" - // Define the websocket URL the EventsQueryClient will subscribe to - cometWebsocketURL = "ws://example.com:36657/websocket" - // the amount of events we want before they are emitted - replayObsBufferSize = 1 -) - -var _ EventType = (*eventType)(nil) - -// Define an interface to represent the onchain event -type EventType interface { - GetName() string // Illustrative only; arbitrary interfaces are supported. -} - -// Define the event type that implements the interface -type eventType struct { - Name string `json:"name"` -} - -// See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsFn -func eventTypeFactory(ctx context.Context) events.NewEventsFn[EventType] { - // Define a decoder function that can take the raw event bytes - // received from the EventsQueryClient and convert them into - // the desired type for the EventsReplayClient - return func(eventBz []byte) (EventType, error) { - eventMsg := new(eventType) - logger := polylog.Ctx(ctx) - - if err := json.Unmarshal(eventBz, eventMsg); err != nil { - return nil, err - } - - // Confirm the event is correct by checking its fields - if eventMsg.Name == "" { - logger.Error().Str("eventBz", string(eventBz)).Msg("event type is not correct") - return nil, events.ErrEventsUnmarshalEvent. - Wrapf("with eventType data: %s", string(eventBz)) - } - - return eventMsg, nil - } -} - -func (e *eventType) GetName() string { return e.Name } - -func ExampleNewEventsReplayClient() { - // Create the events query client and a depinject config to supply - // it into the EventsReplayClient - // See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsQueryClient - evtClient := events.NewEventsQueryClient(cometWebsocketURL) - depConfig := depinject.Supply(evtClient) - - // Create a context (this should be cancellable to close the EventsReplayClient) - ctx, cancel := context.WithCancel(context.Background()) - - // Create a new instance of the EventsReplayClient - // See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsReplayClient - client, err := events.NewEventsReplayClient[EventType]( - ctx, - depConfig, - eventQueryString, - eventTypeFactory(ctx), - replayObsBufferSize, - ) - if err != nil { - panic(fmt.Errorf("unable to create EventsReplayClient %v", err)) - } - - // Assume events the lastest event emitted of type EventType has the name "testEvent" - - // Retrieve the latest emitted event - lastEventType := client.LastNEvents(ctx, 1)[0] - fmt.Printf("Last Event: '%s'\n", lastEventType.GetName()) - - // Get the latest replay observable from the EventsReplayClient - // In order to get the latest events from the sequence - latestEventsObs := client.EventsSequence(ctx) - // Get the latest events from the sequence - lastEventType = latestEventsObs.Last(ctx, 1)[0] - fmt.Printf("Last Event: '%s'\n", lastEventType.GetName()) - - // Cancel the context which will call client.Close and close all - // subscriptions and the EventsQueryClient - cancel() - // Output - // Last Event: 'testEvent' - // Last Event: 'testEvent' -} diff --git a/pkg/client/events/replay_client_integration_test.go b/pkg/client/events/replay_client_integration_test.go deleted file mode 100644 index 30fe639be..000000000 --- a/pkg/client/events/replay_client_integration_test.go +++ /dev/null @@ -1,146 +0,0 @@ -package events_test - -import ( - "context" - "encoding/json" - "fmt" - "sync/atomic" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" -) - -// Create the generic event type and decoder for the replay client - -var _ messageEvent = (*tEvent)(nil) - -type messageEvent interface { - EventMessage() string -} - -type tEvent struct { - Message string `json:"message"` -} - -type messageEventReplayObs observable.ReplayObservable[messageEvent] - -func (t *tEvent) EventMessage() string { - return t.Message -} - -func newDecodeEventMessageFn() events.NewEventsFn[messageEvent] { - return func(eventBz []byte) (messageEvent, error) { - t := new(tEvent) - if err := json.Unmarshal(eventBz, t); err != nil { - return nil, err - } - if t.Message == "" { - return nil, events.ErrEventsUnmarshalEvent - } - return t, nil - } -} - -// newMessageEventBz returns a new message event in JSON format -func newMessageEventBz(eventNum int32) []byte { - return []byte(fmt.Sprintf(`{"message":"message_%d"}`, eventNum)) -} - -func TestReplayClient_Remapping(t *testing.T) { - var ( - ctx = context.Background() - connClosed atomic.Bool - firstEventDelayed atomic.Bool - readEventCounter atomic.Int32 - eventsReceived atomic.Int32 - eventsToRecv = int32(10) - errCh = make(chan error, 1) - timeoutAfter = 3 * time.Second // 1 second delay on retry.OnError - ) - - // Setup the mock connection and dialer - connMock, dialerMock := testeventsquery.NewNTimesReconnectMockConnAndDialer(t, 2, &connClosed, &firstEventDelayed) - // Mock the connection receiving events - connMock.EXPECT().Receive(). - // Receive is called in the tightest loop possible (max speed limited - // by a goroutine) and as such the sleep's within are used to slow down - // the time between events to prevent unexpected behavior. As in this - // test environment, there are no "real" delays between "#Receive" calls - // (events being emitted) and as such the sleep's enable the publishing - // of notifications to observers to occur in a flake-free manner. - DoAndReturn(func() (any, error) { - // Simulate ErrConnClosed if connection is isClosed. - if connClosed.Load() { - return nil, events.ErrEventsConnClosed - } - - // Delay the event if needed, this is to allow for the events query - // client to subscribe and receive the first event. - if !firstEventDelayed.CompareAndSwap(false, true) { - time.Sleep(50 * time.Millisecond) - } - - eventNum := readEventCounter.Add(1) - 1 - event := newMessageEventBz(eventNum) - // After an arbitrary number of events (2 in this case), simulate - // the connection closing so that the replay client can remap the - // events it receives without the caller having to resubscribe. - if eventNum == 2 { - // Simulate the connection closing - connMock.Close() - } - - // Simulate IO delay between sequential events. - time.Sleep(50 * time.Microsecond) - - return event, nil - }). - MinTimes(int(eventsToRecv)) - - // Setup the events query client dependency - dialerOpt := events.WithDialer(dialerMock) - queryClient := events.NewEventsQueryClient("", dialerOpt) - deps := depinject.Supply(queryClient) - - // Create the replay client - replayClient, err := events.NewEventsReplayClient[messageEvent]( - ctx, - deps, - "", // subscription query string - newDecodeEventMessageFn(), - 100, // replay buffer size - ) - require.NoError(t, err) - - channel.ForEach( - ctx, - observable.Observable[messageEvent](replayClient.EventsSequence(ctx)), - func(ctx context.Context, event messageEvent) { - require.NotEmpty(t, event) - received := eventsReceived.Add(1) - if received >= eventsToRecv { - errCh <- nil - return - } - }, - ) - - select { - case err := <-errCh: - require.NoError(t, err) - eventsRecv := eventsReceived.Load() - require.Equalf(t, eventsToRecv, eventsRecv, "received %d events, want: %d", eventsReceived.Load(), eventsRecv) - case <-time.After(timeoutAfter): - t.Fatalf( - "timed out waiting for events subscription; expected %d messages, got %d", - eventsToRecv, eventsReceived.Load(), - ) - } -} diff --git a/pkg/client/events/websocket/connection.go b/pkg/client/events/websocket/connection.go deleted file mode 100644 index 5f34aba4e..000000000 --- a/pkg/client/events/websocket/connection.go +++ /dev/null @@ -1,35 +0,0 @@ -package websocket - -import ( - gorillaws "github.com/gorilla/websocket" - - "github.com/pokt-network/poktroll/pkg/client" -) - -var _ client.Connection = (*websocketConn)(nil) - -// websocketConn implements the Connection interface using the gorilla websocket -// transport implementation. -type websocketConn struct { - conn *gorillaws.Conn -} - -// Receive implements the respective interface method using the underlying websocket. -func (wsConn *websocketConn) Receive() ([]byte, error) { - _, msg, err := wsConn.conn.ReadMessage() - if err != nil { - return nil, ErrEventsWebsocketReceive.Wrapf("%s", err) - } - return msg, nil -} - -// Send implements the respective interface method using the underlying websocket. -func (wsConn *websocketConn) Send(msg []byte) error { - // Using the TextMessage message to indicate that msg is UTF-8 encoded. - return wsConn.conn.WriteMessage(gorillaws.TextMessage, msg) -} - -// Close implements the respective interface method using the underlying websocket. -func (wsConn *websocketConn) Close() error { - return wsConn.conn.Close() -} diff --git a/pkg/client/events/websocket/dialer.go b/pkg/client/events/websocket/dialer.go deleted file mode 100644 index bd0597d03..000000000 --- a/pkg/client/events/websocket/dialer.go +++ /dev/null @@ -1,35 +0,0 @@ -package websocket - -import ( - "context" - - "github.com/gorilla/websocket" - - "github.com/pokt-network/poktroll/pkg/client" -) - -var _ client.Dialer = (*websocketDialer)(nil) - -// websocketDialer implements the Dialer interface using the gorilla websocket -// transport implementation. -type websocketDialer struct{} - -// NewWebsocketDialer creates a new websocketDialer. -func NewWebsocketDialer() client.Dialer { - return &websocketDialer{} -} - -// DialContext implements the respective interface method using the default gorilla -// websocket dialer. -func (wsDialer *websocketDialer) DialContext( - ctx context.Context, - urlString string, -) (client.Connection, error) { - // TODO_IMPROVE: check http response status and potential err - // TODO_TECHDEBT: add test coverage and ensure support for a 3xx responses - conn, _, err := websocket.DefaultDialer.DialContext(ctx, urlString, nil) - if err != nil { - return nil, err - } - return &websocketConn{conn: conn}, nil -} diff --git a/pkg/client/events/websocket/errors.go b/pkg/client/events/websocket/errors.go deleted file mode 100644 index 85f8953fd..000000000 --- a/pkg/client/events/websocket/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package websocket - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "events_query_client_websocket_connection" - - ErrEventsWebsocketReceive = sdkerrors.Register(codespace, 1, "failed to receive event over websocket connection to pocket node") -) diff --git a/pkg/client/events/websocket/godoc.go b/pkg/client/events/websocket/godoc.go deleted file mode 100644 index 6ac7e3f04..000000000 --- a/pkg/client/events/websocket/godoc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package websocket provides a websocket client used to connect to a cosmos-sdk -// based chain node and subscribe to events via the EventsQueryClient. -package websocket diff --git a/pkg/client/godoc.go b/pkg/client/godoc.go deleted file mode 100644 index 66da550dd..000000000 --- a/pkg/client/godoc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package client defines interfaces and types that facilitate interactions -// with blockchain functionalities, both transactional and observational. It is -// built to provide an abstraction layer for sending, receiving, and querying -// blockchain data, thereby offering a standardized way of integrating with -// various blockchain platforms. -// -// The client package leverages external libraries like cosmos-sdk and cometbft, -// but there is a preference to minimize direct dependencies on these external -// libraries, when defining interfaces, aiming for a cleaner decoupling. -// It seeks to provide a flexible and comprehensive interface layer, adaptable to -// different blockchain configurations and requirements. -package client diff --git a/pkg/client/interface.go b/pkg/client/interface.go deleted file mode 100644 index da18a8790..000000000 --- a/pkg/client/interface.go +++ /dev/null @@ -1,264 +0,0 @@ -//go:generate mockgen -destination=../../testutil/mockclient/events_query_client_mock.go -package=mockclient . Dialer,Connection,EventsQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/block_client_mock.go -package=mockclient . Block,BlockClient -//go:generate mockgen -destination=../../testutil/mockclient/delegation_client_mock.go -package=mockclient . Redelegation,DelegationClient -//go:generate mockgen -destination=../../testutil/mockclient/tx_client_mock.go -package=mockclient . TxContext,TxClient -//go:generate mockgen -destination=../../testutil/mockclient/supplier_client_mock.go -package=mockclient . SupplierClient -//go:generate mockgen -destination=../../testutil/mockclient/account_query_client_mock.go -package=mockclient . AccountQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/application_query_client_mock.go -package=mockclient . ApplicationQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/supplier_query_client_mock.go -package=mockclient . SupplierQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/session_query_client_mock.go -package=mockclient . SessionQueryClient -//go:generate mockgen -destination=../../testutil/mockclient/cosmos_tx_builder_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client TxBuilder -//go:generate mockgen -destination=../../testutil/mockclient/cosmos_keyring_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/crypto/keyring Keyring -//go:generate mockgen -destination=../../testutil/mockclient/cosmos_client_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client AccountRetriever - -package client - -import ( - "context" - - comettypes "github.com/cometbft/cometbft/rpc/core/types" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/pokt-network/smt" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// SupplierClient is an interface for sufficient for a supplier operator to be -// able to construct blockchain transactions from pocket protocol-specific messages -// related to its role. -type SupplierClient interface { - // CreateClaim sends a claim message which creates an on-chain commitment by - // calling supplier to the given smt.SparseMerkleSumTree root hash of the given - // session's mined relays. - CreateClaim( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - rootHash []byte, - ) error - // SubmitProof sends a proof message which contains the - // smt.SparseMerkleClosestProof, corresponding to some previously created claim - // for the same session. The proof is validated on-chain as part of the pocket - // protocol. - SubmitProof( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - proof *smt.SparseMerkleClosestProof, - ) error -} - -// TxClient provides a synchronous interface initiating and waiting for transactions -// derived from cosmos-sdk messages, in a cosmos-sdk based blockchain network. -type TxClient interface { - SignAndBroadcast( - ctx context.Context, - msgs ...cosmostypes.Msg, - ) either.AsyncError -} - -// TxContext provides an interface which consolidates the operational dependencies -// required to facilitate the sender side of the transaction lifecycle: build, sign, -// encode, broadcast, and query (optional). -// -// TODO_IMPROVE: Avoid depending on cosmos-sdk structs or interfaces; add Pocket -// interface types to substitute: -// - ResultTx -// - TxResponse -// - Keyring -// - TxBuilder -type TxContext interface { - // GetKeyring returns the associated key management mechanism for the transaction context. - GetKeyring() cosmoskeyring.Keyring - - // NewTxBuilder creates and returns a new transaction builder instance. - NewTxBuilder() cosmosclient.TxBuilder - - // SignTx signs a transaction using the specified key name. It can operate in offline mode, - // and can overwrite any existing signatures based on the provided flags. - SignTx( - keyName string, - txBuilder cosmosclient.TxBuilder, - offline, overwriteSig bool, - ) error - - // EncodeTx takes a transaction builder and encodes it, returning its byte representation. - EncodeTx(txBuilder cosmosclient.TxBuilder) ([]byte, error) - - // BroadcastTx broadcasts the given transaction to the network. - BroadcastTx(txBytes []byte) (*cosmostypes.TxResponse, error) - - // QueryTx retrieves a transaction status based on its hash and optionally provides - // proof of the transaction. - QueryTx( - ctx context.Context, - txHash []byte, - prove bool, - ) (*comettypes.ResultTx, error) -} - -// Block is an interface which abstracts the details of a block to its minimal -// necessary components. -type Block interface { - Height() int64 - Hash() []byte -} - -// Redelegation is an interface which wraps the EventRedelegation event -// emitted by the application module. -// See: proto/pocket/application/types/event.proto#EventRedelegation -type Redelegation interface { - GetAppAddress() string - GetGatewayAddress() string -} - -// EventsObservable is a replay observable for events of some type T. -// NB: This cannot be an alias due to gomock's lack of support for generic types. -type EventsObservable[T any] observable.ReplayObservable[T] - -// EventsReplayClient is an interface which provides notifications about newly received -// events as well as direct access to the latest event via some blockchain API. -type EventsReplayClient[T any] interface { - // EventsSequence returns an observable which emits new events. - EventsSequence(context.Context) observable.ReplayObservable[T] - // LastNEvents returns the latest N events that has been received. - LastNEvents(ctx context.Context, n int) []T - // Close unsubscribes all observers of the events sequence observable - // and closes the events query client. - Close() -} - -// BlockReplayObservable is a defined type which is a replay observable of type Block. -// NB: This cannot be an alias due to gomock's lack of support for generic types. -type BlockReplayObservable EventsObservable[Block] - -// BlockClient is an interface that wraps the EventsReplayClient interface -// specific for the EventsReplayClient[Block] implementation -type BlockClient interface { - // CommittedBlocksSequence returns a BlockObservable that emits the - // latest blocks that have been committed to the chain. - CommittedBlocksSequence(context.Context) BlockReplayObservable - // LastNBlocks returns the latest N blocks that have been committed to - // the chain. - LastNBlocks(context.Context, int) []Block - // Close unsubscribes all observers of the committed block sequence - // observable and closes the events query client. - Close() -} - -// RedelegationReplayObservable is a defined type which is a replay observable -// of type Redelegation. -// NB: This cannot be an alias due to gomock's lack of support for generic types. -type RedelegationReplayObservable EventsObservable[Redelegation] - -// DelegationClient is an interface that wraps the EventsReplayClient interface -// specific for the EventsReplayClient[Redelegation] implementation -type DelegationClient interface { - // RedelegationsSequence returns a Observable of Redelegations that - // emits the latest redelegation events that have occurred on chain. - RedelegationsSequence(context.Context) RedelegationReplayObservable - // LastNRedelegations returns the latest N redelegation events that have - // occurred on chain. - LastNRedelegations(context.Context, int) []Redelegation - // Close unsubscribes all observers of the committed block sequence - // observable and closes the events query client. - Close() -} - -// EventsBytesObservable is an observable which is notified with an either -// value which contains either an error or the event message bytes. -// -// TODO_HACK: The purpose of this type is to work around gomock's lack of -// support for generic types. For the same reason, this type cannot be an -// alias (i.e. EventsBytesObservable = observable.Observable[either.Bytes]). -type EventsBytesObservable observable.Observable[either.Bytes] - -// EventsQueryClient is used to subscribe to chain event messages matching the given query, -// -// TODO_CONSIDERATION: the cosmos-sdk CLI code seems to use a cometbft RPC client -// which includes a `#Subscribe()` method for a similar purpose. Perhaps we could -// replace our custom implementation with one which wraps that. -// (see: https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110) -// (see: https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114) -// -// NOTE: a branch which attempts this is available at: -// https://github.com/pokt-network/poktroll/pull/74 -type EventsQueryClient interface { - // EventsBytes returns an observable which is notified about chain event messages - // matching the given query. It receives an either value which contains either an - // error or the event message bytes. - EventsBytes( - ctx context.Context, - query string, - ) (EventsBytesObservable, error) - // Close unsubscribes all observers of each active query's events bytes - // observable and closes the connection. - Close() -} - -// Connection is a transport agnostic, bi-directional, message-passing interface. -type Connection interface { - // Receive blocks until a message is received or an error occurs. - Receive() (msg []byte, err error) - // Send sends a message and may return a synchronous error. - Send(msg []byte) error - // Close closes the connection. - Close() error -} - -// Dialer encapsulates the construction of connections. -type Dialer interface { - // DialContext constructs a connection to the given URL and returns it or - // potentially a synchronous error. - DialContext(ctx context.Context, urlStr string) (Connection, error) -} - -// EventsQueryClientOption defines a function type that modifies the EventsQueryClient. -type EventsQueryClientOption func(EventsQueryClient) - -// TxClientOption defines a function type that modifies the TxClient. -type TxClientOption func(TxClient) - -// SupplierClientOption defines a function type that modifies the SupplierClient. -type SupplierClientOption func(SupplierClient) - -// AccountQueryClient defines an interface that enables the querying of the -// on-chain account information -type AccountQueryClient interface { - // GetAccount queries the chain for the details of the account provided - GetAccount(ctx context.Context, address string) (accounttypes.AccountI, error) -} - -// ApplicationQueryClient defines an interface that enables the querying of the -// on-chain application information -type ApplicationQueryClient interface { - // GetApplication queries the chain for the details of the application provided - GetApplication(ctx context.Context, appAddress string) (apptypes.Application, error) - - // GetAllApplications queries all on-chain applications - GetAllApplications(ctx context.Context) ([]apptypes.Application, error) -} - -// SupplierQueryClient defines an interface that enables the querying of the -// on-chain supplier information -type SupplierQueryClient interface { - // GetSupplier queries the chain for the details of the supplier provided - GetSupplier(ctx context.Context, supplierAddress string) (sharedtypes.Supplier, error) -} - -// SessionQueryClient defines an interface that enables the querying of the -// on-chain session information -type SessionQueryClient interface { - // GetSession queries the chain for the details of the session provided - GetSession( - ctx context.Context, - appAddress string, - serviceId string, - blockHeight int64, - ) (*sessiontypes.Session, error) -} diff --git a/pkg/client/keyring/errors.go b/pkg/client/keyring/errors.go deleted file mode 100644 index 7be8a677a..000000000 --- a/pkg/client/keyring/errors.go +++ /dev/null @@ -1,19 +0,0 @@ -package keyring - -import "cosmossdk.io/errors" - -var ( - // ErrEmptySigningKeyName represents an error which indicates that the - // provided signing key name is empty or unspecified. - ErrEmptySigningKeyName = errors.Register(codespace, 1, "empty signing key name") - - // ErrNoSuchSigningKey represents an error signifying that the requested - // signing key does not exist or could not be located. - ErrNoSuchSigningKey = errors.Register(codespace, 2, "signing key does not exist") - - // ErrSigningKeyAddr is raised when there's a failure in retrieving the - // associated address for the provided signing key. - ErrSigningKeyAddr = errors.Register(codespace, 3, "failed to get address for signing key") - - codespace = "keyring" -) diff --git a/pkg/client/keyring/keyring.go b/pkg/client/keyring/keyring.go deleted file mode 100644 index a77d35b6e..000000000 --- a/pkg/client/keyring/keyring.go +++ /dev/null @@ -1,29 +0,0 @@ -package keyring - -import ( - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" -) - -// KeyNameToAddr attempts to retrieve the key with the given name from the -// given keyring and compute its address. -func KeyNameToAddr( - keyName string, - keyring cosmoskeyring.Keyring, -) (cosmostypes.AccAddress, error) { - if keyName == "" { - return nil, ErrEmptySigningKeyName - } - - keyRecord, err := keyring.Key(keyName) - if err != nil { - return nil, ErrNoSuchSigningKey.Wrapf("name %q: %s", keyName, err) - } - - signingAddr, err := keyRecord.GetAddress() - if err != nil { - return nil, ErrSigningKeyAddr.Wrapf("name %q: %s", keyName, err) - } - - return signingAddr, nil -} diff --git a/pkg/client/query/accquerier.go b/pkg/client/query/accquerier.go deleted file mode 100644 index c61ec9760..000000000 --- a/pkg/client/query/accquerier.go +++ /dev/null @@ -1,58 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" - grpc "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" -) - -var _ client.AccountQueryClient = (*accQuerier)(nil) - -// accQuerier is a wrapper around the accounttypes.QueryClient that enables the -// querying of on-chain account information through a single exposed method -// which returns an accounttypes.AccountI interface -type accQuerier struct { - clientConn grpc.ClientConn - accountQuerier accounttypes.QueryClient -} - -// NewAccountQuerier returns a new instance of a client.AccountQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - clientCtx -func NewAccountQuerier(deps depinject.Config) (client.AccountQueryClient, error) { - aq := &accQuerier{} - - if err := depinject.Inject( - deps, - &aq.clientConn, - ); err != nil { - return nil, err - } - - aq.accountQuerier = accounttypes.NewQueryClient(aq.clientConn) - - return aq, nil -} - -// GetAccount returns an accounttypes.AccountI interface for a given address -func (aq *accQuerier) GetAccount( - ctx context.Context, - address string, -) (accounttypes.AccountI, error) { - req := &accounttypes.QueryAccountRequest{Address: address} - res, err := aq.accountQuerier.Account(ctx, req) - if err != nil { - return nil, ErrQueryAccountNotFound.Wrapf("address: %s [%v]", address, err) - } - var acc accounttypes.AccountI - if err = queryCodec.UnpackAny(res.Account, &acc); err != nil { - return nil, ErrQueryUnableToDeserializeAccount.Wrapf("address: %s [%v]", address, err) - } - return acc, nil -} diff --git a/pkg/client/query/appquerier.go b/pkg/client/query/appquerier.go deleted file mode 100644 index 9998a64f7..000000000 --- a/pkg/client/query/appquerier.go +++ /dev/null @@ -1,64 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - grpc "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -var _ client.ApplicationQueryClient = (*appQuerier)(nil) - -// appQuerier is a wrapper around the apptypes.QueryClient that enables the -// querying of on-chain application information through a single exposed method -// which returns an apptypes.Application interface -type appQuerier struct { - clientConn grpc.ClientConn - applicationQuerier apptypes.QueryClient -} - -// NewApplicationQuerier returns a new instance of a client.ApplicationQueryClient -// by injecting the dependecies provided by the depinject.Config -// -// Required dependencies: -// - clientCtx -func NewApplicationQuerier(deps depinject.Config) (client.ApplicationQueryClient, error) { - aq := &appQuerier{} - - if err := depinject.Inject( - deps, - &aq.clientConn, - ); err != nil { - return nil, err - } - - aq.applicationQuerier = apptypes.NewQueryClient(aq.clientConn) - - return aq, nil -} - -// GetApplication returns an apptypes.Application interface for a given address -func (aq *appQuerier) GetApplication( - ctx context.Context, - appAddress string, -) (apptypes.Application, error) { - req := apptypes.QueryGetApplicationRequest{Address: appAddress} - res, err := aq.applicationQuerier.Application(ctx, &req) - if err != nil { - return apptypes.Application{}, apptypes.ErrAppNotFound.Wrapf("app address: %s [%v]", appAddress, err) - } - return res.Application, nil -} - -// GetAllApplications returns all staked applications -func (aq *appQuerier) GetAllApplications(ctx context.Context) ([]apptypes.Application, error) { - req := apptypes.QueryAllApplicationRequest{} - res, err := aq.applicationQuerier.ApplicationAll(ctx, &req) - if err != nil { - return []apptypes.Application{}, err - } - return res.Application, nil -} diff --git a/pkg/client/query/codec.go b/pkg/client/query/codec.go deleted file mode 100644 index 536df1484..000000000 --- a/pkg/client/query/codec.go +++ /dev/null @@ -1,20 +0,0 @@ -package query - -import ( - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -// queryCodec is a codec used to unmarshal the account interface returned by the -// account querier into the concrete account interface implementation registered -// in the interface registry of the auth module -var queryCodec *codec.ProtoCodec - -func init() { - reg := codectypes.NewInterfaceRegistry() - accounttypes.RegisterInterfaces(reg) - cryptocodec.RegisterInterfaces(reg) - queryCodec = codec.NewProtoCodec(reg) -} diff --git a/pkg/client/query/errors.go b/pkg/client/query/errors.go deleted file mode 100644 index f395a9997..000000000 --- a/pkg/client/query/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package query - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "query" - ErrQueryAccountNotFound = sdkerrors.Register(codespace, 1, "account not found") - ErrQueryUnableToDeserializeAccount = sdkerrors.Register(codespace, 2, "unable to deserialize account") - ErrQueryRetrieveSession = sdkerrors.Register(codespace, 3, "error while trying to retrieve a session") -) diff --git a/pkg/client/query/godoc.go b/pkg/client/query/godoc.go deleted file mode 100644 index 8cea857fd..000000000 --- a/pkg/client/query/godoc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package query provides interfaces used to query the state of the blockchain. -// These interfaces abstract the underlying request/response types and provide -// a single method to query for a specific piece of information from the chain. -package query diff --git a/pkg/client/query/sessionquerier.go b/pkg/client/query/sessionquerier.go deleted file mode 100644 index 6a86205fe..000000000 --- a/pkg/client/query/sessionquerier.go +++ /dev/null @@ -1,66 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - grpc "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var _ client.SessionQueryClient = (*sessionQuerier)(nil) - -// sessionQuerier is a wrapper around the sessiontypes.QueryClient that enables the -// querying of on-chain session information through a single exposed method -// which returns an sessiontypes.Session struct -type sessionQuerier struct { - clientConn grpc.ClientConn - sessionQuerier sessiontypes.QueryClient -} - -// NewSessionQuerier returns a new instance of a client.SessionQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - clientCtx -func NewSessionQuerier(deps depinject.Config) (client.SessionQueryClient, error) { - sessq := &sessionQuerier{} - - if err := depinject.Inject( - deps, - &sessq.clientConn, - ); err != nil { - return nil, err - } - - sessq.sessionQuerier = sessiontypes.NewQueryClient(sessq.clientConn) - - return sessq, nil -} - -// GetSession returns an sessiontypes.Session struct for a given appAddress, -// serviceId and blockHeight. It implements the SessionQueryClient#GetSession function. -func (sessq *sessionQuerier) GetSession( - ctx context.Context, - appAddress string, - serviceId string, - blockHeight int64, -) (*sessiontypes.Session, error) { - service := &sharedtypes.Service{Id: serviceId} - req := &sessiontypes.QueryGetSessionRequest{ - ApplicationAddress: appAddress, - Service: service, - BlockHeight: blockHeight, - } - res, err := sessq.sessionQuerier.GetSession(ctx, req) - if err != nil { - return nil, ErrQueryRetrieveSession.Wrapf( - "address: %s; serviceId: %s; block height: %d; error: [%v]", - appAddress, serviceId, blockHeight, err, - ) - } - return res.Session, nil -} diff --git a/pkg/client/query/supplierquerier.go b/pkg/client/query/supplierquerier.go deleted file mode 100644 index c622ad9e5..000000000 --- a/pkg/client/query/supplierquerier.go +++ /dev/null @@ -1,56 +0,0 @@ -package query - -import ( - "context" - - "cosmossdk.io/depinject" - "github.com/cosmos/gogoproto/grpc" - - "github.com/pokt-network/poktroll/pkg/client" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -// supplierQuerier is a wrapper around the suppliertypes.QueryClient that enables the -// querying of on-chain supplier information through a single exposed method -// which returns an sharedtypes.Supplier struct -type supplierQuerier struct { - clientConn grpc.ClientConn - supplierQuerier suppliertypes.QueryClient -} - -// NewSupplierQuerier returns a new instance of a client.SupplierQueryClient by -// injecting the dependecies provided by the depinject.Config. -// -// Required dependencies: -// - grpc.ClientConn -func NewSupplierQuerier(deps depinject.Config) (client.SupplierQueryClient, error) { - supq := &supplierQuerier{} - - if err := depinject.Inject( - deps, - &supq.clientConn, - ); err != nil { - return nil, err - } - - supq.supplierQuerier = suppliertypes.NewQueryClient(supq.clientConn) - - return supq, nil -} - -// GetSupplier returns an suppliertypes.Supplier struct for a given address -func (supq *supplierQuerier) GetSupplier( - ctx context.Context, - address string, -) (sharedtypes.Supplier, error) { - req := &suppliertypes.QueryGetSupplierRequest{Address: address} - res, err := supq.supplierQuerier.Supplier(ctx, req) - if err != nil { - return sharedtypes.Supplier{}, suppliertypes.ErrSupplierNotFound.Wrapf( - "address: %s [%v]", - address, err, - ) - } - return res.Supplier, nil -} diff --git a/pkg/client/query/types/context.go b/pkg/client/query/types/context.go deleted file mode 100644 index d0f56fe6f..000000000 --- a/pkg/client/query/types/context.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -import ( - cosmosclient "github.com/cosmos/cosmos-sdk/client" -) - -// Context is used to distinguish a cosmosclient.Context intended for use in -// queries from others. This is because the same cosmosclient.Context can be -// used for both queries and transactions (as they are generated identically). -// This type is intentionally not an alias in order to make this distinction -// clear to the dependency injector (i.e. querytypes.Context). -type Context cosmosclient.Context diff --git a/pkg/client/services.go b/pkg/client/services.go deleted file mode 100644 index 08fbaee03..000000000 --- a/pkg/client/services.go +++ /dev/null @@ -1,19 +0,0 @@ -package client - -import ( - "fmt" - - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// NewTestApplicationServiceConfig returns a slice of application service configs for testing. -func NewTestApplicationServiceConfig(prefix string, count int) []*sharedtypes.ApplicationServiceConfig { - appSvcCfg := make([]*sharedtypes.ApplicationServiceConfig, count) - for i := range appSvcCfg { - serviceId := fmt.Sprintf("%s%d", prefix, i) - appSvcCfg[i] = &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: serviceId}, - } - } - return appSvcCfg -} diff --git a/pkg/client/supplier/client.go b/pkg/client/supplier/client.go deleted file mode 100644 index 4bf4c0554..000000000 --- a/pkg/client/supplier/client.go +++ /dev/null @@ -1,151 +0,0 @@ -package supplier - -import ( - "context" - - "cosmossdk.io/depinject" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/smt" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/polylog" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -var _ client.SupplierClient = (*supplierClient)(nil) - -// supplierClient -type supplierClient struct { - signingKeyName string - signingKeyAddr cosmostypes.AccAddress - - txClient client.TxClient - txCtx client.TxContext -} - -// NewSupplierClient constructs a new SupplierClient with the given dependencies -// and options. If a signingKeyName is not configured, an error will be returned. -// -// Required dependencies: -// - client.TxClient -// - client.TxContext -// -// Available options: -// - WithSigningKeyName -func NewSupplierClient( - deps depinject.Config, - opts ...client.SupplierClientOption, -) (*supplierClient, error) { - sClient := &supplierClient{} - - if err := depinject.Inject( - deps, - &sClient.txClient, - &sClient.txCtx, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(sClient) - } - - if err := sClient.validateConfigAndSetDefaults(); err != nil { - return nil, err - } - - return sClient, nil -} - -// SubmitProof constructs a submit proof message then signs and broadcasts it -// to the network via #txClient. It blocks until the transaction is included in -// a block or times out. -func (sClient *supplierClient) SubmitProof( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - proof *smt.SparseMerkleClosestProof, -) error { - logger := polylog.Ctx(ctx) - - proofBz, err := proof.Marshal() - if err != nil { - return err - } - - msg := &suppliertypes.MsgSubmitProof{ - SupplierAddress: sClient.signingKeyAddr.String(), - SessionHeader: &sessionHeader, - Proof: proofBz, - } - eitherErr := sClient.txClient.SignAndBroadcast(ctx, msg) - err, errCh := eitherErr.SyncOrAsyncError() - if err != nil { - return err - } - - // TODO_IMPROVE: log details related to what & how much is being proven - logger.Info(). - Fields(map[string]any{ - "supplier_addr": sClient.signingKeyAddr.String(), - "app_addr": sessionHeader.ApplicationAddress, - "session_id": sessionHeader.SessionId, - "service": sessionHeader.Service.Id, - }). - Msg("submitted a new proof") - - return <-errCh -} - -// CreateClaim constructs a creates claim message then signs and broadcasts it -// to the network via #txClient. It blocks until the transaction is included in -// a block or times out. -func (sClient *supplierClient) CreateClaim( - ctx context.Context, - sessionHeader sessiontypes.SessionHeader, - rootHash []byte, -) error { - logger := polylog.Ctx(ctx) - - msg := &suppliertypes.MsgCreateClaim{ - SupplierAddress: sClient.signingKeyAddr.String(), - SessionHeader: &sessionHeader, - RootHash: rootHash, - } - eitherErr := sClient.txClient.SignAndBroadcast(ctx, msg) - err, errCh := eitherErr.SyncOrAsyncError() - if err != nil { - return err - } - - // TODO_IMPROVE: log details related to how much is claimed - logger.Info(). - Fields(map[string]any{ - "supplier_addr": sClient.signingKeyAddr.String(), - "app_addr": sessionHeader.ApplicationAddress, - "session_id": sessionHeader.SessionId, - "service": sessionHeader.Service.Id, - }). - Msg("created a new claim") - - return <-errCh -} - -// validateConfigAndSetDefaults attempts to get the address from the keyring -// corresponding to the key whose name matches the configured signingKeyName. -// If signingKeyName is empty or the keyring does not contain the corresponding -// key, an error is returned. -func (sClient *supplierClient) validateConfigAndSetDefaults() error { - signingAddr, err := keyring.KeyNameToAddr( - sClient.signingKeyName, - sClient.txCtx.GetKeyring(), - ) - if err != nil { - return err - } - - sClient.signingKeyAddr = signingAddr - - return nil -} diff --git a/pkg/client/supplier/client_integration_test.go b/pkg/client/supplier/client_integration_test.go deleted file mode 100644 index f7ea11f56..000000000 --- a/pkg/client/supplier/client_integration_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build integration - -package supplier_test - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/testclient/testsupplier" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -func TestNewSupplierClient_Localnet(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services") - - var ( - signingKeyName = "app1" - ctx = context.Background() - ) - - supplierClient := testsupplier.NewLocalnetClient(t, signingKeyName) - require.NotNil(t, supplierClient) - - var rootHash []byte - sessionHeader := sessiontypes.SessionHeader{ - ApplicationAddress: "", - SessionStartBlockHeight: 0, - SessionId: "", - } - err := supplierClient.CreateClaim(ctx, sessionHeader, rootHash) - require.NoError(t, err) - - require.True(t, false) -} diff --git a/pkg/client/supplier/client_test.go b/pkg/client/supplier/client_test.go deleted file mode 100644 index b40fc3430..000000000 --- a/pkg/client/supplier/client_test.go +++ /dev/null @@ -1,201 +0,0 @@ -package supplier_test - -import ( - "context" - "crypto/sha256" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/golang/mock/gomock" - "github.com/pokt-network/smt" - "github.com/pokt-network/smt/kvstore/badger" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/client/supplier" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - testSigningKeyName = "test_signer" - testService = "test_service" -) - -func TestNewSupplierClient(t *testing.T) { - ctrl := gomock.NewController(t) - - memKeyring, _ := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, memKeyring) - txClientMock := mockclient.NewMockTxClient(ctrl) - - deps := depinject.Supply( - txCtxMock, - txClientMock, - ) - - tests := []struct { - name string - signingKeyName string - expectedErr error - }{ - { - name: "valid signing key name", - signingKeyName: testSigningKeyName, - expectedErr: nil, - }, - { - name: "empty signing key name", - signingKeyName: "", - expectedErr: keyring.ErrEmptySigningKeyName, - }, - { - name: "no such signing key name", - signingKeyName: "nonexistent", - expectedErr: keyring.ErrNoSuchSigningKey, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - signingKeyOpt := supplier.WithSigningKeyName(tt.signingKeyName) - - supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - require.Nil(t, supplierClient) - } else { - require.NoError(t, err) - require.NotNil(t, supplierClient) - } - }) - } -} - -func TestSupplierClient_CreateClaim(t *testing.T) { - var ( - signAndBroadcastDelay = 50 * time.Millisecond - doneCh = make(chan struct{}, 1) - ctx = context.Background() - ) - - keyring, testAppKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - testAppAddr, err := testAppKey.GetAddress() - require.NoError(t, err) - - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) - txClientMock := testtx.NewOneTimeDelayedSignAndBroadcastTxClient(t, ctx, signAndBroadcastDelay) - - signingKeyOpt := supplier.WithSigningKeyName(testAppKey.Name) - deps := depinject.Supply( - txCtxMock, - txClientMock, - ) - - supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - require.NoError(t, err) - require.NotNil(t, supplierClient) - - var rootHash []byte - sessionHeader := sessiontypes.SessionHeader{ - ApplicationAddress: testAppAddr.String(), - SessionStartBlockHeight: 0, - SessionId: "", - Service: &sharedtypes.Service{ - Id: testService, - }, - } - - go func() { - err = supplierClient.CreateClaim(ctx, sessionHeader, rootHash) - require.NoError(t, err) - close(doneCh) - }() - - // TODO_IMPROVE: this could be rewritten to record the times at which - // things happen and then compare them to the expected times. - - select { - case <-doneCh: - t.Fatal("expected CreateClaim to block for signAndBroadcastDelay") - case <-time.After(signAndBroadcastDelay * 95 / 100): - t.Log("OK: CreateClaim blocked for at least 95% of signAndBroadcastDelay") - } - - select { - case <-time.After(signAndBroadcastDelay): - t.Fatal("expected CreateClaim to unblock after signAndBroadcastDelay") - case <-doneCh: - t.Log("OK: CreateClaim unblocked after signAndBroadcastDelay") - } -} - -func TestSupplierClient_SubmitProof(t *testing.T) { - var ( - signAndBroadcastDelay = 50 * time.Millisecond - doneCh = make(chan struct{}, 1) - ctx = context.Background() - ) - - keyring, testAppKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - testAppAddr, err := testAppKey.GetAddress() - require.NoError(t, err) - - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) - txClientMock := testtx.NewOneTimeDelayedSignAndBroadcastTxClient(t, ctx, signAndBroadcastDelay) - - signingKeyOpt := supplier.WithSigningKeyName(testAppKey.Name) - deps := depinject.Supply( - txCtxMock, - txClientMock, - ) - - supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - require.NoError(t, err) - require.NotNil(t, supplierClient) - - sessionHeader := sessiontypes.SessionHeader{ - ApplicationAddress: testAppAddr.String(), - SessionStartBlockHeight: 0, - SessionId: "", - Service: &sharedtypes.Service{ - Id: testService, - }, - } - - kvStore, err := badger.NewKVStore("") - require.NoError(t, err) - - tree := smt.NewSparseMerkleSumTrie(kvStore, sha256.New()) - proof, err := tree.ProveClosest([]byte{1}) - require.NoError(t, err) - - go func() { - err = supplierClient.SubmitProof(ctx, sessionHeader, proof) - require.NoError(t, err) - close(doneCh) - }() - - // TODO_IMPROVE: this could be rewritten to record the times at which - // things happen and then compare them to the expected times. - - select { - case <-doneCh: - t.Fatal("expected SubmitProof to block for signAndBroadcastDelay") - case <-time.After(signAndBroadcastDelay * 95 / 100): - t.Log("OK: SubmitProof blocked for at least 95% of signAndBroadcastDelay") - } - - select { - case <-time.After(signAndBroadcastDelay): - t.Fatal("expected SubmitProof to unblock after signAndBroadcastDelay") - case <-doneCh: - t.Log("OK: SubmitProof unblocked after signAndBroadcastDelay") - } -} diff --git a/pkg/client/supplier/options.go b/pkg/client/supplier/options.go deleted file mode 100644 index f4460c8c9..000000000 --- a/pkg/client/supplier/options.go +++ /dev/null @@ -1,14 +0,0 @@ -package supplier - -import ( - "github.com/pokt-network/poktroll/pkg/client" -) - -// WithSigningKeyName sets the name of the key which the supplier client should -// retrieve from the keyring to use for authoring and signing CreateClaim and -// SubmitProof messages. -func WithSigningKeyName(keyName string) client.SupplierClientOption { - return func(sClient client.SupplierClient) { - sClient.(*supplierClient).signingKeyName = keyName - } -} diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go deleted file mode 100644 index 2149f383d..000000000 --- a/pkg/client/tx/client.go +++ /dev/null @@ -1,506 +0,0 @@ -package tx - -import ( - "bytes" - "context" - "encoding/hex" - "encoding/json" - "fmt" - "sync" - - "cosmossdk.io/api/tendermint/abci" - "cosmossdk.io/depinject" - comettypes "github.com/cometbft/cometbft/types" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - "go.uber.org/multierr" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/either" -) - -const ( - // DefaultCommitTimeoutHeightOffset is the default number of blocks after the - // latest block (when broadcasting) that a transactions should be considered - // errored if it has not been committed. - DefaultCommitTimeoutHeightOffset = 5 - - // defaultTxReplayLimit is the number of abci.TxResult events that the replay - // observable returned by LastNBlocks() will be able to replay. - // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient - // struct that defaults to this but can be overridden via an option. - defaultTxReplayLimit = 100 - - // txWithSenderAddrQueryFmt is the query used to subscribe to cometbft transactions - // events where the sender address matches the interpolated address. - // (see: https://docs.cosmos.network/v0.47/core/events#subscribing-to-events) - txWithSenderAddrQueryFmt = "tm.event='Tx' AND message.sender='%s'" -) - -// TODO_TECHDEBT(@bryanchriswhite/@h5law): Refactor this to use the EventsReplayClient -// In order to simplify the logic of the TxClient -var _ client.TxClient = (*txClient)(nil) - -// txClient orchestrates building, signing, broadcasting, and querying of -// transactions. It maintains a single events query subscription to its own -// transactions (via the EventsQueryClient) in order to receive notifications -// regarding their status. -// It also depends on the BlockClient as a timer, synchronized to block height, -// to facilitate transaction timeout logic. If a transaction doesn't appear to -// have been committed by commitTimeoutHeightOffset number of blocks have elapsed, -// it is considered as timed out. Upon timeout, the client queries the network for -// the last status of the transaction, which is used to derive the asynchronous -// error that's populated in the either.AsyncError. -type txClient struct { - // TODO_TECHDEBT: this should be configurable & integrated w/ viper, flags, etc. - // commitTimeoutHeightOffset is the number of blocks after the latest block - // that a transactions should be considered errored if it has not been committed. - commitTimeoutHeightOffset int64 - // signingKeyName is the name of the key in the keyring to use for signing - // transactions. - signingKeyName string - // signingAddr is the address of the signing key referenced by signingKeyName. - // It is hydrated from the keyring by calling Keyring#Key() with signingKeyName. - signingAddr cosmostypes.AccAddress - // txCtx is the transactions context which encapsulates transactions building, signing, - // broadcasting, and querying, as well as keyring access. - txCtx client.TxContext - // eventsReplayClient is the client used to subscribe to transactions events from this - // sender. It is used to receive notifications about transactions events corresponding - // to transactions which it has constructed, signed, and broadcast. - eventsReplayClient client.EventsReplayClient[*abci.TxResult] - // blockClient is the client used to query for the latest block height. - // It is used to implement timout logic for transactions which weren't committed. - blockClient client.BlockClient - - // txsMutex protects txErrorChans and txTimeoutPool maps. - txsMutex sync.Mutex - // txErrorChans maps tx_hash->channel which will receive an error or nil, - // and close, when the transactions with the given hash is committed. - txErrorChans txErrorChansByHash - // txTimeoutPool maps timeout_block_height->map_of_txsByHash. It - // is used to ensure that transactions error channels receive and close in the event - // that they have not already by the given timeout height. - txTimeoutPool txTimeoutPool -} - -type ( - txTimeoutPool map[height]txErrorChansByHash - txErrorChansByHash map[txHash]chan error - height = int64 - txHash = string -) - -// NewTxClient attempts to construct a new TxClient using the given dependencies -// and options. -// -// It performs the following steps: -// 1. Initializes a default txClient with the default commit timeout height -// offset, an empty error channel map, and an empty transaction timeout pool. -// 2. Injects the necessary dependencies using depinject. -// 3. Applies any provided options to customize the client. -// 4. Validates and sets any missing default configurations using the -// validateConfigAndSetDefaults method. -// 5. Subscribes the client to its own transactions. This step might be -// reconsidered for relocation to a potential Start() method in the future. -// -// Required dependencies: -// - client.TxContext -// - client.EventsQueryClient -// - client.BlockClient -// -// Available options: -// - WithSigningKeyName -// - WithCommitTimeoutHeightOffset -func NewTxClient( - ctx context.Context, - deps depinject.Config, - opts ...client.TxClientOption, -) (_ client.TxClient, err error) { - tClient := &txClient{ - commitTimeoutHeightOffset: DefaultCommitTimeoutHeightOffset, - txErrorChans: make(txErrorChansByHash), - txTimeoutPool: make(txTimeoutPool), - } - - if err = depinject.Inject( - deps, - &tClient.txCtx, - &tClient.blockClient, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(tClient) - } - - if err := tClient.validateConfigAndSetDefaults(); err != nil { - return nil, err - } - - // Form a query based on the client's signing address. - eventQuery := fmt.Sprintf(txWithSenderAddrQueryFmt, tClient.signingAddr) - - // Initialize and events replay client. - tClient.eventsReplayClient, err = events.NewEventsReplayClient[*abci.TxResult]( - ctx, - deps, - eventQuery, - unmarshalTxResult, - defaultTxReplayLimit, - ) - if err != nil { - return nil, err - } - - // Start an events query subscription for transactions originating from this - // client's signing address. - // TODO_CONSIDERATION: move this into a #Start() method - go tClient.goSubscribeToOwnTxs(ctx) - - // Launch a separate goroutine to handle transaction timeouts. - // TODO_CONSIDERATION: move this into a #Start() method - go tClient.goTimeoutPendingTransactions(ctx) - - return tClient, nil -} - -// SignAndBroadcast signs a set of Cosmos SDK messages, constructs a transaction, -// and broadcasts it to the network. The function performs several steps to -// ensure the messages and the resultant transaction are valid: -// -// 1. Validates each message in the provided set. -// 2. Constructs the transaction using the Cosmos SDK's transaction builder. -// 3. Calculates and sets the transaction's timeout height. -// 4. Sets a default gas limit (note: this will be made configurable in the future). -// 5. Signs the transaction. -// 6. Validates the constructed transaction. -// 7. Serializes and broadcasts the transaction. -// 8. Checks the broadcast response for errors. -// 9. If all the above steps are successful, the function registers the -// transaction as pending. -// -// If any step encounters an error, it returns an either.AsyncError populated with -// the synchronous error. If the function completes successfully, it returns an -// either.AsyncError populated with the error channel which will receive if the -// transaction results in an asynchronous error or times out. -func (tClient *txClient) SignAndBroadcast( - ctx context.Context, - msgs ...cosmostypes.Msg, -) either.AsyncError { - var validationErrs error - for i, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - validationErr := ErrInvalidMsg.Wrapf("in msg with index %d: %s", i, err) - validationErrs = multierr.Append(validationErrs, validationErr) - } - } - if validationErrs != nil { - return either.SyncErr(validationErrs) - } - - // Construct the transactions using cosmos' transactions builder. - txBuilder := tClient.txCtx.NewTxBuilder() - if err := txBuilder.SetMsgs(msgs...); err != nil { - // return synchronous error - return either.SyncErr(err) - } - - // Calculate timeout height - timeoutHeight := tClient.blockClient.LastNBlocks(ctx, 1)[0]. - Height() + tClient.commitTimeoutHeightOffset - - // TODO_TECHDEBT: this should be configurable - txBuilder.SetGasLimit(200000) - txBuilder.SetTimeoutHeight(uint64(timeoutHeight)) - - // sign transactions - err := tClient.txCtx.SignTx( - tClient.signingKeyName, - txBuilder, - false, false, - ) - if err != nil { - return either.SyncErr(err) - } - - // ensure transactions is valid - // NOTE: this makes the transactions valid; i.e. it is *REQUIRED* - if err := txBuilder.GetTx().ValidateBasic(); err != nil { - return either.SyncErr(err) - } - - // serialize transactions - txBz, err := tClient.txCtx.EncodeTx(txBuilder) - if err != nil { - return either.SyncErr(err) - } - - txResponse, err := tClient.txCtx.BroadcastTx(txBz) - if err != nil { - return either.SyncErr(err) - } - - if txResponse.Code != 0 { - return either.SyncErr(ErrCheckTx.Wrapf(txResponse.RawLog)) - } - - return tClient.addPendingTransactions(normalizeTxHashHex(txResponse.TxHash), timeoutHeight) -} - -// validateConfigAndSetDefaults ensures that the necessary configurations for the -// txClient are set, and populates any missing defaults. -// -// 1. It checks if the signing key name is set and returns an error if it's empty. -// 2. It then retrieves the key record from the keyring using the signing key name -// and checks its existence. -// 3. The address of the signing key is computed and assigned to txClient#signgingAddr. -// 4. Lastly, it ensures that commitTimeoutHeightOffset has a valid value, setting -// it to DefaultCommitTimeoutHeightOffset if it's zero or negative. -// -// Returns: -// - ErrEmptySigningKeyName if the signing key name is not provided. -// - ErrNoSuchSigningKey if the signing key is not found in the keyring. -// - ErrSigningKeyAddr if there's an issue retrieving the address for the signing key. -// - nil if validation is successful and defaults are set appropriately. -func (tClient *txClient) validateConfigAndSetDefaults() error { - signingAddr, err := keyring.KeyNameToAddr( - tClient.signingKeyName, - tClient.txCtx.GetKeyring(), - ) - if err != nil { - return err - } - - tClient.signingAddr = signingAddr - - if tClient.commitTimeoutHeightOffset <= 0 { - tClient.commitTimeoutHeightOffset = DefaultCommitTimeoutHeightOffset - } - return nil -} - -// addPendingTransactions registers a new pending transaction for monitoring and -// notification of asynchronous errors. It accomplishes the following: -// -// 1. Creates an error notification channel (if one doesn't already exist) and associates -// it with the provided transaction hash in the txErrorChans map. -// -// 2. Ensures that there's an initialized map of transactions by hash for the -// given timeout height in the txTimeoutPool. The same error notification channel -// is also associated with the transaction hash in this map. -// -// Both txErrorChans and txTimeoutPool store references to the same error notification -// channel for a given transaction hash. This ensures idempotency of error handling -// for any given transaction between asynchronous, transaction-specific errors and -// transaction timeout logic. -// -// Note: The error channels are buffered to prevent blocking on send operations and -// are intended to convey a single error event. -// -// Returns: -// - An either.AsyncError populated with the error notification channel for the -// provided transaction hash. -func (tClient *txClient) addPendingTransactions( - txHash string, - timeoutHeight int64, -) either.AsyncError { - tClient.txsMutex.Lock() - defer tClient.txsMutex.Unlock() - - // Initialize txTimeoutPool map if necessary. - txsByHash, ok := tClient.txTimeoutPool[timeoutHeight] - if !ok { - txsByHash = make(map[string]chan error) - tClient.txTimeoutPool[timeoutHeight] = txsByHash - } - - // Initialize txErrorChans map in txTimeoutPool map if necessary. - errCh, ok := txsByHash[txHash] - if !ok { - // NB: intentionally buffered to avoid blocking on send. Only intended - // to send/receive a single error. - errCh = make(chan error, 1) - txsByHash[txHash] = errCh - } - - // Initialize txErrorChans map if necessary. - if _, ok := tClient.txErrorChans[txHash]; !ok { - // NB: both maps hold a reference to the same channel so that we can check - // if the channel has already been closed when timing out. - tClient.txErrorChans[txHash] = errCh - } - - return either.AsyncErr(errCh) -} - -// goSubscribeToOwnTxs establishes an event query subscription to monitor transactions -// originating from this client's signing address, ranges over observed transaction events, -// and performs the following steps on each: -// -// 1. Normalize hexadeimal transaction hash. -// 2. Retrieves the transaction's error channel from txErrorChans. -// 3. Closes and removes it from txErrorChans. -// 4. Removes the transaction error channel from txTimeoutPool. -// -// It is intended to be called in a goroutine. -// -// Important considerations: -// There's uncertainty surrounding the potential for asynchronous errors post transaction broadcast. -// Current implementation and observations suggest that errors might be returned synchronously, -// even when using Cosmos' BroadcastTxAsync method. Further investigation is required. -// -// Parameters: -// - ctx: Context for managing the function's lifecycle and child operations. -func (tClient *txClient) goSubscribeToOwnTxs(ctx context.Context) { - txResultsObs := tClient.eventsReplayClient.EventsSequence(ctx) - txResultsCh := txResultsObs.Subscribe(ctx).Ch() - for txResult := range txResultsCh { - // Convert transaction hash into its normalized hex form. - txHashHex := txHashBytesToNormalizedHex(comettypes.Tx(txResult.Tx).Hash()) - - tClient.txsMutex.Lock() - - // Check for a corresponding error channel in the map. - txErrCh, ok := tClient.txErrorChans[txHashHex] - if !ok { - panic("Received tx event without an associated error channel.") - } - - // TODO_INVESTIGATE: it seems like it may not be possible for the - // txResult to represent an error. Cosmos' #BroadcastTxSync() is being - // called internally, which will return an error if the transaction - // is not accepted by the mempool. - // - // It's unclear if a cosmos chain is capable of returning an async - // error for a transaction at this point; even when substituting - // #BroadcastTxAsync(), the error is returned synchronously: - // - // > error in json rpc client, with http response metadata: (Status: - // > 200 OK, Protocol HTTP/1.1). RPC error -32000 - tx added to local - // > mempool but failed to gossip: validation failed - // - // Potential parse and send transaction error on txErrCh here. - - // Close and remove from txErrChans - close(txErrCh) - delete(tClient.txErrorChans, txHashHex) - - // Remove from the txTimeoutPool. - for timeoutHeight, txErrorChans := range tClient.txTimeoutPool { - // Handled transaction isn't in this timeout height. - if _, ok := txErrorChans[txHashHex]; !ok { - continue - } - - delete(txErrorChans, txHashHex) - if len(txErrorChans) == 0 { - delete(tClient.txTimeoutPool, timeoutHeight) - } - } - - tClient.txsMutex.Unlock() - } -} - -// goTimeoutPendingTransactions monitors blocks and handles transaction timeouts. -// For each block observed, it checks if there are transactions associated with that -// block's height in the txTimeoutPool. If transactions are found, the function -// evaluates whether they have already been processed by the transaction events -// query subscription logic. If not, a timeout error is generated and sent on the -// transaction's error channel. Finally, the error channel is closed and removed -// from the txTimeoutPool. -func (tClient *txClient) goTimeoutPendingTransactions(ctx context.Context) { - // Subscribe to a sequence of committed blocks. - blockCh := tClient.blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx).Ch() - - // Iterate over each incoming block. - for block := range blockCh { - select { - case <-ctx.Done(): - // Exit if the context signals done. - return - default: - } - - tClient.txsMutex.Lock() - - // Retrieve transactions associated with the current block's height. - txsByHash, ok := tClient.txTimeoutPool[block.Height()] - if !ok { - // If no transactions are found for the current block height, continue. - tClient.txsMutex.Unlock() - continue - } - - // Process each transaction for the current block height. - for txHash, txErrCh := range txsByHash { - select { - // Check if the transaction was processed by its subscription. - case err, ok := <-txErrCh: - if ok { - // Unexpected state: error channel should be closed after processing. - panic(fmt.Errorf("Expected txErrCh to be closed; received err: %w", err)) - } - // Remove the processed transaction. - delete(txsByHash, txHash) - tClient.txsMutex.Unlock() - continue - default: - } - - // Transaction was not processed by its subscription: handle timeout. - txErrCh <- tClient.getTxTimeoutError(ctx, txHash) // Send a timeout error. - close(txErrCh) // Close the error channel. - delete(txsByHash, txHash) // Remove the transaction. - } - - // Clean up the txTimeoutPool for the current block height. - delete(tClient.txTimeoutPool, block.Height()) - tClient.txsMutex.Unlock() - } -} - -// getTxTimeoutError checks if a transaction with the specified hash has timed out. -// The function decodes the provided hexadecimal hash into bytes and queries the -// transaction using the byte hash. If any error occurs during this process, -// appropriate wrapped errors are returned for easier debugging. -func (tClient *txClient) getTxTimeoutError(ctx context.Context, txHashHex string) error { - // Decode the provided hex hash into bytes. - txHash, err := hex.DecodeString(txHashHex) - if err != nil { - return ErrInvalidTxHash.Wrapf("%s", txHashHex) - } - - // Query the transaction using the decoded byte hash. - txResponse, err := tClient.txCtx.QueryTx(ctx, txHash, false) - if err != nil { - return ErrQueryTx.Wrapf("with hash: %s: %s", txHashHex, err) - } - - // Return a timeout error with details about the transaction. - return ErrTxTimeout.Wrapf("with hash %s: %s", txHashHex, txResponse.TxResult.Log) -} - -// unmarshalTxResult attempts to deserialize a slice of bytes into a TxResult -// It checks if the given bytes correspond to a valid transaction event. -// If the resulting TxResult has empty transaction bytes, it assumes that -// the message was not a transaction results and returns an error. -func unmarshalTxResult(txResultBz []byte) (*abci.TxResult, error) { - txResult := new(abci.TxResult) - - // Try to deserialize the provided bytes into a TxResult. - if err := json.Unmarshal(txResultBz, txResult); err != nil { - return nil, events.ErrEventsUnmarshalEvent.Wrap(err.Error()) - } - - // Check if the TxResult has empty transaction bytes, which indicates - // the message might not be a valid transaction event. - if bytes.Equal(txResult.Tx, []byte{}) { - return nil, events.ErrEventsUnmarshalEvent.Wrap("event bytes do not correspond to an abci.TxResult event") - } - - return txResult, nil -} diff --git a/pkg/client/tx/client_integration_test.go b/pkg/client/tx/client_integration_test.go deleted file mode 100644 index 67d4b71ef..000000000 --- a/pkg/client/tx/client_integration_test.go +++ /dev/null @@ -1,67 +0,0 @@ -//go:build integration - -package tx_test - -import ( - "context" - "testing" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" - "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -func TestTxClient_SignAndBroadcast_Integration(t *testing.T) { - t.Skip( - "TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services", - ) - - ctx := context.Background() - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewLocalnetClient(t) - - _, txCtx := testtx.NewAnyTimesTxTxContext(t, keyring) - - // Construct a new mock block client because it is a required dependency. Since - // we're not exercising transactions timeouts in this test, we don't need to set any - // particular expectations on it, nor do we care about the value of blockHash - // argument. - blockClientMock := testblock.NewLocalnetClient(ctx, t) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtx, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient(ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName)) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, _ = eitherErr.SyncOrAsyncError() - require.NoError(t, err) -} diff --git a/pkg/client/tx/client_test.go b/pkg/client/tx/client_test.go deleted file mode 100644 index 4de1b2f9a..000000000 --- a/pkg/client/tx/client_test.go +++ /dev/null @@ -1,423 +0,0 @@ -package tx_test - -import ( - "context" - "encoding/json" - "sync" - "testing" - "time" - - "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" - cometbytes "github.com/cometbft/cometbft/libs/bytes" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/keyring" - "github.com/pokt-network/poktroll/pkg/client/tx" - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/testutil/mockclient" - "github.com/pokt-network/poktroll/testutil/testclient" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" - "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" - "github.com/pokt-network/poktroll/testutil/testclient/testtx" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -const ( - testSigningKeyName = "test_signer" - // NB: testServiceIdPrefix must not be longer than 7 characters due to - // maxServiceIdLen. - testServiceIdPrefix = "testsvc" - txCommitTimeout = 10 * time.Millisecond -) - -// TODO_TECHDEBT: add coverage for the transactions client handling an events bytes error either. - -func TestTxClient_SignAndBroadcast_Succeeds(t *testing.T) { - var ( - // expectedTx is the expected transactions bytes that will be signed and broadcast - // by the transaction client. It is computed and assigned in the - // testtx.NewOneTimeTxTxContext helper function. The same reference needs - // to be used across the expectations that are set on the transactions context mock. - expectedTx cometbytes.HexBytes - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transactions event bytes. It is used near the end of - // the test to mock the network signaling that the transactions was committed. - txResultsBzPublishCh chan<- either.Bytes - blocksPublishCh chan client.Block - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - txCtxMock := testtx.NewOneTimeTxTxContext( - t, keyring, - testSigningKeyName, - &expectedTx, - ) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transactions timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient( - ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), - ) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, errCh := eitherErr.SyncOrAsyncError() - require.NoError(t, err) - - // Construct the expected transaction event bytes from the expected transaction bytes. - txResultBz, err := json.Marshal(abci.TxResult{Tx: expectedTx}) - require.NoError(t, err) - - // Publish the transaction event bytes to the events query client so that the transaction client - // registers the transactions as committed (i.e. removes it from the timeout pool). - txResultsBzPublishChMu.Lock() - txResultsBzPublishCh <- either.Success[[]byte](txResultBz) - txResultsBzPublishChMu.Unlock() - - // Assert that the error channel was closed without receiving. - select { - case err, ok := <-errCh: - require.NoError(t, err) - require.Falsef(t, ok, "expected errCh to be closed") - case <-time.After(txCommitTimeout): - t.Fatal("test timed out waiting for errCh to receive") - } -} - -func TestTxClient_NewTxClient_Error(t *testing.T) { - // Construct an empty in-memory keyring. - memKeyring := cosmoskeyring.NewInMemory(testclient.EncodingConfig.Marshaler) - - tests := []struct { - name string - signingKeyName string - expectedErr error - }{ - { - name: "empty signing key name", - signingKeyName: "", - expectedErr: keyring.ErrEmptySigningKeyName, - }, - { - name: "signing key does not exist", - signingKeyName: "nonexistent", - expectedErr: keyring.ErrNoSuchSigningKey, - }, - // TODO_TECHDEBT: add coverage for this error case - // { - // name: "failed to get address", - // testSigningKeyName: "incompatible", - // expectedErr: tx.ErrSigningKeyAddr, - // }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var ( - ctrl = gomock.NewController(t) - ctx = context.Background() - ) - - // Construct a new mock events query client. Since we expect the - // NewTxClient call to fail, we don't need to set any expectations - // on this mock. - eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) - - // Construct a new mock transactions context. - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, memKeyring) - - // Construct a new mock block client. Since we expect the NewTxClient - // call to fail, we don't need to set any expectations on this mock. - blockClientMock := mockclient.NewMockBlockClient(ctrl) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct a signing key option using the test signing key name. - signingKeyOpt := tx.WithSigningKeyName(tt.signingKeyName) - - // Attempt to create the transactions client. - txClient, err := tx.NewTxClient(ctx, txClientDeps, signingKeyOpt) - require.ErrorIs(t, err, tt.expectedErr) - require.Nil(t, txClient) - }) - } -} - -func TestTxClient_SignAndBroadcast_SyncError(t *testing.T) { - var ( - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transactions event bytes. It is not used in - // this test but is required to use the NewOneTimeTxEventsQueryClient - // helper. - txResultsBzPublishCh chan<- either.Bytes - // blocksPublishCh is the channel that the mock block client will use - // to publish the latest block. It is not used in this test but is - // required to use the NewOneTimeCommittedBlocksSequenceBlockClient - // helper. - blocksPublishCh chan client.Block - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - // Construct a new mock events query client. Since we expect the - // NewTxClient call to fail, we don't need to set any expectations - // on this mock. - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - // Construct a new mock transaction context. - txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transactions timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient( - ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), - ) - require.NoError(t, err) - - // Construct an invalid (arbitrary) message to sign, encode, and broadcast. - signingAddr, err := signingKey.GetAddress() - require.NoError(t, err) - appStakeMsg := &apptypes.MsgStakeApplication{ - // Providing address to avoid panic from #GetSigners(). - Address: signingAddr.String(), - Stake: nil, - // NB: explicitly omitting required fields - } - - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, _ = eitherErr.SyncOrAsyncError() - require.ErrorIs(t, err, tx.ErrInvalidMsg) - - time.Sleep(10 * time.Millisecond) -} - -// TODO_INCOMPLETE: add coverage for async error; i.e. insufficient gas or on-chain error -func TestTxClient_SignAndBroadcast_CheckTxError(t *testing.T) { - var ( - // expectedErrMsg is the expected error message that will be returned - // by the transaction client. It is computed and assigned in the - // testtx.NewOneTimeErrCheckTxTxContext helper function. - expectedErrMsg string - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transactions event bytes. It is used near the end of - // the test to mock the network signaling that the transactions was committed. - txResultsBzPublishCh chan<- either.Bytes - blocksPublishCh chan client.Block - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - txCtxMock := testtx.NewOneTimeErrCheckTxTxContext( - t, keyring, - testSigningKeyName, - &expectedErrMsg, - ) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transactions timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient(ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName)) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, _ = eitherErr.SyncOrAsyncError() - require.ErrorIs(t, err, tx.ErrCheckTx) - require.ErrorContains(t, err, expectedErrMsg) -} - -func TestTxClient_SignAndBroadcast_Timeout(t *testing.T) { - var ( - // expectedErrMsg is the expected error message that will be returned - // by the transaction client. It is computed and assigned in the - // testtx.NewOneTimeErrCheckTxTxContext helper function. - expectedErrMsg string - // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access - // as it is expected to be updated in a mock method but is also sent on in the test. - txResultsBzPublishChMu = new(sync.Mutex) - // txResultsBzPublishCh is the channel that the mock events query client - // will use to publish the transaction event bytes. It is used near the end of - // the test to mock the network signaling that the transaction was committed. - txResultsBzPublishCh chan<- either.Bytes - blocksPublishCh = make(chan client.Block, tx.DefaultCommitTimeoutHeightOffset) - ctx = context.Background() - ) - - keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) - - eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( - ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, - ) - - txCtxMock := testtx.NewOneTimeErrTxTimeoutTxContext( - t, keyring, - testSigningKeyName, - &expectedErrMsg, - ) - - // Construct a new mock block client because it is a required dependency. - // Since we're not exercising transaction timeouts in this test, we don't need to - // set any particular expectations on it, nor do we care about the contents - // of the latest block. - blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( - t, blocksPublishCh, - ) - - // Construct a new depinject config with the mocks we created above. - txClientDeps := depinject.Supply( - eventsQueryClient, - txCtxMock, - blockClientMock, - ) - - // Construct the transaction client. - txClient, err := tx.NewTxClient( - ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), - ) - require.NoError(t, err) - - signingKeyAddr, err := signingKey.GetAddress() - require.NoError(t, err) - - // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) - appStakeMsg := &apptypes.MsgStakeApplication{ - Address: signingKeyAddr.String(), - Stake: &appStake, - Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), - } - - // Sign and broadcast the message in a transaction. - eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) - err, errCh := eitherErr.SyncOrAsyncError() - require.NoError(t, err) - - for i := 0; i < tx.DefaultCommitTimeoutHeightOffset; i++ { - blocksPublishCh <- testblock.NewAnyTimesBlock(t, []byte{}, int64(i+1)) - } - - // Assert that we receive the expected error type & message. - select { - case err := <-errCh: - require.ErrorIs(t, err, tx.ErrTxTimeout) - require.ErrorContains(t, err, expectedErrMsg) - // NB: wait 110% of txCommitTimeout; a bit longer than strictly necessary in - // order to mitigate flakiness. - case <-time.After(txCommitTimeout * 110 / 100): - t.Fatal("test timed out waiting for errCh to receive") - } - - // Assert that the error channel was closed. - select { - case err, ok := <-errCh: - require.Falsef(t, ok, "expected errCh to be closed") - require.NoError(t, err) - // NB: Give the error channel some time to be ready to receive in order to - // mitigate flakiness. - case <-time.After(50 * time.Millisecond): - t.Fatal("expected errCh to be closed") - } -} - -// TODO_TECHDEBT: add coverage for sending multiple messages simultaneously -func TestTxClient_SignAndBroadcast_MultipleMsgs(t *testing.T) { - t.SkipNow() -} diff --git a/pkg/client/tx/context.go b/pkg/client/tx/context.go deleted file mode 100644 index 6ee1525cf..000000000 --- a/pkg/client/tx/context.go +++ /dev/null @@ -1,100 +0,0 @@ -package tx - -import ( - "context" - - "cosmossdk.io/depinject" - cometrpctypes "github.com/cometbft/cometbft/rpc/core/types" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmostx "github.com/cosmos/cosmos-sdk/client/tx" - cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" - cosmostypes "github.com/cosmos/cosmos-sdk/types" - authclient "github.com/cosmos/cosmos-sdk/x/auth/client" - - "github.com/pokt-network/poktroll/pkg/client" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" -) - -var _ client.TxContext = (*cosmosTxContext)(nil) - -// cosmosTxContext is an internal implementation of the client.TxContext interface. -// It provides methods related to transaction context within the Cosmos SDK. -type cosmosTxContext struct { - // Holds cosmos-sdk client context. - // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/client#Context) - clientCtx txtypes.Context - // Holds the cosmos-sdk transaction factory. - // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/client/tx#Factory) - txFactory cosmostx.Factory -} - -// NewTxContext initializes a new cosmosTxContext with the given dependencies. -// It uses depinject to populate its members and returns a client.TxContext -// interface type. -// -// Required dependencies: -// - cosmosclient.Context -// - cosmostx.Factory -func NewTxContext(deps depinject.Config) (client.TxContext, error) { - txCtx := cosmosTxContext{} - - if err := depinject.Inject( - deps, - &txCtx.clientCtx, - &txCtx.txFactory, - ); err != nil { - return nil, err - } - - return txCtx, nil -} - -// GetKeyring returns the cosmos-sdk client Keyring associated with the transaction factory. -func (txCtx cosmosTxContext) GetKeyring() cosmoskeyring.Keyring { - return txCtx.txFactory.Keybase() -} - -// SignTx signs the provided transaction using the given key name. It can operate in offline mode -// and can optionally overwrite any existing signatures. -// It is a proxy to the cosmos-sdk auth module client SignTx function. -// (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/x/auth/client) -func (txCtx cosmosTxContext) SignTx( - signingKeyName string, - txBuilder cosmosclient.TxBuilder, - offline, overwriteSig bool, -) error { - return authclient.SignTx( - txCtx.txFactory, - cosmosclient.Context(txCtx.clientCtx), - signingKeyName, - txBuilder, - offline, overwriteSig, - ) -} - -// NewTxBuilder returns a new transaction builder instance using the cosmos-sdk client transaction config. -func (txCtx cosmosTxContext) NewTxBuilder() cosmosclient.TxBuilder { - return txCtx.clientCtx.TxConfig.NewTxBuilder() -} - -// EncodeTx encodes the provided tx and returns its bytes representation. -func (txCtx cosmosTxContext) EncodeTx(txBuilder cosmosclient.TxBuilder) ([]byte, error) { - return txCtx.clientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) -} - -// BroadcastTx broadcasts the given transaction to the network, blocking until the check-tx -// ABCI operation completes and returns a TxResponse of the transaction status at that point in time. -func (txCtx cosmosTxContext) BroadcastTx(txBytes []byte) (*cosmostypes.TxResponse, error) { - clientCtx := cosmosclient.Context(txCtx.clientCtx) - return clientCtx.BroadcastTxAsync(txBytes) -} - -// QueryTx queries the transaction based on its hash and optionally provides proof -// of the transaction. It returns the transaction query result. -func (txCtx cosmosTxContext) QueryTx( - ctx context.Context, - txHash []byte, - prove bool, -) (*cometrpctypes.ResultTx, error) { - return txCtx.clientCtx.Client.Tx(ctx, txHash, prove) -} diff --git a/pkg/client/tx/encoding.go b/pkg/client/tx/encoding.go deleted file mode 100644 index 78612e7b7..000000000 --- a/pkg/client/tx/encoding.go +++ /dev/null @@ -1,18 +0,0 @@ -package tx - -import ( - "fmt" - "strings" -) - -// normalizeTxHashHex defines canonical and unambiguous representation for a -// transaction hash hexadecimal string; lower-case. -func normalizeTxHashHex(txHash string) string { - return strings.ToLower(txHash) -} - -// txHashBytesToNormalizedHex converts a transaction hash bytes to a normalized -// hexadecimal string representation. -func txHashBytesToNormalizedHex(txHash []byte) string { - return normalizeTxHashHex(fmt.Sprintf("%x", txHash)) -} diff --git a/pkg/client/tx/errors.go b/pkg/client/tx/errors.go deleted file mode 100644 index 328d7a51d..000000000 --- a/pkg/client/tx/errors.go +++ /dev/null @@ -1,41 +0,0 @@ -package tx - -import errorsmod "cosmossdk.io/errors" - -var ( - // ErrInvalidMsg signifies that there was an issue in validating the - // transaction message. This could be due to format, content, or other - // constraints imposed on the message. - ErrInvalidMsg = errorsmod.Register(codespace, 4, "failed to validate tx message") - - // ErrCheckTx indicates an error occurred during the ABCI check transaction - // process, which verifies the transaction's integrity before it is added - // to the mempool. - ErrCheckTx = errorsmod.Register(codespace, 5, "error during ABCI check tx") - - // ErrTxTimeout is raised when a transaction has taken too long to - // complete, surpassing a predefined threshold. - ErrTxTimeout = errorsmod.Register(codespace, 6, "tx timed out") - - // ErrQueryTx indicates an error occurred while trying to query for the status - // of a specific transaction, likely due to issues with the query parameters - // or the state of the blockchain network. - ErrQueryTx = errorsmod.Register(codespace, 7, "error encountered while querying for tx") - - // ErrInvalidTxHash represents an error which is triggered when the - // transaction hash provided does not adhere to the expected format or - // constraints, implying it may be corrupted or tampered with. - ErrInvalidTxHash = errorsmod.Register(codespace, 8, "invalid tx hash") - - // ErrNonTxEventBytes indicates an attempt to deserialize bytes that do not - // correspond to a transaction event. This error is triggered when the provided - // byte data isn't recognized as a valid transaction event representation. - ErrNonTxEventBytes = errorsmod.Register(codespace, 9, "attempted to deserialize non-tx event bytes") - - // ErrUnmarshalTx signals a failure in the unmarshaling process of a transaction. - // This error is triggered when the system encounters issues translating a set of - // bytes into the corresponding Tx structure or object. - ErrUnmarshalTx = errorsmod.Register(codespace, 10, "failed to unmarshal tx") - - codespace = "tx_client" -) diff --git a/pkg/client/tx/options.go b/pkg/client/tx/options.go deleted file mode 100644 index 34e782b6d..000000000 --- a/pkg/client/tx/options.go +++ /dev/null @@ -1,22 +0,0 @@ -package tx - -import ( - "github.com/pokt-network/poktroll/pkg/client" -) - -// WithCommitTimeoutBlocks sets the timeout duration in terms of number of blocks -// for the client to wait for broadcast transactions to be committed before -// returning a timeout error. -func WithCommitTimeoutBlocks(timeout int64) client.TxClientOption { - return func(client client.TxClient) { - client.(*txClient).commitTimeoutHeightOffset = timeout - } -} - -// WithSigningKeyName sets the name of the key which should be retrieved from the -// keyring and used for signing transactions. -func WithSigningKeyName(keyName string) client.TxClientOption { - return func(client client.TxClient) { - client.(*txClient).signingKeyName = keyName - } -} diff --git a/pkg/client/tx/types/context.go b/pkg/client/tx/types/context.go deleted file mode 100644 index 7dd15cd7f..000000000 --- a/pkg/client/tx/types/context.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -import ( - cosmosclient "github.com/cosmos/cosmos-sdk/client" -) - -// Context is used to distinguish a cosmosclient.Context intended for use in -// transactions from others. This is because the same cosmosclient.Context can -// be used for both queries and transactions (as they are generated identically). -// This type is intentionally not an alias in order to make this distinction -// clear to the dependency injector (i.e. txtypes.Context). -type Context cosmosclient.Context diff --git a/pkg/crypto/godoc.go b/pkg/crypto/godoc.go deleted file mode 100644 index 846f22de6..000000000 --- a/pkg/crypto/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package crypto provides the cryptographic primitives used by the Pocket -// Network. This includes the RingCache used to build and cache rings used -// for signing relays, and may expand to include other cryptographic -// primitives in the future. -package crypto diff --git a/pkg/crypto/interface.go b/pkg/crypto/interface.go deleted file mode 100644 index 4298a9b6a..000000000 --- a/pkg/crypto/interface.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:generate mockgen -destination=../../testutil/mockcrypto/ring_cache_mock.go -package=mockcrypto . RingCache -package crypto - -import ( - "context" - - "github.com/noot/ring-go" -) - -// RingCache is used to store rings used for signing and verifying relay requests. -// It will cache rings for future use after querying the application module for -// the addresses of the gateways the application is delegated to, and converting -// them into their corresponding public key points on the secp256k1 curve. -type RingCache interface { - // Start starts the ring cache, it takes a cancellable context and, in a - // separate goroutine, listens for on-chain delegation events and invalidates - // the cache if the redelegation event's AppAddress is stored in the cache. - Start(ctx context.Context) - // GetCachedAddresses returns the addresses of the applications that are - // currently cached in the ring cache. - GetCachedAddresses() []string - // GetRingForAddress returns the ring for the given application address if - // it exists. If it does not exist in the cache, it follows a lazy approach - // of querying the on-chain state and creating it just-in-time, caching for - // future retrievals. - GetRingForAddress(ctx context.Context, appAddress string) (*ring.Ring, error) - // Stop stops the ring cache by unsubscribing from on-chain delegation events. - // And clears the cache, so that it no longer contains any rings, - Stop() -} diff --git a/pkg/crypto/rings/cache.go b/pkg/crypto/rings/cache.go deleted file mode 100644 index e1a21ed50..000000000 --- a/pkg/crypto/rings/cache.go +++ /dev/null @@ -1,278 +0,0 @@ -package rings - -import ( - "context" - "fmt" - "sync" - - "cosmossdk.io/depinject" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ringtypes "github.com/athanorlabs/go-dleq/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/noot/ring-go" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -var _ crypto.RingCache = (*ringCache)(nil) - -type ringCache struct { - // logger is the logger for the ring cache. - logger polylog.Logger - - // ringPointsCache maintains a map of application addresses to the points - // on the secp256k1 curve that correspond to the public keys of the gateways - // the application is delegated to. These are used to build the app's ring. - ringPointsCache map[string][]ringtypes.Point - ringPointsMu *sync.RWMutex - - // delegationClient is used to listen for on-chain delegation events and - // invalidate cache entries for rings that have been updated on chain. - delegationClient client.DelegationClient - - // applicationQuerier is the querier for the application module, and is - // used to get the addresses of the gateways an application is delegated to. - applicationQuerier client.ApplicationQueryClient - - // accountQuerier is the querier for the account module, and is used to get - // the public keys of the application and its delegated gateways. - accountQuerier client.AccountQueryClient -} - -// NewRingCache returns a new RingCache instance. It requires a depinject.Config -// to be passed in, which is used to inject the dependencies of the RingCache. -// -// Required dependencies: -// - polylog.Logger -// - client.DelegationClient -// - client.ApplicationQueryClient -// - client.AccountQueryClient -func NewRingCache(deps depinject.Config) (crypto.RingCache, error) { - rc := &ringCache{ - ringPointsCache: make(map[string][]ringtypes.Point), - ringPointsMu: &sync.RWMutex{}, - } - - // Supply the account and application queriers to the RingCache. - if err := depinject.Inject( - deps, - &rc.logger, - &rc.delegationClient, - &rc.applicationQuerier, - &rc.accountQuerier, - ); err != nil { - return nil, err - } - - return rc, nil -} - -// Start starts the ring cache by subscribing to on-chain redelegation events. -func (rc *ringCache) Start(ctx context.Context) { - rc.logger.Info().Msg("starting ring cache") - // Listen for redelegation events and invalidate the cache if the - // redelegation event's address is stored in the cache. - go func() { - select { - case <-ctx.Done(): - // Stop the ring cache if the context is cancelled. - rc.Stop() - } - }() - go rc.goInvalidateCache(ctx) -} - -// goInvalidateCache listens for redelegation events and invalidates the -// cache if the app address in the redelegation event is stored in the cache. -// This function is intended to be run in a goroutine. -func (rc *ringCache) goInvalidateCache(ctx context.Context) { - // Get the latest redelegation replay observable. - redelegationObs := rc.delegationClient.RedelegationsSequence(ctx) - // For each redelegation event, check if the redelegation events' - // app address is in the cache. If it is, invalidate the cache entry. - channel.ForEach[client.Redelegation]( - ctx, redelegationObs, - func(ctx context.Context, redelegation client.Redelegation) { - // Lock the cache for writing. - rc.ringPointsMu.Lock() - defer rc.ringPointsMu.Unlock() - // Check if the redelegation event's app address is in the cache. - if _, ok := rc.ringPointsCache[redelegation.GetAppAddress()]; ok { - rc.logger.Debug(). - Str("app_address", redelegation.GetAppAddress()). - Msg("redelegation event received; invalidating cache entry") - // Invalidate the cache entry. - delete(rc.ringPointsCache, redelegation.GetAppAddress()) - } - }) -} - -// Stop stops the ring cache by unsubscribing from on-chain redelegation events. -func (rc *ringCache) Stop() { - // Clear the cache. - rc.ringPointsMu.Lock() - rc.ringPointsCache = make(map[string][]ringtypes.Point) - rc.ringPointsMu.Unlock() - // Close the delegation client. - rc.delegationClient.Close() -} - -// GetCachedAddresses returns the addresses of the applications that are -// currently cached in the ring cache. -func (rc *ringCache) GetCachedAddresses() []string { - rc.ringPointsMu.RLock() - defer rc.ringPointsMu.RUnlock() - keys := make([]string, 0, len(rc.ringPointsCache)) - for k := range rc.ringPointsCache { - keys = append(keys, k) - } - return keys -} - -// GetRingForAddress returns the ring for the address provided. If it does not -// exist in the cache, it will be created by querying the application module. -// and converting the addresses into their corresponding public key points on -// the secp256k1 curve. It will then be cached for future use. -func (rc *ringCache) GetRingForAddress( - ctx context.Context, - appAddress string, -) (*ring.Ring, error) { - var ( - ring *ring.Ring - err error - ) - - // Lock the cache for reading. - rc.ringPointsMu.RLock() - // Check if the ring is in the cache. - points, ok := rc.ringPointsCache[appAddress] - // Unlock the cache in case it was not cached. - rc.ringPointsMu.RUnlock() - - if !ok { - // If the ring is not in the cache, get it from the application module. - rc.logger.Debug(). - Str("app_address", appAddress). - Msg("ring cache miss; fetching from application module") - ring, err = rc.getRingForAppAddress(ctx, appAddress) - } else { - // If the ring is in the cache, create it from the points. - rc.logger.Debug(). - Str("app_address", appAddress). - Msg("ring cache hit; creating from points") - ring, err = newRingFromPoints(points) - } - if err != nil { - return nil, err - } - - // Return the ring. - return ring, nil -} - -// getRingForAppAddress returns the RingSinger used to sign relays. It does so by fetching -// the latest information from the application module and creating the correct ring. -// This method also caches the ring's public keys for future use. -func (rc *ringCache) getRingForAppAddress( - ctx context.Context, - appAddress string, -) (*ring.Ring, error) { - points, err := rc.getDelegatedPubKeysForAddress(ctx, appAddress) - if err != nil { - return nil, err - } - // Cache the ring's points for future use - rc.logger.Debug(). - Str("app_address", appAddress). - Msg("updating ring cache for app") - rc.ringPointsMu.Lock() - defer rc.ringPointsMu.Unlock() - rc.ringPointsCache[appAddress] = points - return newRingFromPoints(points) -} - -// newRingFromPoints creates a new ring from points on the secp256k1 curve -func newRingFromPoints(points []ringtypes.Point) (*ring.Ring, error) { - return ring.NewFixedKeyRingFromPublicKeys(ring_secp256k1.NewCurve(), points) -} - -// getDelegatedPubKeysForAddress returns the ring used to sign a message for -// the given application address, by querying the application module for it's -// delegated pubkeys and converting them to points on the secp256k1 curve in -// order to create the ring. -func (rc *ringCache) getDelegatedPubKeysForAddress( - ctx context.Context, - appAddress string, -) ([]ringtypes.Point, error) { - rc.ringPointsMu.Lock() - defer rc.ringPointsMu.Unlock() - - // Get the application's on chain state. - app, err := rc.applicationQuerier.GetApplication(ctx, appAddress) - if err != nil { - return nil, err - } - - // Create a slice of addresses for the ring. - ringAddresses := make([]string, 0) - ringAddresses = append(ringAddresses, appAddress) // app address is index 0 - if len(app.DelegateeGatewayAddresses) == 0 { - // add app address twice to make the ring size of mininmum 2 - // TODO_HACK: We are adding the appAddress twice because a ring - // signature requires AT LEAST two pubKeys. When the Application has - // not delegated to any gateways, we add the application's own address - // twice. This is a HACK and should be investigated as to what is the - // best approach to take in this situation. - ringAddresses = append(ringAddresses, appAddress) - } else { - // add the delegatee gateway addresses - ringAddresses = append(ringAddresses, app.DelegateeGatewayAddresses...) - } - - // Get the points on the secp256k1 curve for the addresses. - points, err := rc.addressesToPoints(ctx, ringAddresses) - if err != nil { - return nil, err - } - - // Return the public key points on the secp256k1 curve. - return points, nil -} - -// addressesToPoints converts a slice of addresses to a slice of points on the -// secp256k1 curve, by querying the account module for the public key for each -// address and converting them to the corresponding points on the secp256k1 curve -func (rc *ringCache) addressesToPoints( - ctx context.Context, - addresses []string, -) ([]ringtypes.Point, error) { - curve := ring_secp256k1.NewCurve() - points := make([]ringtypes.Point, len(addresses)) - rc.logger.Debug(). - // TODO_TECHDEBT: implement and use `polylog.Event#Strs([]string)` instead of formatting here. - Str("addresses", fmt.Sprintf("%v", addresses)). - Msg("converting addresses to points") - for i, addr := range addresses { - // Retrieve the account from the auth module - acc, err := rc.accountQuerier.GetAccount(ctx, addr) - if err != nil { - return nil, err - } - key := acc.GetPubKey() - // Check if the key is a secp256k1 public key - if _, ok := key.(*secp256k1.PubKey); !ok { - return nil, ErrRingsNotSecp256k1Curve.Wrapf("got %T", key) - } - // Convert the public key to the point on the secp256k1 curve - point, err := curve.DecodeToPoint(key.Bytes()) - if err != nil { - return nil, err - } - // Insert the point into the slice of points - points[i] = point - } - return points, nil -} diff --git a/pkg/crypto/rings/cache_test.go b/pkg/crypto/rings/cache_test.go deleted file mode 100644 index 8505fa3dd..000000000 --- a/pkg/crypto/rings/cache_test.go +++ /dev/null @@ -1,307 +0,0 @@ -package rings_test - -import ( - "context" - "errors" - "testing" - "time" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" - "github.com/pokt-network/poktroll/testutil/testclient/testqueryclients" - testrings "github.com/pokt-network/poktroll/testutil/testcrypto/rings" - apptypes "github.com/pokt-network/poktroll/x/application/types" -) - -const noDelegateesRingSize = 2 - -// account is an internal struct used to define an (address, public_key) pairing -type account struct { - address string - pubKey cryptotypes.PubKey -} - -// newAccount creates a new account for testing purposes on the desired curve -func newAccount(curve string) account { - var addr string - var pubkey cryptotypes.PubKey - switch curve { - case "ed25519": - addr, pubkey = sample.AccAddressAndPubKeyEdd2519() - case "secp256k1": - addr, pubkey = sample.AccAddressAndPubKey() - } - return account{ - address: addr, - pubKey: pubkey, - } -} - -func TestRingCache_BuildRing_Uncached(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - defer cancelCtx() - rc, _ := createRingCache(ctx, t, "") - rc.Start(ctx) - t.Cleanup(rc.Stop) - - tests := []struct { - desc string - appAddrIndex int - appAccount account - delegateeAccounts []account - expectedRingSize int - expectedErr error - }{ - { - desc: "success: un-cached application without delegated gateways", - appAddrIndex: 1, - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{}, - expectedRingSize: noDelegateesRingSize, - expectedErr: nil, - }, - { - desc: "success: un-cached application with delegated gateways", - appAddrIndex: 2, - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{newAccount("secp256k1"), newAccount("secp256k1")}, - expectedRingSize: 3, - expectedErr: nil, - }, - { - desc: "failure: app pubkey uses wrong curve", - appAccount: newAccount("ed25519"), - delegateeAccounts: []account{newAccount("secp256k1"), newAccount("secp256k1")}, - expectedRingSize: 0, - expectedErr: rings.ErrRingsNotSecp256k1Curve, - }, - { - desc: "failure: gateway pubkey uses wrong curve", - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{newAccount("ed25519"), newAccount("ed25519")}, - expectedRingSize: 0, - expectedErr: rings.ErrRingsNotSecp256k1Curve, - }, - { - desc: "failure: application not found", - appAccount: newAccount("secp256k1"), - delegateeAccounts: []account{newAccount("secp256k1")}, - expectedRingSize: 0, - expectedErr: apptypes.ErrAppNotFound, - }, - } - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - // If we expect the application to exist then add it to the test - // application map with the number of delegated gateways it is - // supposed to have so it can be retrieved from the mock - if !errors.As(test.expectedErr, &apptypes.ErrAppNotFound) { - accMap := make(map[string]cryptotypes.PubKey) - for _, delegateeAcc := range test.delegateeAccounts { - accMap[delegateeAcc.address] = delegateeAcc.pubKey - } - // add the application's account and the accounts of all its - // delegated gateways to the testing state - testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, accMap) - } - // Attempt to retrieve the ring for the address - ring, err := rc.GetRingForAddress(ctx, test.appAccount.address) - if test.expectedErr != nil { - require.ErrorAs(t, err, &test.expectedErr) - return - } - require.NoError(t, err) - // Ensure the ring is the correct size. - require.Equal(t, test.expectedRingSize, ring.Size()) - require.Equal(t, test.appAddrIndex, len(rc.GetCachedAddresses())) - }) - } -} - -func TestRingCache_BuildRing_Cached(t *testing.T) { - tests := []struct { - desc string - appAccount account - expectedRingSize int - expectedErr error - }{ - { - desc: "success: cached application without delegated gateways", - appAccount: newAccount("secp256k1"), - expectedRingSize: noDelegateesRingSize, - expectedErr: nil, - }, - { - desc: "success: cached application with delegated gateways", - appAccount: newAccount("secp256k1"), - expectedRingSize: 3, - expectedErr: nil, - }, - } - - for _, test := range tests { - t.Run(test.desc, func(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - defer cancelCtx() - rc, pubCh := createRingCache(ctx, t, test.appAccount.address) - rc.Start(ctx) - t.Cleanup(rc.Stop) - - // Check that the ring cache is empty - require.Equal(t, 0, len(rc.GetCachedAddresses())) - - // add the application's account with no delegated gateways to the - // testing state - testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, nil) - - // Attempt to retrieve the ring for the address and cache it - ring1, err := rc.GetRingForAddress(ctx, test.appAccount.address) - require.NoError(t, err) - require.Equal(t, noDelegateesRingSize, ring1.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - accMap := make(map[string]cryptotypes.PubKey) - // if the test expects a ring > 2 we have delegated gateways - if test.expectedRingSize != noDelegateesRingSize { - // create accounts for all the expected delegated gateways - // and add them to the map - for i := 0; i < test.expectedRingSize-1; i++ { - gatewayAcc := newAccount("secp256k1") - accMap[gatewayAcc.address] = gatewayAcc.pubKey - } - } - - // add the application's account and the accounts of all its - // delegated gateways to the testing state simulating a change - testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, accMap) - for k := range accMap { - t.Log(accMap) - // publish a redelegation event - pubCh <- testdelegation.NewAnyTimesRedelegation(t, test.appAccount.address, k) - } - - // Wait a tick to allow the ring cache to process asynchronously. - // It should have invalidated the cache for the ring, if changed. - time.Sleep(15 * time.Millisecond) - - // Attempt to retrieve the ring for the address and cache it if - // the ring was updated - ring2, err := rc.GetRingForAddress(ctx, test.appAccount.address) - require.NoError(t, err) - // If the ring was updated then the rings should not be equal - if test.expectedRingSize != noDelegateesRingSize { - require.False(t, ring1.Equals(ring2)) - } else { - require.True(t, ring1.Equals(ring2)) - } - require.Equal(t, test.expectedRingSize, ring2.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Attempt to retrieve the ring for the address after its been cached - ring3, err := rc.GetRingForAddress(ctx, test.appAccount.address) - require.NoError(t, err) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Ensure the rings are the same and have the same size - require.True(t, ring2.Equals(ring3)) - require.Equal(t, test.expectedRingSize, ring3.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - }) - } -} - -func TestRingCache_Stop(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - t.Cleanup(cancelCtx) - rc, _ := createRingCache(ctx, t, "") - rc.Start(ctx) - - // Insert an application into the testing state - appAccount := newAccount("secp256k1") - gatewayAccount := newAccount("secp256k1") - testqueryclients.AddAddressToApplicationMap( - t, appAccount.address, - appAccount.pubKey, - map[string]cryptotypes.PubKey{ - gatewayAccount.address: gatewayAccount.pubKey, - }) - - // Attempt to retrieve the ring for the address and cache it - ring1, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.Equal(t, 2, ring1.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Retrieve the cached ring - ring2, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.True(t, ring1.Equals(ring2)) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Stop the ring cache - rc.Stop() - - // Retrieve the ring again - require.Equal(t, 0, len(rc.GetCachedAddresses())) -} - -func TestRingCache_CancelContext(t *testing.T) { - // Create and start the ring cache - ctx, cancelCtx := context.WithCancel(context.Background()) - rc, _ := createRingCache(ctx, t, "") - rc.Start(ctx) - - // Insert an application into the testing state - appAccount := newAccount("secp256k1") - gatewayAccount := newAccount("secp256k1") - testqueryclients.AddAddressToApplicationMap( - t, - appAccount.address, appAccount.pubKey, - map[string]cryptotypes.PubKey{ - gatewayAccount.address: gatewayAccount.pubKey, - }) - - // Attempt to retrieve the ring for the address and cache it - ring1, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.Equal(t, 2, ring1.Size()) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Retrieve the cached ring - ring2, err := rc.GetRingForAddress(ctx, appAccount.address) - require.NoError(t, err) - require.True(t, ring1.Equals(ring2)) - require.Equal(t, 1, len(rc.GetCachedAddresses())) - - // Cancel the context - cancelCtx() - - // Wait a tick to allow the ring cache to process asynchronously. - time.Sleep(15 * time.Millisecond) - - // Retrieve the ring again - require.Equal(t, 0, len(rc.GetCachedAddresses())) -} - -// createRingCache creates the RingCache using mocked AccountQueryClient and -// ApplicatioQueryClient instances and returns the RingCache and the delegatee -// change replay observable. -func createRingCache(ctx context.Context, t *testing.T, appAddress string) (crypto.RingCache, chan<- client.Redelegation) { - t.Helper() - redelegationObs, redelegationPublishCh := channel.NewReplayObservable[client.Redelegation](ctx, 1) - delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(ctx, t, appAddress, redelegationObs) - accQuerier := testqueryclients.NewTestAccountQueryClient(t) - appQuerier := testqueryclients.NewTestApplicationQueryClient(t) - rc := testrings.NewRingCacheWithMockDependencies(ctx, t, accQuerier, appQuerier, delegationClient) - return rc, redelegationPublishCh -} diff --git a/pkg/crypto/rings/errors.go b/pkg/crypto/rings/errors.go deleted file mode 100644 index 8aae1ad9d..000000000 --- a/pkg/crypto/rings/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package rings - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "rings" - ErrRingsNotSecp256k1Curve = sdkerrors.Register(codespace, 1, "key is not a secp256k1 public key") -) diff --git a/pkg/crypto/rings/godoc.go b/pkg/crypto/rings/godoc.go deleted file mode 100644 index 522a7719b..000000000 --- a/pkg/crypto/rings/godoc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Package rings provides the RingCache interface that is used to build rings -// for applications by either the application itself or a gateway. This ring -// is used to sign the relay requests. -// The RingCache is responsible for caching the rings for future use and -// invalidating the cache when the application's delegated gateways change. -package rings diff --git a/pkg/deps/config/godoc.go b/pkg/deps/config/godoc.go deleted file mode 100644 index e5d9b15a5..000000000 --- a/pkg/deps/config/godoc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package config provides a method by which dependencies can be injected into -// dependency chains, via the use of SupplierFn functions. These functions -// return functions that can be used in CLI code to chain the dependencies -// required to start a service into a single depinject.Config. -package config diff --git a/pkg/deps/config/suppliers.go b/pkg/deps/config/suppliers.go deleted file mode 100644 index 7c9f4dd21..000000000 --- a/pkg/deps/config/suppliers.go +++ /dev/null @@ -1,363 +0,0 @@ -package config - -import ( - "context" - "net/url" - - "cosmossdk.io/depinject" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - grpc "github.com/cosmos/gogoproto/grpc" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/client/delegation" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/query" - querytypes "github.com/pokt-network/poktroll/pkg/client/query/types" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/sdk" -) - -// SupplierFn is a function that is used to supply a depinject config. -type SupplierFn func( - context.Context, - depinject.Config, - *cobra.Command, -) (depinject.Config, error) - -// SupplyConfig supplies a depinject config by calling each of the supplied -// supplier functions in order and passing the result of each supplier to the -// next supplier, chaining them together. -func SupplyConfig( - ctx context.Context, - cmd *cobra.Command, - suppliers []SupplierFn, -) (deps depinject.Config, err error) { - // Initialize deps to with empty depinject config. - deps = depinject.Configs() - for _, supplyFn := range suppliers { - deps, err = supplyFn(ctx, deps, cmd) - if err != nil { - return nil, err - } - } - return deps, nil -} - -// NewSupplyLoggerFromCtx supplies a depinject config with a polylog.Logger instance -// populated from the given context. -func NewSupplyLoggerFromCtx(ctx context.Context) SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - return depinject.Configs(deps, depinject.Supply(polylog.Ctx(ctx))), nil - } -} - -// NewSupplyEventsQueryClientFn supplies a depinject config with an -// EventsQueryClient from the given queryNodeRPCURL. -func NewSupplyEventsQueryClientFn(queryNodeRPCURL *url.URL) SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Convert the host to a websocket URL - queryNodeWebsocketURL := sdk.HostToWebsocketURL(queryNodeRPCURL.Host) - eventsQueryClient := events.NewEventsQueryClient(queryNodeWebsocketURL) - - return depinject.Configs(deps, depinject.Supply(eventsQueryClient)), nil - } -} - -// NewSupplyBlockClientFn supplies a depinject config with a blockClient. -func NewSupplyBlockClientFn() SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Requires a query client to be supplied to the deps - blockClient, err := block.NewBlockClient(ctx, deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(blockClient)), nil - } -} - -// NewSupplyDelegationClientFn returns a function which constructs a -// DelegationClient instance and returns a new depinject.Config which is -// supplied with the given deps and the new DelegationClient. -func NewSupplyDelegationClientFn() SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Requires a query client to be supplied to the deps - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(delegationClient)), nil - } -} - -// NewSupplyQueryClientContextFn supplies a depinject config with a query -// -// ClientContext, a GRPC client connection, and a keyring from the given queryNodeGRPCURL. -func NewSupplyQueryClientContextFn(queryNodeGRPCURL *url.URL) SupplierFn { - return func(_ context.Context, - deps depinject.Config, - cmd *cobra.Command, - ) (depinject.Config, error) { - // Temporarily store the flag's current value to be restored later, after - // the client context has been created with queryNodeGRPCURL. - // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. - tmpGRPC, err := cmd.Flags().GetString(cosmosflags.FlagGRPC) - if err != nil { - return nil, err - } - - // Set --grpc-addr flag to the pocketQueryNodeURL for the client context - // This flag is read by cosmosclient.GetClientQueryContext. - // Cosmos-SDK is expecting a GRPC address formatted as [:], - // so we only need to set the Host parameter of the URL to cosmosflags.FlagGRPC value. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, queryNodeGRPCURL.Host); err != nil { - return nil, err - } - - // NB: Currently, the implementations of GetClientTxContext() and - // GetClientQueryContext() are identical, allowing for their interchangeable - // use in both querying and transaction operations. However, in order to support - // independent configuration of client contexts for distinct querying and - // transacting purposes. E.g.: transactions are dispatched to the sequencer - // while queries are handled by a trusted full-node. - queryClientCtx, err := cosmosclient.GetClientQueryContext(cmd) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply( - querytypes.Context(queryClientCtx), - grpc.ClientConn(queryClientCtx), - queryClientCtx.Keyring, - )) - - // Restore the flag's original value in order for other components - // to use the flag as expected. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, tmpGRPC); err != nil { - return nil, err - } - - return deps, nil - } -} - -// NewSupplyTxClientContextFn supplies a depinject config with a TxClientContext -// from the given txNodeGRPCURL. -// TODO_TECHDEBT(#256): Remove this function once the as we may no longer -// need to supply a TxClientContext to the RelayMiner. -func NewSupplyTxClientContextFn( - queryNodeGRPCURL *url.URL, - txNodeRPCURL *url.URL, -) SupplierFn { - return func(_ context.Context, - deps depinject.Config, - cmd *cobra.Command, - ) (depinject.Config, error) { - // Temporarily store the flag's current value to be restored later, after - // the client context has been created with txNodeRPCURL. - // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. - tmpNode, err := cmd.Flags().GetString(cosmosflags.FlagNode) - if err != nil { - return nil, err - } - - // Temporarily store the flag's current value to be restored later, after - // the client context has been created with queryNodeGRPCURL. - // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. - tmpGRPC, err := cmd.Flags().GetString(cosmosflags.FlagGRPC) - if err != nil { - return nil, err - } - - // Set --node flag to the txNodeRPCURL for the client context - // This flag is read by cosmosclient.GetClientTxContext. - if err := cmd.Flags().Set(cosmosflags.FlagNode, txNodeRPCURL.String()); err != nil { - return nil, err - } - - // Set --grpc-addr flag to the queryNodeGRPCURL for the client context - // This flag is read by cosmosclient.GetClientTxContext to query accounts - // for transaction signing. - // Cosmos-SDK is expecting a GRPC address formatted as [:], - // so we only need to set the Host parameter of the URL to cosmosflags.FlagGRPC value. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, queryNodeGRPCURL.Host); err != nil { - return nil, err - } - - // NB: Currently, the implementations of GetClientTxContext() and - // GetClientQueryContext() are identical, allowing for their interchangeable - // use in both querying and transaction operations. However, in order to support - // independent configuration of client contexts for distinct querying and - // transacting purposes. E.g.: transactions are dispatched to the sequencer - // while queries are handled by a trusted full-node. - txClientCtx, err := cosmosclient.GetClientTxContext(cmd) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply( - txtypes.Context(txClientCtx), - )) - - // Restore the flag's original value in order for other components - // to use the flag as expected. - if err := cmd.Flags().Set(cosmosflags.FlagGRPC, tmpGRPC); err != nil { - return nil, err - } - - // Restore the flag's original value in order for other components - // to use the flag as expected. - if err := cmd.Flags().Set(cosmosflags.FlagNode, tmpNode); err != nil { - return nil, err - } - - return deps, nil - } -} - -// NewSupplyAccountQuerierFn supplies a depinject config with an AccountQuerier. -func NewSupplyAccountQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the account querier. - accountQuerier, err := query.NewAccountQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the account querier to the provided deps - return depinject.Configs(deps, depinject.Supply(accountQuerier)), nil - } -} - -// NewSupplyApplicationQuerierFn supplies a depinject config with an ApplicationQuerier. -func NewSupplyApplicationQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the application querier. - applicationQuerier, err := query.NewApplicationQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the application querier to the provided deps - return depinject.Configs(deps, depinject.Supply(applicationQuerier)), nil - } -} - -// NewSupplySessionQuerierFn supplies a depinject config with a SessionQuerier. -func NewSupplySessionQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the session querier. - sessionQuerier, err := query.NewSessionQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the session querier to the provided deps - return depinject.Configs(deps, depinject.Supply(sessionQuerier)), nil - } -} - -// NewSupplySupplierQuerierFn supplies a depinject config with a SupplierQuerier. -func NewSupplySupplierQuerierFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the supplier querier. - supplierQuerier, err := query.NewSupplierQuerier(deps) - if err != nil { - return nil, err - } - - // Supply the supplier querier to the provided deps - return depinject.Configs(deps, depinject.Supply(supplierQuerier)), nil - } -} - -// NewSupplyRingCacheFn supplies a depinject config with a RingCache. -func NewSupplyRingCacheFn() SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - // Create the ring cache. - ringCache, err := rings.NewRingCache(deps) - if err != nil { - return nil, err - } - - // Supply the ring cache to the provided deps - return depinject.Configs(deps, depinject.Supply(ringCache)), nil - } -} - -// NewSupplyPOKTRollSDKFn supplies a depinject config with a POKTRollSDK given -// the signing key name. -func NewSupplyPOKTRollSDKFn(signingKeyName string) SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - var clientCtx cosmosclient.Context - - // On a Cosmos environment we get the private key from the keyring - // Inject the client context, get the keyring from it then get the private key - if err := depinject.Inject(deps, &clientCtx); err != nil { - return nil, err - } - - keyRecord, err := clientCtx.Keyring.Key(signingKeyName) - if err != nil { - return nil, err - } - - privateKey, ok := keyRecord.GetLocal().PrivKey.GetCachedValue().(cryptotypes.PrivKey) - if !ok { - return nil, err - } - - config := &sdk.POKTRollSDKConfig{PrivateKey: privateKey, Deps: deps} - poktrollSDK, err := sdk.NewPOKTRollSDK(ctx, config) - if err != nil { - return nil, err - } - - // Supply the session querier to the provided deps - return depinject.Configs(deps, depinject.Supply(poktrollSDK)), nil - } -} diff --git a/pkg/either/either.go b/pkg/either/either.go deleted file mode 100644 index 2febbb412..000000000 --- a/pkg/either/either.go +++ /dev/null @@ -1,43 +0,0 @@ -package either - -// Either represents a type that can hold either a value of type T or an error. -// It's commonly used in functional programming to encapsulate functions that might fail. -// This way, instead of returning a value and an error separately, both are combined into a single type. -type Either[R any] struct { - right R // holds the success value - left error // holds the error, if any -} - -func NewEither[R any](right R, left error) Either[R] { - return Either[R]{right: right, left: left} -} - -// Success creates a successful Either value. -func Success[T any](value T) Either[T] { - return Either[T]{right: value, left: nil} -} - -// Error creates an error Either value. -func Error[T any](err error) Either[T] { - return Either[T]{right: zeroValue[T](), left: err} -} - -// IsSuccess checks if the Either contains a success value. -func (m Either[T]) IsSuccess() bool { - return m.left == nil -} - -// IsError checks if the Either contains an error. -func (m Either[T]) IsError() bool { - return m.left != nil -} - -// ValueOrError unpacks the Either value. -func (m Either[T]) ValueOrError() (T, error) { - return m.right, m.left -} - -// Helper function to get the zero value for any type. -func zeroValue[T any]() (zero T) { - return zero -} diff --git a/pkg/either/errors.go b/pkg/either/errors.go deleted file mode 100644 index f464b8886..000000000 --- a/pkg/either/errors.go +++ /dev/null @@ -1,35 +0,0 @@ -package either - -// SyncErr creates an AsyncError either from a synchronous error. -// It wraps the Error into the left field (conventionally associated with the -// error value in the Either pattern) of the Either type. It casts the result -// to the AsyncError type. -func SyncErr(err error) AsyncError { - return AsyncError(Error[chan error](err)) -} - -// AsyncErr creates an AsyncError from an error channel. -// It wraps the error channel into the right field (conventionally associated with -// successful values in the Either pattern) of the Either type. -func AsyncErr(errCh chan error) AsyncError { - return AsyncError(Success[chan error](errCh)) -} - -// SyncOrAsyncError decomposes the AsyncError into its components, returning -// a synchronous error and an error channel. If the AsyncError represents a -// synchronous error, the error channel will be nil and vice versa. -func (soaErr AsyncError) SyncOrAsyncError() (error, chan error) { - errCh, err := Either[chan error](soaErr).ValueOrError() - return err, errCh -} - -// IsSyncError checks if the AsyncError represents a synchronous error. -func (soaErr AsyncError) IsSyncError() bool { - return Either[chan error](soaErr).IsError() -} - -// IsAsyncError checks if the AsyncError represents an asynchronous error -// (sent through a channel). -func (soaErr AsyncError) IsAsyncError() bool { - return Either[chan error](soaErr).IsSuccess() -} diff --git a/pkg/either/types.go b/pkg/either/types.go deleted file mode 100644 index 4f5f53f00..000000000 --- a/pkg/either/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package either - -import "github.com/pokt-network/poktroll/pkg/relayer" - -type ( - // AsyncError represents a value which could either be a synchronous error or - // an asynchronous error (sent through a channel). It wraps the more generic - // `Either` type specific for error channels. - AsyncError Either[chan error] - Bytes = Either[[]byte] - SessionTree = Either[relayer.SessionTree] -) diff --git a/pkg/observable/channel/collect.go b/pkg/observable/channel/collect.go deleted file mode 100644 index edbc545cb..000000000 --- a/pkg/observable/channel/collect.go +++ /dev/null @@ -1,34 +0,0 @@ -package channel - -import ( - "context" - "sync" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// Collect collects all notifications received from the observable and returns -// them as a slice. ctx MUST be canceled, after some finite duration as it blocks -// until either srcObservable is closed OR ctx is canceled. Collect is a terminal -// observable operator. -func Collect[V any]( - ctx context.Context, - srcObservable observable.Observable[V], -) (dstCollection []V) { - var dstCollectionMu sync.Mutex - // Defer unlocking as lock is acquired immediately before returning. - defer dstCollectionMu.Unlock() - - ForEach(ctx, srcObservable, func(ctx context.Context, src V) { - dstCollectionMu.Lock() - dstCollection = append(dstCollection, src) - dstCollectionMu.Unlock() - }) - - // Wait for context to be done before returning. - <-ctx.Done() - - // Lock to read from dstCollection in return. - dstCollectionMu.Lock() - return dstCollection -} diff --git a/pkg/observable/channel/map.go b/pkg/observable/channel/map.go deleted file mode 100644 index d6053aefa..000000000 --- a/pkg/observable/channel/map.go +++ /dev/null @@ -1,130 +0,0 @@ -package channel - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -type MapFn[S, D any] func(ctx context.Context, src S) (dst D, skip bool) -type ForEachFn[V any] func(ctx context.Context, src V) - -// Map transforms the given observable by applying the given transformFn to each -// notification received from the observable. If the transformFn returns a skip -// bool of true, the notification is skipped and not emitted to the resulting -// observable. -func Map[S, D any]( - ctx context.Context, - srcObservable observable.Observable[S], - transformFn MapFn[S, D], -) observable.Observable[D] { - dstObservable, dstProducer := NewObservable[D]() - srcObserver := srcObservable.Subscribe(ctx) - - go goMapTransformNotification( - ctx, - srcObserver, - transformFn, - func(dstNotification D) { - dstProducer <- dstNotification - }, - ) - - return dstObservable -} - -// MapExpand transforms the given observable by applying the given transformFn to -// each notification received from the observable, similar to Map; however, the -// transformFn returns a slice of output notifications for each input notification. -func MapExpand[S, D any]( - ctx context.Context, - srcObservable observable.Observable[S], - transformFn MapFn[S, []D], -) observable.Observable[D] { - dstObservable, dstPublishCh := NewObservable[D]() - srcObserver := srcObservable.Subscribe(ctx) - - go goMapTransformNotification( - ctx, - srcObserver, - transformFn, - func(dstNotifications []D) { - for _, dstNotification := range dstNotifications { - dstPublishCh <- dstNotification - } - }, - ) - - return dstObservable -} - -// MapReplay transforms the given observable by applying the given transformFn to -// each notification received from the observable. If the transformFn returns a -// skip bool of true, the notification is skipped and not emitted to the resulting -// observable. -// The resulting observable will receive the last replayBufferSize -// number of values published to the source observable before receiving new values. -func MapReplay[S, D any]( - ctx context.Context, - replayBufferSize int, - srcObservable observable.Observable[S], - transformFn MapFn[S, D], -) observable.ReplayObservable[D] { - dstObservable, dstProducer := NewReplayObservable[D](ctx, replayBufferSize) - srcObserver := srcObservable.Subscribe(ctx) - - go goMapTransformNotification( - ctx, - srcObserver, - transformFn, - func(dstNotification D) { - dstProducer <- dstNotification - }, - ) - - return dstObservable -} - -// ForEach applies the given forEachFn to each notification received from the -// observable, similar to Map; however, ForEach does not publish to a destination -// observable. ForEach is useful for side effects and is a terminal observable -// operator. -func ForEach[V any]( - ctx context.Context, - srcObservable observable.Observable[V], - forEachFn ForEachFn[V], -) { - Map( - ctx, srcObservable, - func(ctx context.Context, src V) (dst V, skip bool) { - forEachFn(ctx, src) - - // No downstream observers; SHOULD always skip. - return zeroValue[V](), true - }, - ) -} - -// goMapTransformNotification transforms, optionally skips, and publishes -// notifications via the given publishFn. -func goMapTransformNotification[S, D any]( - ctx context.Context, - srcObserver observable.Observer[S], - transformFn MapFn[S, D], - publishFn func(dstNotifications D), -) { - for srcNotification := range srcObserver.Ch() { - dstNotifications, skip := transformFn(ctx, srcNotification) - if skip { - continue - } - - publishFn(dstNotifications) - } - -} - -// zeroValue is a generic helper which returns the zero value of the given type. -func zeroValue[T any]() (zero T) { - return zero -} diff --git a/pkg/observable/channel/map_test.go b/pkg/observable/channel/map_test.go deleted file mode 100644 index aa7507a71..000000000 --- a/pkg/observable/channel/map_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package channel_test - -import ( - "context" - "sync/atomic" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" -) - -func TestMap_Word_BytesToPalindrome(t *testing.T) { - tests := []struct { - name string - wordBz []byte - isValid bool - }{ - { - name: "valid palindrome", - wordBz: []byte("rotator"), - isValid: true, - }, - { - name: "invalid palindrome", - wordBz: []byte("spinner"), - isValid: false, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var ( - wordCounter int32 - ctx, cancel = context.WithCancel(context.Background()) - ) - t.Cleanup(cancel) - - // set up source bytes observable - bzObservable, bzPublishCh := channel.NewObservable[[]byte]() - - // map bytes observable to palindrome observable - palindromeObservable := channel.Map(ctx, bzObservable, bytesToPalindrome) - palindromeObserver := palindromeObservable.Subscribe(ctx) - - // publish a word in bytes - bzPublishCh <- tt.wordBz - - // concurrently consume the palindrome observer's channel - go func() { - for word := range palindromeObserver.Ch() { - atomic.AddInt32(&wordCounter, 1) - - // word.forwards should always match the original word - require.Equal(t, string(tt.wordBz), word.forwards) - - if tt.isValid { - require.Equal(t, string(tt.wordBz), word.backwards) - require.Truef(t, word.IsValid(), "palindrome should be valid") - } else { - require.NotEmptyf(t, string(tt.wordBz), word.backwards) - require.Falsef(t, word.IsValid(), "palindrome should be invalid") - } - } - }() - - // wait a tick for the observer to receive the word - time.Sleep(10 * time.Millisecond) - - // ensure that the observer received the word - require.Equal(t, int32(1), atomic.LoadInt32(&wordCounter)) - }) - } -} - -// Palindrome is a word that is spelled the same forwards and backwards. -// It's used as an example of a type that can be mapped from one observable -// and has no real utility outside of this test. -type palindrome struct { - forwards string - backwards string -} - -func newPalindrome(word string) palindrome { - return palindrome{ - forwards: word, - backwards: reverseString(word), - } -} - -// IsValid returns true if the word actually is a palindrome. -func (p *palindrome) IsValid() bool { - return p.forwards == (p.backwards) -} - -func bytesToPalindrome(_ context.Context, wordBz []byte) (palindrome, bool) { - return newPalindrome(string(wordBz)), false -} - -// reverseString reverses a string, character-by-character. -func reverseString(s string) string { - runes := []rune(s) - // use i & j as cursors to iteratively swap values on symmetrical indexes - for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { - runes[i], runes[j] = runes[j], runes[i] - } - return string(runes) -} diff --git a/pkg/observable/channel/observable.go b/pkg/observable/channel/observable.go deleted file mode 100644 index fa898200f..000000000 --- a/pkg/observable/channel/observable.go +++ /dev/null @@ -1,101 +0,0 @@ -package channel - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// TODO_DISCUSS: what should this be? should it be configurable? It seems to be most -// relevant in the context of the behavior of the observable when it has multiple -// observers which consume at different rates. -// defaultSubscribeBufferSize is the buffer size of a observable's publish channel. -const defaultPublishBufferSize = 50 - -var ( - _ observable.Observable[any] = (*channelObservable[any])(nil) - _ observerManager[any] = (*channelObservable[any])(nil) -) - -// option is a function which receives and can modify the channelObservable state. -type option[V any] func(obs *channelObservable[V]) - -// channelObservable implements the observable.Observable interface and can be notified -// by sending on its corresponding publishCh channel. -type channelObservable[V any] struct { - // embed observerManager to encapsulate concurrent-safe read/write access to - // observers. This also allows higher-level objects to wrap this observable - // without knowing its specific type by asserting that it implements the - // observerManager interface. - observerManager[V] - // publishCh is an observable-wide channel that is used to receive values - // which are subsequently fanned out to observers. - publishCh chan V -} - -// NewObservable creates a new observable which is notified when the publishCh -// channel receives a value. -func NewObservable[V any](opts ...option[V]) (observable.Observable[V], chan<- V) { - // initialize an observable that publishes messages from 1 publishCh to N observers - obs := &channelObservable[V]{ - observerManager: newObserverManager[V](), - } - - for _, opt := range opts { - opt(obs) - } - - // If the caller does not provide a publishCh, create a new one using the - // defaultPublishBuffer size and return it. - if obs.publishCh == nil { - obs.publishCh = make(chan V, defaultPublishBufferSize) - } - - // start listening to the publishCh and emit values to observers - go obs.goPublish() - - return obs, obs.publishCh -} - -// WithPublisher returns an option function which sets the given publishCh of the -// resulting observable when passed to NewObservable(). -func WithPublisher[V any](publishCh chan V) option[V] { - return func(obs *channelObservable[V]) { - obs.publishCh = publishCh - } -} - -// Subscribe returns an observer which is notified when the publishCh channel -// receives a value. -func (obs *channelObservable[V]) Subscribe(ctx context.Context) observable.Observer[V] { - // Create a new observer and add it to the list of observers to be notified - // when publishCh receives a new value. - observer := NewObserver[V](ctx, obs.observerManager.remove) - obs.observerManager.add(observer) - - // caller can rely on context cancelation or call UnsubscribeAll() to unsubscribe - // active observers - if ctx != nil { - // asynchronously wait for the context to be done and then unsubscribe - // this observer. - go obs.observerManager.goUnsubscribeOnDone(ctx, observer) - } - return observer -} - -// UnsubscribeAll unsubscribes and removes all observers from the observable. -func (obs *channelObservable[V]) UnsubscribeAll() { - obs.observerManager.removeAll() -} - -// goPublish to the publishCh and notify observers when values are received. -// This function is blocking and should be run in a goroutine. -func (obs *channelObservable[V]) goPublish() { - for notification := range obs.publishCh { - obs.observerManager.notifyAll(notification) - } - - // Here we know that the publisher channel has been closed. - // Unsubscribe all observers as they can no longer receive notifications. - obs.observerManager.removeAll() -} diff --git a/pkg/observable/channel/observable_test.go b/pkg/observable/channel/observable_test.go deleted file mode 100644 index b278546fc..000000000 --- a/pkg/observable/channel/observable_test.go +++ /dev/null @@ -1,371 +0,0 @@ -package channel_test - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "golang.org/x/sync/errgroup" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testchannel" - "github.com/pokt-network/poktroll/testutil/testerrors" -) - -const ( - publishDelay = time.Millisecond - notifyTimeout = 50 * time.Millisecond - cancelUnsubscribeDelay = publishDelay * 2 -) - -func TestChannelObservable_NotifyObservers(t *testing.T) { - type test struct { - name string - publishCh chan int - inputs []int - expectedOutputs []int - setupFn func(t test) - } - - inputs := []int{123, 456, 789} - // NB: see TODO_INCOMPLETE comment below - //fullBlockingPublisher := make(chan *int) - //fullBufferedPublisher := make(chan *int, 1) - - tests := []test{ - { - name: "nil publisher (default buffer size)", - publishCh: nil, - inputs: inputs, - expectedOutputs: inputs, - }, - { - name: "empty non-buffered publisher", - publishCh: make(chan int), - inputs: inputs, - expectedOutputs: inputs, - }, - { - name: "empty buffered len 1 publisher", - publishCh: make(chan int, 1), - inputs: inputs, - expectedOutputs: inputs, - }, - { - name: "empty buffered len 1000 publisher", - publishCh: make(chan int, 1000), - inputs: inputs, - expectedOutputs: inputs, - }, - // TODO_INCOMPLETE(#81): publisher channels which are full are proving harder to test - // robustly (no flakiness); perhaps it has to do with the lack of some - // kind of guarantee about the receiver order on the consumer side. - // - // The following scenarios should generally pass but are flaky: - // (see: docs/pkg/observable/README.md regarding synchronization and buffering) - // - // { - // name: "full non-buffered publisher", - // publishCh: fullBlockingPublisher, - // inputs: inputs[1:], - // expectedOutputs: inputs, - // setupFn: func(t test) { - // go func() { - // // blocking send - // t.publishCh <- &inputs[0] - // }() - // }, - // }, - // { - // name: "full buffered len 1 publisher", - // publishCh: fullBufferedPublisher, - // inputs: inputs[1:], - // expectedOutputs: inputs, - // setupFn: func(t test) { - // // non-blocking send - // t.publishCh <- &inputs[0] - // }, - // }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.setupFn != nil { - tt.setupFn(tt) - } - - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - obsvbl, publishCh := channel.NewObservable[int]( - channel.WithPublisher(tt.publishCh), - ) - require.NotNil(t, obsvbl) - require.NotNil(t, publishCh) - - // construct 3 distinct observers, each with its own channel - observers := make([]observable.Observer[int], 1) - for i := range observers { - observers[i] = obsvbl.Subscribe(ctx) - } - - group, ctx := errgroup.WithContext(ctx) - - // ensure all observer channels are notified - for obsvrIdx, obsvr := range observers { - // onNext is called for each notification received by the observer - onNext := func(outputIndex int, output int) error { - // obsvr channel should receive notified input - if !assert.Equalf( - t, tt.expectedOutputs[outputIndex], - output, - "obsvr Idx: %d", obsvrIdx, - ) { - return testerrors.ErrAsync - } - return nil - } - - // onDone is called when the observer channel closes - onDone := func(outputs []int) error { - if !assert.ElementsMatch( - t, tt.expectedOutputs, outputs, - "obsvr addr: %p", obsvr, - ) { - return testerrors.ErrAsync - } - return nil - } - - // concurrently await notification or timeout to avoid blocking on - // empty and/or non-buffered publishers. - group.Go(goNotifiedOrTimedOutFactory(obsvr, onNext, onDone, notifyTimeout)) - } - - // notify with test input - publish := delayedPublishFactory(publishCh, publishDelay) - for _, input := range tt.inputs { - // simulating IO delay in sequential message publishing - publish(input) - } - - // Finished sending values, close publishCh to unsubscribe all observers - // and close all fan-out channels. - close(publishCh) - - // wait for obsvbl to be notified or timeout - err := group.Wait() - require.NoError(t, err) - - // closing publishCh should unsubscribe all observers, causing them - // to close their channels. - for _, observer := range observers { - // must drain the channel first to ensure it is isClosed - err := testchannel.DrainChannel(observer.Ch()) - require.NoError(t, err) - } - }) - } -} - -func TestChannelObservable_UnsubscribeObservers(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - obsvbl, publishCh := channel.NewObservable[int]() - require.NotNil(t, obsvbl) - require.NotNil(t, publishCh) - - type test struct { - name string - lifecycleFn func() observable.Observer[int] - } - - tests := []test{ - { - name: "nil context", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(nil) - observer.Unsubscribe() - return observer - }, - }, - { - name: "only unsubscribe", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - observer.Unsubscribe() - return observer - }, - }, - { - name: "only cancel", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - cancel() - return observer - }, - }, - { - // NOTE: this will log a warning that can be ignored: - // > redundant unsubscribe: observer is closed - name: "cancel then unsubscribe", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - cancel() - time.Sleep(cancelUnsubscribeDelay) - observer.Unsubscribe() - return observer - }, - }, - { - // NOTE: this will log a warning that can be ignored: - // > redundant unsubscribe: observer is closed - name: "unsubscribe then cancel", - lifecycleFn: func() observable.Observer[int] { - observer := obsvbl.Subscribe(ctx) - observer.Unsubscribe() - time.Sleep(cancelUnsubscribeDelay) - cancel() - return observer - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - observer := tt.lifecycleFn() - - select { - case value, ok := <-observer.Ch(): - require.Empty(t, value) - require.False(t, ok) - case <-time.After(notifyTimeout): - t.Fatal("observer channel left open") - } - }) - } -} - -// TODO_INCOMPLETE/TODO_TECHDEBT: Implement `TestChannelObservable_ConcurrentSubUnSub` -func TestChannelObservable_ConcurrentSubUnSub(t *testing.T) { - t.Skip("add coverage: subscribing and unsubscribing concurrently should not race") -} - -func TestChannelObservable_SequentialPublishAndUnsubscription(t *testing.T) { - observations := new([]*observation[int]) - expectedNotifications := [][]int{ - {123, 456, 789}, - {456, 789, 987}, - {789, 987, 654}, - {987, 654, 321}, - } - - obsvbl, publishCh := channel.NewObservable[int]() - require.NotNil(t, obsvbl) - require.NotNil(t, publishCh) - // simulate IO delay in sequential message publishing - publish := delayedPublishFactory(publishCh, publishDelay) - - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - observation0 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation0) - go goReceiveNotifications(observation0) - publish(123) - - observation1 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation1) - go goReceiveNotifications(observation1) - publish(456) - - observation2 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation2) - go goReceiveNotifications(observation2) - publish(789) - - observation3 := newObservation(ctx, obsvbl) - *observations = append(*observations, observation3) - go goReceiveNotifications(observation3) - - observation0.Unsubscribe() - publish(987) - - observation1.Unsubscribe() - publish(654) - - observation2.Unsubscribe() - publish(321) - - observation3.Unsubscribe() - - for obsnIdx, obsrvn := range *observations { - t.Run(fmt.Sprintf("observation%d", obsnIdx), func(t *testing.T) { - msg := "observer %d channel left open" - select { - case _, ok := <-obsrvn.Ch(): - require.Falsef(t, ok, msg, obsnIdx) - default: - t.Fatalf(msg, obsnIdx) - } - - obsrvn.Lock() - defer obsrvn.Unlock() - - require.EqualValuesf( - t, expectedNotifications[obsnIdx], obsrvn.Notifications, - "observation index: %d", obsnIdx, - ) - }) - } -} - -// TODO_TECHDEBT/TODO_INCOMPLETE: add coverage for active observers closing when publishCh closes. -func TestChannelObservable_ObserversCloseOnPublishChannelClose(t *testing.T) { - t.Skip("add coverage: all observers should unsubscribe when publishCh closes") -} - -func delayedPublishFactory[V any](publishCh chan<- V, delay time.Duration) func(value V) { - return func(value V) { - publishCh <- value - // simulate IO delay in sequential message publishing - // NB: this make the test code safer as concurrent operations have more - // time to react; i.e. interact with the test harness. - time.Sleep(delay) - } -} - -func goNotifiedOrTimedOutFactory[V any]( - obsvr observable.Observer[V], - onNext func(index int, output V) error, - onDone func(outputs []V) error, - timeoutDuration time.Duration, -) func() error { - var ( - outputIndex int - outputs []V - ) - return func() error { - for { - select { - case output, ok := <-obsvr.Ch(): - if !ok { - return onDone(outputs) - } - - if err := onNext(outputIndex, output); err != nil { - return err - } - - outputs = append(outputs, output) - outputIndex++ - continue - case <-time.After(timeoutDuration): - return fmt.Errorf("timed out waiting for observer to be notified") - } - } - } -} diff --git a/pkg/observable/channel/observation_test.go b/pkg/observable/channel/observation_test.go deleted file mode 100644 index 71a3aa098..000000000 --- a/pkg/observable/channel/observation_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package channel_test - -import ( - "context" - "sync" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -// NOTE: this file does not contain any tests, only test helpers. - -// observation is a data structure that embeds an observer -// and keeps track of the received notifications. -// It uses generics with type parameter V. -type observation[V any] struct { - // Embeds a mutex for thread-safe operations - sync.Mutex - // Embeds an Observer of type V - observable.Observer[V] - // Notifications is a slice of type V to store received notifications - Notifications []V -} - -// newObservation is a constructor function that returns -// a new observation instance. It subscribes to the provided observable. -func newObservation[V any]( - ctx context.Context, - observable observable.Observable[V], -) *observation[V] { - return &observation[V]{ - Observer: observable.Subscribe(ctx), - Notifications: []V{}, - } -} - -// notify is a method on observation that safely -// appends a received value to the Notifications slice. -func (o *observation[V]) notify(value V) { - o.Lock() // Locks the mutex to prevent concurrent write access - defer o.Unlock() // Unlocks the mutex when the method returns - - o.Notifications = append(o.Notifications, value) // Appends the received value to the Notifications slice -} - -// goReceiveNotifications is a function that listens for -// notifications from the observer's channel and notifies -// the observation instance for each received value. -func goReceiveNotifications[V any](obsvn *observation[V]) { - for notification := range obsvn.Ch() { // Listens for notifications on the channel - obsvn.notify(notification) // Notifies the observation instance with the received value - } -} diff --git a/pkg/observable/channel/observer.go b/pkg/observable/channel/observer.go deleted file mode 100644 index 98f43a99b..000000000 --- a/pkg/observable/channel/observer.go +++ /dev/null @@ -1,152 +0,0 @@ -package channel - -import ( - "context" - "sync" - "time" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/polylog" - _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -const ( - // TODO_DISCUSS: what should this be? should it be configurable? It seems to be most - // relevant in the context of the behavior of the observable when it has multiple - // observers which consume at different rates. - // defaultSubscribeBufferSize is the buffer size of a channelObserver's channel. - defaultSubscribeBufferSize = 50 - // sendRetryInterval is the duration between attempts to send on the observer's - // channel in the event that it's full. It facilitates a branch in a for loop - // which unlocks the observer's mutex and tries again. - // NOTE: setting this too low can cause the send retry loop to "slip", giving - // up on a send attempt before the channel is ready to receive for multiple - // iterations of the loop. - sendRetryInterval = 100 * time.Millisecond -) - -var _ observable.Observer[any] = (*channelObserver[any])(nil) - -// channelObserver implements the observable.Observer interface. -type channelObserver[V any] struct { - ctx context.Context - // onUnsubscribe is called in Observer#Unsubscribe, closing this observer's - // channel and removing it from the respective obervable's observers list - // in a concurrency-safe manner. - onUnsubscribe func(toRemove observable.Observer[V]) - // observerMu protects the observerCh and isClosed fields. - observerMu *sync.RWMutex - // observerCh is the channel that is used to emit values to the observer. - // I.e. on the "N" side of the 1:N relationship between observable and - // observer. - observerCh chan V - // isClosed indicates whether the observer has been isClosed. It's set in - // unsubscribe; isClosed observers can't be reused. - isClosed bool -} - -type UnsubscribeFunc[V any] func(toRemove observable.Observer[V]) - -func NewObserver[V any]( - ctx context.Context, - onUnsubscribe UnsubscribeFunc[V], -) *channelObserver[V] { - // Create a channel for the observer and append it to the observers list - return &channelObserver[V]{ - ctx: ctx, - observerMu: new(sync.RWMutex), - observerCh: make(chan V, defaultSubscribeBufferSize), - onUnsubscribe: onUnsubscribe, - } -} - -// Unsubscribe closes the subscription channel and removes the subscription from -// the observable. -func (obsvr *channelObserver[V]) Unsubscribe() { - obsvr.unsubscribe() -} - -// Ch returns a receive-only subscription channel. -func (obsvr *channelObserver[V]) Ch() <-chan V { - return obsvr.observerCh -} - -// IsClosed returns true if the observer has been unsubscribed. -// A closed observer cannot be reused. -func (obsvr *channelObserver[V]) IsClosed() bool { - obsvr.observerMu.Lock() - defer obsvr.observerMu.Unlock() - - return obsvr.isClosed -} - -// unsubscribe closes the subscription channel, marks the observer as isClosed, and -// removes the subscription from its observable's observers list via onUnsubscribe. -func (obsvr *channelObserver[V]) unsubscribe() { - obsvr.observerMu.Lock() - defer obsvr.observerMu.Unlock() - - if obsvr.isClosed { - // Get a context, eihter from the observer or from the background to get - // a reference to the logger. - ctx := obsvr.ctx - if ctx == nil { - ctx = context.Background() - } - logger := polylog.Ctx(ctx) - - // log the fact that this case was encountered such that an extreme change - // in its frequency would be obvious. - logger.Warn().Err(observable.ErrObserverClosed).Msg("redundant unsubscribe") - return - } - - close(obsvr.observerCh) - obsvr.isClosed = true - obsvr.onUnsubscribe(obsvr) -} - -// notify is called by observable to send a msg on the observer's channel. -// We can't use channelObserver#Ch because it's intended to be a -// receive-only channel. The channel will block if it is full (determined by the buffer -// size) -// if the channel's buffer is full, we will retry after sendRetryInterval/s. -// The other half is spent holding the read-lock and waiting for the (full) channel -// to be ready to receive. -func (obsvr *channelObserver[V]) notify(value V) { - defer obsvr.observerMu.RUnlock() // defer releasing a read lock - - sendRetryTicker := time.NewTicker(sendRetryInterval) - for { - // observerMu must remain read-locked until the value is sent on observerCh - // in the event that it would be isClosed concurrently (i.e. this observer - // unsubscribes), which could cause a "send on isClosed channel" error. - if !obsvr.observerMu.TryRLock() { - continue - } - if obsvr.isClosed { - return - } - - select { - case <-obsvr.ctx.Done(): - // if the context is done just release the read-lock (deferred) - return - case obsvr.observerCh <- value: - // if observerCh has space in its buffer, the value is written to it - return - // if the context isn't done and channel is full (i.e. blocking), - // release the read-lock to give write-lockers a turn. This case - // continues the loop, re-read-locking and trying again. - case <-sendRetryTicker.C: - // TODO_IMPROVE/TODO_CONSIDERATION: this is where we would implement - // some backpressure strategy. It would be good to have a simple fail- - // safe strategy that can be used by default; e.g. dropping the oldest - // value if its buffer is full. - - // This case implies that the (read) lock was acquired, so it must - // be unlocked before continuing the send retry loop. - obsvr.observerMu.RUnlock() - } - } -} diff --git a/pkg/observable/channel/observer_manager.go b/pkg/observable/channel/observer_manager.go deleted file mode 100644 index 65acca5bc..000000000 --- a/pkg/observable/channel/observer_manager.go +++ /dev/null @@ -1,152 +0,0 @@ -package channel - -import ( - "context" - "sync" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -var _ observerManager[any] = (*channelObserverManager[any])(nil) - -// observerManager is an interface intended to be used between an observable and some -// higher-level abstraction and/or observable implementation which would embed it. -// Embedding this interface rather than a channelObservable directly allows for -// more transparency and flexibility in higher-level code. -// NOTE: this interface MUST be used with a common concrete Observer type. -// TODO_CONSIDERATION: Consider whether `observerManager` and `Observable` should remain as separate -// types after some more time and experience using both. -type observerManager[V any] interface { - notifyAll(notification V) - add(toAdd observable.Observer[V]) - remove(toRemove observable.Observer[V]) - removeAll() - goUnsubscribeOnDone(ctx context.Context, observer observable.Observer[V]) -} - -// TODO_CONSIDERATION: if this were a generic implementation, we wouldn't need -// to cast `toAdd` to a channelObserver in add. There are two things -// currently preventing a generic observerManager implementation: -// 1. channelObserver#notify() is not part of the observable.Observer interface -// and is therefore not accessible here. If we move everything into the -// `observable` pkg so that the unexported member is in scope, then the channel -// pkg can't implement it for the same reason, it's an unexported method defined -// in a different pkg. -// 2. == is not defined for a generic Observer type. We would have to add an Equals() -// to the Observer interface. - -// channelObserverManager implements the observerManager interface using -// channelObservers. -type channelObserverManager[V any] struct { - // observersMu protects observers from concurrent access/updates - observersMu *sync.RWMutex - // observers is a list of channelObservers that will be notified when new value - // are received. - observers []*channelObserver[V] -} - -func newObserverManager[V any]() *channelObserverManager[V] { - return &channelObserverManager[V]{ - observersMu: &sync.RWMutex{}, - observers: make([]*channelObserver[V], 0), - } -} - -func (com *channelObserverManager[V]) notifyAll(notification V) { - // Copy currentObservers to avoid holding the lock while notifying them. - // New or existing Observers may (un)subscribe while this notification - // is being fanned out. - // The observers at the time of locking, prior to copying, are the canonical - // set of observers which receive this notification. - currentObservers := com.copyObservers() - for _, obsvr := range currentObservers { - // TODO_TECHDEBT: since this synchronously notifies all observers in a loop, - // it is possible to block here, part-way through notifying all observers, - // on a slow observer consumer (i.e. full buffer). Instead, we should notify - // observers with some limited concurrency of "worker" goroutines. - // The storj/common repo contains such a `Limiter` implementation, see: - // https://github.com/storj/common/blob/main/sync2/limiter.go. - obsvr.notify(notification) - } -} - -// addObserver implements the respective member of observerManager. It is used -// by the channelObservable implementation as well as embedders of observerManager -// (e.g. replayObservable). -// It panics if toAdd is not a channelObserver. -func (com *channelObserverManager[V]) add(toAdd observable.Observer[V]) { - // must (write) lock observersMu so that we can safely append to the observers list - com.observersMu.Lock() - defer com.observersMu.Unlock() - - com.observers = append(com.observers, toAdd.(*channelObserver[V])) -} - -// remove removes a given observer from the observable's list of observers. -// It implements the respective member of observerManager and is used by -// the channelObservable implementation as well as embedders of observerManager -// (e.g. replayObservable). -func (com *channelObserverManager[V]) remove(toRemove observable.Observer[V]) { - // must (write) lock to iterate over and modify the observers list - com.observersMu.Lock() - defer com.observersMu.Unlock() - - for i, observer := range com.observers { - if observer == toRemove { - com.observers = append((com.observers)[:i], (com.observers)[i+1:]...) - break - } - } -} - -// removeAll unsubscribes and removes all observers from the observable. -// It implements the respective member of observerManager and is used by -// the channelObservable implementation as well as embedders of observerManager -// (e.g. replayObservable). -func (com *channelObserverManager[V]) removeAll() { - // Copy currentObservers to avoid holding the lock while unsubscribing them. - // The observers at the time of locking, prior to copying, are the canonical - // set of observers which are unsubscribed. - // New or existing Observers may (un)subscribe while the observable is closing. - // Any such observers won't be isClosed but will also stop receiving notifications - // immediately (if they receive any at all). - currentObservers := com.copyObservers() - for _, observer := range currentObservers { - observer.Unsubscribe() - } - - // Reset observers to an empty list. This purges any observers which might have - // subscribed while the observable was closing. - com.observersMu.Lock() - com.observers = []*channelObserver[V]{} - com.observersMu.Unlock() -} - -// goUnsubscribeOnDone unsubscribes from the subscription when the context is done. -// It is a blocking function and intended to be called in a goroutine. -func (com *channelObserverManager[V]) goUnsubscribeOnDone( - ctx context.Context, - observer observable.Observer[V], -) { - <-ctx.Done() - if observer.IsClosed() { - return - } - observer.Unsubscribe() -} - -// copyObservers returns a copy of the current observers list. It is safe to -// call concurrently. Notably, it is not part of the observerManager interface. -func (com *channelObserverManager[V]) copyObservers() (observers []*channelObserver[V]) { - defer com.observersMu.RUnlock() - - // This loop blocks on acquiring a read lock on observersMu. If TryRLock - // fails, the loop continues until it succeeds. This is intended to give - // callers a guarantee that this copy operation won't contribute to a deadlock. - com.observersMu.RLock() - - observers = make([]*channelObserver[V], len(com.observers)) - copy(observers, com.observers) - - return observers -} diff --git a/pkg/observable/channel/observer_test.go b/pkg/observable/channel/observer_test.go deleted file mode 100644 index 034541c85..000000000 --- a/pkg/observable/channel/observer_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package channel - -import ( - "context" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable" -) - -func TestObserver_Unsubscribe(t *testing.T) { - var ( - publishCh = make(chan int, 1) - onUnsubscribeCalled = false - onUnsubscribe = func(toRemove observable.Observer[int]) { - onUnsubscribeCalled = true - } - ) - obsvr := &channelObserver[int]{ - observerMu: &sync.RWMutex{}, - // using a buffered channel to keep the test synchronous - observerCh: publishCh, - onUnsubscribe: onUnsubscribe, - } - - // should initially be open - require.Equal(t, false, obsvr.isClosed) - - publishCh <- 1 - require.Equal(t, false, obsvr.isClosed) - - obsvr.Unsubscribe() - // should be isClosed after `#Unsubscribe()` - require.Equal(t, true, obsvr.isClosed) - require.True(t, onUnsubscribeCalled) -} - -func TestObserver_ConcurrentUnsubscribe(t *testing.T) { - var ( - publishCh = make(chan int, 1) - onUnsubscribeCalled = false - onUnsubscribe = func(toRemove observable.Observer[int]) { - onUnsubscribeCalled = true - } - ) - - obsvr := &channelObserver[int]{ - ctx: context.Background(), - observerMu: &sync.RWMutex{}, - // using a buffered channel to keep the test synchronous - observerCh: publishCh, - onUnsubscribe: onUnsubscribe, - } - - require.Equal(t, false, obsvr.isClosed, "observer channel should initially be open") - - // concurrently & continuously publish until the test cleanup runs - done := make(chan struct{}, 1) - go func() { - for idx := 0; ; idx++ { - // return when done receives; otherwise, - select { - case <-done: - return - default: - } - - // publish a value - obsvr.notify(idx) - - // Slow this loop to prevent bogging the test down. - time.Sleep(10 * time.Microsecond) - } - }() - // send on done when the test cleans up - t.Cleanup(func() { done <- struct{}{} }) - - // it should still be open after a bit of inactivity - time.Sleep(time.Millisecond) - require.Equal(t, false, obsvr.isClosed) - - obsvr.Unsubscribe() - // should be isClosed after `#Unsubscribe()` - require.Equal(t, true, obsvr.isClosed) - require.True(t, onUnsubscribeCalled) -} diff --git a/pkg/observable/channel/replay.go b/pkg/observable/channel/replay.go deleted file mode 100644 index 6f3284089..000000000 --- a/pkg/observable/channel/replay.go +++ /dev/null @@ -1,243 +0,0 @@ -package channel - -import ( - "context" - "sync" - "time" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// replayPartialBufferTimeout is the duration to wait for the replay buffer to -// accumulate at least 1 value before returning the accumulated values. -// TODO_CONSIDERATION: perhaps this should be parameterized. -const replayPartialBufferTimeout = 100 * time.Millisecond - -var ( - _ observable.ReplayObservable[any] = (*replayObservable[any])(nil) - _ observable.Observable[any] = (*replayObservable[any])(nil) -) - -type replayObservable[V any] struct { - // embed observerManager to encapsulate concurrent-safe read/write access to - // observers. This also allows higher-level objects to wrap this observable - // without knowing its specific type by asserting that it implements the - // observerManager interface. - observerManager[V] - // replayBufferSize is the number of notifications to buffer so that they - // can be replayed to new observers. - replayBufferSize int - // replayBufferMu protects replayBuffer from concurrent access/updates. - replayBufferMu sync.RWMutex - // replayBuffer holds the last relayBufferSize number of notifications received - // by this observable. This buffer is replayed to new observers, on subscribing, - // prior to any new notifications being propagated. - replayBuffer []V -} - -// NewReplayObservable returns a new ReplayObservable with the given replay buffer -// replayBufferSize and the corresponding publish channel to notify it of new values. -func NewReplayObservable[V any]( - ctx context.Context, - replayBufferSize int, - opts ...option[V], -) (observable.ReplayObservable[V], chan<- V) { - obsvbl, publishCh := NewObservable[V](opts...) - return ToReplayObservable[V](ctx, replayBufferSize, obsvbl), publishCh -} - -// ToReplayObservable returns an observable which replays the last replayBufferSize -// number of values published to the source observable to new observers, before -// publishing new values. -// It panics if srcObservable does not implement the observerManager interface. -// It should only be used with a srcObservable which contains channelObservers -// (i.e. channelObservable or similar). -func ToReplayObservable[V any]( - ctx context.Context, - replayBufferSize int, - srcObsvbl observable.Observable[V], -) observable.ReplayObservable[V] { - // Assert that the source observable implements the observerMngr required - // to embed and wrap it. - observerMngr := srcObsvbl.(observerManager[V]) - - replayObsvbl := &replayObservable[V]{ - observerManager: observerMngr, - replayBufferSize: replayBufferSize, - replayBuffer: make([]V, 0, replayBufferSize), - } - - srcObserver := srcObsvbl.Subscribe(ctx) - go replayObsvbl.goBufferReplayNotifications(srcObserver) - - return replayObsvbl -} - -// Last synchronously returns the last n values from the replay buffer. It blocks -// until at least 1 notification has been accumulated, then waits replayPartialBufferTimeout -// duration before returning all notifications accumulated notifications by that time. -// If the replay buffer contains at least n notifications, this function will only -// block as long as it takes to accumulate and return them. -// If n is greater than the replay buffer size, the entire replay buffer is returned. -func (ro *replayObservable[V]) Last(ctx context.Context, n int) []V { - logger := polylog.Ctx(ctx) - - // Use a temporary observer to accumulate replay values. - // Subscribe will always start with the replay buffer, so we can safely - // leverage it here for synchronization (i.e. blocking until at least 1 - // notification has been accumulated). This also eliminates the need for - // locking and/or copying the replay buffer. - tempObserver := ro.Subscribe(ctx) - defer tempObserver.Unsubscribe() - - // If n is greater than the replay buffer size, return the entire replay buffer. - if n > ro.replayBufferSize { - n = ro.replayBufferSize - logger.Warn(). - Int("requested_replay_buffer_size", n). - Int("replay_buffer_capacity", cap(ro.replayBuffer)). - Msg("requested replay buffer size is greater than replay buffer capacity; returning entire replay buffer") - } - - // accumulateReplayValues works concurrently and returns a context and cancellation - // function for signaling completion. - return accumulateReplayValues(tempObserver, n) -} - -// Subscribe returns an observer which is notified when the publishCh channel -// receives a value. -func (ro *replayObservable[V]) Subscribe(ctx context.Context) observable.Observer[V] { - ro.replayBufferMu.RLock() - defer ro.replayBufferMu.RUnlock() - - observer := NewObserver[V](ctx, ro.observerManager.remove) - - // Replay all buffered replayBuffer to the observer channel buffer before - // any new values have an opportunity to send on observerCh (i.e. appending - // observer to ro.observers). - // - // TODO_IMPROVE: this assumes that the observer channel buffer is large enough - // to hold all replay (buffered) notifications. - for _, notification := range ro.replayBuffer { - observer.notify(notification) - } - - ro.observerManager.add(observer) - - // caller can rely on context cancellation or call UnsubscribeAll() to unsubscribe - // active observers - if ctx != nil { - // asynchronously wait for the context to be done and then unsubscribe - // this observer. - go ro.observerManager.goUnsubscribeOnDone(ctx, observer) - } - - return observer -} - -// UnsubscribeAll unsubscribes and removes all observers from the observable. -func (ro *replayObservable[V]) UnsubscribeAll() { - ro.observerManager.removeAll() -} - -// goBufferReplayNotifications buffers the last n notifications from a source -// observer. It is intended to be run in a goroutine. -func (ro *replayObservable[V]) goBufferReplayNotifications(srcObserver observable.Observer[V]) { - for notification := range srcObserver.Ch() { - ro.replayBufferMu.Lock() - // Add the notification to the buffer. - if len(ro.replayBuffer) < ro.replayBufferSize { - ro.replayBuffer = append(ro.replayBuffer, notification) - } else { - // buffer full, make room for the new notification by removing the - // oldest notification. - ro.replayBuffer = append(ro.replayBuffer[1:], notification) - } - ro.replayBufferMu.Unlock() - } -} - -// accumulateReplayValues synchronously (but concurrently) accumulates n values -// from the observer channel into the slice pointed to by accValues and then returns -// said slice. It cancels the context either when n values have been accumulated -// or when at least 1 value has been accumulated and replayPartialBufferTimeout -// has elapsed. -func accumulateReplayValues[V any](observer observable.Observer[V], n int) []V { - var ( - // accValuesMu protects accValues from concurrent access. - accValuesMu sync.Mutex - // Accumulate replay values in a new slice to avoid (read) locking replayBufferMu. - accValues = new([]V) - // canceling the context will cause the loop in the goroutine to exit. - ctx, cancel = context.WithCancel(context.Background()) - ) - - // Concurrently accumulate n values from the observer channel. - go func() { - // Defer canceling the context and unlocking accValuesMu. The function - // assumes that the mutex is locked when it gets execution control back - // from the loop. - defer func() { - cancel() - accValuesMu.Unlock() - }() - for { - // Lock the mutex to read accValues here and potentially write in - // the first case branch in the select below. - accValuesMu.Lock() - - // The context was canceled since the last iteration. - if ctx.Err() != nil { - return - } - - // We've accumulated n values. - if len(*accValues) >= n { - return - } - - // Receive from the observer's channel if we can, otherwise let - // the loop run. - select { - // Receiving from the observer channel blocks if replayBuffer is empty. - case value, ok := <-observer.Ch(): - // tempObserver was closed concurrently. - if !ok { - return - } - - // Update the accumulated values pointed to by accValues. - *accValues = append(*accValues, value) - default: - // If we can't receive from the observer channel immediately, - // let the loop run. - } - - // Unlock accValuesMu so that the select below gets a chance to check - // the length of *accValues to decide whether to cancel, and it can - // be relocked at the top of the loop as it must be locked when the - // loop exits. - accValuesMu.Unlock() - // Wait a tick before continuing the loop. - time.Sleep(time.Millisecond) - } - }() - - // Wait for N values to be accumulated or timeout. When timing out, if we - // have at least 1 value, we can return it. Otherwise, we need to wait for - // the next value to be published (i.e. continue the loop). - for { - select { - case <-ctx.Done(): - return *accValues - case <-time.After(replayPartialBufferTimeout): - accValuesMu.Lock() - if len(*accValues) > 1 { - cancel() - return *accValues - } - accValuesMu.Unlock() - } - } -} diff --git a/pkg/observable/channel/replay_test.go b/pkg/observable/channel/replay_test.go deleted file mode 100644 index 6e01f123e..000000000 --- a/pkg/observable/channel/replay_test.go +++ /dev/null @@ -1,240 +0,0 @@ -package channel_test - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testerrors" -) - -func TestReplayObservable(t *testing.T) { - var ( - replayBufferSize = 3 - values = []int{1, 2, 3, 4, 5} - // the replay buffer is full and has shifted out values with index < - // len(values)-replayBufferSize so Last should return values starting - // from there. - expectedValues = values[len(values)-replayBufferSize:] - errCh = make(chan error, 1) - ctx, cancel = context.WithCancel(context.Background()) - ) - t.Cleanup(cancel) - - // NB: intentionally not using NewReplayObservable() to test ToReplayObservable() directly - // and to retain a reference to the wrapped observable for testing. - obsvbl, publishCh := channel.NewObservable[int]() - replayObsvbl := channel.ToReplayObservable[int](ctx, replayBufferSize, obsvbl) - - // vanilla observer, should be able to receive all values published after subscribing - observer := obsvbl.Subscribe(ctx) - go func() { - for _, expected := range values { - select { - case v := <-observer.Ch(): - if !assert.Equal(t, expected, v) { - errCh <- testerrors.ErrAsync - return - } - case <-time.After(1 * time.Second): - t.Errorf("Did not receive expected value %d in time", expected) - errCh <- testerrors.ErrAsync - return - } - } - }() - - // send all values to the observable's publish channel - for _, value := range values { - time.Sleep(10 * time.Microsecond) - publishCh <- value - time.Sleep(10 * time.Microsecond) - } - - // allow some time for values to be buffered by the replay observable - time.Sleep(time.Millisecond) - - // replay observer, should receive the last lastN values published prior to - // subscribing followed by subsequently published values - replayObserver := replayObsvbl.Subscribe(ctx) - - // Collect values from replayObserver. - var actualValues []int - for _, expected := range expectedValues { - select { - case v := <-replayObserver.Ch(): - actualValues = append(actualValues, v) - case <-time.After(1 * time.Second): - t.Fatalf("Did not receive expected value %d in time", expected) - } - } - - require.EqualValues(t, expectedValues, actualValues) - - // Second replay observer, should receive the same values as the first - // even though it subscribed after all values were published and the - // values were already replayed by the first. - replayObserver2 := replayObsvbl.Subscribe(ctx) - - // Collect values from replayObserver2. - var actualValues2 []int - for _, expected := range expectedValues { - select { - case v := <-replayObserver2.Ch(): - actualValues2 = append(actualValues2, v) - case <-time.After(1 * time.Second): - t.Fatalf("Did not receive expected value %d in time", expected) - } - } - - require.EqualValues(t, expectedValues, actualValues) -} - -func TestReplayObservable_Last_Full_ReplayBuffer(t *testing.T) { - values := []int{1, 2, 3, 4, 5} - tests := []struct { - name string - replayBufferSize int - // lastN is the number of values to return from the replay buffer - lastN int - expectedValues []int - }{ - { - name: "n < replayBufferSize", - replayBufferSize: 5, - lastN: 3, - // the replay buffer is not full so Last should return values - // starting from the first published value. - expectedValues: values[:3], // []int{1, 2, 3}, - }, - { - name: "n = replayBufferSize", - replayBufferSize: 5, - lastN: 5, - expectedValues: values, - }, - { - name: "n > replayBufferSize", - replayBufferSize: 3, - lastN: 5, - // the replay buffer is full so Last should return values starting - // from lastN - replayBufferSize. - expectedValues: values[2:], // []int{3, 4, 5}, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - var ctx = context.Background() - - replayObsvbl, publishCh := - channel.NewReplayObservable[int](ctx, tt.replayBufferSize) - - for _, value := range values { - publishCh <- value - time.Sleep(time.Millisecond) - } - - actualValues := replayObsvbl.Last(ctx, tt.lastN) - require.ElementsMatch(t, tt.expectedValues, actualValues) - }) - } -} - -func TestReplayObservable_Last_Blocks_And_Times_Out(t *testing.T) { - var ( - replayBufferSize = 5 - lastN = 5 - // splitIdx is the index at which this test splits the set of values. - // The two groups of values are published at different points in the - // test to test the behavior of Last under different conditions. - splitIdx = 3 - values = []int{1, 2, 3, 4, 5} - ctx = context.Background() - ) - - replayObsvbl, publishCh := channel.NewReplayObservable[int](ctx, replayBufferSize) - - // getLastValues is a helper function which returns a channel that will - // receive the result of a call to Last, the method under test. - getLastValues := func() chan []int { - lastValuesCh := make(chan []int, 1) - go func() { - // Last should block until lastN values have been published. - // NOTE: this will produce a warning log which can safely be ignored: - // > WARN: requested replay buffer size 3 is greater than replay buffer - // > capacity 3; returning entire replay buffer - lastValuesCh <- replayObsvbl.Last(ctx, lastN) - }() - return lastValuesCh - } - - // Ensure that last blocks when the replay buffer is empty - select { - case actualValues := <-getLastValues(): - t.Fatalf( - "Last should block until at lest 1 value has been published; actualValues: %v", - actualValues, - ) - case <-time.After(10 * time.Millisecond): - } - - // Publish some values (up to splitIdx). - for _, value := range values[:splitIdx] { - publishCh <- value - time.Sleep(time.Millisecond) - } - - // Ensure Last works as expected when n <= len(published_values). - require.ElementsMatch(t, []int{1}, replayObsvbl.Last(ctx, 1)) - require.ElementsMatch(t, []int{1, 2}, replayObsvbl.Last(ctx, 2)) - require.ElementsMatch(t, []int{1, 2, 3}, replayObsvbl.Last(ctx, 3)) - - // Ensure that Last blocks when n > len(published_values) and the replay - // buffer is not full. - select { - case actualValues := <-getLastValues(): - t.Fatalf( - "Last should block until replayPartialBufferTimeout has elapsed; received values: %v", - actualValues, - ) - default: - t.Log("OK: Last is blocking, as expected") - } - - // Ensure that Last returns the correct values when n > len(published_values) - // and the replay buffer is not full. - select { - case actualValues := <-getLastValues(): - require.ElementsMatch(t, values[:splitIdx], actualValues) - case <-time.After(250 * time.Millisecond): - t.Fatal("timed out waiting for Last to return") - } - - // Publish the rest of the values (from splitIdx on). - for _, value := range values[splitIdx:] { - publishCh <- value - time.Sleep(time.Millisecond) - } - - // Ensure that Last doesn't block when n = len(published_values) and the - // replay buffer is full. - select { - case actualValues := <-getLastValues(): - require.Len(t, actualValues, lastN) - require.ElementsMatch(t, values, actualValues) - case <-time.After(50 * time.Millisecond): - t.Fatal("timed out waiting for Last to return") - } - - // Ensure that Last still works as expected when n <= len(published_values). - require.ElementsMatch(t, []int{1}, replayObsvbl.Last(ctx, 1)) - require.ElementsMatch(t, []int{1, 2}, replayObsvbl.Last(ctx, 2)) - require.ElementsMatch(t, []int{1, 2, 3}, replayObsvbl.Last(ctx, 3)) - require.ElementsMatch(t, []int{1, 2, 3, 4}, replayObsvbl.Last(ctx, 4)) - require.ElementsMatch(t, []int{1, 2, 3, 4, 5}, replayObsvbl.Last(ctx, 5)) -} diff --git a/pkg/observable/errors.go b/pkg/observable/errors.go deleted file mode 100644 index c34f2f7d6..000000000 --- a/pkg/observable/errors.go +++ /dev/null @@ -1,8 +0,0 @@ -package observable - -import errorsmod "cosmossdk.io/errors" - -var ( - ErrObserverClosed = errorsmod.Register(codespace, 1, "observer is closed") - codespace = "observable" -) diff --git a/pkg/observable/filter/either.go b/pkg/observable/filter/either.go deleted file mode 100644 index 86e3d57ab..000000000 --- a/pkg/observable/filter/either.go +++ /dev/null @@ -1,62 +0,0 @@ -package filter - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" -) - -// EitherError operates on an observable of an either type. It filters for all -// eithers which are not populated with errors, and maps them to their errors -// (publishes errors to the resulting observable). -func EitherError[T any]( - ctx context.Context, - eitherObservable observable.Observable[either.Either[T]], -) observable.Observable[error] { - return channel.Map( - ctx, - eitherObservable, - mapEitherError[T], - ) -} - -// EitherSuccess operates on an observable of an either type. It filters for all -// eithers which are not populated with values, and maps them to their values -// (publishes values to the resulting observable). -func EitherSuccess[T any]( - ctx context.Context, - eitherObservable observable.Observable[either.Either[T]], -) observable.Observable[T] { - return channel.Map( - ctx, - eitherObservable, - mapEitherSuccess[T], - ) -} - -// mapEitherError is a MapFn that maps an either to its error. It skips the -// notification if the either is populated with a value. -func mapEitherError[T any]( - _ context.Context, - inputEither either.Either[T], -) (_ error, skip bool) { - if _, err := inputEither.ValueOrError(); err != nil { - return err, false - } - return nil, true -} - -// mapEitherSuccess is a MapFn that maps an either to its value. It skips the -// notification if the either is populated with an error. -func mapEitherSuccess[T any]( - _ context.Context, - inputEither either.Either[T], -) (_ T, skip bool) { - value, err := inputEither.ValueOrError() - if err != nil { - return value, true - } - return value, false -} diff --git a/pkg/observable/interface.go b/pkg/observable/interface.go deleted file mode 100644 index d86da414f..000000000 --- a/pkg/observable/interface.go +++ /dev/null @@ -1,41 +0,0 @@ -package observable - -import "context" - -// NOTE: We explicitly decided to write a small and custom notifications package -// to keep logic simple and minimal. If the needs & requirements of this library ever -// grow, other packages (e.g. https://github.com/ReactiveX/RxGo) can be considered. -// (see: https://github.com/ReactiveX/RxGo/pull/377) - -// ReplayObservable is an observable which replays the last n values published -// to new observers, before publishing new values to observers. -type ReplayObservable[V any] interface { - Observable[V] - // Last synchronously returns the last n values from the replay buffer. - Last(ctx context.Context, n int) []V -} - -// Observable is a generic interface that allows multiple subscribers to be -// notified of new values asynchronously. -// It is analogous to a publisher in a "Fan-Out" system design. -type Observable[V any] interface { - // Subscribe returns an observer which is notified when the publishCh channel - // receives a value. - Subscribe(context.Context) Observer[V] - // UnsubscribeAll unsubscribes and removes all observers from the observable. - UnsubscribeAll() -} - -// Observer is a generic interface that provides access to the notified -// channel and allows unsubscribing from an Observable. -// It is analogous to a subscriber in a "Fan-Out" system design. -type Observer[V any] interface { - // Unsubscribe closes the subscription channel and removes the subscription from - // the observable. - Unsubscribe() - // Ch returns a receive-only subscription channel. - Ch() <-chan V - // IsClosed returns true if the observer has been unsubscribed. - // A closed observer cannot be reused. - IsClosed() bool -} diff --git a/pkg/observable/logging/logging.go b/pkg/observable/logging/logging.go deleted file mode 100644 index 97f7e6c1b..000000000 --- a/pkg/observable/logging/logging.go +++ /dev/null @@ -1,22 +0,0 @@ -package logging - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// LogErrors operates on an observable of errors. It logs all errors received -// from the observable. -func LogErrors(ctx context.Context, errs observable.Observable[error]) { - channel.ForEach(ctx, errs, forEachErrorLogError) -} - -// forEachErrorLogError is a ForEachFn that logs the given error. -func forEachErrorLogError(ctx context.Context, err error) { - logger := polylog.Ctx(ctx) - // Logging the error and flushing (i.e. sending) the log message to stdout - logger.Error().Err(err).Send() -} diff --git a/pkg/observable/types.go b/pkg/observable/types.go deleted file mode 100644 index 04df98201..000000000 --- a/pkg/observable/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package observable - -type ( - Error = Observable[error] -) diff --git a/pkg/partials/errors.go b/pkg/partials/errors.go deleted file mode 100644 index 8f3d84885..000000000 --- a/pkg/partials/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package partials - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "partial" - ErrPartialInvalidPayload = sdkerrors.Register(codespace, 1, "invalid partial payload") - ErrPartialUnrecognisedRequestFormat = sdkerrors.Register(codespace, 2, "unrecognised request format in partial payload") -) diff --git a/pkg/partials/interface.go b/pkg/partials/interface.go deleted file mode 100644 index 6a014ad98..000000000 --- a/pkg/partials/interface.go +++ /dev/null @@ -1,32 +0,0 @@ -package partials - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/partials/payloads" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var ( - _ PartialPayload = (*payloads.PartialJSONPayload)(nil) - _ PartialPayload = (*payloads.PartialRESTPayload)(nil) -) - -// PartialPayload defines an interface for partial RPC payloads that enables the -// transparent relaying of RPC requests from applications to suppliers. In order -// for this to occur we must be able to infer its format. This requires the RPC -// payload to be partially decoded, extracting the required fields, currently -// limited for the purpose of determine the RPC type, compute units and error -// generation, but may be used for other logic in the future -type PartialPayload interface { - // GetRPCType returns the request type for the given payload. - GetRPCType() sharedtypes.RPCType - // GenerateErrorPayload creates an error message from the provided error - // compatible with the protocol of this RPC type. - GenerateErrorPayload(err error) ([]byte, error) - // GetRPCComputeUnits returns the compute units for the RPC request - GetRPCComputeUnits(ctx context.Context) (uint64, error) - // ValidateBasic ensures that all the required fields are set in the partial - // payload. - ValidateBasic(ctx context.Context) error -} diff --git a/pkg/partials/partial.go b/pkg/partials/partial.go deleted file mode 100644 index 1e699c1b4..000000000 --- a/pkg/partials/partial.go +++ /dev/null @@ -1,71 +0,0 @@ -package partials - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/partials/payloads" - "github.com/pokt-network/poktroll/pkg/polylog" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// GetRequestType returns the request type for the given payload. -func GetRequestType(ctx context.Context, payloadBz []byte) (sharedtypes.RPCType, error) { - partialRequest, err := PartiallyUnmarshalRequest(ctx, payloadBz) - if err != nil { - return sharedtypes.RPCType_UNKNOWN_RPC, err - } - // if the request has missing fields return an error detailing which fields - // are missing as they are required - if err := partialRequest.ValidateBasic(ctx); err != nil { - return partialRequest.GetRPCType(), - ErrPartialInvalidPayload.Wrapf("payload: %s [%v]", string(payloadBz), err) - } - return partialRequest.GetRPCType(), nil -} - -// GetErrorReply returns an error reply for the given payload and error, -// in the correct format required by the request type. -func GetErrorReply(ctx context.Context, payloadBz []byte, err error) ([]byte, error) { - partialRequest, er := PartiallyUnmarshalRequest(ctx, payloadBz) - if er != nil { - return nil, er - } - return partialRequest.GenerateErrorPayload(err) -} - -// GetComputeUnits returns the compute units for the RPC request provided -func GetComputeUnits(ctx context.Context, payloadBz []byte) (uint64, error) { - partialRequest, err := PartiallyUnmarshalRequest(ctx, payloadBz) - if err != nil { - return 0, err - } - // if the request has missing fields return an error detailing - // which fields are missing - if err := partialRequest.ValidateBasic(ctx); err != nil { - return 0, ErrPartialInvalidPayload.Wrapf("payload: %s [%v]", string(payloadBz), err) - } - return partialRequest.GetRPCComputeUnits(ctx) -} - -// TODO_BLOCKER(@h5law): This function currently only supports JSON-RPC and must -// be extended to other request types. -// PartiallyUnmarshalRequest unmarshals the payload into a partial request -// that contains only the fields necessary to generate an error response and -// handle accounting for the request's method. -func PartiallyUnmarshalRequest(ctx context.Context, payloadBz []byte) (PartialPayload, error) { - logger := polylog.Ctx(ctx) - logger.Debug(). - Str("payload", string(payloadBz)). - Msg("partially Unmarshalling request") - // First attempt to unmarshal the payload into a partial JSON-RPC request - - jsonPayload, err := payloads.PartiallyUnmarshalJSONPayload(payloadBz) - if err != nil { - return nil, ErrPartialInvalidPayload.Wrapf("json payload: %s [%v]", string(payloadBz), err) - } - if jsonPayload != nil { - return jsonPayload, nil - } - // TODO(@h5law): Handle other request types - return nil, ErrPartialUnrecognisedRequestFormat.Wrapf("got: %s", string(payloadBz)) -} diff --git a/pkg/partials/partials_test.go b/pkg/partials/partials_test.go deleted file mode 100644 index 84c749b2a..000000000 --- a/pkg/partials/partials_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package partials - -import ( - "context" - "encoding/json" - "errors" - "testing" - - sdkerror "cosmossdk.io/errors" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/testutil/testpolylog" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// TODO(@h5law): Expand coverage with more test cases when more request types -// are implemented in the partials package. -func TestPartials_GetErrorReply(t *testing.T) { - _, logCtx := testpolylog.NewLoggerWithCtx( - context.Background(), - polyzero.DebugLevel, - ) - - tests := []struct { - name string - err error - payload []byte - expectedReply []byte - expectedErr *sdkerror.Error - }{ - { - name: "valid json - properly formatted payload", - err: errors.New("test error"), - payload: []byte( - `{"id":1,"jsonrpc":"2.0","method":"eth_getBlockNumber","params":{"these":"are","ignored":0}}`, - ), - expectedReply: []byte( - `{"id":1,"jsonrpc":"2.0","error":{"code":-32000,"data":null,"message":"test error"}}`, - ), - expectedErr: nil, - }, - { - name: "invalid json - unrecognised payload", - err: errors.New("test error"), - payload: []byte(`{"invalid": "payload"}`), - expectedReply: nil, - expectedErr: ErrPartialUnrecognisedRequestFormat, - }, - { - name: "invalid - unrecognised payload", - err: errors.New("test error"), - payload: []byte("invalid payload"), - expectedReply: nil, - expectedErr: ErrPartialUnrecognisedRequestFormat, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - // Generate the error reply - replyBz, err := GetErrorReply(logCtx, test.payload, test.err) - if test.expectedErr != nil { - require.ErrorIs(t, err, test.expectedErr) - return - } - require.NoError(t, err) - // Unmarshal the payload to test reply equality - partialReq, err := PartiallyUnmarshalRequest(logCtx, test.payload) - require.NoError(t, err) - require.NotNil(t, partialReq) - switch partialReq.GetRPCType() { - case sharedtypes.RPCType_JSON_RPC: - reply := make(map[string]any) - err = json.Unmarshal(replyBz, &reply) - require.NoError(t, err) - expectedReply := make(map[string]any) - err = json.Unmarshal(test.expectedReply, &expectedReply) - require.NoError(t, err) - for k, v := range expectedReply { - require.Equal(t, v, reply[k]) - } - require.Equal(t, len(reply), len(expectedReply)) - } - }) - } -} diff --git a/pkg/partials/payloads/godoc.go b/pkg/partials/payloads/godoc.go deleted file mode 100644 index fe74c19a4..000000000 --- a/pkg/partials/payloads/godoc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Package payloads contains the different types of RPC payloads the partials -// package supports. The structs defined here are used to partially unmarshal -// the payload and extract the minimal fields required to: generate error -// responses, retrieve RPC request type, determine request compute units, etc... -// This is done through partially unmarshalling the payload into the minimum -// required set of pre-defined fields that need to be explicitly determined for -// each RPC type supported. -package payloads diff --git a/pkg/partials/payloads/jsonrpc.go b/pkg/partials/payloads/jsonrpc.go deleted file mode 100644 index 284a6f40c..000000000 --- a/pkg/partials/payloads/jsonrpc.go +++ /dev/null @@ -1,82 +0,0 @@ -package payloads - -import ( - "context" - "encoding/json" - "errors" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/x/shared/types" -) - -// PartialJSONPayload is a partial representation of a JSON-RPC request payload -// that contains the minimal fields necessary for basic business logic such as -// generating an error response, handling request account, etc... -type PartialJSONPayload struct { - Id uint64 `json:"id"` - JsonRPC string `json:"jsonrpc"` - Method string `json:"method"` -} - -// ValidateBasic ensures that all the required fields are set in the partial -// JSON payload. -// It uses a non-pointer receiver to ensure the default values of unset fields -// are present -func (j PartialJSONPayload) ValidateBasic(ctx context.Context) error { - logger := polylog.Ctx(ctx) - - var err error - if j.Id == 0 { - err = errors.Join(err, errors.New("id field is zero")) - } - if j.JsonRPC == "" { - err = errors.Join(err, errors.New("jsonrpc version field is empty")) - } - if j.Method == "" { - err = errors.Join(err, errors.New("method field is empty")) - } - logger.Debug().Err(err).Msg("Validating basic JSON payload") - return err -} - -// PartiallyUnmarshalJSONPayload receives a serialized payload and attempts to -// unmarshal it into the PartialJSONPayload struct. If successful this struct -// is returned, if however the struct does not contain all the required fields -// an error is returned detailing what was missing. -// If the payload is not a JSON request this function will return nil, nil -func PartiallyUnmarshalJSONPayload(payloadBz []byte) (*PartialJSONPayload, error) { - var jsonPayload PartialJSONPayload - err := json.Unmarshal(payloadBz, &jsonPayload) - // Check if we can unmarshal if we cannot return nil, nil - if err != nil || jsonPayload == (PartialJSONPayload{}) { - return nil, nil - } - // return the partial json request - return &jsonPayload, nil -} - -// GetRPCType returns the request type for the given payload. -func (j *PartialJSONPayload) GetRPCType() types.RPCType { - return types.RPCType_JSON_RPC -} - -// GenerateErrorPayload creates a JSON-RPC error payload from the provided -// error with the macthing json-rpc and id fields from the request payload. -func (j *PartialJSONPayload) GenerateErrorPayload(err error) ([]byte, error) { - reply := map[string]any{ - "jsonrpc": j.JsonRPC, - "id": j.Id, - "error": map[string]any{ - "code": -32000, - "message": err.Error(), - "data": nil, - }, - } - return json.Marshal(reply) -} - -// GetRPCComputeUnits returns the compute units for the RPC request -func (j *PartialJSONPayload) GetRPCComputeUnits(ctx context.Context) (uint64, error) { - // TODO(@h5law): Implement this method - return 0, nil -} diff --git a/pkg/partials/payloads/rest.go b/pkg/partials/payloads/rest.go deleted file mode 100644 index 273139280..000000000 --- a/pkg/partials/payloads/rest.go +++ /dev/null @@ -1,51 +0,0 @@ -package payloads - -import ( - "context" - - "github.com/pokt-network/poktroll/x/shared/types" -) - -// PartialRESTPayload is a partial representation of a REST request payload -// that contains the minimal fields necessary for basic business logic such as -// generating an error response, handling request account, etc... -type PartialRESTPayload struct { - Headers map[string]string `json:"headers"` -} - -// PartiallyUnmarshalRESTPayload receives a serialized payload and attempts to -// unmarshal it into the PartialRESTPayload struct. If successful this struct -// is returned, if however the struct does not contain all the required fields -// the success return value is false and a nil payload is returned. -func PartiallyUnmarshalRESTPayload(payloadBz []byte) (restPayload *PartialRESTPayload, success bool) { - // TODO(@h5law): Implement this function - return nil, false -} - -// ValidateBasic ensures that all the required fields are set in the partial -// REST payload. -// It uses a non-pointer receiver to ensure the default values of unset fields -// are present -func (r PartialRESTPayload) ValidateBasic(ctx context.Context) error { - // TODO(@h5law): Implement this function - var err error - return err -} - -// GetRPCType returns the request type for the given payload. -func (r *PartialRESTPayload) GetRPCType() types.RPCType { - return types.RPCType_REST -} - -// GenerateErrorPayload creates a REST error payload using the headers from the -// request payload. -func (r *PartialRESTPayload) GenerateErrorPayload(err error) ([]byte, error) { - // TODO(@h5law): Implement this method - return nil, nil -} - -// GetRPCComputeUnits returns the compute units for the RPC request -func (r *PartialRESTPayload) GetRPCComputeUnits(ctx context.Context) (uint64, error) { - // TODO(@h5law): Implement this method - return 0, nil -} diff --git a/pkg/polylog/LICENSE b/pkg/polylog/LICENSE deleted file mode 100644 index 3914913fc..000000000 --- a/pkg/polylog/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -The `Logger` and `Event` interfaces follow the `zerolog` package's API 1:1 -(possibly partially) to make zerolog implementation/integration become the -thinnest wrapper possible. - -This is the API intended for all off-chain (i.e. under `/pkg`) logging. - -The following is the MIT LICENSE from `zerolog` package at the time of writing: -(see: https://github.com/rs/zerolog) - ---- - -MIT License - -Copyright (c) 2017 Olivier Poitrey - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/pkg/polylog/context.go b/pkg/polylog/context.go deleted file mode 100644 index 0e6904b64..000000000 --- a/pkg/polylog/context.go +++ /dev/null @@ -1,39 +0,0 @@ -package polylog - -import "context" - -// CtxKey is the key used to store the polylog.Logger in a context.Context. This -// is **independant** of any logger-implementation-specific context key that may -// be used internal to any of the logger implementations. Polylog attempts to -// provide a ubiquitous interface for storing and retrieving loggers from the -// context but also to integrate with the underlying logger implementations as -// seamlessly as possible. -const CtxKey = "polylog/context" - -// DefaultContextLogger is the default logger implementation used when no logger -// is associated with a context. It is assigned in the implementation package's -// init() function to avoid potentially creating import cycles. -// The default logger implementation is zerolog (i.e. pkg/polylog/polyzero). -// -// IMPORTANT: In order for the default to be populated, the polyzero package MUST -// be part of the build. Otherwise, the polyzero package's init function will -// neither be included in the build nor executed. If no such import exists, the -// polyzero package can be imported for side effects only, e.g.: -// -// import _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -var DefaultContextLogger Logger - -// Ctx returns the Logger associated with the ctx. If no logger is associated, -// DefaultContextLogger is returned, unless DefaultContextLogger is nil, in which -// case a disabled logger is returned. -// -// To get a context which is associated a given logger, call the respective logger's -// #WithContext() method. Then this function can be used to retrieve it from that -// (or a context derived from that) context, later and elsewhere. -func Ctx(ctx context.Context) Logger { - logger, ok := ctx.Value(CtxKey).(Logger) - if !ok { - return DefaultContextLogger - } - return logger -} diff --git a/pkg/polylog/context_example_test.go b/pkg/polylog/context_example_test.go deleted file mode 100644 index 11f979ae4..000000000 --- a/pkg/polylog/context_example_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package polylog_test - -import ( - "context" - "os" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func ExampleCtx() { - // Use whichever zerolog level you need. - level := zerolog.InfoLevel - - // Specify the lowest level to log. I.e.: calls to level methods "lower" - // than this will be ignored. - levelOpt := polyzero.WithLevel(level) - - // Construct a context, this is typically received as an argument. - ctx := context.Background() - - // Construct expectedLogger. - // NB: adding WithOutput is optional; defaults to os.Stderr. It is needed - // here to print to stdout for testable example purposes. - expectedLogger := polyzero.NewLogger(levelOpt, polyzero.WithOutput(os.Stdout)) - - // Add fields to the expectedLogger's context so that we can identify it in the output. - expectedLogger = expectedLogger.With("label", "my_test_logger") - - // Associate the expectedLogger with the context and update the context reference. - ctx = expectedLogger.WithContext(ctx) - - // Retrieve the logger from the context. - retrievedLogger := polylog.Ctx(ctx) - - // Log and check that the output matches our expectations. - retrievedLogger.Info().Msg("info message") - - // Output: - // {"level":"info","label":"my_test_logger","message":"info message"} -} diff --git a/pkg/polylog/context_test.go b/pkg/polylog/context_test.go deleted file mode 100644 index d37201249..000000000 --- a/pkg/polylog/context_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package polylog_test - -import ( - "context" - "testing" - - "github.com/rs/zerolog" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func TestWithContext_Ctx(t *testing.T) { - var ( - expectedLogger = polyzero.NewLogger() - ctx = context.Background() - ) - - // Ensure that no logger is associated with the context. - existingLogger, ok := ctx.Value(polylog.CtxKey).(polylog.Logger) - require.False(t, ok) - require.Nil(t, existingLogger) - - // Retrieve the default logger from the context using polylog and assert - // that it matches the default context logger. - defaultLogger := polylog.Ctx(ctx) - require.Equal(t, polylog.DefaultContextLogger, defaultLogger) - - // Associate a logger with a context. - ctx = expectedLogger.WithContext(ctx) - - // Retrieve the associated logger from the context using polylog and assert - // that it matches the one constructed at the beginning of the test. - actualLogger := polylog.Ctx(ctx) - require.Equal(t, expectedLogger, actualLogger) - - // Retrieve the associated logger from the context using zerolog and assert - // that it matches the one constructed at the beginning of the test. - actualZerologLogger := zerolog.Ctx(ctx) - expectedZerologLogger := polyzero.GetZerologLogger(expectedLogger) - require.Equal(t, expectedZerologLogger, actualZerologLogger) -} diff --git a/pkg/polylog/godoc.go b/pkg/polylog/godoc.go deleted file mode 100644 index e3f759007..000000000 --- a/pkg/polylog/godoc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Package polylog provides a ubiquitous logging interface which is derived from -// github.com/rs/zerolog, and as a result, also highly compatibly with other -// common, industry-standard logging libraries. This API mirrors that of zerolog -// but exists as a distinct layer of abstraction, and an extremely thin wrapper -// around the underlying logging library; especially in the case of the zerolog -// implementation. This distinction is intended to allow for evolution of the needs -// of this packages consumers as well as any future ambitions to (and implications -// thereof) adding support for adapting to additional logging libraries. -// -// It is intended to initially support the go std `log`, `github.com/rs/zerolog` and `go.uber.org/zap` logging libraries: -// -// - https://pkg.go.dev/log@go1.21.4 -// -// - https://github.com/rs/zerolog -// -// - https://github.com/uber-go/zap -package polylog diff --git a/pkg/polylog/interface.go b/pkg/polylog/interface.go deleted file mode 100644 index b4ef28457..000000000 --- a/pkg/polylog/interface.go +++ /dev/null @@ -1,193 +0,0 @@ -package polylog - -import ( - "context" - "time" -) - -// TODO_CONSIDERATION: this may be a good candidate package for extraction to -// its own module. - -// TODO_INVESTIGATE: check whether the pkg dependency tree includes all logging -// libraries. - -// Level is the minimal interface required to express and convert between log levels -// of the underlying logging libraries. -type Level interface { - // String returns the string representation of the underlying Level. - String() string - // Int returns the int representation of the underlying Level. Level types are - // typically defined as enums of a concrete type that implement #String(). - Int() int -} - -// Logger is an interface that exposes methods for each supported log level, each -// of which returns an Event. -type Logger interface { - // Debug starts a new log message (event) with debug level. - // - // You must call Msg on the returned event in order to send the event. - Debug() Event - - // Info starts a new log message (event) with info level. - // - // You must call Msg on the returned event in order to send the event. - Info() Event - - // Warn starts a new log message (event) with warn level. - // - // You must call Msg on the returned event in order to send the event. - Warn() Event - - // Error starts a new log message (event) with error level. - // - // You must call Msg on the returned event in order to send the event. - Error() Event - - // With creates a child logger with the fields constructed from keyVals added - // to its context. - With(keyVals ...any) Logger - - // WithContext returns a copy of ctx with the receiver attached. The Logger - // attached to the provided Context (if any) will not be effected. If the - // receiver's log level is Disabled it will only be attached to the returned - // Context if the provided Context has a previously attached Logger. If the - // provided Context has no attached Logger, a Disabled Logger will not be - // attached. - // - // TODO_IMPROVE/TODO_COMMUNITY: support #UpdateContext() and update this - // godoc to include #UpdateContext() usage example. - // See: https://pkg.go.dev/github.com/rs/zerolog#Logger.UpdateContext. - WithContext(ctx context.Context) context.Context - - // WithLevel starts a new message (event) with level. - // - // You must call Msg on the returned event in order to send the event. - WithLevel(level Level) Event - - // Write implements the io.Writer interface. This is useful to set as a writer - // for the standard library log. - Write(p []byte) (n int, err error) -} - -// Event represents a log event. It is instanced by one of the level methods of -// Logger and finalized by the Msg, Msgf, or Send methods. It exposes methods for -// adding fields to the event which will be rendered in an encoding-appropriate -// way in the log output. -// -// TODO_IMPROVE/TODO_COMMUNITY: support #Dict(), #Stack(), #Any() type methods. -// See: https://pkg.go.dev/github.com/rs/zerolog#Event -// -// TODO_IMPROVE/TODO_COMMUNITY: support #Ctx() and #GetCtx() methods. -// See: https://pkg.go.dev/github.com/rs/zerolog#Event.Ctx and -// https://pkg.go.dev/github.com/rs/zerolog#Event.Ctx. -type Event interface { - // Str adds the field key with value as a string to the Event context. - Str(key, value string) Event - - // Bool adds the field key with value as a bool to the Event context. - Bool(key string, value bool) Event - - // Int adds the field key with value as an int to the Event context. - Int(key string, value int) Event - - // Int8 adds the field key with value as an int8 to the Event context. - Int8(key string, value int8) Event - - // Int16 adds the field key with value as an int16 to the Event context. - Int16(key string, value int16) Event - - // Int32 adds the field key with value as an int32 to the Event context. - Int32(key string, value int32) Event - - // Int64 adds the field key with value as an int64 to the Event context. - Int64(key string, value int64) Event - - // Uint adds the field key with value as a uint to the Event context. - Uint(key string, value uint) Event - - // Uint8 adds the field key with value as a uint8 to the Event context. - Uint8(key string, value uint8) Event - - // Uint16 adds the field key with value as a uint16 to the Event context. - Uint16(key string, value uint16) Event - - // Uint32 adds the field key with value as a uint32 to the Event context. - Uint32(key string, value uint32) Event - - // Uint64 adds the field key with value as a uint64 to the Event context. - Uint64(key string, value uint64) Event - - // Float32 adds the field key with value as a float32 to the Event context. - Float32(key string, value float32) Event - - // Float64 adds the field key with value as a float64 to the Event context. - Float64(key string, value float64) Event - - // Err adds the field "error" with serialized err to the Event context. - // If err is nil, no field is added. - // - // TODO_TEST: ensure implementation tests cover this: do not add a field - // if err is nil. - // - // To customize the key name, use the appropriate option from the respective - // package when constructing a logger. - // - // TODO_UPNEXT(@bryanchriswhite): ensure implementations' godoc examples cover - // options. - Err(err error) Event - - // Timestamp adds the current local time as UNIX timestamp to the Event context - // with the "time" key. To customize the key name, use the appropriate option - // from the respective package when constructing a Logger. - // - // TODO_UPNEXT(@bryanchriswhite): ensure implementations' godoc examples cover - // options. - // - // NOTE: It won't dedupe the "time" key if the Event (or *Context) has one - // already. - Timestamp() Event - - // Time adds the field key with value formatted as string using a configurable, - // implementation-specific format. - // - // To customize the time format, use the appropriate option from the respective - // package when constructing a Logger. - Time(key string, value time.Time) Event - - // Dur adds the field key with duration with a configurable, - // implementation-specific value format. - Dur(key string, value time.Duration) Event - - // Fields is a helper function to use a map or slice to set fields using type assertion. - // Only map[string]interface{} and []interface{} are accepted. []interface{} must - // alternate string keys and arbitrary values, and extraneous ones are ignored. - Fields(fields any) Event - - // Func allows an anonymous func to run only if the event is enabled. - Func(func(Event)) Event - - // Enabled return false if the Event is going to be filtered out by - // log level or sampling. - Enabled() bool - - // Discard disables the event so Msg(f)/Send won't print it. - Discard() Event - - // Msg sends the Event with msg added as the message field if not empty. - // - // NOTICE: once this method is called, the Event should be disposed. - // Calling Msg twice can have unexpected result. - Msg(message string) - - // Msgf sends the event with formatted msg added as the message field if not empty. - // - // NOTICE: once this method is called, the Event should be disposed. - // Calling Msgf twice can have unexpected result. - Msgf(format string, keyVals ...interface{}) - - // Send is equivalent to calling Msg(""). - // - // NOTICE: once this method is called, the Event should be disposed. - Send() -} diff --git a/pkg/polylog/polyzero/default.go b/pkg/polylog/polyzero/default.go deleted file mode 100644 index 905cf7c2c..000000000 --- a/pkg/polylog/polyzero/default.go +++ /dev/null @@ -1,15 +0,0 @@ -package polyzero - -import "github.com/pokt-network/poktroll/pkg/polylog" - -func init() { - // Set the default logger to a polyzero logger. This is the logger which will - // be returned when calling polylog.Ctx() with a context which has no logger - // associated. - // - // This is assigned here to avoid an import cycle. Note that dependency init - // functions are called before dependents. It is therefore safe to override - // this default logger assignment in polylog consumer code, including in - // consumer package init functions. - polylog.DefaultContextLogger = NewLogger() -} diff --git a/pkg/polylog/polyzero/event.go b/pkg/polylog/polyzero/event.go deleted file mode 100644 index 58a78df8a..000000000 --- a/pkg/polylog/polyzero/event.go +++ /dev/null @@ -1,205 +0,0 @@ -package polyzero - -import ( - "time" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -var _ polylog.Event = (*zerologEvent)(nil) - -// zerologEvent is a thin wrapper around a zerolog event. -type zerologEvent struct { - event *zerolog.Event -} - -// Str adds the field key with value as a string to the Event context. -func (zle *zerologEvent) Str(key, value string) polylog.Event { - zle.event.Str(key, value) - return zle -} - -// Bool adds the field key with value as a bool to the Event context. -func (zle *zerologEvent) Bool(key string, value bool) polylog.Event { - zle.event.Bool(key, value) - return zle -} - -// Int adds the field key with value as an int to the Event context. -func (zle *zerologEvent) Int(key string, value int) polylog.Event { - zle.event.Int(key, value) - return zle -} - -// Int8 adds the field key with value as an int8 to the Event context. -func (zle *zerologEvent) Int8(key string, value int8) polylog.Event { - zle.event.Int8(key, value) - return zle -} - -// Int16 adds the field key with value as an int16 to the Event context. -func (zle *zerologEvent) Int16(key string, value int16) polylog.Event { - zle.event.Int16(key, value) - return zle -} - -// Int32 adds the field key with value as an int32 to the Event context. -func (zle *zerologEvent) Int32(key string, value int32) polylog.Event { - zle.event.Int32(key, value) - return zle -} - -// Int64 adds the field key with value as an int64 to the Event context. -func (zle *zerologEvent) Int64(key string, value int64) polylog.Event { - zle.event.Int64(key, value) - return zle -} - -// Uint adds the field key with value as an uint to the Event context. -func (zle *zerologEvent) Uint(key string, value uint) polylog.Event { - zle.event.Uint(key, value) - return zle -} - -// Uint8 adds the field key with value as an uint8 to the Event context. -func (zle *zerologEvent) Uint8(key string, value uint8) polylog.Event { - zle.event.Uint8(key, value) - return zle -} - -// Uint16 adds the field key with value as an uint16 to the Event context. -func (zle *zerologEvent) Uint16(key string, value uint16) polylog.Event { - zle.event.Uint16(key, value) - return zle -} - -// Uint32 adds the field key with value as an uint32 to the Event context. -func (zle *zerologEvent) Uint32(key string, value uint32) polylog.Event { - zle.event.Uint32(key, value) - return zle -} - -// Uint64 adds the field key with value as an uint64 to the Event context. -func (zle *zerologEvent) Uint64(key string, value uint64) polylog.Event { - zle.event.Uint64(key, value) - return zle -} - -// Float32 adds the field key with value as a float32 to the Event context. -func (zle *zerologEvent) Float32(key string, value float32) polylog.Event { - zle.event.Float32(key, value) - return zle -} - -// Float64 adds the field key with value as a float64 to the Event context. -func (zle *zerologEvent) Float64(key string, value float64) polylog.Event { - zle.event.Float64(key, value) - return zle -} - -// Err adds the field "error" with serialized err to the Event context. -// If err is nil, no field is added. -// -// To customize the key name, change zerolog.ErrorFieldName. This can be done -// directly or by using the WithErrKey() option when constructing the logger. -// -// If Stack() has been called before and zerolog.ErrorStackMarshaler is defined, -// the err is passed to ErrorStackMarshaler and the result is appended to the -// zerolog.ErrorStackFieldName. -func (zle *zerologEvent) Err(err error) polylog.Event { - zle.event.Err(err) - return zle -} - -// Timestamp adds the current local time as UNIX timestamp to the Event context -// with the "time" key. -// To customize the key name, change zerolog.TimestampFieldName. This can be done directly or via -// the WithTimestampKey() option when constructing the logger. -// -// NOTE: It won't dedupe the "time" key if the Event (or *Context) has one -// already. -func (zle *zerologEvent) Timestamp() polylog.Event { - zle.event.Timestamp() - return zle -} - -// Time adds the field key with value formatted as string using zerolog.TimeFieldFormat. -func (zle *zerologEvent) Time(key string, value time.Time) polylog.Event { - zle.event.Time(key, value) - return zle -} - -// Dur adds the field key with duration value stored as zerolog.DurationFieldUnit. -// If zerolog.DurationFieldInteger is true, durations are rendered as integer -// instead of float. -func (zle *zerologEvent) Dur(key string, value time.Duration) polylog.Event { - zle.event.Dur(key, value) - return zle -} - -// Func allows an anonymous func to run only if the event is enabled. -func (zle *zerologEvent) Func(fn func(polylog.Event)) polylog.Event { - // NB: no need to call #Enabled() here because the underlying zerolog.Event - // will do that for us. - if zle.Enabled() { - zle.event.Func( - func(event *zerolog.Event) { - fn(newEvent(event)) - }, - ) - } - return zle -} - -// Fields is a helper function to use a map or slice to set fields using type -// assertion. Only map[string]any and []any are accepted. any must alternate -// string keys and arbitrary values, and extraneous ones are ignored. -func (zle *zerologEvent) Fields(fields any) polylog.Event { - zle.event.Fields(fields) - return zle -} - -// Enabled return false if the Event is going to be filtered out by -// log level or sampling. -func (zle *zerologEvent) Enabled() bool { - return zle.event.Enabled() -} - -// Discard disables the event so Msg(f)/Send won't print it. -func (zle *zerologEvent) Discard() polylog.Event { - zle.event.Discard() - return zle -} - -// Msg sends the Event with msg added as the message field if not empty. -// -// NOTICE: once this method is called, the Event should be disposed. -// Calling Msg twice can have unexpected result. -func (zle *zerologEvent) Msg(msg string) { - zle.event.Msg(msg) -} - -// Msgf sends the event with formatted msg added as the message field if not empty. -// -// NOTICE: once this method is called, the Event should be disposed. -// Calling Msgf twice can have unexpected result. -func (zle *zerologEvent) Msgf(format string, args ...any) { - zle.event.Msgf(format, args...) -} - -// Send is equivalent to calling Msg(""). It can be thought of as a Flush. -// -// NOTICE: once this method is called, the Event should be disposed. -func (zle *zerologEvent) Send() { - zle.event.Send() -} - -// newEvent takes a zerolog event pointer and wraps it in a polylog.zerologEvent -// struct. -func newEvent(event *zerolog.Event) polylog.Event { - return &zerologEvent{ - event: event, - } -} diff --git a/pkg/polylog/polyzero/godoc.go b/pkg/polylog/polyzero/godoc.go deleted file mode 100644 index 4410dd8e9..000000000 --- a/pkg/polylog/polyzero/godoc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package polyzero provides a polylog.Logger implementation backed by zerolog. -// As the polylogger interface mirrors that of zerolog, this package is a thin -// wrapper around the zerolog package. However, it is only a partial mapping of -// the full zerolog API, and has already begun to deviate a bit to be more -// accommodating to other supported logging libraries. -// -// Use polyzero if you don't have a preference for a particular logging library -// or are already using zerolog. -package polyzero diff --git a/pkg/polylog/polyzero/levels.go b/pkg/polylog/polyzero/levels.go deleted file mode 100644 index e2880711c..000000000 --- a/pkg/polylog/polyzero/levels.go +++ /dev/null @@ -1,47 +0,0 @@ -package polyzero - -import ( - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// TODO_TECHDEBT: support a Disabled level. -const ( - // DebugLevel logs are typically voluminous, and are usually disabled in - // production. - DebugLevel = Level(iota) - // InfoLevel is the default logging priority. - InfoLevel - // WarnLevel logs are more important than Info, but don't need individual - // human review. - WarnLevel - // ErrorLevel logs are high-priority. If an application is running smoothly, - // it shouldn't generate any error-level logs. - ErrorLevel -) - -var _ polylog.Level = Level(0) - -// Level implements the polylog.Level interface for zerolog levels. -type Level int - -// Levels is a convenience function to return all supported levels. -func Levels() []Level { - return []Level{ - DebugLevel, - InfoLevel, - WarnLevel, - ErrorLevel, - } -} - -// String implements polylog.Level#String(). -func (lvl Level) String() string { - return zerolog.Level(lvl).String() -} - -// Int implements polylog.Level#Int(). -func (lvl Level) Int() int { - return int(lvl) -} diff --git a/pkg/polylog/polyzero/logger.go b/pkg/polylog/polyzero/logger.go deleted file mode 100644 index 8c908fd0f..000000000 --- a/pkg/polylog/polyzero/logger.go +++ /dev/null @@ -1,109 +0,0 @@ -package polyzero - -import ( - "context" - "os" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// zerologLogger is a thin wrapper around a zerolog logger which implements -// the polylog.Logger interface. -type zerologLogger struct { - // NB: Default (0) is Debug. - level zerolog.Level - zerolog.Logger -} - -// NewLogger constructs a new zerolog-backed logger which conforms to the -// polylog.Logger interface. By default, the logger is configured to write to -// os.Stderr and log at the Debug level. -// -// TODO_IMPROVE/TODO_COMMUNITY: Add `NewProductionLogger`, `NewDevelopmentLogger`, -// and `NewExampleLogger` functions with reasonable defaults the their respective -// environments; conceptually similar to the respective analogues in zap. -// See: https://pkg.go.dev/github.com/uber-go/zap#hdr-Configuring_Zap. -func NewLogger( - opts ...polylog.LoggerOption, -) polylog.Logger { - ze := &zerologLogger{ - level: zerolog.DebugLevel, - Logger: zerolog.New(os.Stderr), - } - - for _, opt := range opts { - opt(ze) - } - - return ze -} - -// Debug starts a new message with debug level. -// -// You must call Msg on the returned event in order to send the event. -func (ze *zerologLogger) Debug() polylog.Event { - return newEvent(ze.Logger.Debug()) -} - -// Info starts a new message with info level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) Info() polylog.Event { - return newEvent(ze.Logger.Info()) -} - -// Warn starts a new message with warn level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) Warn() polylog.Event { - return newEvent(ze.Logger.Warn()) -} - -// Error starts a new message with error level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) Error() polylog.Event { - return newEvent(ze.Logger.Error()) -} - -// With creates a child logger with the fields constructed from keyVals added -// to its context. -func (ze *zerologLogger) With(keyVals ...any) polylog.Logger { - return &zerologLogger{ - level: ze.level, - Logger: ze.Logger.With().Fields(keyVals).Logger(), - } -} - -// WithLevel starts a new message with level. -// -// You must call Msg, Msgf, or Send on the returned event in order to send the event. -func (ze *zerologLogger) WithLevel(level polylog.Level) polylog.Event { - return newEvent(ze.Logger.WithLevel(zerolog.Level(level.Int()))) -} - -// WithContext returns a copy of ctx with the receiver logger attached. -// - The Logger attached to the provided Context (if any) will not be effected. -// - If the receiver's log level is Disabled, it will only be attached to the returned -// Context if the provided Context has a previously attached Logger. -// - If the provided Context has no attached Logger, a Disabled Logger -// will not be attached. -// -// TODO_TEST/TODO_COMMUNITY: add support for #UpdateContext() and update this -// godoc to inlude example usage. -// See: https://pkg.go.dev/github.com/rs/zerolog#Logger.WithContext. -// -// TODO_TEST/TODO_COMMUNITY: add coverage for `polyzero.Logger#WithContext()`. -func (ze *zerologLogger) WithContext(ctx context.Context) context.Context { - ctx = context.WithValue(ctx, polylog.CtxKey, ze) - ctx = ze.Logger.WithContext(ctx) - return ctx -} - -// Write implements io.Writer. This is useful to set as a writer for the -// standard library log. -func (ze *zerologLogger) Write(p []byte) (n int, err error) { - return ze.Logger.Write(p) -} diff --git a/pkg/polylog/polyzero/logger_example_test.go b/pkg/polylog/polyzero/logger_example_test.go deleted file mode 100644 index 7534026d6..000000000 --- a/pkg/polylog/polyzero/logger_example_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package polyzero_test - -import ( - "os" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" -) - -func ExampleNewLogger() { - // Use whichever zerolog level you need. - level := zerolog.InfoLevel - // Specify the lowest level to log. I.e.: calls to level methods "lower" - // than this will be ignored. - levelOpt := polyzero.WithLevel(level) - - // Construct logger. - // NB: adding WithOutput is optional; defaults to os.Stderr. It is needed - // here to print to stdout for testable example purposes. - logger := polyzero.NewLogger(levelOpt, polyzero.WithOutput(os.Stdout)) - - // All level methods are always available, but will only log if the level - // is enabled. - logger.Debug().Msg("debug message - should not see me") - logger.Info().Msgf("info message with %s", "formatting") - logger.Warn().Str("warn", "message").Send() - // NB: arg type MUST be either map[string]any OR []any. - logger.Error().Fields(map[string]any{ - "error": "message", - }).Send() - - // Output: - // {"level":"info","message":"info message with formatting"} - // {"level":"warn","warn":"message"} - // {"level":"error","error":"message"} -} diff --git a/pkg/polylog/polyzero/logger_test.go b/pkg/polylog/polyzero/logger_test.go deleted file mode 100644 index c55668d41..000000000 --- a/pkg/polylog/polyzero/logger_test.go +++ /dev/null @@ -1,392 +0,0 @@ -package polyzero_test - -import ( - "bytes" - "fmt" - "testing" - "time" - - "github.com/rs/zerolog" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/testutil/testpolylog" -) - -const polyzeroEventTypeName = "*polyzero.zerologEvent" - -var ( - expectedErr = fmt.Errorf("%d", 42) - expectedTime = time.Now() - // expectedTimestampDayPrecisionLayout is a "layout" which is described using - // the "reference time", as per the time package usage convention. - // See: https://golang.org/pkg/time/#pkg-constants for more details on "layouts" and the "reference time". - // - // NB: #Timestamp() uses time.Now() internally. If the test is run around the - // rollover of a second, minute, or hour, the expected timestamp time may not - // match the actual time precisely enough. While this is still a possibility - // near the rollover of a day, this window occurs less frequently and is many - // multiples of the time it takes CI to run. - // - // TODO_CONSIDERATION: redesign the test helper to support regular expressions - // for the output expectation. - expectedTimestampDayPrecisionLayout = "2006-01-02T" - expectedTimeLayout = "2006-01-02T15:04:05-07:00" - expectedTimestampEventContains = fmt.Sprintf(`"time":"%s`, expectedTime.Format(expectedTimestampDayPrecisionLayout)) - expectedTimeEventContains = fmt.Sprintf(`"Time":"%s`, expectedTime.Format(expectedTimeLayout)) - expectedDuration = time.Millisecond + (250 * time.Nanosecond) // 1000250 - expectedDurationString = expectedDuration.String()[:len(expectedDuration.String())-2] // 1.00025 - expectedDurationEventContains = fmt.Sprintf(`"Dur":%s`, expectedDurationString) -) - -func TestZerologLogger_AllLevels_AllEventTypeMethods(t *testing.T) { - tests := []testpolylog.EventMethodTestCase{ - { - // Explicitly left empty; no event method should be called. - EventMethodName: "", - Msg: "Msg", - ExpectedOutputContains: "Msg", - }, - { - // Explicitly left empty; no event method should be called. - EventMethodName: "", - MsgFmt: "%s", - MsgFmtArgs: []any{"Msgf"}, - ExpectedOutputContains: "Msgf", - }, - { - Key: "Str", - Value: "str_value", - EventMethodName: "Str", - ExpectedOutputContains: `"Str":"str_value"`, - }, - { - Key: "Bool", - Value: true, - EventMethodName: "Bool", - ExpectedOutputContains: `"Bool":true`, - }, - { - EventMethodName: "Int", - Key: "Int", - Value: int(42), - ExpectedOutputContains: `"Int":42`, - }, - { - EventMethodName: "Int8", - Key: "Int8", - Value: int8(42), - ExpectedOutputContains: `"Int8":42`, - }, - { - EventMethodName: "Int16", - Key: "Int16", - Value: int16(42), - ExpectedOutputContains: `"Int16":42`, - }, - { - EventMethodName: "Int32", - Key: "Int32", - Value: int32(42), - ExpectedOutputContains: `"Int32":42`, - }, - { - EventMethodName: "Int64", - Key: "Int64", - Value: int64(42), - ExpectedOutputContains: `"Int64":42`, - }, - { - EventMethodName: "Uint", - Key: "Uint", - Value: uint(42), - ExpectedOutputContains: `"Uint":42`, - }, - { - EventMethodName: "Uint8", - Key: "Uint8", - Value: uint8(42), - ExpectedOutputContains: `"Uint8":42`, - }, - { - Key: "Uint16", - ExpectedOutputContains: `"Uint16":42`, - Value: uint16(42), - EventMethodName: "Uint16", - }, - { - EventMethodName: "Uint32", - Key: "Uint32", - Value: uint32(42), - ExpectedOutputContains: `"Uint32":42`, - }, - { - EventMethodName: "Uint64", - Key: "Uint64", - Value: uint64(42), - ExpectedOutputContains: `"Uint64":42`, - }, - { - EventMethodName: "Float32", - Key: "Float32", - Value: float32(420.69), - ExpectedOutputContains: `"Float32":420.69`, - }, - { - EventMethodName: "Float64", - Key: "Float64", - Value: float64(420.69), - ExpectedOutputContains: `"Float64":420.69`, - }, - { - EventMethodName: "Err", - Value: expectedErr, - ExpectedOutputContains: `"error":"42"`, - }, - { - EventMethodName: "Timestamp", - ExpectedOutputContains: expectedTimestampEventContains, - }, - // TODO_TECHDEBT: figure out why this fails in CI but not locally, - // (even with `make itest 500 10 ./pkg/polylog/... -- -run=ZeroLogger_AllLevels_AllEventTypeMethods`). - // - //{ - // EventMethodName: "Time", - // Key: "Time", - // Value: expectedTime, - // ExpectedOutputContains: expectedTimeEventContains, - //}, - { - EventMethodName: "Dur", - Key: "Dur", - Value: expectedDuration, - ExpectedOutputContains: expectedDurationEventContains, - }, - { - EventMethodName: "Fields", - Value: map[string]any{ - "key1": "value1", - "key2": 42, - }, - ExpectedOutputContains: `"key1":"value1","key2":42`, - }, - { - EventMethodName: "Fields", - Value: []any{"key1", "value1", "key2", 42}, - ExpectedOutputContains: `"key1":"value1","key2":42`, - }, - } - - for _, level := range polyzero.Levels() { - testpolylog.RunEventMethodTests( - t, - level, - tests, - newTestLogger, - newTestEventWithLevel, - getExpectedLevelOutputContains, - ) - } -} - -func TestZerologLogger_Levels_Discard(t *testing.T) { - // Construct a logger with each level. With each logger, log an event at each - // level and assert that the event is logged if and only if the event level - // is GTE the logger level. - for _, loggerLevel := range polyzero.Levels() { - testDesc := fmt.Sprintf("%s level logger", loggerLevel.String()) - t.Run(testDesc, func(t *testing.T) { - logger, logOutput := newTestLogger(t, loggerLevel) - - // Log an event for each level. - for _, eventLevel := range polyzero.Levels() { - event := newTestEventWithLevel(t, logger, eventLevel) - // Log the event level string. - event.Msg(eventLevel.String()) - - // If the event level is GTE the logger level, then the event should - // be logged. - if eventLevel.Int() >= loggerLevel.Int() { - require.Truef(t, event.Enabled(), "expected event to be enabled") - require.Contains(t, logOutput.String(), eventLevel.String()) - } else { - require.Falsef(t, event.Enabled(), "expected event to be discarded") - require.NotContains(t, logOutput.String(), eventLevel.String()) - } - } - - // Print log output for manual inspection. - t.Log(logOutput.String()) - }) - } -} - -func TestZerologLogger_Func_Discard_Enabled(t *testing.T) { - for _, loggerLevel := range polyzero.Levels() { - testDesc := fmt.Sprintf("%s loggerLevel logger", loggerLevel.String()) - t.Run(testDesc, func(t *testing.T) { - var ( - notExpectedOutput = "if you're reading this, the test failed" - // Construct a spy which implements a #Fn() method which we can use to - // assert that the function passed to polylog.Event#Func() is called with - // the expected arg(s). - logger, logOutput = newTestLogger(t, loggerLevel) - ) - - for _, eventLevel := range polyzero.Levels() { - funcSpy := testpolylog.EventFuncSpy{} - funcSpy.On("Fn", mock.AnythingOfType(polyzeroEventTypeName)).Return() - - event := newTestEventWithLevel(t, logger, eventLevel) - expectedEventLevelEnabled := eventLevel.Int() >= loggerLevel.Int() - - require.Equalf(t, expectedEventLevelEnabled, event.Enabled(), "expected event to be initially enabled") - - // If the event level is GTE the logger level, then make additional - // assertions about #Func(), #Discard(), and #Enabled() behavior. - if expectedEventLevelEnabled { - // Assert that #Func() calls `funcSpy#Fn()` method 1 time with - // an event whose type name matches funcMethodEventTypeName. - event.Func(funcSpy.Fn) - funcSpy.AssertCalled(t, "Fn", mock.AnythingOfType(polyzeroEventTypeName)) - funcSpy.AssertNumberOfCalls(t, "Fn", 1) - - event.Discard() - require.Falsef(t, event.Enabled(), "expected event to be disabled after Discard()") - - // Assert that #Func() **does not** call `funcSpy#Fn()` method again. - event.Func(funcSpy.Fn) - funcSpy.AssertNumberOfCalls(t, "Fn", 1) - - event.Msg(notExpectedOutput) - require.NotContains(t, logOutput.String(), notExpectedOutput) - } - - // NB: this test doesn't produce any log output as all cases - // exercise discarding. - } - }) - } -} - -func TestZerologLogger_With(t *testing.T) { - logger, logOutput := newTestLogger(t, polyzero.DebugLevel) - - logger.Debug().Msg("before") - require.Contains(t, logOutput.String(), "before") - - logger = logger.With("key", "value") - - logger.Debug().Msg("after") - require.Contains(t, logOutput.String(), "after") - require.Contains(t, logOutput.String(), `"key":"value"`) -} - -func TestZerologLogger_WithLevel(t *testing.T) { - logger, logOutput := newTestLogger(t, polyzero.DebugLevel) - logger.WithLevel(polyzero.DebugLevel).Msg("WithLevel()") - - require.Contains(t, logOutput.String(), "WithLevel()") -} - -func TestZerologLogger_Write(t *testing.T) { - testOutput := "Write()" - logger, logOutput := newTestLogger(t, polyzero.DebugLevel) - - n, err := logger.Write([]byte(testOutput)) - require.NoError(t, err) - require.Lenf(t, testOutput, n, "expected %d bytes to be written", len(testOutput)) - - require.Contains(t, logOutput.String(), testOutput) -} - -func TestWithTimestampKey(t *testing.T) { - expectedTimestampKey := "custom-timestamp-key" - - timestampKeyOpt := polyzero.WithTimestampKey(expectedTimestampKey) - // Reset zerolog timestamp key to default value after test. - t.Cleanup(func() { - zerolog.TimestampFieldName = "time" - }) - logger, logOutput := newTestLogger(t, polyzero.DebugLevel, timestampKeyOpt) - - logger.Debug().Timestamp().Send() - - expectedCustomTimestampEventContains := fmt.Sprintf( - `"%s":"%s`, - expectedTimestampKey, - expectedTime.Format(expectedTimestampDayPrecisionLayout), - ) - require.Contains(t, logOutput.String(), expectedCustomTimestampEventContains) - - // Print log output for manual inspection. - t.Log(logOutput) -} - -func TestWithErrorKey(t *testing.T) { - expectedErrKey := "custom-error-key" - - errorKeyOpt := polyzero.WithErrKey(expectedErrKey) - // Reset zerolog error key to default value after test. - t.Cleanup(func() { - zerolog.ErrorFieldName = "error" - }) - logger, logOutput := newTestLogger(t, polyzero.DebugLevel, errorKeyOpt) - - logger.Debug().Err(expectedErr).Send() - - require.Contains(t, logOutput.String(), expectedErr.Error()) - require.Contains(t, logOutput.String(), expectedErrKey) - - // Print log output for manual inspection. - t.Log(logOutput) -} - -func newTestLogger( - t *testing.T, - level polylog.Level, - opts ...polylog.LoggerOption, -) (polylog.Logger, *bytes.Buffer) { - t.Helper() - - // Redirect standard log output to logOutput buffer. - logOutput := new(bytes.Buffer) - opts = append( - opts, - polyzero.WithOutput(logOutput), - // NB: typically consumers would pass zerolog.Level directly instead. - polyzero.WithLevel(zerolog.Level(level.Int())), - ) - - logger := polyzero.NewLogger(opts...) - - return logger, logOutput -} - -func newTestEventWithLevel( - t *testing.T, - logger polylog.Logger, - level polylog.Level, -) polylog.Event { - t.Helper() - - // Match on level string to determine which level method to call. - switch level.String() { - case zerolog.DebugLevel.String(): - return logger.Debug() - case zerolog.InfoLevel.String(): - return logger.Info() - case zerolog.WarnLevel.String(): - return logger.Warn() - case zerolog.ErrorLevel.String(): - return logger.Error() - default: - panic(fmt.Errorf("level not yet supported: %s", level.String())) - } -} - -func getExpectedLevelOutputContains(level polylog.Level) string { - return fmt.Sprintf(`"level":%q`, level.String()) -} diff --git a/pkg/polylog/polyzero/options.go b/pkg/polylog/polyzero/options.go deleted file mode 100644 index 4fbe18d83..000000000 --- a/pkg/polylog/polyzero/options.go +++ /dev/null @@ -1,51 +0,0 @@ -package polyzero - -import ( - "io" - - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// WithOutput returns an option function that configures the output writer for zerolog. -func WithOutput(output io.Writer) polylog.LoggerOption { - return func(logger polylog.Logger) { - zl := logger.(*zerologLogger).Logger - logger.(*zerologLogger).Logger = zl.Output(output) - } -} - -// WithLevel returns an option function that configures the logger level for zerolog. -func WithLevel(level zerolog.Level) polylog.LoggerOption { - return func(logger polylog.Logger) { - zl := logger.(*zerologLogger).Logger - logger.(*zerologLogger).Logger = zl.Level(level) - } -} - -// WithTimestampKey returns an option function which configures the logger to -// use the given key when `polylog.Event#Timestamp()` is called. -func WithTimestampKey(key string) polylog.LoggerOption { - return func(_ polylog.Logger) { - zerolog.TimestampFieldName = key - } -} - -// WithErrKey returns an option function which configures the logger to use the -// given key when `polylog.Event#Err()` is called. -func WithErrKey(key string) polylog.LoggerOption { - return func(_ polylog.Logger) { - zerolog.ErrorFieldName = key - } -} - -// WithSetupFn takes function which receives the underlying zerolog logger pointer -// and returns an options function that calls it, passing the zerolog logger. -// -// TODO_TEST/TODO_COMMUNITY: add test coverage and example usage around this method. -func WithSetupFn(fn func(logger *zerolog.Logger)) polylog.LoggerOption { - return func(logger polylog.Logger) { - fn(&logger.(*zerologLogger).Logger) - } -} diff --git a/pkg/polylog/polyzero/test_logger.go b/pkg/polylog/polyzero/test_logger.go deleted file mode 100644 index f0c35c89c..000000000 --- a/pkg/polylog/polyzero/test_logger.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build test - -package polyzero - -import ( - "github.com/rs/zerolog" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// GetZerologLogger is a helper function which provides direct access to the -// underlying zerolog logger for testing purposes; e.g. use in assertions. To use -// this helper, ensure that the build tag/constraint "test" is set (e.g. `go build -tags=test`). -// It MUST be defined in this package (as opposed to somewhere in testutils), as -// by definition, it references unexported members of this package. -func GetZerologLogger(polylogger polylog.Logger) *zerolog.Logger { - return &polylogger.(*zerologLogger).Logger -} diff --git a/pkg/polylog/types.go b/pkg/polylog/types.go deleted file mode 100644 index 3ac2ce4a0..000000000 --- a/pkg/polylog/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package polylog - -type LoggerOption func(logger Logger) diff --git a/pkg/relayer/cmd/cmd.go b/pkg/relayer/cmd/cmd.go deleted file mode 100644 index 7c758303c..000000000 --- a/pkg/relayer/cmd/cmd.go +++ /dev/null @@ -1,345 +0,0 @@ -package cmd - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/url" - "os" - - "cosmossdk.io/depinject" - cosmosclient "github.com/cosmos/cosmos-sdk/client" - cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" - cosmostx "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/rs/zerolog" - "github.com/spf13/cobra" - - "github.com/pokt-network/poktroll/cmd/signals" - "github.com/pokt-network/poktroll/pkg/client/supplier" - "github.com/pokt-network/poktroll/pkg/client/tx" - txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" - "github.com/pokt-network/poktroll/pkg/deps/config" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/pkg/relayer" - relayerconfig "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - "github.com/pokt-network/poktroll/pkg/relayer/proxy" - "github.com/pokt-network/poktroll/pkg/relayer/session" -) - -// We're `explicitly omitting default` so the relayer crashes if these aren't specified. -const omittedDefaultFlagValue = "explicitly omitting default" - -// TODO_CONSIDERATION: Consider moving all flags defined in `/pkg` to a `flags.go` file. -var ( - // flagRelayMinerConfig is the variable containing the relay miner config filepath - // sourced from the `--config` flag. - flagRelayMinerConfig string - // flagNodeRPCURL is the variable containing the Cosmos node RPC URL flag value. - flagNodeRPCURL string - // flagNodeGRPCURL is the variable containing the Cosmos node GRPC URL flag value. - flagNodeGRPCURL string -) - -// RelayerCmd returns the Cobra command for running the relay miner. -func RelayerCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "relayminer", - Short: "Run a relay miner", - Long: `Run a relay miner. The relay miner process configures and starts -relay servers for each service the supplier actor identified by --signing-key is -staked for (configured on-chain). - -Relay requests received by the relay servers are validated and proxied to their -respective service endpoints, maintained by the relayer off-chain. The responses -are then signed and sent back to the requesting application. - -For each successfully served relay, the miner will hash and compare its difficulty -against an on-chain threshold. If the difficulty is sufficient, it is applicable -to relay volume and therefore rewards. Such relays are inserted into and persisted -via an SMT KV store. The miner will monitor the current block height and periodically -submit claim and proof messages according to the protocol as sessions become eligible -for such operations.`, - RunE: runRelayer, - } - // Custom flags - cmd.Flags().StringVar(&flagRelayMinerConfig, "config", "", "The path to the relayminer config file") - - // Cosmos flags - // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. - cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query and tx contexts correctly. It can be used to override the `QueryNodeRPCURL` and `TxNodeRPCURL` fields in the config file if specified.") - cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCURL` field in the config file if specified.") - cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") - - return cmd -} - -func runRelayer(cmd *cobra.Command, _ []string) error { - ctx, cancelCtx := context.WithCancel(cmd.Context()) - // Ensure context cancellation. - defer cancelCtx() - - // Handle interrupt and kill signals asynchronously. - signals.GoOnExitSignal(cancelCtx) - - configContent, err := os.ReadFile(flagRelayMinerConfig) - if err != nil { - return err - } - - // TODO_TECHDEBT: add logger level and output options to the config. - relayMinerConfig, err := relayerconfig.ParseRelayMinerConfigs(configContent) - if err != nil { - return err - } - - // TODO_TECHDEBT: populate logger from the config (ideally, from viper). - loggerOpts := []polylog.LoggerOption{ - polyzero.WithLevel(zerolog.DebugLevel), - polyzero.WithOutput(os.Stderr), - } - - // Construct a logger and associate it with the command context. - logger := polyzero.NewLogger(loggerOpts...) - ctx = logger.WithContext(ctx) - cmd.SetContext(ctx) - - // Sets up the following dependencies: - // Miner, EventsQueryClient, BlockClient, cosmosclient.Context, TxFactory, - // TxContext, TxClient, SupplierClient, RelayerProxy, RelayerSessionsManager. - deps, err := setupRelayerDependencies(ctx, cmd, relayMinerConfig) - if err != nil { - return err - } - - relayMiner, err := relayer.NewRelayMiner(ctx, deps) - if err != nil { - return err - } - - // Serve metrics. - if relayMinerConfig.Metrics.Enabled { - err = relayMiner.ServeMetrics(relayMinerConfig.Metrics.Addr) - if err != nil { - return fmt.Errorf("failed to start metrics endpoint: %w", err) - } - } - - // Start the relay miner - logger.Info().Msg("Starting relay miner...") - if err := relayMiner.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) { - return fmt.Errorf("failed to start relay miner: %w", err) - } else if errors.Is(err, http.ErrServerClosed) { - logger.Info().Msg("Relay miner stopped; exiting") - } - return nil -} - -// setupRelayerDependencies sets up all the dependencies the relay miner needs -// to run by building the dependency tree from the leaves up, incrementally -// supplying each component to an accumulating depinject.Config: -// Miner, EventsQueryClient, BlockClient, cosmosclient.Context, TxFactory, TxContext, -// TxClient, SupplierClient, RelayerProxy, RelayerSessionsManager. -func setupRelayerDependencies( - ctx context.Context, - cmd *cobra.Command, - relayMinerConfig *relayerconfig.RelayMinerConfig, -) (deps depinject.Config, err error) { - queryNodeRPCUrl := relayMinerConfig.PocketNode.QueryNodeRPCUrl - queryNodeGRPCUrl := relayMinerConfig.PocketNode.QueryNodeGRPCUrl - txNodeRPCUrl := relayMinerConfig.PocketNode.TxNodeRPCUrl - - // Override the config file's `QueryNodeGRPCUrl` fields - // with the `--grpc-addr` flag if it was specified. - // TODO(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeGRPCURL != omittedDefaultFlagValue { - parsedFlagNodeGRPCUrl, err := url.Parse(flagNodeGRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse grpc query URL: %w", err) - } - queryNodeGRPCUrl = parsedFlagNodeGRPCUrl - } - - // Override the config file's `QueryNodeUrl` and `txNodeRPCUrl` fields - // with the `--node` flag if it was specified. - // TODO(#223) Remove this check once viper is used as SoT for overridable config values. - if flagNodeRPCURL != omittedDefaultFlagValue { - parsedFlagNodeRPCUrl, err := url.Parse(flagNodeRPCURL) - if err != nil { - return nil, fmt.Errorf("failed to parse rpc query URL: %w", err) - } - queryNodeRPCUrl = parsedFlagNodeRPCUrl - txNodeRPCUrl = parsedFlagNodeRPCUrl - } - - signingKeyName := relayMinerConfig.SigningKeyName - proxiedServiceEndpoints := relayMinerConfig.Proxies - smtStorePath := relayMinerConfig.SmtStorePath - - supplierFuncs := []config.SupplierFn{ - config.NewSupplyLoggerFromCtx(ctx), - config.NewSupplyEventsQueryClientFn(queryNodeRPCUrl), // leaf - config.NewSupplyBlockClientFn(), // leaf - config.NewSupplyQueryClientContextFn(queryNodeGRPCUrl), // leaf - supplyMiner, // leaf - config.NewSupplyTxClientContextFn(queryNodeGRPCUrl, txNodeRPCUrl), // leaf - config.NewSupplyDelegationClientFn(), // leaf - config.NewSupplyAccountQuerierFn(), - config.NewSupplyApplicationQuerierFn(), - config.NewSupplySupplierQuerierFn(), - config.NewSupplySessionQuerierFn(), - config.NewSupplyRingCacheFn(), - supplyTxFactory, - supplyTxContext, - newSupplyTxClientFn(signingKeyName), - newSupplySupplierClientFn(signingKeyName), - newSupplyRelayerProxyFn(signingKeyName, proxiedServiceEndpoints), - newSupplyRelayerSessionsManagerFn(smtStorePath), - } - - return config.SupplyConfig(ctx, cmd, supplierFuncs) -} - -// supplyMiner constructs a Miner instance and returns a new depinject.Config -// which is supplied with the given deps and the new Miner. -func supplyMiner( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, -) (depinject.Config, error) { - mnr, err := miner.NewMiner() - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(mnr)), nil -} - -// supplyTxFactory constructs a cosmostx.Factory instance and returns a new -// depinject.Config which is supplied with the given deps and the new -// cosmostx.Factory. -func supplyTxFactory( - _ context.Context, - deps depinject.Config, - cmd *cobra.Command, -) (depinject.Config, error) { - var txClientCtx txtypes.Context - if err := depinject.Inject(deps, &txClientCtx); err != nil { - return nil, err - } - - clientCtx := cosmosclient.Context(txClientCtx) - clientFactory, err := cosmostx.NewFactoryCLI(clientCtx, cmd.Flags()) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(clientFactory)), nil -} - -func supplyTxContext( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, -) (depinject.Config, error) { - txContext, err := tx.NewTxContext(deps) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(txContext)), nil -} - -// newSupplyTxClientFn returns a function which constructs a TxClient -// instance and returns a new depinject.Config which is supplied with -// the given deps and the new TxClient. -func newSupplyTxClientFn(signingKeyName string) config.SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - txClient, err := tx.NewTxClient( - ctx, - deps, - tx.WithSigningKeyName(signingKeyName), - // TODO_TECHDEBT: populate this from some config. - tx.WithCommitTimeoutBlocks(tx.DefaultCommitTimeoutHeightOffset), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(txClient)), nil - } -} - -// newSupplySupplierClientFn returns a function which constructs a -// SupplierClient instance and returns a new depinject.Config which is -// supplied with the given deps and the new SupplierClient. -func newSupplySupplierClientFn(signingKeyName string) config.SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - supplierClient, err := supplier.NewSupplierClient( - deps, - supplier.WithSigningKeyName(signingKeyName), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(supplierClient)), nil - } -} - -// newSupplyRelayerProxyFn returns a function which constructs a -// RelayerProxy instance and returns a new depinject.Config which -// is supplied with the given deps and the new RelayerProxy. -func newSupplyRelayerProxyFn( - signingKeyName string, - proxiedServiceEndpoints map[string]*relayerconfig.RelayMinerProxyConfig, -) config.SupplierFn { - return func( - _ context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - relayerProxy, err := proxy.NewRelayerProxy( - deps, - proxy.WithSigningKeyName(signingKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServiceEndpoints), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(relayerProxy)), nil - } -} - -// newSupplyRelayerSessionsManagerFn returns a function which constructs a -// RelayerSessionsManager instance and returns a new depinject.Config which -// is supplied with the given deps and the new RelayerSessionsManager. -func newSupplyRelayerSessionsManagerFn(smtStorePath string) config.SupplierFn { - return func( - ctx context.Context, - deps depinject.Config, - _ *cobra.Command, - ) (depinject.Config, error) { - relayerSessionsManager, err := session.NewRelayerSessions( - ctx, deps, - session.WithStoresDirectory(smtStorePath), - ) - if err != nil { - return nil, err - } - - return depinject.Configs(deps, depinject.Supply(relayerSessionsManager)), nil - } -} diff --git a/pkg/relayer/config/errors.go b/pkg/relayer/config/errors.go deleted file mode 100644 index eace596e3..000000000 --- a/pkg/relayer/config/errors.go +++ /dev/null @@ -1,14 +0,0 @@ -package config - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "relayminer_config" - ErrRelayMinerConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrRelayMinerConfigInvalidNodeUrl = sdkerrors.Register(codespace, 2, "invalid node url in RelayMiner config") - ErrRelayMinerConfigInvalidSigningKeyName = sdkerrors.Register(codespace, 3, "invalid signing key name in RelayMiner config") - ErrRelayMinerConfigInvalidSmtStorePath = sdkerrors.Register(codespace, 4, "invalid smt store path in RelayMiner config") - ErrRelayMinerConfigEmpty = sdkerrors.Register(codespace, 5, "empty RelayMiner config") - ErrRelayMinerConfigInvalidSupplier = sdkerrors.Register(codespace, 6, "invalid supplier in RelayMiner config") - ErrRelayMinerConfigInvalidProxy = sdkerrors.Register(codespace, 7, "invalid proxy in RelayMiner config") -) diff --git a/pkg/relayer/config/pocket_node_config_hydrator.go b/pkg/relayer/config/pocket_node_config_hydrator.go deleted file mode 100644 index 88a57fa85..000000000 --- a/pkg/relayer/config/pocket_node_config_hydrator.go +++ /dev/null @@ -1,56 +0,0 @@ -package config - -import "net/url" - -// HydratePocketNodeUrls populates the pocket node fields of the RelayMinerConfig -// that are relevant to the "pocket_node" section in the config file. -func (relayMinerConfig *RelayMinerConfig) HydratePocketNodeUrls( - yamlPocketNodeConfig *YAMLRelayMinerPocketNodeConfig, -) error { - relayMinerConfig.PocketNode = &RelayMinerPocketNodeConfig{} - - if len(yamlPocketNodeConfig.TxNodeRPCUrl) == 0 { - return ErrRelayMinerConfigInvalidNodeUrl.Wrap("tx node rpc url is required") - } - - // Check if the pocket node rpc url is a valid URL - txNodeRPCUrl, err := url.Parse(yamlPocketNodeConfig.TxNodeRPCUrl) - if err != nil { - return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( - "invalid tx node rpc url %s", - err.Error(), - ) - } - relayMinerConfig.PocketNode.TxNodeRPCUrl = txNodeRPCUrl - - // If the query node rpc url is empty, use the tx node rpc url - if len(yamlPocketNodeConfig.QueryNodeRPCUrl) == 0 { - relayMinerConfig.PocketNode.QueryNodeRPCUrl = relayMinerConfig.PocketNode.TxNodeRPCUrl - } else { - // If the query node rpc url is not empty, make sure it is a valid URL - queryNodeRPCUrl, err := url.Parse(yamlPocketNodeConfig.QueryNodeRPCUrl) - if err != nil { - return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( - "invalid query node rpc url %s", - err.Error(), - ) - } - relayMinerConfig.PocketNode.QueryNodeRPCUrl = queryNodeRPCUrl - } - - if len(yamlPocketNodeConfig.QueryNodeGRPCUrl) == 0 { - return ErrRelayMinerConfigInvalidNodeUrl.Wrap("query node grpc url is required") - } - - // Check if the query node grpc url is a valid URL - queryNodeGRPCUrl, err := url.Parse(yamlPocketNodeConfig.QueryNodeGRPCUrl) - if err != nil { - return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( - "invalid query node grpc url %s", - err.Error(), - ) - } - relayMinerConfig.PocketNode.QueryNodeGRPCUrl = queryNodeGRPCUrl - - return nil -} diff --git a/pkg/relayer/config/proxies_config_hydrator.go b/pkg/relayer/config/proxies_config_hydrator.go deleted file mode 100644 index f3b7628ed..000000000 --- a/pkg/relayer/config/proxies_config_hydrator.go +++ /dev/null @@ -1,63 +0,0 @@ -package config - -// HydrateProxies populates the proxies fields of the RelayMinerConfig that -// are relevant to the "proxies" section in the config file. -func (relayMinerConfig *RelayMinerConfig) HydrateProxies( - yamlProxyConfigs []YAMLRelayMinerProxyConfig, -) error { - // At least one proxy is required - if len(yamlProxyConfigs) == 0 { - return ErrRelayMinerConfigInvalidProxy.Wrap("no proxies provided") - } - - relayMinerConfig.Proxies = make(map[string]*RelayMinerProxyConfig) - - for _, yamlProxyConfig := range yamlProxyConfigs { - // Proxy name is required - if len(yamlProxyConfig.ProxyName) == 0 { - return ErrRelayMinerConfigInvalidProxy.Wrap("proxy name is required") - } - - // Proxy name should not be unique - if _, ok := relayMinerConfig.Proxies[yamlProxyConfig.ProxyName]; ok { - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "duplicate porxy name %s", - yamlProxyConfig.ProxyName, - ) - } - - proxyConfig := &RelayMinerProxyConfig{ - ProxyName: yamlProxyConfig.ProxyName, - XForwardedHostLookup: yamlProxyConfig.XForwardedHostLookup, - Suppliers: make(map[string]*RelayMinerSupplierConfig), - } - - // Populate the proxy fields that are relevant to each supported proxy type - switch yamlProxyConfig.Type { - case "http": - if err := proxyConfig.parseHTTPProxyConfig(yamlProxyConfig); err != nil { - return err - } - default: - // Fail if the proxy type is not supported - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "invalid proxy type %s", - yamlProxyConfig.Type, - ) - } - - switch yamlProxyConfig.Type { - case "http": - proxyConfig.Type = ProxyTypeHTTP - default: - ErrRelayMinerConfigInvalidProxy.Wrapf( - "invalid proxy type %s", - yamlProxyConfig.Type, - ) - } - - relayMinerConfig.Proxies[proxyConfig.ProxyName] = proxyConfig - } - - return nil -} diff --git a/pkg/relayer/config/proxy_http_config_parser.go b/pkg/relayer/config/proxy_http_config_parser.go deleted file mode 100644 index a8f655f14..000000000 --- a/pkg/relayer/config/proxy_http_config_parser.go +++ /dev/null @@ -1,73 +0,0 @@ -package config - -import ( - "fmt" - "net/url" -) - -// parseHTTPProxyConfig populates the proxy fields of the target structure that -// are relevant to the "http" type in the proxy section of the config file. -// This function alters the target RelayMinerProxyConfig structure as a side effect. -func (proxyConfig *RelayMinerProxyConfig) parseHTTPProxyConfig( - yamlProxyConfig YAMLRelayMinerProxyConfig, -) error { - // Check if the proxy host is a valid URL. - // Since `yamlProxyConfig.Host` is a string representing the host, we need to - // prepend it with the "http://" scheme to make it a valid URL; we end up - // using the `Host` field of the resulting `url.URL` struct, so the prepended - // scheme is irrelevant. - proxyUrl, err := url.Parse(fmt.Sprintf("http://%s", yamlProxyConfig.Host)) - if err != nil { - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "invalid proxy host %s", - err.Error(), - ) - } - - if proxyUrl.Host == "" { - return ErrRelayMinerConfigInvalidProxy.Wrap("empty proxy host") - } - - proxyConfig.Host = proxyUrl.Host - return nil -} - -// parseHTTPSupplierConfig populates the supplier fields of the target structure -// that are relevant to the "http" type in the supplier section of the config file. -// This function alters the target RelayMinerSupplierServiceConfig structure -// as a side effect. -func (supplierServiceConfig *RelayMinerSupplierServiceConfig) parseHTTPSupplierConfig( - yamlSupplierServiceConfig YAMLRelayMinerSupplierServiceConfig, -) error { - // Check if the supplier url is not empty - if len(yamlSupplierServiceConfig.Url) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrap("empty supplier url") - } - - // Check if the supplier url is a valid URL - supplierServiceUrl, err := url.Parse(yamlSupplierServiceConfig.Url) - if err != nil { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "invalid supplier url %s", - err.Error(), - ) - } - - supplierServiceConfig.Url = supplierServiceUrl - - // If the Authentication section is not empty, populate the supplier service - // authentication fields - if yamlSupplierServiceConfig.Authentication != (YAMLRelayMinerSupplierServiceAuthentication{}) { - supplierServiceConfig.Authentication = &RelayMinerSupplierServiceAuthentication{ - Username: yamlSupplierServiceConfig.Authentication.Username, - Password: yamlSupplierServiceConfig.Authentication.Password, - } - } - - // If the Headers section is not empty, populate the supplier service headers fields - if yamlSupplierServiceConfig.Headers != nil { - supplierServiceConfig.Headers = yamlSupplierServiceConfig.Headers - } - - return nil -} diff --git a/pkg/relayer/config/relayminer_configs_reader.go b/pkg/relayer/config/relayminer_configs_reader.go deleted file mode 100644 index b546d451d..000000000 --- a/pkg/relayer/config/relayminer_configs_reader.go +++ /dev/null @@ -1,84 +0,0 @@ -package config - -import yaml "gopkg.in/yaml.v2" - -// ParseRelayMinerConfigs parses the relay miner config file into a RelayMinerConfig -func ParseRelayMinerConfigs(configContent []byte) (*RelayMinerConfig, error) { - var ( - yamlRelayMinerConfig YAMLRelayMinerConfig - relayMinerConfig = &RelayMinerConfig{} - ) - - // The config file should not be empty - if len(configContent) == 0 { - return nil, ErrRelayMinerConfigEmpty - } - - // Unmarshal the stake config file into a yamlAppGateConfig - if err := yaml.Unmarshal(configContent, &yamlRelayMinerConfig); err != nil { - return nil, ErrRelayMinerConfigUnmarshalYAML.Wrap(err.Error()) - } - - // Top level section - // SigningKeyName is required - if len(yamlRelayMinerConfig.SigningKeyName) == 0 { - return nil, ErrRelayMinerConfigInvalidSigningKeyName - } - relayMinerConfig.SigningKeyName = yamlRelayMinerConfig.SigningKeyName - - // SmtStorePath is required - if len(yamlRelayMinerConfig.SmtStorePath) == 0 { - return nil, ErrRelayMinerConfigInvalidSmtStorePath - } - relayMinerConfig.SmtStorePath = yamlRelayMinerConfig.SmtStorePath - - // No additional validation on metrics. The server would fail to start if they are invalid - // which is the intended behaviour. - relayMinerConfig.Metrics = &RelayMinerMetricsConfig{ - Enabled: yamlRelayMinerConfig.Metrics.Enabled, - Addr: yamlRelayMinerConfig.Metrics.Addr, - } - - // Hydrate the pocket node urls - if err := relayMinerConfig.HydratePocketNodeUrls(&yamlRelayMinerConfig.PocketNode); err != nil { - return nil, err - } - - // Hydrate the proxies - if err := relayMinerConfig.HydrateProxies(yamlRelayMinerConfig.Proxies); err != nil { - return nil, err - } - - // Hydrate the suppliers - if err := relayMinerConfig.HydrateSuppliers(yamlRelayMinerConfig.Suppliers); err != nil { - return nil, err - } - - // Check if proxies are referencing hosts more than once - if err := relayMinerConfig.EnsureUniqueHosts(); err != nil { - return nil, err - } - - return relayMinerConfig, nil -} - -// EnsureUniqueHosts checks if each proxy is referencing a host more than once -func (relayMinerConfig *RelayMinerConfig) EnsureUniqueHosts() error { - for _, proxyConfig := range relayMinerConfig.Proxies { - existingHosts := make(map[string]bool) - for _, supplierConfig := range proxyConfig.Suppliers { - for _, host := range supplierConfig.Hosts { - if _, ok := existingHosts[host]; ok { - return ErrRelayMinerConfigInvalidProxy.Wrapf( - "duplicate host %s in proxy %s", - host, - proxyConfig.ProxyName, - ) - } - existingHosts[host] = true - } - } - } - - return nil -} diff --git a/pkg/relayer/config/relayminer_configs_reader_test.go b/pkg/relayer/config/relayminer_configs_reader_test.go deleted file mode 100644 index 6b8bc3c60..000000000 --- a/pkg/relayer/config/relayminer_configs_reader_test.go +++ /dev/null @@ -1,1265 +0,0 @@ -package config_test - -import ( - "net/url" - "testing" - - sdkerrors "cosmossdk.io/errors" - "github.com/gogo/status" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/testutil/yaml" -) - -func Test_ParseRelayMinerConfigs(t *testing.T) { - tests := []struct { - desc string - - inputConfigYAML string - - expectedError *sdkerrors.Error - expectedConfig *config.RelayMinerConfig - }{ - // Valid Configs - { - desc: "valid: relay miner config", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - authentication: - username: user - password: pwd - headers: {} - hosts: - - tcp://ethereum.devnet1.poktroll.com - - tcp://ethereum - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - Authentication: &config.RelayMinerSupplierServiceAuthentication{ - Username: "user", - Password: "pwd", - }, - Headers: map[string]string{}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: multiple suppliers, single proxy", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - authentication: - username: user - password: pwd - headers: {} - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - - service_id: 7b-llm-model - type: http - service_config: - url: http://llama-endpoint - hosts: - - tcp://7b-llm-model.devnet1.poktroll.com - - tcp://7b-llm-model - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - Authentication: &config.RelayMinerSupplierServiceAuthentication{ - Username: "user", - Password: "pwd", - }, - Headers: map[string]string{}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - "7b-llm-model": { - ServiceId: "7b-llm-model", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "llama-endpoint"}, - }, - Hosts: []string{ - "7b-llm-model.devnet1.poktroll.com", - "7b-llm-model", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: multiple proxies for a single supplier, no auth", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: first-proxy - host: 127.0.0.1:8080 - type: http - - proxy_name: second-proxy - host: 127.0.0.1:8081 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - first-proxy - - second-proxy - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "first-proxy": { - ProxyName: "first-proxy", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - }, - }, - }, - }, - "second-proxy": { - ProxyName: "second-proxy", - Host: "127.0.0.1:8081", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: relay miner config with query node rpc url defaulting to tx node rpc url", - - inputConfigYAML: ` - pocket_node: - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - - tcp://ethereum - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: false, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - }, - }, - }, - }, - }, - { - desc: "valid: relay miner config with x_forwarded_host_lookup set to true", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - x_forwarded_host_lookup: true - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - - tcp://ethereum - proxy_names: - - http-example - `, - - expectedError: nil, - expectedConfig: &config.RelayMinerConfig{ - PocketNode: &config.RelayMinerPocketNodeConfig{ - QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, - QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, - TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, - }, - SigningKeyName: "servicer1", - SmtStorePath: "smt_stores", - Proxies: map[string]*config.RelayMinerProxyConfig{ - "http-example": { - ProxyName: "http-example", - Host: "127.0.0.1:8080", - Type: config.ProxyTypeHTTP, - XForwardedHostLookup: true, - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - "ethereum": { - ServiceId: "ethereum", - Type: config.ProxyTypeHTTP, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, - }, - Hosts: []string{ - "ethereum.devnet1.poktroll.com", - "ethereum", - }, - }, - }, - }, - }, - }, - }, - // Invalid Configs - { - desc: "invalid: invalid tx node grpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: &tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: missing tx node grpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - # explicitly omitted tx node grpc url - query_node_grpc_url: tcp://127.0.0.1:36658 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: invalid query node grpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: &tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: invalid query node rpc url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: &tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: missing query node grpc url", - - inputConfigYAML: ` - pocket_node: - # explicitly omitted query node rpc url - query_node_rpc_url: tcp://127.0.0.1:36657 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, - }, - { - desc: "invalid: missing signing key name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - # explicitly omitted signing key name - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSigningKeyName, - }, - { - desc: "invalid: missing smt store path", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - # explicitly omitted smt store path - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSmtStorePath, - }, - { - desc: "invalid: missing proxies section", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - # explicitly omitted proxies section - suppliers: - - proxy_name: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty proxies section", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: # explicitly empty proxies section - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: omitted proxy name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - # explicitly omitted proxy name - - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty proxy name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: # explicitly empty proxy name - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: missing http proxy host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - # explicitly missing proxy host - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty http proxy host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: # explicitly empty proxy host - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: missing proxy type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - # explicitly missing proxy type - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty proxy type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: # explicitly empty proxy type - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: unsupported proxy type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: unsupported - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: missing supplier name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - # explicitly missing supplier name - - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier name", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: # explicitly empty supplier name - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: unsupported supplier type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: unsupported - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: missing supplier type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - # explicitly missing supplier type - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier type", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: # explicitly empty supplier type - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: bad supplier service config url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: &http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier service config url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: # explicitly empty supplier service config url - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: missing supplier service config url", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - # explicitly missing supplier service config url - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: bad supplier host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - &tcp://ethereum.devnet1.poktroll.com - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: blank supplier host", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - # explicitly blank supplier host - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier proxy references", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://ethereum.devnet1.poktroll.com - proxy_names: - - bad-proxy-name - `, - - expectedError: config.ErrRelayMinerConfigInvalidSupplier, - }, - { - desc: "invalid: empty supplier proxy references", - - inputConfigYAML: ` - pocket_node: - query_node_rpc_url: tcp://127.0.0.1:36657 - query_node_grpc_url: tcp://127.0.0.1:36658 - tx_node_rpc_url: tcp://127.0.0.1:36659 - signing_key_name: servicer1 - smt_store_path: smt_stores - proxies: - - proxy_name: http-example - host: 127.0.0.1:8080 - type: http - suppliers: - - service_id: ethereum - type: http - service_config: - url: http://anvil.servicer:8545 - hosts: - - tcp://devnet1.poktroll.com # hosts for both suppliers are the same - proxy_names: - - http-example - - service_id: avax - type: http - service_config: - url: http://avax.servicer:8545 - hosts: - - tcp://devnet1.poktroll.com # hosts for both suppliers are the same - proxy_names: - - http-example - `, - - expectedError: config.ErrRelayMinerConfigInvalidProxy, - }, - { - desc: "invalid: empty RelayMiner config file", - - inputConfigYAML: ``, - - expectedError: config.ErrRelayMinerConfigEmpty, - }, - // TODO_NB: Test for supplier and proxy types mismatch once we have more - // than one proxy type. - } - - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) - config, err := config.ParseRelayMinerConfigs([]byte(normalizedConfig)) - - if tt.expectedError != nil { - require.ErrorIs(t, err, tt.expectedError) - require.Nil(t, config) - stat, ok := status.FromError(tt.expectedError) - require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) - require.Nil(t, config) - return - } - - require.NoError(t, err) - - require.Equal( - t, - tt.expectedConfig.SigningKeyName, - config.SigningKeyName, - ) - - require.Equal( - t, - tt.expectedConfig.SmtStorePath, - config.SmtStorePath, - ) - - require.Equal( - t, - tt.expectedConfig.PocketNode.QueryNodeGRPCUrl.String(), - config.PocketNode.QueryNodeGRPCUrl.String(), - ) - - require.Equal( - t, - tt.expectedConfig.PocketNode.QueryNodeRPCUrl.String(), - config.PocketNode.QueryNodeRPCUrl.String(), - ) - - require.Equal( - t, - tt.expectedConfig.PocketNode.TxNodeRPCUrl.String(), - config.PocketNode.TxNodeRPCUrl.String(), - ) - - for proxyName, proxy := range tt.expectedConfig.Proxies { - require.Equal( - t, - proxy.ProxyName, - config.Proxies[proxyName].ProxyName, - ) - - require.Equal( - t, - proxy.Host, - config.Proxies[proxyName].Host, - ) - - require.Equal( - t, - proxy.Type, - config.Proxies[proxyName].Type, - ) - - for supplierName, supplier := range proxy.Suppliers { - require.Equal( - t, - supplier.ServiceId, - config.Proxies[proxyName].Suppliers[supplierName].ServiceId, - ) - - require.Equal( - t, - supplier.Type, - config.Proxies[proxyName].Suppliers[supplierName].Type, - ) - - require.Equal( - t, - supplier.ServiceConfig.Url.String(), - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Url.String(), - ) - - if supplier.ServiceConfig.Authentication != nil { - require.NotNil( - t, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication, - ) - - require.Equal( - t, - supplier.ServiceConfig.Authentication.Username, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication.Username, - ) - - require.Equal( - t, - supplier.ServiceConfig.Authentication.Password, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication.Password, - ) - } - - for headerKey, headerValue := range supplier.ServiceConfig.Headers { - require.Equal( - t, - headerValue, - config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Headers[headerKey], - ) - } - - for i, host := range supplier.Hosts { - require.Contains( - t, - host, - config.Proxies[proxyName].Suppliers[supplierName].Hosts[i], - ) - } - } - } - }) - } -} diff --git a/pkg/relayer/config/supplier_hydrator.go b/pkg/relayer/config/supplier_hydrator.go deleted file mode 100644 index 0b54a36f0..000000000 --- a/pkg/relayer/config/supplier_hydrator.go +++ /dev/null @@ -1,82 +0,0 @@ -package config - -import "net/url" - -// HydrateSupplier populates a single supplier's fields of the RelayMinerConfig -// that are relevant to each supplier in the "suppliers" section of the config file. -func (supplierConfig *RelayMinerSupplierConfig) HydrateSupplier( - yamlSupplierConfig YAMLRelayMinerSupplierConfig, -) error { - // Supplier name is required - if len(yamlSupplierConfig.ServiceId) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrap("supplier name is required") - } - supplierConfig.ServiceId = yamlSupplierConfig.ServiceId - - // Supplier hosts - supplierConfig.Hosts = []string{} - existingHosts := make(map[string]bool) - for _, host := range yamlSupplierConfig.Hosts { - // Check if the supplier host is empty - if len(host) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrap("empty supplier host") - } - - // Check if the supplier host is a valid URL - supplierHost, err := url.Parse(host) - if err != nil { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "invalid supplier host %s", - host, - ) - } - - // Check if the supplier host is unique - if _, ok := existingHosts[supplierHost.Host]; ok { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "duplicate supplier host %s", - host, - ) - } - existingHosts[supplierHost.Host] = true - - // Add the supplier host to the suppliers list - supplierConfig.Hosts = append(supplierConfig.Hosts, supplierHost.Host) - } - - // Add a default host which corresponds to the supplier name if it is not - // already in the list - if _, ok := existingHosts[supplierConfig.ServiceId]; !ok { - supplierConfig.Hosts = append(supplierConfig.Hosts, supplierConfig.ServiceId) - } - - // Populate the supplier service fields that are relevant to each supported - // supplier type. - // If other supplier types are added in the future, they should be handled - // by their own functions. - supplierConfig.ServiceConfig = &RelayMinerSupplierServiceConfig{} - switch yamlSupplierConfig.Type { - case "http": - supplierConfig.Type = ProxyTypeHTTP - if err := supplierConfig.ServiceConfig. - parseHTTPSupplierConfig(yamlSupplierConfig.ServiceConfig); err != nil { - return err - } - default: - // Fail if the supplier type is not supported - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "invalid supplier type %s", - yamlSupplierConfig.Type, - ) - } - - // Check if the supplier has proxies - if len(yamlSupplierConfig.ProxyNames) == 0 { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "supplier %s has no proxies", - supplierConfig.ServiceId, - ) - } - - return nil -} diff --git a/pkg/relayer/config/suppliers_config_hydrator.go b/pkg/relayer/config/suppliers_config_hydrator.go deleted file mode 100644 index b8f0f4fa7..000000000 --- a/pkg/relayer/config/suppliers_config_hydrator.go +++ /dev/null @@ -1,51 +0,0 @@ -package config - -// HydrateSuppliers populates the suppliers fields of the RelayMinerConfig that -// are relevant to the "suppliers" section in the config file. -func (relayMinerConfig *RelayMinerConfig) HydrateSuppliers( - yamlSupplierConfigs []YAMLRelayMinerSupplierConfig, -) error { - existingSuppliers := make(map[string]bool) - for _, yamlSupplierConfig := range yamlSupplierConfigs { - // Hydrate and validate each supplier in the suppliers list of the config file. - supplierConfig := &RelayMinerSupplierConfig{} - if err := supplierConfig.HydrateSupplier(yamlSupplierConfig); err != nil { - return err - } - - // Supplier name should not be unique - if _, ok := existingSuppliers[yamlSupplierConfig.ServiceId]; ok { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "duplicate supplier name %s", - yamlSupplierConfig.ServiceId, - ) - } - // Mark the supplier as existing - existingSuppliers[yamlSupplierConfig.ServiceId] = true - - // Add the supplier config to the referenced proxies - for _, proxyName := range yamlSupplierConfig.ProxyNames { - // If the proxy name is referencing a non-existent proxy, fail - if _, ok := relayMinerConfig.Proxies[proxyName]; !ok { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "no matching proxy %s for supplier %s", - supplierConfig.ServiceId, - proxyName, - ) - } - - // If the proxy name is referencing a proxy of a different type, fail - if supplierConfig.Type != relayMinerConfig.Proxies[proxyName].Type { - return ErrRelayMinerConfigInvalidSupplier.Wrapf( - "supplier %s and proxy %s have different types", - supplierConfig.ServiceId, - proxyName, - ) - } - - relayMinerConfig.Proxies[proxyName].Suppliers[supplierConfig.ServiceId] = supplierConfig - } - } - - return nil -} diff --git a/pkg/relayer/config/types.go b/pkg/relayer/config/types.go deleted file mode 100644 index edd63ff54..000000000 --- a/pkg/relayer/config/types.go +++ /dev/null @@ -1,163 +0,0 @@ -package config - -import "net/url" - -type ProxyType int - -const ( - ProxyTypeHTTP ProxyType = iota - // TODO: Support other proxy types: HTTPS, TCP, UNIX socket, UDP, QUIC, WebRTC ... -) - -// YAMLRelayMinerConfig is the structure used to unmarshal the RelayMiner config file -// TODO_DOCUMENT(@red-0ne): Add proper README documentation for yaml config files -// and update inline comments accordingly. -type YAMLRelayMinerConfig struct { - PocketNode YAMLRelayMinerPocketNodeConfig `yaml:"pocket_node"` - SigningKeyName string `yaml:"signing_key_name"` - SmtStorePath string `yaml:"smt_store_path"` - Metrics YAMLRelayMinerMetricsConfig `yaml:"metrics"` - Proxies []YAMLRelayMinerProxyConfig `yaml:"proxies"` - Suppliers []YAMLRelayMinerSupplierConfig `yaml:"suppliers"` -} - -// YAMLRelayMinerPocketNodeConfig is the structure used to unmarshal the pocket -// node URLs section of the RelayMiner config file -type YAMLRelayMinerPocketNodeConfig struct { - QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` - QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` - TxNodeRPCUrl string `yaml:"tx_node_rpc_url"` -} - -// YAMLRelayMinerProxyConfig is the structure used to unmarshal the proxy -// section of the RelayMiner config file -type YAMLRelayMinerProxyConfig struct { - ProxyName string `yaml:"proxy_name"` - Type string `yaml:"type"` - Host string `yaml:"host"` - XForwardedHostLookup bool `yaml:"x_forwarded_host_lookup"` -} - -// YAMLRelayMinerMetricsConfig is the structure used to unmarshal the metrics -// section of the RelayMiner config file -type YAMLRelayMinerMetricsConfig struct { - Enabled bool `yaml:"enabled"` - Addr string `yaml:"addr"` -} - -// YAMLRelayMinerSupplierConfig is the structure used to unmarshal the supplier -// section of the RelayMiner config file -type YAMLRelayMinerSupplierConfig struct { - ServiceId string `yaml:"service_id"` - Type string `yaml:"type"` - Hosts []string `yaml:"hosts"` - ServiceConfig YAMLRelayMinerSupplierServiceConfig `yaml:"service_config"` - ProxyNames []string `yaml:"proxy_names"` -} - -// YAMLRelayMinerSupplierServiceConfig is the structure used to unmarshal the supplier -// service sub-section of the RelayMiner config file -type YAMLRelayMinerSupplierServiceConfig struct { - Url string `yaml:"url"` - Authentication YAMLRelayMinerSupplierServiceAuthentication `yaml:"authentication,omitempty"` - Headers map[string]string `yaml:"headers,omitempty"` -} - -// YAMLRelayMinerSupplierServiceAuthentication is the structure used to unmarshal -// the supplier service basic auth of the RelayMiner config file when the -// supplier is of type "http" -type YAMLRelayMinerSupplierServiceAuthentication struct { - Username string `yaml:"username,omitempty"` - Password string `yaml:"password,omitempty"` -} - -// RelayMinerConfig is the structure describing the RelayMiner config -type RelayMinerConfig struct { - PocketNode *RelayMinerPocketNodeConfig - Proxies map[string]*RelayMinerProxyConfig - Metrics *RelayMinerMetricsConfig - SigningKeyName string - SmtStorePath string -} - -// RelayMinerPocketNodeConfig is the structure resulting from parsing the pocket -// node URLs section of the RelayMiner config file -type RelayMinerPocketNodeConfig struct { - QueryNodeRPCUrl *url.URL - QueryNodeGRPCUrl *url.URL - TxNodeRPCUrl *url.URL -} - -// RelayMinerProxyConfig is the structure resulting from parsing the proxy -// section of the RelayMiner config file. -// Each proxy embeds a map of supplier configs that are associated with it. -// Other proxy types may embed other fields in the future. eg. "https" may -// embed a TLS config. -type RelayMinerProxyConfig struct { - // ProxyName is the name of the proxy server, used to identify it in the config - ProxyName string - // Type is the transport protocol used by the proxy server like (http, https, etc.) - Type ProxyType - // Host is the host on which the proxy server will listen for incoming - // relay requests - Host string - // XForwardedHostLookup is a flag that indicates whether the proxy server - // should lookup the host from the X-Forwarded-Host header before falling - // back to the Host header. - XForwardedHostLookup bool - // Suppliers is a map of serviceIds -> RelayMinerSupplierConfig - Suppliers map[string]*RelayMinerSupplierConfig -} - -// RelayMinerMetricsConfig is the structure resulting from parsing the metrics -// section of the RelayMiner config file -type RelayMinerMetricsConfig struct { - Enabled bool - Addr string -} - -// RelayMinerSupplierConfig is the structure resulting from parsing the supplier -// section of the RelayMiner config file. -type RelayMinerSupplierConfig struct { - // ServiceId is the serviceId corresponding to the current configuration. - ServiceId string - // Type is the transport protocol used by the supplier, it must match the - // type of the proxy it is associated with. - Type ProxyType - // Hosts is a list of hosts advertised on-chain by the supplier, the corresponding - // proxy server will accept relay requests for these hosts. - Hosts []string - // ServiceConfig is the config of the service that relays will be proxied to. - // Other supplier types may embed other fields in the future. eg. "https" may - // embed a TLS config. - ServiceConfig *RelayMinerSupplierServiceConfig -} - -// RelayMinerSupplierServiceConfig is the structure resulting from parsing the supplier -// service sub-section of the RelayMiner config file. -type RelayMinerSupplierServiceConfig struct { - // Url is the URL of the service that relays will be proxied to. - Url *url.URL - // Authentication is the basic auth structure used to authenticate to the - // request being proxied from the current proxy server. - // If the service the relay requests are forwarded to requires basic auth - // then this field must be populated. - // TODO_TECHDEBT(@red-0ne): Pass the authentication to the service instance - // when the relay request is forwarded to it. - Authentication *RelayMinerSupplierServiceAuthentication - // Headers is a map of headers to be used for other authentication means. - // If the service the relay requests are forwarded to requires header based - // authentication then this field must be populated accordingly. - // For example: { "Authorization": "Bearer " } - // TODO_TECHDEBT(@red-0ne): Add these headers to the forwarded request - // before sending it to the service instance. - Headers map[string]string -} - -// RelayMinerSupplierServiceAuthentication is the structure resulting from parsing -// the supplier service basic auth of the RelayMiner config file when the -// supplier is of type "http" -type RelayMinerSupplierServiceAuthentication struct { - Username string - Password string -} diff --git a/pkg/relayer/interface.go b/pkg/relayer/interface.go deleted file mode 100644 index ba426f9e8..000000000 --- a/pkg/relayer/interface.go +++ /dev/null @@ -1,151 +0,0 @@ -//go:generate mockgen -destination=../../testutil/mockrelayer/relayer_proxy_mock.go -package=mockrelayer . RelayerProxy -//go:generate mockgen -destination=../../testutil/mockrelayer/miner_mock.go -package=mockrelayer . Miner -//go:generate mockgen -destination=../../testutil/mockrelayer/relayer_sessions_manager_mock.go -package=mockrelayer . RelayerSessionsManager - -package relayer - -import ( - "context" - - "github.com/pokt-network/smt" - - "github.com/pokt-network/poktroll/pkg/observable" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// RelaysObservable is an observable which is notified with Relay values. -// -// TODO_HACK: The purpose of this type is to work around gomock's lack of -// support for generic types. For the same reason, this type cannot be an -// alias (i.e. RelaysObservable = observable.Observable[*servicetypes.Relay]). -type RelaysObservable observable.Observable[*servicetypes.Relay] - -// MinedRelaysObservable is an observable which is notified with MinedRelay values. -// -// TODO_HACK: The purpose of this type is to work around gomock's lack of -// support for generic types. For the same reason, this type cannot be an -// alias (i.e. MinedRelaysObservable = observable.Observable[*MinedRelay]). -type MinedRelaysObservable observable.Observable[*MinedRelay] - -// Miner is responsible for observing servedRelayObs, hashing and checking the -// difficulty of each, finally publishing those with sufficient difficulty to -// minedRelayObs as they are applicable for relay volume. -type Miner interface { - MinedRelays( - ctx context.Context, - servedRelayObs RelaysObservable, - ) (minedRelaysObs MinedRelaysObservable) -} - -type MinerOption func(Miner) - -// RelayerProxy is the interface for the proxy that serves relays to the application. -// It is responsible for starting and stopping all supported RelayServers. -// While handling requests and responding in a closed loop, it also notifies -// the miner about the relays that have been served. -type RelayerProxy interface { - // Start starts all advertised relay servers and returns an error if any of them fail to start. - Start(ctx context.Context) error - - // Stop stops all advertised relay servers and returns an error if any of them fail. - Stop(ctx context.Context) error - - // ServedRelays returns an observable that notifies the miner about the relays that have been served. - // A served relay is one whose RelayRequest's signature and session have been verified, - // and its RelayResponse has been signed and successfully sent to the client. - ServedRelays() RelaysObservable - - // VerifyRelayRequest is a shared method used by RelayServers to check the - // relay request signature and session validity. - // TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface - // that should not be responsible for verifying relay requests. - VerifyRelayRequest( - ctx context.Context, - relayRequest *servicetypes.RelayRequest, - service *sharedtypes.Service, - ) error - - // SignRelayResponse is a shared method used by RelayServers to sign - // and append the signature to the RelayResponse. - // TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface - // that should not be responsible for signing relay responses. - SignRelayResponse(relayResponse *servicetypes.RelayResponse) error -} - -type RelayerProxyOption func(RelayerProxy) - -// RelayServer is the interface of the advertised relay servers provided by the RelayerProxy. -type RelayServer interface { - // Start starts the service server and returns an error if it fails. - Start(ctx context.Context) error - - // Stop terminates the service server and returns an error if it fails. - Stop(ctx context.Context) error -} - -// RelayerSessionsManager is responsible for managing the relayer's session lifecycles. -// It handles the creation and retrieval of SMSTs (trees) for a given session, as -// well as the respective and subsequent claim creation and proof submission. -// This is largely accomplished by pipelining observables of relays and sessions -// through a series of map operations. -// -// TODO_TECHDEBT: add architecture diagrams covering observable flows throughout -// the relayer package. -type RelayerSessionsManager interface { - // InsertRelays receives an observable of relays that should be included - // in their respective session's SMST (tree). - InsertRelays(minedRelaysObs MinedRelaysObservable) - - // Start iterates over the session trees at the end of each, respective, session. - // The session trees are piped through a series of map operations which progress - // them through the claim/proof lifecycle, broadcasting transactions to the - // network as necessary. - Start(ctx context.Context) - - // Stop unsubscribes all observables from the InsertRelays observable which - // will close downstream observables as they drain. - // - // TODO_TECHDEBT: Either add a mechanism to wait for draining to complete - // and/or ensure that the state at each pipeline stage is persisted to disk - // and exit as early as possible. - Stop() -} - -type RelayerSessionsManagerOption func(RelayerSessionsManager) - -// SessionTree is an interface that wraps an SMST (Sparse Merkle State Trie) and its corresponding session. -type SessionTree interface { - // GetSessionHeader returns the header of the session corresponding to the SMST. - GetSessionHeader() *sessiontypes.SessionHeader - - // Update is a wrapper for the SMST's Update function. It updates the SMST with - // the given key, value, and weight. - // This function should be called when a Relay has been successfully served. - Update(key, value []byte, weight uint64) error - - // ProveClosest is a wrapper for the SMST's ProveClosest function. It returns the - // proof for the given path. - // This function should be called several blocks after a session has been claimed and needs to be proven. - ProveClosest(path []byte) (proof *smt.SparseMerkleClosestProof, err error) - - // Flush gets the root hash of the SMST needed for submitting the claim; - // then commits the entire tree to disk and stops the KVStore. - // It should be called before submitting the claim on-chain. This function frees up - // the in-memory resources used by the SMST that are no longer needed while waiting - // for the proof submission window to open. - Flush() (SMSTRoot []byte, err error) - - // TODO_DISCUSS: This function should not be part of the interface as it is an optimization - // aiming to free up KVStore resources after the proof is no longer needed. - // Delete deletes the SMST from the KVStore. - // WARNING: This function should be called only after the proof has been successfully - // submitted on-chain and the servicer has confirmed that it has been rewarded. - Delete() error - - // StartClaiming marks the session tree as being picked up for claiming, - // so it won't be picked up by the relayer again. - // It returns an error if it has already been marked as such. - StartClaiming() error -} diff --git a/pkg/relayer/miner/gen/gen_fixtures.go b/pkg/relayer/miner/gen/gen_fixtures.go deleted file mode 100644 index 59071d9ab..000000000 --- a/pkg/relayer/miner/gen/gen_fixtures.go +++ /dev/null @@ -1,304 +0,0 @@ -// NB: ensure this code is never included in any normal builds. -//go:build ignore - -// NB: package MUST be `main` so that it can be run as a binary. -package main - -import ( - "bytes" - "context" - "crypto/rand" - "flag" - "fmt" - "hash" - "log" - "os" - "strings" - "sync" - "time" - - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -const ( - defaultDifficultyBits = 16 - defaultFixtureLimitPerGroup = 5 - defaultRandLength = 16 - defaultOutPath = "relay_fixtures_test.go" -) - -var ( - // flagDifficultyBitsThreshold is the number of leading zero bits that a - // randomized, serialized relay must have to be included in the - // `marshaledMinableRelaysHex` slice which is generated. It is also used as - // the maximum difficulty allowed for relays to be included in the - // `marshaledUnminableRelaysHex` slice. - flagDifficultyBitsThreshold int - - // flagFixtureLimitPerGroup is the number of randomized, serialized relays that will be - // generated for each of `marshaledMinableRelaysHex` and - // `marshaledUnminableRelaysHex`. - flagFixtureLimitPerGroup int - - // flagOut is the path to the generated file. - flagOut string -) - -// TODO_TECHDEBT: remove once marshaling using canonical codec. -type marshalable interface { - Marshal() ([]byte, error) -} - -func init() { - flag.IntVar(&flagDifficultyBitsThreshold, "difficulty-bits-threshold", defaultDifficultyBits, "the number of leading zero bits that a randomized, serialized relay must have to be included in the `marshaledMinableRelaysHex` slice which is generated. It is also used as the maximum difficulty allowed for relays to be included in the `marshaledUnminableRelaysHex` slice.") - flag.IntVar(&flagFixtureLimitPerGroup, "fixture-limit-per-group", defaultFixtureLimitPerGroup, "the number of randomized, serialized relays that will be generated for each of `marshaledMinableRelaysHex` and `marshaledUnminableRelaysHex`.") - flag.StringVar(&flagOut, "out", defaultOutPath, "the path to the generated file.") -} - -// This is utility for generating relay fixtures for testing. It is not intended -// to be used **in/by** any tests but rather is persisted to aid in re-generation -// of relay fixtures should the test requirements change. It generates two slices -// of minedRelays, `marshaledMinableRelaysHex` and `marshaledUnminableRelaysHex`, -// which contain hex encoded strings of serialized relays. The relays in -// `marshaledMinableRelaysHex` have been pre-mined to difficulty 16 by populating -// the signature with random bytes. The relays in `marshaledUnminableRelaysHex` -// have been pre-mined to **exclude** relays with difficulty 16 (or greater). Like -// `marshaledMinableRelaysHex`, this is done by populating the signature with -// random bytes. -// Output file is truncated and overwritten if it already exists. -// -// To regenerate all fixtures, use `make go_testgen_fixtures`; to regenerate only this -// test's fixtures run `go generate ./pkg/relayer/miner/miner_test.go`. -func main() { - flag.Parse() - - ctx, cancelCtx := context.WithCancel(context.Background()) - defer cancelCtx() - - randRelaysObs, errCh := genRandomizedMinedRelayFixtures( - ctx, - defaultRandLength, - miner.DefaultRelayHasher, - ) - exitOnError(errCh) - - outputBuffer := new(bytes.Buffer) - - // Collect the minable relay fixtures into a single string (one relay per line). - marshaledMinableRelaysHex := getMarshaledRelayFmtLines(ctx, randRelaysObs, difficultyGTE) - - // Collect the unminable relay fixtures into a single string (one relay per line). - marshaledUnminableRelaysHex := getMarshaledRelayFmtLines(ctx, randRelaysObs, difficultyLT) - - // Interpolate the collected relay fixtures into the relay fixtures template. - if err := relayFixturesTemplate.Execute( - outputBuffer, - map[string]any{ - "difficultyBitsThreshold": flagDifficultyBitsThreshold, - "MarshaledMinableRelaysHex": marshaledMinableRelaysHex, - "MarshaledUnminableRelaysHex": marshaledUnminableRelaysHex, - }, - ); err != nil { - log.Fatal(err) - } - - // Write the output buffer to the file at flagOut path. - if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { - log.Fatal(err) - } -} - -// genRandomizedMinedRelayFixtures returns an observable of mined relays which -// are generated by randomizing the signature of a relay. It generates these mined -// relay fixtures continuously until the context is canceled. It also returns an -// error channel which will receive any error it encounters while generating. -func genRandomizedMinedRelayFixtures( - ctx context.Context, - randLength int, - newHasher func() hash.Hash, -) (observable.Observable[*relayer.MinedRelay], <-chan error) { - var ( - errCh = make(chan error, 1) - randBzObs, randBzPublishCh = channel.NewObservable[*relayer.MinedRelay]() - ) - - go func() { - for { - select { - case <-ctx.Done(): - return - default: - } - - randBz := make([]byte, randLength) - if _, err := rand.Read(randBz); err != nil { - errCh <- err - return - } - - // Populate a relay with the minimally sufficient randomized data. - relay := servicetypes.Relay{ - Req: &servicetypes.RelayRequest{ - Meta: &servicetypes.RelayRequestMetadata{ - Signature: randBz, - }, - Payload: nil, - }, - Res: nil, - } - - // TODO_BLOCKER: use canonical codec. - relayBz, err := relay.Marshal() - if err != nil { - errCh <- err - return - } - - // Hash relay bytes - relayHash, err := hashBytes(newHasher, relayBz) - if err != nil { - errCh <- err - return - } - - randBzPublishCh <- &relayer.MinedRelay{ - Relay: relay, - Bytes: relayBz, - Hash: relayHash, - } - } - }() - - return randBzObs, errCh -} - -// hashBytes hashes the given bytes using the given hasher. -func hashBytes(newHasher func() hash.Hash, relayBz []byte) ([]byte, error) { - hasher := newHasher() - if _, err := hasher.Write(relayBz); err != nil { - return nil, err - } - - return hasher.Sum(nil), nil -} - -// exitOnError exits the program if an error is received on the given error -// channel. -func exitOnError(errCh <-chan error) { - go func() { - for err := range errCh { - log.Fatalf("ERROR: %s", err) - } - }() -} - -// difficultyGTE returns true if the given hash has a difficulty greater than or -// equal to flagDifficultyBitsThreshold. -func difficultyGTE(hash []byte) bool { - return protocol.MustCountDifficultyBits(hash) >= flagDifficultyBitsThreshold -} - -// difficultyLT returns true if the given hash has a difficulty less than -// flagDifficultyBitsThreshold. -func difficultyLT(hash []byte) bool { - return protocol.MustCountDifficultyBits(hash) < flagDifficultyBitsThreshold -} - -// getMarshaledRelayFmtLines performs two map operations followed by a collect. -// The first map filters mined relays from the given observable, skipping when -// shouldAccept is false. This map, and as a result, all downstream observables -// are closed when flagFixtureLimitPerGroup number of relays have been accepted. -// The second map then marshals, hex-encodes, and formats the filtered mined relay. -// Finally, the collect operation collects the formatted mined relays into a slice -// to return. -func getMarshaledRelayFmtLines( - ctx context.Context, - randRelaysObs observable.Observable[*relayer.MinedRelay], - shouldAccept func(hash []byte) bool, -) string { - ctx, cancelFilterMapCollect := context.WithCancel(ctx) - filteredRelaysObs := filterLimitRelays( - ctx, - cancelFilterMapCollect, - flagFixtureLimitPerGroup, - randRelaysObs, - shouldAccept, - ) - - marshaledFilteredRelayLinesObs := channel.Map( - ctx, filteredRelaysObs, - newMapRelayMarshalLineFmt[*relayer.MinedRelay](relayFixtureLineFmt), - ) - - // Collect the filtered relays and return them (as a slice). - marshaledFilteredRelayLines := channel.Collect(ctx, marshaledFilteredRelayLinesObs) - return strings.Join(marshaledFilteredRelayLines, "\n") -} - -// filterLimitRelays maps over the given observable of mined relays, skipping when -// the given shouldAppend function returns false. Once flagFixtureLimitPerGroup -// number of relay fixtures have been mapped, it calls the given cancel function. -func filterLimitRelays( - ctx context.Context, - cancel context.CancelFunc, - limit int, - randRelaysObs observable.Observable[*relayer.MinedRelay], - shouldCollect func(hash []byte) bool, -) observable.Observable[*relayer.MinedRelay] { - var ( - counterMu sync.Mutex - minedRelayAcceptCounter = 0 - minedRelayRejectCounter = 0 - ) - - return channel.Map(ctx, randRelaysObs, - func( - _ context.Context, - minedRelay *relayer.MinedRelay, - ) (_ *relayer.MinedRelay, skip bool) { - counterMu.Lock() - defer counterMu.Unlock() - - // At the start of each iteration, check if the relayCounter has reached - // the limit. If so, cancel the ctx to stop the map operation. - if minedRelayAcceptCounter >= limit { - // Wait a tick for the map to complete as the observable drains - // asynchronously. - time.Sleep(time.Millisecond) - cancel() - return nil, true - } - - // Skip if shouldCollect returns false. - if !shouldCollect(minedRelay.Hash) { - minedRelayRejectCounter++ - return nil, true - } - - minedRelayAcceptCounter++ - return minedRelay, false - }, - ) -} - -// newMapRelayMarshalLineFmt returns a MapFn which formats the given marshalable -// as a hex-encoded string with the given line format string. -func newMapRelayMarshalLineFmt[T marshalable](lineFmt string) channel.MapFn[T, string] { - return func( - _ context.Context, - marsh T, - ) (_ string, skip bool) { - // TODO_BLOCKER: marshal using canonical codec. - minedRelayBz, err := marsh.Marshal() - if err != nil { - log.Fatal(err) - } - - return fmt.Sprintf(lineFmt, minedRelayBz), false - } -} diff --git a/pkg/relayer/miner/gen/template.go b/pkg/relayer/miner/gen/template.go deleted file mode 100644 index c75e761a4..000000000 --- a/pkg/relayer/miner/gen/template.go +++ /dev/null @@ -1,37 +0,0 @@ -package main - -import "text/template" - -var ( - relayFixtureLineFmt = "\t\t\"%x\"," - relayFixturesTemplate = template.Must( - template.New("relay_fixtures_test.go").Parse( - `// DO NOT EDIT: this file was generated by gen/gen_fixtures.go, -// changes made will be overwritten upon regeneration. -// -// To regenerate all fixtures, use make go_testgen_fixture; to regenerate only this -// test's fixtures run go generate ./pkg/relayer/miner/miner_test.go. -package miner_test - -var ( - // marshaledMinableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to difficulty {{.difficultyBitsThreshold}} by - // populating the signature with random bytes. It is intended for use - // in tests. - marshaledMinableRelaysHex = []string{ -{{.MarshaledMinableRelaysHex}} - } - - // marshaledUnminableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to **exclude** relays with - // difficulty {{.difficultyBitsThreshold}} (or greater). Like marshaledMinableRelaysHex, this is done - // by populating the signature with random bytes. It is intended for use in - // tests. - marshaledUnminableRelaysHex = []string{ -{{.MarshaledUnminableRelaysHex}} - } -) -`, - ), - ) -) diff --git a/pkg/relayer/miner/miner.go b/pkg/relayer/miner/miner.go deleted file mode 100644 index c3b062a04..000000000 --- a/pkg/relayer/miner/miner.go +++ /dev/null @@ -1,137 +0,0 @@ -package miner - -import ( - "context" - "crypto/sha256" - "hash" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/filter" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -var ( - _ relayer.Miner = (*miner)(nil) - // TODO_TECHDEBT(@h5law): Retrieve the relay hasher mechanism from the `smt` repo. - DefaultRelayHasher = sha256.New - // TODO_BLOCKER: query on-chain governance params once available. - // Setting this to 0 to effectively disables mining for now. - // I.e., all relays are added to the tree. - defaultRelayDifficultyBits = 0 -) - -// Miner is responsible for observing servedRelayObs, hashing and checking the -// difficulty of each, finally publishing those with sufficient difficulty to -// minedRelayObs as they are applicable for relay volume. -// -// Available options: -// - WithDifficulty -// -// TODO_BLOCKER: The relay hashing and relay difficulty mechanisms & values must come -// from on-chain. -type miner struct { - // relayHasher is a function which returns a hash.Hash interfact type. It is - // used to hash serialized relays to measure their mining difficulty. - relayHasher func() hash.Hash - // relayDifficultyBits is the minimum difficulty that a relay must have to be - // volume / reward applicable. - relayDifficultyBits int -} - -// NewMiner creates a new miner from the given dependencies and options. It -// returns an error if it has not been sufficiently configured or supplied. -func NewMiner( - opts ...relayer.MinerOption, -) (*miner, error) { - mnr := &miner{} - - for _, opt := range opts { - opt(mnr) - } - - mnr.setDefaults() - - return mnr, nil -} - -// MinedRelays maps servedRelaysObs through a pipeline which: -// 1. Hashes the relay -// 2. Checks if it's above the mining difficulty -// 3. Adds it to the session tree if so -// It DOES NOT BLOCK as map operations run in their own goroutines. -func (mnr *miner) MinedRelays( - ctx context.Context, - servedRelaysObs relayer.RelaysObservable, -) relayer.MinedRelaysObservable { - // NB: must cast back to generic observable type to use with Map. - // relayer.RelaysObervable cannot be an alias due to gomock's lack of - // support for generic types. - relaysObs := observable.Observable[*servicetypes.Relay](servedRelaysObs) - - // Map servedRelaysObs to a new observable of an either type, populated with - // the minedRelay or an error. It is notified after the relay has been mined - // or an error has been encountered, respectively. - eitherMinedRelaysObs := channel.Map(ctx, relaysObs, mnr.mapMineRelay) - logging.LogErrors(ctx, filter.EitherError(ctx, eitherMinedRelaysObs)) - - return filter.EitherSuccess(ctx, eitherMinedRelaysObs) -} - -// setDefaults ensures that the miner has been configured with a hasherConstructor and uses -// the default hasherConstructor if not. -func (mnr *miner) setDefaults() { - if mnr.relayHasher == nil { - mnr.relayHasher = DefaultRelayHasher - } - - if mnr.relayDifficultyBits == 0 { - mnr.relayDifficultyBits = defaultRelayDifficultyBits - } -} - -// mapMineRelay is intended to be used as a MapFn. -// 1. It hashes the relay and compares its difficult to the minimum threshold. -// 2. If the relay difficulty is sufficient -> return an Either[MineRelay Value] -// 3. If an error is encountered -> return an Either[error] -// 4. Otherwise, skip the relay. -func (mnr *miner) mapMineRelay( - _ context.Context, - relay *servicetypes.Relay, -) (_ either.Either[*relayer.MinedRelay], skip bool) { - // TODO_BLOCKER: marshal using canonical codec. - relayBz, err := relay.Marshal() - if err != nil { - return either.Error[*relayer.MinedRelay](err), false - } - - // TODO_BLOCKER: Centralize the logic of hashing a relay. It should live - // alongside signing & verification. - // - // TODO_IMPROVE: We need to hash the key; it would be nice if smst.Update() could do it - // since smst has a reference to the hasherConstructor - relayHash := mnr.hash(relayBz) - - // The relay IS NOT volume / reward applicable - if protocol.MustCountDifficultyBits(relayHash) < mnr.relayDifficultyBits { - return either.Success[*relayer.MinedRelay](nil), true - } - - // The relay IS volume / reward applicable - return either.Success(&relayer.MinedRelay{ - Relay: *relay, - Bytes: relayBz, - Hash: relayHash, - }), false -} - -// hash constructs a new hasher and hashes the given input bytes. -func (mnr *miner) hash(inputBz []byte) []byte { - hasher := mnr.relayHasher() - hasher.Write(inputBz) - return hasher.Sum(nil) -} diff --git a/pkg/relayer/miner/miner_test.go b/pkg/relayer/miner/miner_test.go deleted file mode 100644 index 9366f4121..000000000 --- a/pkg/relayer/miner/miner_test.go +++ /dev/null @@ -1,145 +0,0 @@ -//go:generate go run gen/gen_fixtures.go gen/template.go -// (see: https://pkg.go.dev/cmd/go/internal/generate) -// (see: https://go.googlesource.com/proposal/+/refs/heads/master/design/go-generate.md) - -package miner_test - -import ( - "context" - "encoding/hex" - "hash" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/miner" - "github.com/pokt-network/poktroll/testutil/testrelayer" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -const testDifficulty = 16 - -// TestMiner_MinedRelays constructs an observable of mined relays, through which -// it pipes pre-mined relay fixtures. It asserts that the observable only emits -// mined relays with difficulty equal to or greater than testDifficulty. -// -// To regenerate all fixtures, use `make go_testgen_fixtures`; to regenerate only this -// test's fixtures run `go generate ./pkg/relayer/miner/miner_test.go`. -func TestMiner_MinedRelays(t *testing.T) { - var ( - minedRelayCounter = 0 - ctx = context.Background() - actualMinedRelaysMu sync.Mutex - actualMinedRelays []*relayer.MinedRelay - mockRelaysObs, relaysFixturePublishCh = channel.NewObservable[*servicetypes.Relay]() - expectedMinedRelays = unmarshalHexMinedRelays( - t, marshaledMinableRelaysHex, - miner.DefaultRelayHasher, - ) - ) - - mnr, err := miner.NewMiner(miner.WithDifficulty(testDifficulty)) - require.NoError(t, err) - - minedRelays := mnr.MinedRelays(ctx, mockRelaysObs) - minedRelaysObserver := minedRelays.Subscribe(ctx) - - // Subscribe to the mined relays observable and append them to the - // actualMinedRelays slice asynchronously. - go func() { - for minedRelay := range minedRelaysObserver.Ch() { - actualMinedRelaysMu.Lock() - actualMinedRelays = append(actualMinedRelays, minedRelay) - minedRelayCounter++ - actualMinedRelaysMu.Unlock() - } - }() - - // Publish unminable relay fixtures to the mock relays observable. - publishRelayFixtures(t, marshaledUnminableRelaysHex, relaysFixturePublishCh) - time.Sleep(time.Millisecond) - - // Assert that no unminable relay fixtures were published to minedRelays. - actualMinedRelaysMu.Lock() - require.Empty(t, actualMinedRelays) - actualMinedRelaysMu.Unlock() - - // Publish minable relay fixtures to the relay fixtures observable. - publishRelayFixtures(t, marshaledMinableRelaysHex, relaysFixturePublishCh) - time.Sleep(time.Millisecond) - - // Assert that all minable relay fixtures were published to minedRelays. - actualMinedRelaysMu.Lock() - require.EqualValues(t, expectedMinedRelays, actualMinedRelays) - actualMinedRelaysMu.Unlock() -} - -func publishRelayFixtures( - t *testing.T, - marshalledRelaysHex []string, - mockRelaysPublishCh chan<- *servicetypes.Relay, -) { - t.Helper() - - for _, marshalledRelayHex := range marshalledRelaysHex { - relay := unmarshalHexRelay(t, marshalledRelayHex) - - mockRelaysPublishCh <- relay - } -} - -func unmarshalHexRelay( - t *testing.T, - marshalledHexRelay string, -) *servicetypes.Relay { - t.Helper() - - relayBz, err := hex.DecodeString(marshalledHexRelay) - require.NoError(t, err) - - var relay servicetypes.Relay - err = relay.Unmarshal(relayBz) - require.NoError(t, err) - - return &relay -} - -func unmarshalHexMinedRelays( - t *testing.T, - marshalledHexMinedRelays []string, - newHasher func() hash.Hash, -) (relays []*relayer.MinedRelay) { - t.Helper() - - for _, marshalledRelayHex := range marshalledHexMinedRelays { - relays = append(relays, unmarshalHexMinedRelay(t, marshalledRelayHex, newHasher)) - } - return relays -} - -func unmarshalHexMinedRelay( - t *testing.T, - marshalledHexMinedRelay string, - newHasher func() hash.Hash, -) *relayer.MinedRelay { - t.Helper() - - relayBz, err := hex.DecodeString(marshalledHexMinedRelay) - require.NoError(t, err) - - var relay servicetypes.Relay - err = relay.Unmarshal(relayBz) - require.NoError(t, err) - - relayHashBz := testrelayer.HashBytes(t, newHasher, relayBz) - - return &relayer.MinedRelay{ - Relay: relay, - Bytes: relayBz, - Hash: relayHashBz, - } -} diff --git a/pkg/relayer/miner/options.go b/pkg/relayer/miner/options.go deleted file mode 100644 index fae783d85..000000000 --- a/pkg/relayer/miner/options.go +++ /dev/null @@ -1,11 +0,0 @@ -package miner - -import "github.com/pokt-network/poktroll/pkg/relayer" - -// WithDifficulty sets the difficulty of the miner, where difficultyBytes is the -// minimum number of leading zero bytes. -func WithDifficulty(difficultyBits int) relayer.MinerOption { - return func(mnr relayer.Miner) { - mnr.(*miner).relayDifficultyBits = difficultyBits - } -} diff --git a/pkg/relayer/miner/relay_fixtures_test.go b/pkg/relayer/miner/relay_fixtures_test.go deleted file mode 100644 index c32dd4509..000000000 --- a/pkg/relayer/miner/relay_fixtures_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// DO NOT EDIT: this file was generated by gen/gen_fixtures.go, -// changes made will be overwritten upon regeneration. -// -// To regenerate all fixtures, use make go_testgen_fixture; to regenerate only this -// test's fixtures run go generate ./pkg/relayer/miner/miner_test.go. -package miner_test - -var ( - // marshaledMinableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to difficulty 16 by - // populating the signature with random bytes. It is intended for use - // in tests. - marshaledMinableRelaysHex = []string{ - "0a140a121210bffa0b5c3f03c71f93d7611af54ba80b", - "0a140a1212106655cb3dccaada7837b094962d65426d", - "0a140a121210b19bcf19e96cb58bb37bae3a1769fc08", - "0a140a121210146014db743850694ce211403e91c451", - "0a140a12121016da74aea084a4d40aebf61d876809d4", - } - - // marshaledUnminableRelaysHex are the hex encoded strings of serialized - // relayer.MinedRelays which have been pre-mined to **exclude** relays with - // difficulty 16 (or greater). Like marshaledMinableRelaysHex, this is done - // by populating the signature with random bytes. It is intended for use in - // tests. - marshaledUnminableRelaysHex = []string{ - "0a140a12121070b059e32e4149bcded39d8eb0186fce", - "0a140a121210f5bb373e3d6cabe04675083ac4ffc36e", - "0a140a1212104ae2b0539ecd82ec56bf23b276d543c1", - "0a140a121210d4238199f9e52347b46d060c477b464e", - "0a140a1212103118a0689c4eb883e384d12378bc61e2", - } -) diff --git a/pkg/relayer/protocol/block_heights.go b/pkg/relayer/protocol/block_heights.go deleted file mode 100644 index bb0676737..000000000 --- a/pkg/relayer/protocol/block_heights.go +++ /dev/null @@ -1,68 +0,0 @@ -package protocol - -import ( - "context" - "encoding/binary" - "fmt" - "math/rand" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// GetEarliestCreateClaimHeight returns the earliest block height at which a claim -// for a session with the given createClaimWindowStartHeight can be created. -// -// TODO_TEST(@bryanchriswhite): Add test coverage and more logs -func GetEarliestCreateClaimHeight(ctx context.Context, createClaimWindowStartBlock client.Block) int64 { - logger := polylog.Ctx(ctx) - - createClaimWindowStartBlockHash := createClaimWindowStartBlock.Hash() - logger.Debug(). - Int64( - "create_claim_window_start_block", - createClaimWindowStartBlock.Height(), - ). - Str( - "create_claim_window_start_block_hash", - // TODO_TECHDEBT: add polylog.Event#Hex() type method. - fmt.Sprintf("%x", createClaimWindowStartBlockHash), - ) - rngSeed, _ := binary.Varint(createClaimWindowStartBlockHash) - randomNumber := rand.NewSource(rngSeed).Int63() - - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // randCreateClaimHeightOffset := randomNumber % (claimproofparams.GovCreateClaimIntervalBlocks - claimproofparams.GovCreateClaimWindowBlocks - 1) - _ = randomNumber - randCreateClaimHeightOffset := int64(0) - - return createClaimWindowStartBlock.Height() + randCreateClaimHeightOffset -} - -// GetEarliestSubmitProofHeight returns the earliest block height at which a proof -// for a session with the given submitProofWindowStartHeight can be submitted. -// -// TODO_TEST(@bryanchriswhite): Add test coverage and more logs -func GetEarliestSubmitProofHeight(ctx context.Context, submitProofWindowStartBlock client.Block) int64 { - logger := polylog.Ctx(ctx) - - earliestSubmitProofBlockHash := submitProofWindowStartBlock.Hash() - logger.Debug(). - Int64( - "submit_proof_window_start_block", - submitProofWindowStartBlock.Height(), - ). - Str( - "submit_proof_window_start_block_hash", - fmt.Sprintf("%x", earliestSubmitProofBlockHash), - ) - rngSeed, _ := binary.Varint(earliestSubmitProofBlockHash) - randomNumber := rand.NewSource(rngSeed).Int63() - - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // randSubmitProofHeightOffset := randomNumber % (claimproofparams.GovSubmitProofIntervalBlocks - claimproofparams.GovSubmitProofWindowBlocks - 1) - _ = randomNumber - randSubmitProofHeightOffset := int64(0) - - return submitProofWindowStartBlock.Height() + randSubmitProofHeightOffset -} diff --git a/pkg/relayer/protocol/difficulty.go b/pkg/relayer/protocol/difficulty.go deleted file mode 100644 index a33c4bac6..000000000 --- a/pkg/relayer/protocol/difficulty.go +++ /dev/null @@ -1,42 +0,0 @@ -package protocol - -import ( - "math/bits" -) - -// TODO_BLOCKER: Revisit this part of the algorithm after initial TestNet Launch. -// TODO_TEST: Add extensive tests for the core relay mining business logic. - -// MustCountDifficultyBits returns the number of leading zero bits in the given -// byte slice. It panics if an error is encountered. -func MustCountDifficultyBits(bz []byte) int { - diff, err := CountDifficultyBits(bz) - if err != nil { - panic(err) - } - - return diff -} - -// CountDifficultyBits returns the number of leading zero bits in the given byte -// slice. It returns an error if the byte slice is all zero bits. -func CountDifficultyBits(bz []byte) (int, error) { - bzLen := len(bz) - - var zeroBits int - for byteIdx, byteValue := range bz { - if byteValue != 0 { - zeroBits = bits.LeadingZeros8(byteValue) - if zeroBits == 8 { - // we already checked that byteValue != 0. - return 0, ErrDifficulty.Wrap("impossible code path") - } - - // We have byteIdx bytes that are all 0s and one byte that has - // zeroBits number of leading 0 bits. - return (byteIdx)*8 + zeroBits, nil - } - } - - return 0, ErrDifficulty.Wrapf("difficulty matches bytes length: %d; bytes (hex): % x", bzLen, bz) -} diff --git a/pkg/relayer/protocol/difficulty_test.go b/pkg/relayer/protocol/difficulty_test.go deleted file mode 100644 index ae5548634..000000000 --- a/pkg/relayer/protocol/difficulty_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package protocol_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer/protocol" -) - -func TestCountDifficultyBits(t *testing.T) { - tests := []struct { - bz []byte - difficulty int - }{ - { - bz: []byte{0b11111111, 255, 255, 255}, - difficulty: 0, - }, - { - bz: []byte{0b01111111, 255, 255, 255}, - difficulty: 1, - }, - { - bz: []byte{0, 255, 255, 255}, - difficulty: 8, - }, - { - bz: []byte{0, 0b01111111, 255, 255}, - difficulty: 9, - }, - { - bz: []byte{0, 0b00111111, 255, 255}, - difficulty: 10, - }, - { - bz: []byte{0, 0, 255, 255}, - difficulty: 16, - }, - } - - for _, tt := range tests { - t.Run(fmt.Sprintf("difficulty_%d_zero_bits", tt.difficulty), func(t *testing.T) { - actualDifficulty, err := protocol.CountDifficultyBits(tt.bz) - require.NoError(t, err) - require.Equal(t, tt.difficulty, actualDifficulty) - }) - } -} - -func TestCountDifficultyBits_Error(t *testing.T) { - _, err := protocol.CountDifficultyBits([]byte{0, 0, 0, 0}) - require.ErrorIs(t, err, protocol.ErrDifficulty) - require.ErrorContains(t, err, "difficulty matches bytes length") -} diff --git a/pkg/relayer/protocol/errors.go b/pkg/relayer/protocol/errors.go deleted file mode 100644 index f578bf8e0..000000000 --- a/pkg/relayer/protocol/errors.go +++ /dev/null @@ -1,8 +0,0 @@ -package protocol - -import errorsmod "cosmossdk.io/errors" - -var ( - ErrDifficulty = errorsmod.New(codespace, 1, "difficulty error") - codespace = "relayer/protocol" -) diff --git a/pkg/relayer/proxy/error_reply.go b/pkg/relayer/proxy/error_reply.go deleted file mode 100644 index 54272d787..000000000 --- a/pkg/relayer/proxy/error_reply.go +++ /dev/null @@ -1,46 +0,0 @@ -package proxy - -import ( - "context" - "net/http" - - "github.com/pokt-network/poktroll/pkg/partials" - "github.com/pokt-network/poktroll/x/service/types" -) - -// replyWithError builds the appropriate error format according to the payload -// using the passed in error and writes it to the writer. -// NOTE: This method is used to reply with an "internal" error that is related -// to the proxy itself and not to the relayed request. -func (sync *synchronousRPCServer) replyWithError( - ctx context.Context, - payloadBz []byte, - writer http.ResponseWriter, - proxyName string, - serviceId string, - err error, -) { - relaysErrorsTotal.With("service_id", serviceId, "proxy_name", proxyName).Add(1) - - responseBz, err := partials.GetErrorReply(ctx, payloadBz, err) - if err != nil { - sync.logger.Error().Err(err).Str("service_id", serviceId).Str("proxy_name", proxyName).Msg( - "failed getting error reply") - return - } - - relayResponse := &types.RelayResponse{Payload: responseBz} - - relayResponseBz, err := relayResponse.Marshal() - if err != nil { - sync.logger.Error().Err(err).Str("service_id", serviceId).Str("proxy_name", proxyName).Msg( - "failed marshaling relay response") - return - } - - if _, err = writer.Write(relayResponseBz); err != nil { - sync.logger.Error().Err(err).Str("service_id", serviceId).Str("proxy_name", proxyName).Msg( - "failed writing relay response") - return - } -} diff --git a/pkg/relayer/proxy/errors.go b/pkg/relayer/proxy/errors.go deleted file mode 100644 index 84604e836..000000000 --- a/pkg/relayer/proxy/errors.go +++ /dev/null @@ -1,20 +0,0 @@ -package proxy - -import ( - sdkerrors "cosmossdk.io/errors" -) - -var ( - codespace = "relayer_proxy" - ErrRelayerProxyUnsupportedRPCType = sdkerrors.Register(codespace, 1, "unsupported relayer proxy rpc type") - ErrRelayerProxyInvalidRelayRequestSignature = sdkerrors.Register(codespace, 2, "invalid relay request signature") - ErrRelayerProxyInvalidSession = sdkerrors.Register(codespace, 3, "invalid session in relayer request") - ErrRelayerProxyInvalidSupplier = sdkerrors.Register(codespace, 4, "invalid relayer proxy supplier") - ErrRelayerProxyUndefinedSigningKeyName = sdkerrors.Register(codespace, 5, "undefined relayer proxy signing key name") - ErrRelayerProxyUndefinedProxiedServicesEndpoints = sdkerrors.Register(codespace, 6, "undefined proxied services endpoints for relayer proxy") - ErrRelayerProxyInvalidRelayRequest = sdkerrors.Register(codespace, 7, "invalid relay request") - ErrRelayerProxyInvalidRelayResponse = sdkerrors.Register(codespace, 8, "invalid relay response") - ErrRelayerProxyEmptyRelayRequestSignature = sdkerrors.Register(codespace, 9, "empty relay response signature") - ErrRelayerProxyServiceEndpointNotHandled = sdkerrors.Register(codespace, 10, "service endpoint not handled by relayer proxy") - ErrRelayerProxyUnsupportedTransportType = sdkerrors.Register(codespace, 11, "unsupported proxy transport type") -) diff --git a/pkg/relayer/proxy/options.go b/pkg/relayer/proxy/options.go deleted file mode 100644 index ab9344c95..000000000 --- a/pkg/relayer/proxy/options.go +++ /dev/null @@ -1,21 +0,0 @@ -package proxy - -import ( - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" -) - -// WithSigningKeyName sets the signing key name used by the relayer proxy to sign relay responses. -// It is used along with the keyring to get the supplier address and sign the relay responses. -func WithSigningKeyName(keyName string) relayer.RelayerProxyOption { - return func(relProxy relayer.RelayerProxy) { - relProxy.(*relayerProxy).signingKeyName = keyName - } -} - -// WithProxiedServicesEndpoints sets the endpoints of the proxied services. -func WithProxiedServicesEndpoints(proxyConfig map[string]*config.RelayMinerProxyConfig) relayer.RelayerProxyOption { - return func(relProxy relayer.RelayerProxy) { - relProxy.(*relayerProxy).proxyConfigs = proxyConfig - } -} diff --git a/pkg/relayer/proxy/proxy.go b/pkg/relayer/proxy/proxy.go deleted file mode 100644 index ec9f5a1c4..000000000 --- a/pkg/relayer/proxy/proxy.go +++ /dev/null @@ -1,172 +0,0 @@ -package proxy - -import ( - "context" - - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "golang.org/x/sync/errgroup" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/x/service/types" -) - -var _ relayer.RelayerProxy = (*relayerProxy)(nil) - -// relayerProxy is the main relayer proxy that takes relay requests of supported services from the client -// and proxies them to the supported proxied services. -// It is responsible for notifying the miner about the relays that have been served so they can be counted -// when the miner enters the claim/proof phase. -// TODO_TEST: Have tests for the relayer proxy. -type relayerProxy struct { - logger polylog.Logger - - // signingKeyName is the supplier's key name in the Cosmos's keybase. It is used along with the keyring to - // get the supplier address and sign the relay responses. - signingKeyName string - keyring keyring.Keyring - - // blockClient is the client used to get the block at the latest height from the blockchain - // and be notified of new incoming blocks. It is used to update the current session data. - blockClient client.BlockClient - - // supplierQuerier is the querier used to get the supplier's advertised information from the blockchain, - // which contains the supported services, RPC types, and endpoints, etc... - supplierQuerier client.SupplierQueryClient - - // sessionQuerier is the querier used to get the current session from the blockchain, - // which is needed to check if the relay proxy should be serving an incoming relay request. - sessionQuerier client.SessionQueryClient - - // proxyServers is a map of proxyName -> RelayServer provided by the relayer proxy, - // where proxyName is the name of the proxy defined in the config file and - // RelayServer is the server that listens for incoming relay requests. - proxyServers map[string]relayer.RelayServer - - // proxyConfigs is a map of proxyName -> RelayMinerProxyConfig where proxyName - // is the name of the proxy defined in the config file and RelayMinerProxyConfig - // is the configuration of the proxy. - proxyConfigs map[string]*config.RelayMinerProxyConfig - - // servedRelays is an observable that notifies the miner about the relays that have been served. - servedRelays relayer.RelaysObservable - - // servedRelaysPublishCh is a channel that emits the relays that have been served so that the - // servedRelays observable can fan out the notifications to its subscribers. - servedRelaysPublishCh chan<- *types.Relay - - // ringCache is used to obtain and store the ring for the application. - ringCache crypto.RingCache - - // supplierAddress is the address of the supplier that the relayer proxy is running for. - supplierAddress string -} - -// NewRelayerProxy creates a new relayer proxy with the given dependencies or returns -// an error if the dependencies fail to resolve or the options are invalid. -// -// Required dependencies: -// - cosmosclient.Context -// - client.BlockClient -// -// Available options: -// - WithSigningKeyName -// - WithProxiedServicesEndpoints -func NewRelayerProxy( - deps depinject.Config, - opts ...relayer.RelayerProxyOption, -) (relayer.RelayerProxy, error) { - rp := &relayerProxy{} - - if err := depinject.Inject( - deps, - &rp.logger, - &rp.blockClient, - &rp.ringCache, - &rp.supplierQuerier, - &rp.sessionQuerier, - &rp.keyring, - ); err != nil { - return nil, err - } - - servedRelays, servedRelaysProducer := channel.NewObservable[*types.Relay]() - - rp.servedRelays = servedRelays - rp.servedRelaysPublishCh = servedRelaysProducer - - for _, opt := range opts { - opt(rp) - } - - if err := rp.validateConfig(); err != nil { - return nil, err - } - - return rp, nil -} - -// Start concurrently starts all advertised relay services and returns an error -// if any of them errors. -// This method IS BLOCKING until all RelayServers are stopped. -func (rp *relayerProxy) Start(ctx context.Context) error { - // The provided services map is built from the supplier's on-chain advertised information, - // which is a runtime parameter that can be changed by the supplier. - // NOTE: We build the provided services map at Start instead of NewRelayerProxy to avoid having to - // return an error from the constructor. - if err := rp.BuildProvidedServices(ctx); err != nil { - return err - } - - // Start the ring cache. - rp.ringCache.Start(ctx) - - startGroup, ctx := errgroup.WithContext(ctx) - - for _, relayServer := range rp.proxyServers { - server := relayServer // create a new variable scoped to the anonymous function - startGroup.Go(func() error { return server.Start(ctx) }) - } - - return startGroup.Wait() -} - -// Stop concurrently stops all advertised relay servers and returns an error if any of them fails. -// This method is blocking until all RelayServers are stopped. -func (rp *relayerProxy) Stop(ctx context.Context) error { - stopGroup, ctx := errgroup.WithContext(ctx) - - for _, relayServer := range rp.proxyServers { - // Create a new object (i.e. deep copy) variable scoped to the anonymous function below - server := relayServer - stopGroup.Go(func() error { return server.Stop(ctx) }) - } - - return stopGroup.Wait() -} - -// ServedRelays returns an observable that notifies the miner about the relays that have been served. -// A served relay is one whose RelayRequest's signature and session have been verified, -// and its RelayResponse has been signed and successfully sent to the client. -func (rp *relayerProxy) ServedRelays() relayer.RelaysObservable { - return rp.servedRelays -} - -// validateConfig validates the relayer proxy's configuration options and returns an error if it is invalid. -// TODO_TEST: Add tests for validating these configurations. -func (rp *relayerProxy) validateConfig() error { - if rp.signingKeyName == "" { - return ErrRelayerProxyUndefinedSigningKeyName - } - - if rp.proxyConfigs == nil || len(rp.proxyConfigs) == 0 { - return ErrRelayerProxyUndefinedProxiedServicesEndpoints - } - - return nil -} diff --git a/pkg/relayer/proxy/proxy_test.go b/pkg/relayer/proxy/proxy_test.go deleted file mode 100644 index 58ca8e3cc..000000000 --- a/pkg/relayer/proxy/proxy_test.go +++ /dev/null @@ -1,765 +0,0 @@ -package proxy_test - -import ( - "bytes" - "context" - "fmt" - "io" - "net/http" - "net/url" - "strings" - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/pkg/relayer/proxy" - "github.com/pokt-network/poktroll/testutil/testproxy" - servicetypes "github.com/pokt-network/poktroll/x/service/types" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -const ( - blockHeight = 1 - defaultService = "service1" - secondaryService = "service2" - thirdService = "service3" - defaultProxyServer = "server1" - secondaryProxyServer = "server2" -) - -var ( - // helpers used for tests that are initialized in init() - supplierKeyName string - - // supplierEndpoints is the map of serviceName -> []SupplierEndpoint - // where serviceName is the name of the service the supplier staked for - // and SupplierEndpoint is the endpoint of the service advertised on-chain - // by the supplier - supplierEndpoints map[string][]*sharedtypes.SupplierEndpoint - - // appPrivateKey is the private key of the application that is used to sign - // relay responses. - // It is also used in these tests to derive the public key and address of the - // application. - appPrivateKey *secp256k1.PrivKey - - // proxiedServices is the parsed configuration of the RelayMinerProxyConfig - proxiedServices map[string]*config.RelayMinerProxyConfig - - // defaultRelayerProxyBehavior is the list of functions that are used to - // define the behavior of the RelayerProxy in the tests. - defaultRelayerProxyBehavior []func(*testproxy.TestBehavior) -) - -func init() { - supplierKeyName = "supplierKeyName" - appPrivateKey = secp256k1.GenPrivKey() - - supplierEndpoints = map[string][]*sharedtypes.SupplierEndpoint{ - defaultService: { - { - Url: "http://supplier:8545/", - // TODO_EXTEND: Consider adding support for non JSON RPC services in the future - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - secondaryService: { - { - Url: "http://supplier:8546/", - RpcType: sharedtypes.RPCType_GRPC, - }, - }, - thirdService: { - { - Url: "http://supplier:8547/", - RpcType: sharedtypes.RPCType_GRPC, - }, - }, - } - - proxiedServices = map[string]*config.RelayMinerProxyConfig{ - defaultProxyServer: { - ProxyName: defaultProxyServer, - Type: config.ProxyTypeHTTP, - Host: "127.0.0.1:8080", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - defaultService: { - ServiceId: defaultService, - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8545"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, - }, - }, - secondaryService: { - ServiceId: secondaryService, - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8546"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8546", Path: "/"}, - }, - }, - }, - }, - secondaryProxyServer: { - ProxyName: secondaryProxyServer, - Type: config.ProxyTypeHTTP, - Host: "127.0.0.1:8081", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - thirdService: { - ServiceId: thirdService, - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8547"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8547", Path: "/"}, - }, - }, - }, - }, - } - - defaultRelayerProxyBehavior = []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), - testproxy.WithRelayerProxiedServices(proxiedServices), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), - } -} - -// RelayerProxy should start and stop without errors -func TestRelayerProxy_StartAndStop(t *testing.T) { - ctx := context.TODO() - // Setup the RelayerProxy instrumented behavior - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - // Create a RelayerProxy - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - // Start RelayerProxy - go rp.Start(ctx) - // Block so relayerProxy has sufficient time to start - time.Sleep(100 * time.Millisecond) - - // Test that RelayerProxy is handling requests (ignoring the actual response content) - res, err := http.DefaultClient.Get(fmt.Sprintf("http://%s/", proxiedServices[defaultProxyServer].Host)) - require.NoError(t, err) - require.NotNil(t, res) - - // Test that RelayerProxy is handling requests from the other server - res, err = http.DefaultClient.Get(fmt.Sprintf("http://%s/", proxiedServices[secondaryProxyServer].Host)) - require.NoError(t, err) - require.NotNil(t, res) - - // Stop RelayerProxy - err = rp.Stop(ctx) - require.NoError(t, err) -} - -// RelayerProxy should fail to start if the signing key is not found in the keyring -func TestRelayerProxy_InvalidSupplierKeyName(t *testing.T) { - ctx := context.TODO() - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName("wrongKeyName"), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.Error(t, err) -} - -// RelayerProxy should fail to build if the signing key name is not provided -func TestRelayerProxy_MissingSupplierKeyName(t *testing.T) { - ctx := context.TODO() - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - _, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(""), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.Error(t, err) -} - -// RelayerProxy should fail to build if the proxied services endpoints are not provided -func TestRelayerProxy_NoProxiedServices(t *testing.T) { - ctx := context.TODO() - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) - - _, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(make(map[string]*config.RelayMinerProxyConfig)), - ) - require.Error(t, err) -} - -// RelayerProxy should fail to start if it cannot spawn a server for the -// services it advertized on-chain. -func TestRelayerProxy_UnsupportedRpcType(t *testing.T) { - ctx := context.TODO() - - unsupportedSupplierEndpoint := map[string][]*sharedtypes.SupplierEndpoint{ - defaultService: { - { - Url: "http://unsupported:8545/jsonrpc", - // TODO_EXTEND: Consider adding support for non JSON RPC services in the future - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - } - - unsupportedRPCTypeBehavior := []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), - testproxy.WithRelayerProxiedServices(proxiedServices), - - // The supplier is staked on-chain but the service it provides is not supported by the proxy - testproxy.WithDefaultSupplier(supplierKeyName, unsupportedSupplierEndpoint), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), - } - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedRPCTypeBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.Error(t, err) -} - -func TestRelayerProxy_UnsupportedTransportType(t *testing.T) { - ctx := context.TODO() - - badTransportSupplierEndpoints := map[string][]*sharedtypes.SupplierEndpoint{ - defaultService: { - { - Url: "xttp://supplier:8545/", - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - } - - unsupportedTransportProxy := map[string]*config.RelayMinerProxyConfig{ - defaultProxyServer: { - ProxyName: defaultProxyServer, - // The proxy is configured with an unsupported transport type - Type: config.ProxyType(100), - Host: "127.0.0.1:8080", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - defaultService: { - ServiceId: defaultService, - // The proxy is configured with an unsupported transport type - Type: config.ProxyType(100), - Hosts: []string{"supplier:8545"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, - }, - }, - }, - }, - } - - unsupportedTransportTypeBehavior := []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), - - // The proxy is configured with an unsupported transport type for the proxy - testproxy.WithRelayerProxiedServices(unsupportedTransportProxy), - testproxy.WithDefaultSupplier(supplierKeyName, badTransportSupplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), - } - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedTransportTypeBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(unsupportedTransportProxy), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.ErrorIs(t, err, proxy.ErrRelayerProxyUnsupportedTransportType) -} - -func TestRelayerProxy_NonConfiguredSupplierServices(t *testing.T) { - ctx := context.TODO() - - missingServicesProxy := map[string]*config.RelayMinerProxyConfig{ - defaultProxyServer: { - ProxyName: defaultProxyServer, - Type: config.ProxyTypeHTTP, - Host: "127.0.0.1:8080", - Suppliers: map[string]*config.RelayMinerSupplierConfig{ - defaultService: { - ServiceId: defaultService, - Type: config.ProxyTypeHTTP, - Hosts: []string{"supplier:8545"}, - ServiceConfig: &config.RelayMinerSupplierServiceConfig{ - Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, - }, - }, - }, - }, - } - - unsupportedTransportTypeBehavior := []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), - - // The proxy is configured with an unsupported transport type for the proxy - testproxy.WithRelayerProxiedServices(missingServicesProxy), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), - } - - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedTransportTypeBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(missingServicesProxy), - ) - require.NoError(t, err) - - err = rp.Start(ctx) - require.ErrorIs(t, err, proxy.ErrRelayerProxyServiceEndpointNotHandled) -} - -// Test different RelayRequest scenarios -func TestRelayerProxy_Relays(t *testing.T) { - // blockOutsideSessionGracePeriod is the block height that is after the first - // session's grace period and within the second session's grace period, - // meaning a relay should not be handled at this block height. - blockOutsideSessionGracePeriod := blockHeight + - sessionkeeper.NumBlocksPerSession + - sessionkeeper.GetSessionGracePeriodBlockCount() - - // blockWithinSessionGracePeriod is the block height that is after the first - // session but within its session's grace period, meaning a relay should be - // handled at this block height. - blockWithinSessionGracePeriod := blockHeight + sessionkeeper.GetSessionGracePeriodBlockCount() - - tests := []struct { - desc string - // RelayerProxy instrumented behavior - relayerProxyBehavior []func(*testproxy.TestBehavior) - // Input scenario builds a RelayRequest, marshals it and sends it to the RelayerProxy - inputScenario func( - t *testing.T, - test *testproxy.TestBehavior, - ) (errCode int32, errMsg string) - - // The request result should return any error form the http.DefaultClient.Do call. - // We infer the behavior from the response's code and message prefix - expectedErrCode int32 - expectedErrMsg string - }{ - { - desc: "Unparsable relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithUnparsableBody, - - // expectedErrCode is because the proxy won't be able to unmarshal the request - // so it does not know how to format the error response - expectedErrCode: 0, - expectedErrMsg: "cannot unmarshal request payload", - }, - { - desc: "Missing session meta from relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithMissingMeta, - - expectedErrCode: -32000, - expectedErrMsg: "missing meta from relay request", - }, - { - desc: "Missing signature from relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithMissingSignature, - - expectedErrCode: -32000, - expectedErrMsg: "missing signature from relay request", - }, - { - desc: "Invalid signature associated with relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithInvalidSignature, - - expectedErrCode: -32000, - expectedErrMsg: "error deserializing ring signature", - }, - { - desc: "Missing session header application address associated with relay request", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithMissingSessionHeaderApplicationAddress, - - expectedErrCode: -32000, - expectedErrMsg: "missing application address from relay request", - }, - { - desc: "Non staked application address", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithNonStakedApplicationAddress, - - expectedErrCode: -32000, - expectedErrMsg: "error getting ring for application address", - }, - { - desc: "Ring signature mismatch", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithRingSignatureMismatch, - - expectedErrCode: -32000, - expectedErrMsg: "ring signature does not match ring for application address", - }, - { - desc: "Session mismatch", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithDifferentSession, - - expectedErrCode: -32000, - expectedErrMsg: "session mismatch", - }, - { - desc: "Invalid relay supplier", - - relayerProxyBehavior: []func(*testproxy.TestBehavior){ - testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), - testproxy.WithRelayerProxiedServices(proxiedServices), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - // Missing session supplier - testproxy.WithDefaultSessionSupplier("", defaultService, appPrivateKey), - }, - inputScenario: sendRequestWithInvalidRelaySupplier, - - expectedErrCode: -32000, - expectedErrMsg: "error while trying to retrieve a session", - }, - { - desc: "Relay request signature does not match the request payload", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithSignatureForDifferentPayload, - - expectedErrCode: -32000, - expectedErrMsg: "invalid ring signature", - }, - { - desc: "Successful relay", - - relayerProxyBehavior: defaultRelayerProxyBehavior, - inputScenario: sendRequestWithSuccessfulReply, - - expectedErrCode: 0, - expectedErrMsg: "", - }, - { - desc: "Successful late relay with session grace period", - - relayerProxyBehavior: []func(*testproxy.TestBehavior){ - // blockHeight is past the first session but within its session grace period - testproxy.WithRelayerProxyDependenciesForBlockHeight( - supplierKeyName, - blockWithinSessionGracePeriod, - ), - testproxy.WithRelayerProxiedServices(proxiedServices), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - // Add 2 sessions, with the first one being within the withing grace period - // and the second one being the current session - testproxy.WithSuccessiveSessions(supplierKeyName, defaultService, appPrivateKey, 2), - }, - inputScenario: sendRequestWithCustomSessionHeight(blockHeight), - - expectedErrCode: 0, - expectedErrMsg: "", // Relay handled successfully - }, - { - desc: "Failed late relay outside session grace period", - - relayerProxyBehavior: []func(*testproxy.TestBehavior){ - // blockHeight is past the first session's grace period - testproxy.WithRelayerProxyDependenciesForBlockHeight( - supplierKeyName, - // Set the current block height value returned by the block provider - blockOutsideSessionGracePeriod, - ), - testproxy.WithRelayerProxiedServices(proxiedServices), - testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), - testproxy.WithDefaultApplication(appPrivateKey), - // Add 3 sessions, with the first one that is no longer within its - // session grace period - testproxy.WithSuccessiveSessions(supplierKeyName, defaultService, appPrivateKey, 3), - }, - // Send a request that has a late session past the grace period - inputScenario: sendRequestWithCustomSessionHeight(blockHeight), - - expectedErrCode: -32000, - expectedErrMsg: "session expired", // Relay rejected by the supplier - }, - } - - ctx := context.TODO() - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - ctx, cancel := context.WithCancel(ctx) - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, tt.relayerProxyBehavior...) - - rp, err := proxy.NewRelayerProxy( - test.Deps, - proxy.WithSigningKeyName(supplierKeyName), - proxy.WithProxiedServicesEndpoints(proxiedServices), - ) - require.NoError(t, err) - - go rp.Start(ctx) - // Block so relayerProxy has sufficient time to start - time.Sleep(100 * time.Millisecond) - - errCode, errMsg := tt.inputScenario(t, test) - require.Equal(t, tt.expectedErrCode, errCode) - require.True(t, strings.HasPrefix(errMsg, tt.expectedErrMsg)) - - cancel() - }) - } -} - -func sendRequestWithUnparsableBody( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - // Send non JSONRpc payload when the post request specifies json - reader := io.NopCloser(bytes.NewReader([]byte("invalid request"))) - - res, err := http.DefaultClient.Post( - fmt.Sprintf("http://%s", proxiedServices[defaultProxyServer].Host), - "application/json", - reader, - ) - require.NoError(t, err) - require.NotNil(t, res) - - return testproxy.GetRelayResponseError(t, res) -} - -func sendRequestWithMissingMeta( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - - req := &servicetypes.RelayRequest{ - // RelayRequest is missing Metadata - Payload: testproxy.PrepareJsonRPCRequestPayload(), - } - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithMissingSignature( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = nil - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithInvalidSignature( - t *testing.T, - test *testproxy.TestBehavior, -) (errorCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = []byte("invalid signature") - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithMissingSessionHeaderApplicationAddress( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - randomPrivKey := secp256k1.GenPrivKey() - req := testproxy.GenerateRelayRequest( - test, - randomPrivKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - - // The application address is missing from the session header - req.Meta.SessionHeader.ApplicationAddress = "" - - // Assign a valid but random ring signature so that the request is not rejected - // before looking at the application address - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithNonStakedApplicationAddress( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - randomPrivKey := secp256k1.GenPrivKey() - req := testproxy.GenerateRelayRequest( - test, - randomPrivKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - - // Have a valid signature from the non staked key - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithRingSignatureMismatch( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - - // The signature is valid but does not match the ring for the application address - randomPrivKey := secp256k1.GenPrivKey() - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithDifferentSession( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - // Use secondaryService instead of service1 so the session IDs don't match - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - secondaryService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithInvalidRelaySupplier( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithSignatureForDifferentPayload( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, appPrivateKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - // Alter the request payload so the hash doesn't match the one used by the signature - req.Payload = []byte(`{"method":"someMethod","id":1,"jsonrpc":"2.0","params":["alteredParam"]}`) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -func sendRequestWithSuccessfulReply( - t *testing.T, - test *testproxy.TestBehavior, -) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - defaultService, - blockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) -} - -// sendRequestWithCustomSessionHeight is a helper function that generates a `RelayRequest` -// with a `Session` that contains the given `requestSessionBlockHeight` and sends it to the -// `RelayerProxy`. -func sendRequestWithCustomSessionHeight( - requestSessionBlockHeight int64, -) func(t *testing.T, test *testproxy.TestBehavior) (errCode int32, errorMessage string) { - return func(t *testing.T, test *testproxy.TestBehavior) (errCode int32, errorMessage string) { - req := testproxy.GenerateRelayRequest( - test, - appPrivateKey, - defaultService, - requestSessionBlockHeight, - testproxy.PrepareJsonRPCRequestPayload(), - ) - req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) - - return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) - } -} diff --git a/pkg/relayer/proxy/relay_builders.go b/pkg/relayer/proxy/relay_builders.go deleted file mode 100644 index c6e9c9a77..000000000 --- a/pkg/relayer/proxy/relay_builders.go +++ /dev/null @@ -1,53 +0,0 @@ -package proxy - -import ( - "io" - "net/http" - - "github.com/pokt-network/poktroll/x/service/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -// newRelayRequest builds a RelayRequest from an http.Request. -func (sync *synchronousRPCServer) newRelayRequest(request *http.Request) (*types.RelayRequest, error) { - requestBz, err := io.ReadAll(request.Body) - if err != nil { - return nil, err - } - - sync.logger.Debug().Msg("unmarshaling relay request") - - var relayReq types.RelayRequest - if err := relayReq.Unmarshal(requestBz); err != nil { - sync.logger.Debug().Msg("unmarshaling relay request failed") - return nil, err - } - - return &relayReq, nil -} - -// newRelayResponse builds a RelayResponse from an http.Response and a SessionHeader. -// It also signs the RelayResponse and assigns it to RelayResponse.Meta.SupplierSignature. -// The response's Body is passed directly into the RelayResponse.Payload field. -func (sync *synchronousRPCServer) newRelayResponse( - response *http.Response, - sessionHeader *sessiontypes.SessionHeader, -) (*types.RelayResponse, error) { - relayResponse := &types.RelayResponse{ - Meta: &types.RelayResponseMetadata{SessionHeader: sessionHeader}, - } - - responseBz, err := io.ReadAll(response.Body) - if err != nil { - return nil, err - } - - relayResponse.Payload = responseBz - - // Sign the relay response and add the signature to the relay response metadata - if err = sync.relayerProxy.SignRelayResponse(relayResponse); err != nil { - return nil, err - } - - return relayResponse, nil -} diff --git a/pkg/relayer/proxy/relay_signer.go b/pkg/relayer/proxy/relay_signer.go deleted file mode 100644 index 347bf6228..000000000 --- a/pkg/relayer/proxy/relay_signer.go +++ /dev/null @@ -1,34 +0,0 @@ -package proxy - -import ( - sdkerrors "cosmossdk.io/errors" - - "github.com/pokt-network/poktroll/pkg/signer" - "github.com/pokt-network/poktroll/x/service/types" -) - -// SignRelayResponse is a shared method used by the RelayServers to sign the hash of the RelayResponse. -// It uses the keyring and keyName to sign the payload and returns the signature. -// TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface -// that should not be responsible for signing relay responses. -// See https://github.com/pokt-network/poktroll/issues/160 for a better design. -func (rp *relayerProxy) SignRelayResponse(relayResponse *types.RelayResponse) error { - // create a simple signer for the request - signer := signer.NewSimpleSigner(rp.keyring, rp.signingKeyName) - - // extract and hash the relay response's signable bytes - signableBz, err := relayResponse.GetSignableBytesHash() - if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error getting signable bytes: %v", err) - } - - // sign the relay response - responseSig, err := signer.Sign(signableBz) - if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error signing relay response: %v", err) - } - - // set the relay response's signature - relayResponse.Meta.SupplierSignature = responseSig - return nil -} diff --git a/pkg/relayer/proxy/relay_verifier.go b/pkg/relayer/proxy/relay_verifier.go deleted file mode 100644 index 60c1458e0..000000000 --- a/pkg/relayer/proxy/relay_verifier.go +++ /dev/null @@ -1,168 +0,0 @@ -package proxy - -import ( - "context" - - sdkerrors "cosmossdk.io/errors" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ring "github.com/noot/ring-go" - - sessiontypes "github.com/pokt-network/poktroll/pkg/relayer/session" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// VerifyRelayRequest is a shared method used by RelayServers to check the relay request signature and session validity. -func (rp *relayerProxy) VerifyRelayRequest( - ctx context.Context, - relayRequest *types.RelayRequest, - service *sharedtypes.Service, -) error { - rp.logger.Debug(). - Fields(map[string]any{ - "session_id": relayRequest.Meta.SessionHeader.SessionId, - "application_address": relayRequest.Meta.SessionHeader.ApplicationAddress, - "service_id": relayRequest.Meta.SessionHeader.Service.Id, - }). - Msg("verifying relay request signature") - - // extract the relay request's ring signature - if relayRequest.Meta == nil { - return ErrRelayerProxyEmptyRelayRequestSignature.Wrapf( - "request payload: %s", relayRequest.Payload, - ) - } - signature := relayRequest.Meta.Signature - if signature == nil { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequest, - "missing signature from relay request: %v", relayRequest, - ) - } - - ringSig := new(ring.RingSig) - if err := ringSig.Deserialize(ring_secp256k1.NewCurve(), signature); err != nil { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequestSignature, - "error deserializing ring signature: %v", err, - ) - } - - if relayRequest.Meta.SessionHeader.ApplicationAddress == "" { - return sdkerrors.Wrap( - ErrRelayerProxyInvalidRelayRequest, - "missing application address from relay request", - ) - } - - // get the ring for the application address of the relay request - appAddress := relayRequest.Meta.SessionHeader.ApplicationAddress - appRing, err := rp.ringCache.GetRingForAddress(ctx, appAddress) - if err != nil { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequest, - "error getting ring for application address %s: %v", appAddress, err, - ) - } - - // verify the ring signature against the ring - if !ringSig.Ring().Equals(appRing) { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequestSignature, - "ring signature does not match ring for application address %s", appAddress, - ) - } - - // get and hash the signable bytes of the relay request - requestSignableBz, err := relayRequest.GetSignableBytesHash() - if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayRequest, "error getting signable bytes: %v", err) - } - - // verify the relay request's signature - if valid := ringSig.Verify(requestSignableBz); !valid { - return sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequestSignature, - "invalid ring signature", - ) - } - - // Query for the current session to check if relayRequest sessionId matches the current session. - rp.logger.Debug(). - Fields(map[string]any{ - "session_id": relayRequest.Meta.SessionHeader.SessionId, - "application_address": relayRequest.Meta.SessionHeader.ApplicationAddress, - "service_id": relayRequest.Meta.SessionHeader.Service.Id, - }). - Msg("verifying relay request session") - - sessionBlockHeight, err := rp.getTargetSessionBlockHeight(ctx, relayRequest) - if err != nil { - return err - } - - session, err := rp.sessionQuerier.GetSession( - ctx, - appAddress, - service.Id, - sessionBlockHeight, - ) - - if err != nil { - return err - } - - // Since the retrieved sessionId was in terms of: - // - the current block height and sessionGracePeriod (which are not provided by the relayRequest) - // - serviceId (which is not provided by the relayRequest) - // - applicationAddress (which is used to to verify the relayRequest signature) - // we can reduce the session validity check to checking if the retrieved session's sessionId - // matches the relayRequest sessionId. - // TODO_INVESTIGATE: Revisit the assumptions above at some point in the future, but good enough for now. - if session.SessionId != relayRequest.Meta.SessionHeader.SessionId { - return ErrRelayerProxyInvalidSession.Wrapf( - "session mismatch, expecting: %+v, got: %+v", - session.Header, - relayRequest.Meta.SessionHeader, - ) - } - - // Check if the relayRequest is allowed to be served by the relayer proxy. - for _, supplier := range session.Suppliers { - if supplier.Address == rp.supplierAddress { - return nil - } - } - - return ErrRelayerProxyInvalidSupplier -} - -// getTargetSessionBlockHeight returns the block height at which the session -// for the given relayRequest should be processed. If the session is within the -// grace period, the session's end block height is returned. Otherwise, -// the current block height is returned. -// If the session has expired, then return an error. -func (rp *relayerProxy) getTargetSessionBlockHeight( - ctx context.Context, - relayRequest *types.RelayRequest, -) (sessionBlockHeight int64, err error) { - currentBlockHeight := rp.blockClient.LastNBlocks(ctx, 1)[0].Height() - sessionEndblockHeight := relayRequest.Meta.SessionHeader.GetSessionEndBlockHeight() - - // Check if the `RelayRequest`'s session has expired. - if sessionEndblockHeight < currentBlockHeight { - // Do not process the `RelayRequest` if the session has expired and the current - // block height is outside the session's grace period. - if sessiontypes.IsWithinGracePeriod(sessionEndblockHeight, currentBlockHeight) { - return sessionEndblockHeight, nil - } - - return 0, ErrRelayerProxyInvalidSession.Wrapf( - "session expired, expecting: %d, got: %d", - sessionEndblockHeight, - currentBlockHeight, - ) - } - - return currentBlockHeight, nil -} diff --git a/pkg/relayer/proxy/server_builder.go b/pkg/relayer/proxy/server_builder.go deleted file mode 100644 index 02c96cbe8..000000000 --- a/pkg/relayer/proxy/server_builder.go +++ /dev/null @@ -1,109 +0,0 @@ -package proxy - -import ( - "context" - "net/url" - - "golang.org/x/exp/slices" - - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// BuildProvidedServices builds the advertised relay servers from the supplier's on-chain advertised services. -// It populates the relayerProxy's `advertisedRelayServers` map of servers for each service, where each server -// is responsible for listening for incoming relay requests and relaying them to the supported proxied service. -func (rp *relayerProxy) BuildProvidedServices(ctx context.Context) error { - // Get the supplier address from the keyring - supplierKey, err := rp.keyring.Key(rp.signingKeyName) - if err != nil { - return err - } - - supplierAddress, err := supplierKey.GetAddress() - if err != nil { - return err - } - - // Get the supplier's advertised information from the blockchain - supplier, err := rp.supplierQuerier.GetSupplier(ctx, supplierAddress.String()) - if err != nil { - return err - } - - // Check that the supplier's advertised services' endpoints are present in - // the proxy config and handled by a proxy host - // Iterate over the supplier's advertised services then iterate over each - // service's endpoint - for _, service := range supplier.Services { - for _, endpoint := range service.Endpoints { - endpointUrl, err := url.Parse(endpoint.Url) - if err != nil { - return err - } - found := false - // Iterate over the proxy configs and check if `endpointUrl` is present - // in any of the proxy config's suppliers' service's hosts - for _, proxyConfig := range rp.proxyConfigs { - supplierService, ok := proxyConfig.Suppliers[service.Service.Id] - if ok && slices.Contains(supplierService.Hosts, endpointUrl.Host) { - found = true - break - } - } - - if !found { - return ErrRelayerProxyServiceEndpointNotHandled.Wrapf( - "service endpoint %s not handled by proxy", - endpoint.Url, - ) - } - } - } - - rp.supplierAddress = supplier.Address - - if rp.proxyServers, err = rp.initializeProxyServers(supplier.Services); err != nil { - return err - } - - return nil -} - -// initializeProxyServers initializes the proxy servers for each proxy config. -func (rp *relayerProxy) initializeProxyServers( - supplierServices []*sharedtypes.SupplierServiceConfig, -) (proxyServerMap map[string]relayer.RelayServer, err error) { - // Build a map of serviceId -> service for the supplier's advertised services - supplierServiceMap := make(map[string]*sharedtypes.Service) - for _, service := range supplierServices { - supplierServiceMap[service.Service.Id] = service.Service - } - - // Build a map of proxyName -> RelayServer for each proxy defined in the config file - proxyServers := make(map[string]relayer.RelayServer) - - for _, proxyConfig := range rp.proxyConfigs { - rp.logger.Info().Str("proxy host", proxyConfig.Host).Msg("starting relay proxy server") - - // TODO(@h5law): Implement a switch that handles all synchronous - // RPC types in one server type and asynchronous RPC types in another - // to create the appropriate RelayServer. - // Initialize the proxy server according to the proxy type defined in the config file - switch proxyConfig.Type { - case config.ProxyTypeHTTP: - proxyServers[proxyConfig.ProxyName] = NewSynchronousServer( - rp.logger, - proxyConfig, - supplierServiceMap, - rp.servedRelaysPublishCh, - rp, - ) - default: - return nil, ErrRelayerProxyUnsupportedTransportType - } - } - - return proxyServers, nil -} diff --git a/pkg/relayer/proxy/synchronous.go b/pkg/relayer/proxy/synchronous.go deleted file mode 100644 index 57353f566..000000000 --- a/pkg/relayer/proxy/synchronous.go +++ /dev/null @@ -1,285 +0,0 @@ -package proxy - -import ( - "bytes" - "context" - "io" - "net/http" - "net/url" - "time" - - sdkerrors "cosmossdk.io/errors" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/config" - "github.com/pokt-network/poktroll/x/service/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -var _ relayer.RelayServer = (*synchronousRPCServer)(nil) - -// synchronousRPCServer is the struct that holds the state of the synchronous -// RPC server. It is used to listen for and respond to relay requests where -// there is a one-to-one correspondence between relay requests and relay responses. -type synchronousRPCServer struct { - logger polylog.Logger - - // supplierServiceMap is a map of serviceId -> SupplierServiceConfig - // representing the supplier's advertised services. - supplierServiceMap map[string]*sharedtypes.Service - - // proxyConfig is the configuration of the proxy server. It contains the - // host address of the server, the service endpoint, and the advertised service. - // endpoints it gets relay requests from. - proxyConfig *config.RelayMinerProxyConfig - - // server is the HTTP server that listens for incoming relay requests. - server *http.Server - - // relayerProxy is the main relayer proxy that the server uses to perform its operations. - relayerProxy relayer.RelayerProxy - - // servedRelaysProducer is a channel that emits the relays that have been served, allowing - // the servedRelays observable to fan-out notifications to its subscribers. - servedRelaysProducer chan<- *types.Relay -} - -// NewSynchronousServer creates a new HTTP server that listens for incoming -// relay requests and forwards them to the supported proxied service endpoint. -// It takes the serviceId, endpointUrl, and the main RelayerProxy as arguments -// and returns a RelayServer that listens to incoming RelayRequests. -func NewSynchronousServer( - logger polylog.Logger, - proxyConfig *config.RelayMinerProxyConfig, - supplierServiceMap map[string]*sharedtypes.Service, - servedRelaysProducer chan<- *types.Relay, - proxy relayer.RelayerProxy, -) relayer.RelayServer { - return &synchronousRPCServer{ - logger: logger, - supplierServiceMap: supplierServiceMap, - server: &http.Server{Addr: proxyConfig.Host}, - relayerProxy: proxy, - servedRelaysProducer: servedRelaysProducer, - proxyConfig: proxyConfig, - } -} - -// Start starts the service server and returns an error if it fails. -// It also waits for the passed in context to end before shutting down. -// This method is blocking and should be called in a goroutine. -func (sync *synchronousRPCServer) Start(ctx context.Context) error { - go func() { - <-ctx.Done() - sync.server.Shutdown(ctx) - }() - - // Set the HTTP handler. - sync.server.Handler = sync - - return sync.server.ListenAndServe() -} - -// Stop terminates the service server and returns an error if it fails. -func (sync *synchronousRPCServer) Stop(ctx context.Context) error { - return sync.server.Shutdown(ctx) -} - -// ServeHTTP listens for incoming relay requests. It implements the respective -// method of the http.Handler interface. It is called by http.ListenAndServe() -// when synchronousRPCServer is used as an http.Handler with an http.Server. -// (see https://pkg.go.dev/net/http#Handler) -func (sync *synchronousRPCServer) ServeHTTP(writer http.ResponseWriter, request *http.Request) { - startTime := time.Now() - ctx := request.Context() - - var originHost string - // When the proxy is behind a reverse proxy, or is getting its requests from - // a CDN or a load balancer, the host header may not contain the on-chain - // advertized address needed to determine the service that the relay request is for. - // These CDNs and reverse proxies usually set the X-Forwarded-Host header - // to the original host. - // RelayMiner operators that have such a setup can set the XForwardedHostLookup - // option to true in the proxy config to enable the proxy to look up the - // original host from the X-Forwarded-Host header. - // Get the original host from X-Forwarded-Host header if specified in the proxy - // config and fall back to the Host header if it is not specified. - if sync.proxyConfig.XForwardedHostLookup { - originHost = request.Header.Get("X-Forwarded-Host") - } - - if originHost == "" { - originHost = request.Host - } - - var supplierService *sharedtypes.Service - var serviceUrl *url.URL - - // Get the Service and serviceUrl corresponding to the originHost. - // TODO_IMPROVE(red-0ne): Checking that the originHost is currently done by - // iterating over the proxy config's suppliers and checking if the originHost - // is present in any of the supplier's service's hosts. We could improve this - // by building a map at the server initialization level with originHost as the - // key so that we can get the service and serviceUrl in O(1) time. - for _, supplierServiceConfig := range sync.proxyConfig.Suppliers { - for _, host := range supplierServiceConfig.Hosts { - if host == originHost { - supplierService = sync.supplierServiceMap[supplierServiceConfig.ServiceId] - serviceUrl = supplierServiceConfig.ServiceConfig.Url - break - } - } - - if serviceUrl != nil { - break - } - } - - if supplierService == nil || serviceUrl == nil { - sync.replyWithError( - ctx, - []byte{}, - writer, - sync.proxyConfig.ProxyName, - "unknown", - ErrRelayerProxyServiceEndpointNotHandled, - ) - return - } - - // Increment the relays counter. - relaysTotal.With("proxy_name", sync.proxyConfig.ProxyName, "service_id", supplierService.Id).Add(1) - defer func() { - duration := time.Since(startTime).Seconds() - - // Capture the relay request duration metric. - relaysDurationSeconds.With( - "proxy_name", sync.proxyConfig.ProxyName, - "service_id", supplierService.Id).Observe(duration) - }() - - sync.logger.Debug().Msg("serving synchronous relay request") - - // Extract the relay request from the request body. - sync.logger.Debug().Msg("extracting relay request from request body") - relayRequest, err := sync.newRelayRequest(request) - if err != nil { - sync.replyWithError(ctx, []byte{}, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) - sync.logger.Warn().Err(err).Msg("failed serving relay request") - return - } - - if relayRequest.Meta == nil { - err = sdkerrors.Wrapf( - ErrRelayerProxyInvalidRelayRequest, - "missing meta from relay request: %v", relayRequest, - ) - sync.replyWithError(ctx, relayRequest.Payload, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) - sync.logger.Warn().Err(err).Msg("relay request metadata is nil which could be a result of failed unmashaling") - return - } - - // Relay the request to the proxied service and build the response that will be sent back to the client. - relay, err := sync.serveHTTP(ctx, serviceUrl, supplierService, request, relayRequest) - if err != nil { - // Reply with an error if the relay could not be served. - sync.replyWithError(ctx, relayRequest.Payload, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) - sync.logger.Warn().Err(err).Msg("failed serving relay request") - return - } - - // Send the relay response to the client. - if err := sync.sendRelayResponse(relay.Res, writer); err != nil { - sync.replyWithError(ctx, relayRequest.Payload, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) - sync.logger.Warn().Err(err).Msg("failed sending relay response") - return - } - - sync.logger.Info().Fields(map[string]any{ - "application_address": relay.Res.Meta.SessionHeader.ApplicationAddress, - "service_id": relay.Res.Meta.SessionHeader.Service.Id, - "session_start_height": relay.Res.Meta.SessionHeader.SessionStartBlockHeight, - "server_addr": sync.server.Addr, - }).Msg("relay request served successfully") - - // Emit the relay to the servedRelays observable. - sync.servedRelaysProducer <- relay -} - -// serveHTTP holds the underlying logic of ServeHTTP. -func (sync *synchronousRPCServer) serveHTTP( - ctx context.Context, - serviceUrl *url.URL, - supplierService *sharedtypes.Service, - request *http.Request, - relayRequest *types.RelayRequest, -) (*types.Relay, error) { - // Verify the relay request signature and session. - // TODO_TECHDEBT(red-0ne): Currently, the relayer proxy is responsible for verifying - // the relay request signature. This responsibility should be shifted to the relayer itself. - // Consider using a middleware pattern to handle non-proxy specific logic, such as - // request signature verification, session verification, and response signature. - // This would help in separating concerns and improving code maintainability. - // See https://github.com/pokt-network/poktroll/issues/160 - if err := sync.relayerProxy.VerifyRelayRequest(ctx, relayRequest, supplierService); err != nil { - return nil, err - } - - // Get the relayRequest payload's `io.ReadCloser` to add it to the http.Request - // that will be sent to the proxied (i.e. staked for) service. - // (see https://pkg.go.dev/net/http#Request) Body field type. - requestBodyReader := io.NopCloser(bytes.NewBuffer(relayRequest.Payload)) - sync.logger.Debug(). - Str("request_payload", string(relayRequest.Payload)). - Msg("serving relay request") - - // Build the request to be sent to the native service by substituting - // the destination URL's host with the native service's listen address. - sync.logger.Debug(). - Str("destination_url", serviceUrl.String()). - Msg("building relay request payload to service") - - relayHTTPRequest := &http.Request{ - Method: request.Method, - Header: request.Header, - URL: serviceUrl, - Host: serviceUrl.Host, - Body: requestBodyReader, - } - - // Send the relay request to the native service. - httpResponse, err := http.DefaultClient.Do(relayHTTPRequest) - if err != nil { - return nil, err - } - - // Build the relay response from the native service response - // Use relayRequest.Meta.SessionHeader on the relayResponse session header since it was verified to be valid - // and has to be the same as the relayResponse session header. - sync.logger.Debug(). - Str("relay_request_session_header", relayRequest.Meta.SessionHeader.String()). - Msg("building relay response protobuf from service response") - - relayResponse, err := sync.newRelayResponse(httpResponse, relayRequest.Meta.SessionHeader) - if err != nil { - return nil, err - } - - return &types.Relay{Req: relayRequest, Res: relayResponse}, nil -} - -// sendRelayResponse marshals the relay response and sends it to the client. -func (sync *synchronousRPCServer) sendRelayResponse( - relayResponse *types.RelayResponse, - writer http.ResponseWriter, -) error { - cdc := types.ModuleCdc - relayResponseBz, err := cdc.Marshal(relayResponse) - if err != nil { - return err - } - - _, err = writer.Write(relayResponseBz) - return err -} diff --git a/pkg/relayer/relayminer.go b/pkg/relayer/relayminer.go deleted file mode 100644 index cf64b9c84..000000000 --- a/pkg/relayer/relayminer.go +++ /dev/null @@ -1,98 +0,0 @@ -package relayer - -import ( - "context" - "net" - "net/http" - - "cosmossdk.io/depinject" - "github.com/prometheus/client_golang/prometheus/promhttp" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// relayMiner is the main struct that encapsulates the relayer's responsibilities (i.e. Relay Mining). -// It starts and stops the RelayerProxy and provide the served relays observable to the miner. -type relayMiner struct { - logger polylog.Logger - relayerProxy RelayerProxy - miner Miner - relayerSessionsManager RelayerSessionsManager -} - -// NewRelayMiner creates a new Relayer instance with the given dependencies. -// It injects the dependencies into the Relayer instance and returns it. -// -// Required dependencies: -// - RelayerProxy -// - Miner -// - RelayerSessionsManager -func NewRelayMiner(ctx context.Context, deps depinject.Config) (*relayMiner, error) { - rel := &relayMiner{ - logger: polylog.Ctx(ctx), - } - - if err := depinject.Inject( - deps, - &rel.relayerProxy, - &rel.miner, - &rel.relayerSessionsManager, - ); err != nil { - return nil, err - } - - // Set up relay pipeline - servedRelaysObs := rel.relayerProxy.ServedRelays() - minedRelaysObs := rel.miner.MinedRelays(ctx, servedRelaysObs) - rel.relayerSessionsManager.InsertRelays(minedRelaysObs) - - return rel, nil -} - -// Start provides the miner with the served relays observable and starts the relayer proxy. -// This method is blocking while the relayer proxy is running and returns when Stop is called -// or when the relayer proxy fails to start. -func (rel *relayMiner) Start(ctx context.Context) error { - // relayerSessionsManager.Start does not block. - // Set up the session (proof/claim) lifecycle pipeline. - rel.logger.Info().Msg("starting relayer sessions manager") - rel.relayerSessionsManager.Start(ctx) - - // Start the flow of relays by starting relayer proxy. - // This is a blocking call as it waits for the waitgroup in relayerProxy.Start() - // that starts all the relay servers to be done. - rel.logger.Info().Msg("starting relayer proxy") - if err := rel.relayerProxy.Start(ctx); err != nil { - return err - } - - rel.logger.Info().Msg("relayer proxy stopped; exiting") - return nil -} - -// Stop stops the relayer proxy which in turn stops all advertised relay servers -// and unsubscribes the miner from the served relays observable. -func (rel *relayMiner) Stop(ctx context.Context) error { - rel.relayerSessionsManager.Stop() - return rel.relayerProxy.Stop(ctx) -} - -// Starts a metrics server on the given address. -func (rel *relayMiner) ServeMetrics(addr string) error { - ln, err := net.Listen("tcp", addr) - if err != nil { - rel.logger.Error().Err(err).Msg("failed to listen on address for metrics") - return err - } - - // If no error, start the server in a new goroutine - go func() { - rel.logger.Info().Str("endpoint", addr).Msg("serving metrics") - if err := http.Serve(ln, promhttp.Handler()); err != nil { - rel.logger.Error().Err(err).Msg("metrics server failed") - return - } - }() - - return nil -} diff --git a/pkg/relayer/relayminer_test.go b/pkg/relayer/relayminer_test.go deleted file mode 100644 index f7de39d39..000000000 --- a/pkg/relayer/relayminer_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package relayer_test - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/testutil/testrelayer" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -func TestRelayMiner_StartAndStop(t *testing.T) { - srObs, _ := channel.NewObservable[*servicetypes.Relay]() - servedRelaysObs := relayer.RelaysObservable(srObs) - - mrObs, _ := channel.NewObservable[*relayer.MinedRelay]() - minedRelaysObs := relayer.MinedRelaysObservable(mrObs) - - ctx := polyzero.NewLogger().WithContext(context.Background()) - relayerProxyMock := testrelayer.NewMockOneTimeRelayerProxy( - ctx, t, - servedRelaysObs, - ) - - minerMock := testrelayer.NewMockOneTimeMiner( - ctx, t, - servedRelaysObs, - minedRelaysObs, - ) - - relayerSessionsManagerMock := testrelayer.NewMockOneTimeRelayerSessionsManager( - ctx, t, - minedRelaysObs, - ) - - deps := depinject.Supply( - relayerProxyMock, - minerMock, - relayerSessionsManagerMock, - ) - - relayminer, err := relayer.NewRelayMiner(ctx, deps) - require.NoError(t, err) - require.NotNil(t, relayminer) - - err = relayminer.Start(ctx) - require.NoError(t, err) - - time.Sleep(time.Millisecond) - - err = relayminer.Stop(ctx) - require.NoError(t, err) -} diff --git a/pkg/relayer/session/claim.go b/pkg/relayer/session/claim.go deleted file mode 100644 index 7344f05b9..000000000 --- a/pkg/relayer/session/claim.go +++ /dev/null @@ -1,140 +0,0 @@ -package session - -import ( - "context" - "fmt" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/filter" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" -) - -// createClaims maps over the sessionsToClaimObs observable. For each claim, it: -// 1. Calculates the earliest block height at which it is safe to CreateClaim -// 2. Waits for said block and creates the claim on-chain -// 3. Maps errors to a new observable and logs them -// 4. Returns an observable of the successfully claimed sessions -// It DOES NOT BLOCK as map operations run in their own goroutines. -func (rs *relayerSessionsManager) createClaims(ctx context.Context) observable.Observable[relayer.SessionTree] { - // Map sessionsToClaimObs to a new observable of the same type which is notified - // when the session is eligible to be claimed. - sessionsWithOpenClaimWindowObs := channel.Map( - ctx, rs.sessionsToClaimObs, - rs.mapWaitForEarliestCreateClaimHeight, - ) - - failedCreateClaimSessionsObs, failedCreateClaimSessionsPublishCh := channel.NewObservable[relayer.SessionTree]() - - // Map sessionsWithOpenClaimWindowObs to a new observable of an either type, - // populated with the session or an error, which is notified after the session - // claim has been created or an error has been encountered, respectively. - eitherClaimedSessionsObs := channel.Map( - ctx, sessionsWithOpenClaimWindowObs, - rs.newMapClaimSessionFn(failedCreateClaimSessionsPublishCh), - ) - - // TODO_TECHDEBT: pass failed create claim sessions to some retry mechanism. - _ = failedCreateClaimSessionsObs - logging.LogErrors(ctx, filter.EitherError(ctx, eitherClaimedSessionsObs)) - - // Map eitherClaimedSessions to a new observable of relayer.SessionTree which - // is notified when the corresponding claim creation succeeded. - return filter.EitherSuccess(ctx, eitherClaimedSessionsObs) -} - -// mapWaitForEarliestCreateClaimHeight is intended to be used as a MapFn. It -// calculates and waits for the earliest block height, allowed by the protocol, -// at which a claim can be created for the given session, then emits the session -// **at that moment**. -func (rs *relayerSessionsManager) mapWaitForEarliestCreateClaimHeight( - ctx context.Context, - session relayer.SessionTree, -) (_ relayer.SessionTree, skip bool) { - rs.waitForEarliestCreateClaimHeight( - ctx, session.GetSessionHeader().GetSessionEndBlockHeight(), - ) - return session, false -} - -// waitForEarliestCreateClaimHeight calculates and waits for (blocking until) the -// earliest block height, allowed by the protocol, at which a claim can be created -// for a session with the given sessionEndHeight. It is calculated relative to -// sessionEndHeight using on-chain governance parameters and randomized input. -// It IS A BLOCKING function. -func (rs *relayerSessionsManager) waitForEarliestCreateClaimHeight( - ctx context.Context, - sessionEndHeight int64, -) { - logger := polylog.Ctx(ctx) - - // TODO_TECHDEBT: refactor this logic to a shared package. - - // TODO_TECHDEBT: query the on-chain governance SessionGracePeriod parameter once available. - // createClaimWindowStartHeight has to systematically start after the session's - // grace period ends to ensure the Claim creation is done after the session - // has been finalized. - createClaimWindowStartHeight := sessionEndHeight + sessionkeeper.GetSessionGracePeriodBlockCount() - - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // + claimproofparams.GovCreateClaimWindowStartHeightOffset - - // we wait for createClaimWindowStartHeight to be received before proceeding since we need its hash - // to know where this servicer's claim submission window starts. - logger.Info(). - Int64("create_claim_window_start_height", createClaimWindowStartHeight). - Msg("waiting & blocking for global earliest claim submission height") - createClaimWindowStartBlock := rs.waitForBlock(ctx, createClaimWindowStartHeight) - - logger.Info(). - Int64("create_claim_window_start_height", createClaimWindowStartBlock.Height()). - Str("hash", fmt.Sprintf("%x", createClaimWindowStartBlock.Hash())). - Msg("received global earliest claim submission height") - - earliestCreateClaimHeight := protocol.GetEarliestCreateClaimHeight(ctx, createClaimWindowStartBlock) - - logger.Info(). - Int64("earliest_create_claim_height", earliestCreateClaimHeight). - Str("hash", fmt.Sprintf("%x", createClaimWindowStartBlock.Hash())). - Msg("waiting & blocking for earliest claim creation height for this supplier") - - _ = rs.waitForBlock(ctx, earliestCreateClaimHeight) -} - -// newMapClaimSessionFn returns a new MapFn that creates a claim for the given -// session. Any session which encounters an error while creating a claim is sent -// on the failedCreateClaimSessions channel. -func (rs *relayerSessionsManager) newMapClaimSessionFn( - failedCreateClaimSessionsPublishCh chan<- relayer.SessionTree, -) channel.MapFn[relayer.SessionTree, either.SessionTree] { - return func( - ctx context.Context, - session relayer.SessionTree, - ) (_ either.SessionTree, skip bool) { - logger := polylog.Ctx(ctx) - - // this session should no longer be updated - claimRoot, err := session.Flush() - if err != nil { - return either.Error[relayer.SessionTree](err), false - } - - latestBlock := rs.blockClient.LastNBlocks(ctx, 1)[0] - logger.Info(). - Int64("current_block", latestBlock.Height()+1). - Msg("submitting claim") - - sessionHeader := session.GetSessionHeader() - if err := rs.supplierClient.CreateClaim(ctx, *sessionHeader, claimRoot); err != nil { - failedCreateClaimSessionsPublishCh <- session - return either.Error[relayer.SessionTree](err), false - } - - return either.Success(session), false - } -} diff --git a/pkg/relayer/session/errors.go b/pkg/relayer/session/errors.go deleted file mode 100644 index 398e18ecb..000000000 --- a/pkg/relayer/session/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package session - -import sdkerrors "cosmossdk.io/errors" - -var ( - codespace = "relayer_session" - ErrSessionTreeClosed = sdkerrors.Register(codespace, 1, "session tree already closed") - ErrSessionTreeNotClosed = sdkerrors.Register(codespace, 2, "session tree not closed") - ErrSessionTreeStorePathExists = sdkerrors.Register(codespace, 3, "session tree store path already exists") - ErrSessionTreeProofPathMismatch = sdkerrors.Register(codespace, 4, "session tree proof path mismatch") - ErrSessionTreeUndefinedStoresDirectory = sdkerrors.Register(codespace, 5, "session tree key-value store directory undefined for where they will be saved on disk") - ErrSessionTreeAlreadyMarkedAsClaimed = sdkerrors.Register(codespace, 6, "session tree already marked as claimed") -) diff --git a/pkg/relayer/session/options.go b/pkg/relayer/session/options.go deleted file mode 100644 index 1edadc132..000000000 --- a/pkg/relayer/session/options.go +++ /dev/null @@ -1,13 +0,0 @@ -package session - -import ( - "github.com/pokt-network/poktroll/pkg/relayer" -) - -// WithStoresDirectory sets the path on disk where KVStore data files used to store -// SMST of work sessions are created. -func WithStoresDirectory(storesDirectory string) relayer.RelayerSessionsManagerOption { - return func(relSessionMgr relayer.RelayerSessionsManager) { - relSessionMgr.(*relayerSessionsManager).storesDirectory = storesDirectory - } -} diff --git a/pkg/relayer/session/proof.go b/pkg/relayer/session/proof.go deleted file mode 100644 index 081d10dca..000000000 --- a/pkg/relayer/session/proof.go +++ /dev/null @@ -1,120 +0,0 @@ -package session - -import ( - "context" - - "github.com/pokt-network/poktroll/pkg/either" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/filter" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/protocol" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" -) - -// submitProofs maps over the given claimedSessions observable. -// For each session, it: -// 1. Calculates the earliest block height at which to submit a proof -// 2. Waits for said height and submits the proof on-chain -// 3. Maps errors to a new observable and logs them -// It DOES NOT BLOCKas map operations run in their own goroutines. -func (rs *relayerSessionsManager) submitProofs( - ctx context.Context, - claimedSessionsObs observable.Observable[relayer.SessionTree], -) { - // Map claimedSessionsObs to a new observable of the same type which is notified - // when the session is eligible to be proven. - sessionsWithOpenProofWindowObs := channel.Map( - ctx, claimedSessionsObs, - rs.mapWaitForEarliestSubmitProofHeight, - ) - - failedSubmitProofSessionsObs, failedSubmitProofSessionsPublishCh := channel.NewObservable[relayer.SessionTree]() - - // Map sessionsWithOpenProofWindow to a new observable of an either type, - // populated with the session or an error, which is notified after the session - // proof has been submitted or an error has been encountered, respectively. - eitherProvenSessionsObs := channel.Map( - ctx, sessionsWithOpenProofWindowObs, - rs.newMapProveSessionFn(failedSubmitProofSessionsPublishCh), - ) - - // TODO_TECHDEBT: pass failed submit proof sessions to some retry mechanism. - _ = failedSubmitProofSessionsObs - logging.LogErrors(ctx, filter.EitherError(ctx, eitherProvenSessionsObs)) -} - -// mapWaitForEarliestSubmitProofHeight is intended to be used as a MapFn. It -// calculates and waits for the earliest block height, allowed by the protocol, -// at which a proof can be submitted for the given session, then emits the session -// **at that moment**. -func (rs *relayerSessionsManager) mapWaitForEarliestSubmitProofHeight( - ctx context.Context, - session relayer.SessionTree, -) (_ relayer.SessionTree, skip bool) { - rs.waitForEarliestSubmitProofHeight( - ctx, session.GetSessionHeader().GetSessionEndBlockHeight(), - ) - return session, false -} - -// waitForEarliestSubmitProofHeight calculates and waits for (blocking until) the -// earliest block height, allowed by the protocol, at which a proof can be submitted -// for a session which was claimed at createClaimHeight. It is calculated relative -// to createClaimHeight using on-chain governance parameters and randomized input. -// It IS A BLOCKING function. -func (rs *relayerSessionsManager) waitForEarliestSubmitProofHeight( - ctx context.Context, - createClaimHeight int64, -) { - submitProofWindowStartHeight := createClaimHeight + sessionkeeper.GetSessionGracePeriodBlockCount() - // TODO_TECHDEBT: query the on-chain governance parameter once available. - // + claimproofparams.GovSubmitProofWindowStartHeightOffset - - // we wait for submitProofWindowStartHeight to be received before proceeding since we need its hash - rs.logger.Info(). - Int64("submitProofWindowStartHeight", submitProofWindowStartHeight). - Msg("waiting & blocking for global earliest proof submission height") - submitProofWindowStartBlock := rs.waitForBlock(ctx, submitProofWindowStartHeight) - - earliestSubmitProofHeight := protocol.GetEarliestSubmitProofHeight(ctx, submitProofWindowStartBlock) - _ = rs.waitForBlock(ctx, earliestSubmitProofHeight) -} - -// newMapProveSessionFn returns a new MapFn that submits a proof for the given -// session. Any session which encouters errors while submitting a proof is sent -// on the failedSubmitProofSessions channel. -func (rs *relayerSessionsManager) newMapProveSessionFn( - failedSubmitProofSessionsCh chan<- relayer.SessionTree, -) channel.MapFn[relayer.SessionTree, either.SessionTree] { - return func( - ctx context.Context, - session relayer.SessionTree, - ) (_ either.SessionTree, skip bool) { - // TODO_BLOCKER: The block that'll be used as a source of entropy for which - // branch(es) to prove should be deterministic and use on-chain governance params - // rather than latest. - latestBlock := rs.blockClient.LastNBlocks(ctx, 1)[0] - proof, err := session.ProveClosest(latestBlock.Hash()) - if err != nil { - return either.Error[relayer.SessionTree](err), false - } - - rs.logger.Info(). - Int64("currentBlockHeight", latestBlock.Height()+1). - Msg("submitting proof") - - // SubmitProof ensures on-chain proof inclusion so we can safely prune the tree. - if err := rs.supplierClient.SubmitProof( - ctx, - *session.GetSessionHeader(), - proof, - ); err != nil { - failedSubmitProofSessionsCh <- session - return either.Error[relayer.SessionTree](err), false - } - - return either.Success(session), false - } -} diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go deleted file mode 100644 index 187086f7f..000000000 --- a/pkg/relayer/session/session.go +++ /dev/null @@ -1,274 +0,0 @@ -package session - -import ( - "context" - "sync" - - "cosmossdk.io/depinject" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/observable" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/observable/logging" - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/pkg/relayer" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -var _ relayer.RelayerSessionsManager = (*relayerSessionsManager)(nil) - -type sessionsTreesMap = map[int64]map[string]relayer.SessionTree - -// relayerSessionsManager is an implementation of the RelayerSessions interface. -// TODO_TEST: Add tests to the relayerSessionsManager. -type relayerSessionsManager struct { - logger polylog.Logger - - relayObs relayer.MinedRelaysObservable - - // sessionsToClaimObs notifies about sessions that are ready to be claimed. - sessionsToClaimObs observable.Observable[relayer.SessionTree] - - // sessionTrees is a map of block heights pointing to a map of SessionTrees - // indexed by their sessionId. - // The block height index is used to know when the sessions contained in the entry should be closed, - // this helps to avoid iterating over all sessionsTrees to check if they are ready to be closed. - sessionsTrees sessionsTreesMap - sessionsTreesMu *sync.Mutex - - // blockClient is used to get the notifications of committed blocks. - blockClient client.BlockClient - - // supplierClient is used to create claims and submit proofs for sessions. - supplierClient client.SupplierClient - - // storesDirectory points to a path on disk where KVStore data files are created. - storesDirectory string -} - -// NewRelayerSessions creates a new relayerSessions. -// -// Required dependencies: -// - client.BlockClient -// - client.SupplierClient -// -// Available options: -// - WithStoresDirectory -func NewRelayerSessions( - ctx context.Context, - deps depinject.Config, - opts ...relayer.RelayerSessionsManagerOption, -) (relayer.RelayerSessionsManager, error) { - rs := &relayerSessionsManager{ - logger: polylog.Ctx(ctx), - sessionsTrees: make(sessionsTreesMap), - sessionsTreesMu: &sync.Mutex{}, - } - - if err := depinject.Inject( - deps, - &rs.blockClient, - &rs.supplierClient, - ); err != nil { - return nil, err - } - - for _, opt := range opts { - opt(rs) - } - - if err := rs.validateConfig(); err != nil { - return nil, err - } - - rs.sessionsToClaimObs = channel.MapExpand[client.Block, relayer.SessionTree]( - ctx, - rs.blockClient.CommittedBlocksSequence(ctx), - rs.mapBlockToSessionsToClaim, - ) - - return rs, nil -} - -// Start maps over the session trees at the end of each, respective, session. -// The session trees are piped through a series of map operations which progress -// them through the claim/proof lifecycle, broadcasting transactions to the -// network as necessary. -// It IS NOT BLOCKING as map operations run in their own goroutines. -func (rs *relayerSessionsManager) Start(ctx context.Context) { - // NB: must cast back to generic observable type to use with Map. - // relayer.MinedRelaysObservable cannot be an alias due to gomock's lack of - // support for generic types. - relayObs := observable.Observable[*relayer.MinedRelay](rs.relayObs) - - // Map eitherMinedRelays to a new observable of an error type which is - // notified if an error was encountered while attempting to add the relay to - // the session tree. - miningErrorsObs := channel.Map(ctx, relayObs, rs.mapAddMinedRelayToSessionTree) - logging.LogErrors(ctx, miningErrorsObs) - - // Start claim/proof pipeline. - claimedSessionsObs := rs.createClaims(ctx) - rs.submitProofs(ctx, claimedSessionsObs) -} - -// Stop unsubscribes all observables from the InsertRelays observable which -// will close downstream observables as they drain. -// -// TODO_TECHDEBT: Either add a mechanism to wait for draining to complete -// and/or ensure that the state at each pipeline stage is persisted to disk -// and exit as early as possible. -func (rs *relayerSessionsManager) Stop() { - rs.relayObs.UnsubscribeAll() -} - -// SessionsToClaim returns an observable that notifies when sessions are ready to be claimed. -func (rs *relayerSessionsManager) InsertRelays(relays relayer.MinedRelaysObservable) { - rs.relayObs = relays -} - -// ensureSessionTree returns the SessionTree for a given session. -// If no tree for the session exists, a new SessionTree is created before returning. -func (rs *relayerSessionsManager) ensureSessionTree(sessionHeader *sessiontypes.SessionHeader) (relayer.SessionTree, error) { - sessionsTrees, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] - - // If there is no map for sessions at the sessionEndHeight, create one. - if !ok { - sessionsTrees = make(map[string]relayer.SessionTree) - rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] = sessionsTrees - } - - // Get the sessionTree for the given session. - sessionTree, ok := sessionsTrees[sessionHeader.SessionId] - - // If the sessionTree does not exist, create it. - var err error - if !ok { - sessionTree, err = NewSessionTree(sessionHeader, rs.storesDirectory, rs.removeFromRelayerSessions) - if err != nil { - return nil, err - } - - sessionsTrees[sessionHeader.SessionId] = sessionTree - } - - return sessionTree, nil -} - -// mapBlockToSessionsToClaim maps a block to a list of sessions which can be -// claimed as of that block. -func (rs *relayerSessionsManager) mapBlockToSessionsToClaim( - _ context.Context, - block client.Block, -) (sessionTrees []relayer.SessionTree, skip bool) { - rs.sessionsTreesMu.Lock() - defer rs.sessionsTreesMu.Unlock() - - // Check if there are sessions that need to enter the claim/proof phase - // as their end block height was the one before the last committed block or - // earlier. - // Iterate over the sessionsTrees map to get the ones that end at a block height - // lower than the current block height. - for endBlockHeight, sessionsTreesEndingAtBlockHeight := range rs.sessionsTrees { - if IsWithinGracePeriod(endBlockHeight, block.Height()) { - // Iterate over the sessionsTrees that have grace period ending at this - // block height and add them to the list of sessionTrees to be published. - for _, sessionTree := range sessionsTreesEndingAtBlockHeight { - // Mark the session as claimed and add it to the list of sessionTrees to be published. - // If the session has already been claimed, it will be skipped. - // Appending the sessionTree to the list of sessionTrees is protected - // against concurrent access by the sessionsTreesMu such that the first - // call that marks the session as claimed will be the only one to add the - // sessionTree to the list. - if err := sessionTree.StartClaiming(); err == nil { - sessionTrees = append(sessionTrees, sessionTree) - } - } - } - } - return sessionTrees, false -} - -// removeFromRelayerSessions removes the SessionTree from the relayerSessions. -func (rs *relayerSessionsManager) removeFromRelayerSessions(sessionHeader *sessiontypes.SessionHeader) { - rs.sessionsTreesMu.Lock() - defer rs.sessionsTreesMu.Unlock() - - sessionsTreesEndingAtBlockHeight, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] - if !ok { - rs.logger.Debug(). - Int64("session_end_block_height", sessionHeader.SessionEndBlockHeight). - Msg("no session tree found for ending sessions") - return - } - - delete(sessionsTreesEndingAtBlockHeight, sessionHeader.SessionId) - - // Check if the sessionsTrees map is empty and delete it if so. - // This is an optimization done to save memory by avoiding an endlessly growing sessionsTrees map. - if len(sessionsTreesEndingAtBlockHeight) == 0 { - delete(rs.sessionsTrees, sessionHeader.SessionEndBlockHeight) - } -} - -// validateConfig validates the relayerSessionsManager's configuration. -// TODO_TEST: Add unit tests to validate these configurations. -func (rp *relayerSessionsManager) validateConfig() error { - if rp.storesDirectory == "" { - return ErrSessionTreeUndefinedStoresDirectory - } - - return nil -} - -// waitForBlock blocks until the block at the given height (or greater) is -// observed as having been committed. -func (rs *relayerSessionsManager) waitForBlock(ctx context.Context, height int64) client.Block { - subscription := rs.blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx) - defer subscription.Unsubscribe() - - for block := range subscription.Ch() { - if block.Height() >= height { - return block - } - } - - return nil -} - -// mapAddMinedRelayToSessionTree is intended to be used as a MapFn. It adds the relay -// to the session tree. If it encounters an error, it returns the error. Otherwise, -// it skips output (only outputs errors). -func (rs *relayerSessionsManager) mapAddMinedRelayToSessionTree( - _ context.Context, - relay *relayer.MinedRelay, -) (_ error, skip bool) { - rs.sessionsTreesMu.Lock() - defer rs.sessionsTreesMu.Unlock() - // ensure the session tree exists for this relay - // TODO_CONSIDERATION: if we get the session header from the response, there - // is no possibility that we forgot to hydrate it (i.e. blindly trust the client). - sessionHeader := relay.GetReq().GetMeta().GetSessionHeader() - smst, err := rs.ensureSessionTree(sessionHeader) - if err != nil { - // TODO_IMPROVE: log additional info? - rs.logger.Error().Err(err).Msg("failed to ensure session tree") - return err, false - } - - if err := smst.Update(relay.Hash, relay.Bytes, 1); err != nil { - // TODO_IMPROVE: log additional info? - rs.logger.Error().Err(err).Msg("failed to update smt") - return err, false - } - - // Skip because this map function only outputs errors. - return nil, true -} - -// IsWithinGracePeriod checks if the grace period for the session has ended -// and signals whether it is time to create a claim for it. -func IsWithinGracePeriod(sessionEndBlockHeight, currentBlockHeight int64) bool { - return currentBlockHeight <= sessionEndBlockHeight+sessionkeeper.GetSessionGracePeriodBlockCount() -} diff --git a/pkg/relayer/session/session_test.go b/pkg/relayer/session/session_test.go deleted file mode 100644 index 64d3dcef1..000000000 --- a/pkg/relayer/session/session_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package session_test - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/depinject" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/pkg/polylog/polyzero" - "github.com/pokt-network/poktroll/pkg/relayer" - "github.com/pokt-network/poktroll/pkg/relayer/session" - "github.com/pokt-network/poktroll/testutil/testclient/testblock" - "github.com/pokt-network/poktroll/testutil/testclient/testsupplier" - "github.com/pokt-network/poktroll/testutil/testpolylog" - "github.com/pokt-network/poktroll/testutil/testrelayer" - sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" -) - -func TestRelayerSessionsManager_Start(t *testing.T) { - const ( - sessionStartHeight = 1 - sessionEndHeight = 2 - ) - var ( - zeroByteSlice = []byte{0} - _, ctx = testpolylog.NewLoggerWithCtx(context.Background(), polyzero.DebugLevel) - ) - - // Set up dependencies. - blocksObs, blockPublishCh := channel.NewReplayObservable[client.Block](ctx, 1) - blockClient := testblock.NewAnyTimesCommittedBlocksSequenceBlockClient(t, blocksObs) - supplierClient := testsupplier.NewOneTimeClaimProofSupplierClient(ctx, t) - - deps := depinject.Supply(blockClient, supplierClient) - storesDirectoryOpt := testrelayer.WithTempStoresDirectory(t) - - // Create a new relayer sessions manager. - relayerSessionsManager, err := session.NewRelayerSessions(ctx, deps, storesDirectoryOpt) - require.NoError(t, err) - require.NotNil(t, relayerSessionsManager) - - // Pass a mined relays observable via InsertRelays. - mrObs, minedRelaysPublishCh := channel.NewObservable[*relayer.MinedRelay]() - minedRelaysObs := relayer.MinedRelaysObservable(mrObs) - relayerSessionsManager.InsertRelays(minedRelaysObs) - - // Start the relayer sessions manager. - relayerSessionsManager.Start(ctx) - - // Publish a mined relay to the minedRelaysPublishCh to insert into the session tree. - minedRelay := testrelayer.NewMinedRelay(t, sessionStartHeight, sessionEndHeight) - minedRelaysPublishCh <- minedRelay - - // Wait a tick to allow the relayer sessions manager to process asynchronously. - // It should have created a session tree for the relay. - time.Sleep(10 * time.Millisecond) - - // Publish a block to the blockPublishCh to simulate non-actionable blocks. - noopBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionStartHeight) - blockPublishCh <- noopBlock - - // Calculate the session grace period end block height to emit that block height - // to the blockPublishCh to trigger claim creation for the session. - sessionGracePeriodEndBlockHeight := int64(sessionEndHeight + sessionkeeper.GetSessionGracePeriodBlockCount()) - - // Publish a block to the blockPublishCh to trigger claim creation for the session. - // TODO_TECHDEBT: assumes claiming at sessionGracePeriodEndBlockHeight is valid. - // This will likely change in future work. - triggerClaimBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionGracePeriodEndBlockHeight) - blockPublishCh <- triggerClaimBlock - - // TODO_IMPROVE: ensure correctness of persisted session trees here. - - // Publish a block to the blockPublishCh to trigger proof submission for the session. - // TODO_TECHDEBT: assumes proving at sessionGracePeriodEndBlockHeight + 1 is valid. - // This will likely change in future work. - triggerProofBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionGracePeriodEndBlockHeight+1) - blockPublishCh <- triggerProofBlock - - // Wait a tick to allow the relayer sessions manager to process asynchronously. - time.Sleep(250 * time.Millisecond) -} diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go deleted file mode 100644 index b663c472f..000000000 --- a/pkg/relayer/session/sessiontree.go +++ /dev/null @@ -1,225 +0,0 @@ -package session - -import ( - "bytes" - "crypto/sha256" - "os" - "path/filepath" - "sync" - - "github.com/pokt-network/smt" - "github.com/pokt-network/smt/kvstore/badger" - - "github.com/pokt-network/poktroll/pkg/relayer" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" -) - -var _ relayer.SessionTree = (*sessionTree)(nil) - -// sessionTree is an implementation of the SessionTree interface. -// TODO_TEST: Add tests to the sessionTree. -type sessionTree struct { - // sessionMu is a mutex used to protect sessionTree operations from concurrent access. - sessionMu *sync.Mutex - - // sessionHeader is the header of the session corresponding to the SMST (Sparse Merkle State Trie). - sessionHeader *sessiontypes.SessionHeader - - // sessionSMT is the SMST (Sparse Merkle State Trie) corresponding the session. - sessionSMT smt.SparseMerkleSumTrie - - // claimedRoot is the root hash of the SMST needed for submitting the claim. - // If it holds a non-nil value, it means that the SMST has been flushed, - // committed to disk and no more updates can be made to it. A non-nil value also - // indicates that a proof could be generated using ProveClosest function. - claimedRoot []byte - - // proofPath is the path for which the proof was generated. - proofPath []byte - - // proof is the generated proof for the session given a proofPath. - proof *smt.SparseMerkleClosestProof - - // treeStore is the KVStore used to store the SMST. - treeStore badger.BadgerKVStore - - // storePath is the path to the KVStore used to store the SMST. - // It is created from the storePrefix and the session.sessionId. - // We keep track of it so we can use it at the end of the claim/proof lifecycle - // to delete the KVStore when it is no longer needed. - storePath string - - // removeFromRelayerSessions is a function that removes the sessionTree from - // the RelayerSessionsManager. - // Since the sessionTree has no knowledge of the RelayerSessionsManager, - // we pass this callback from the session manager to the sessionTree so - // it can remove itself from the RelayerSessionsManager when it is no longer needed. - removeFromRelayerSessions func(sessionHeader *sessiontypes.SessionHeader) - - isClaiming bool -} - -// NewSessionTree creates a new sessionTree from a Session and a storePrefix. It also takes a function -// removeFromRelayerSessions that removes the sessionTree from the RelayerSessionsManager. -// It returns an error if the KVStore fails to be created. -func NewSessionTree( - sessionHeader *sessiontypes.SessionHeader, - storesDirectory string, - removeFromRelayerSessions func(sessionHeader *sessiontypes.SessionHeader), -) (relayer.SessionTree, error) { - // Join the storePrefix and the session.sessionId to create a unique storePath - storePath := filepath.Join(storesDirectory, sessionHeader.SessionId) - - // Make sure storePath does not exist when creating a new SessionTree - if _, err := os.Stat(storePath); err != nil && !os.IsNotExist(err) { - return nil, ErrSessionTreeStorePathExists.Wrapf("storePath: %q", storePath) - } - - treeStore, err := badger.NewKVStore(storePath) - if err != nil { - return nil, err - } - - // Create the SMST from the KVStore and a nil value hasher so the proof would - // contain a non-hashed Relay that could be used to validate the proof on-chain. - trie := smt.NewSparseMerkleSumTrie(treeStore, sha256.New(), smt.WithValueHasher(nil)) - - sessionTree := &sessionTree{ - sessionHeader: sessionHeader, - storePath: storePath, - treeStore: treeStore, - sessionSMT: trie, - sessionMu: &sync.Mutex{}, - - removeFromRelayerSessions: removeFromRelayerSessions, - } - - return sessionTree, nil -} - -// GetSession returns the session corresponding to the SMST. -func (st *sessionTree) GetSessionHeader() *sessiontypes.SessionHeader { - return st.sessionHeader -} - -// Update is a wrapper for the SMST's Update function. It updates the SMST with -// the given key, value, and weight. -// This function should be called by the Miner when a Relay has been successfully served. -// It returns an error if the SMST has been flushed to disk which indicates -// that updates are no longer allowed. -func (st *sessionTree) Update(key, value []byte, weight uint64) error { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - if st.claimedRoot != nil { - return ErrSessionTreeClosed - } - - return st.sessionSMT.Update(key, value, weight) -} - -// ProveClosest is a wrapper for the SMST's ProveClosest function. It returns a proof for the given path. -// This function is intended to be called after a session has been claimed and needs to be proven. -// If the proof has already been generated, it returns the cached proof. -// It returns an error if the SMST has not been flushed yet (the claim has not been generated) -func (st *sessionTree) ProveClosest(path []byte) (proof *smt.SparseMerkleClosestProof, err error) { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - // A claim need to be generated before a proof can be generated. - if st.claimedRoot == nil { - return nil, ErrSessionTreeNotClosed - } - - // If the proof has already been generated, return the cached proof. - if st.proof != nil { - // Make sure the path is the same as the one for which the proof was generated. - if !bytes.Equal(path, st.proofPath) { - return nil, ErrSessionTreeProofPathMismatch - } - - return st.proof, nil - } - - // Restore the KVStore from disk since it has been closed after the claim has been generated. - st.treeStore, err = badger.NewKVStore(st.storePath) - if err != nil { - return nil, err - } - - st.sessionSMT = smt.ImportSparseMerkleSumTrie(st.treeStore, sha256.New(), st.claimedRoot, smt.WithValueHasher(nil)) - - // Generate the proof and cache it along with the path for which it was generated. - st.proof, err = st.sessionSMT.ProveClosest(path) - st.proofPath = path - - return st.proof, err -} - -// Flush gets the root hash of the SMST needed for submitting the claim; -// then commits the entire tree to disk and stops the KVStore. -// It should be called before submitting the claim on-chain. This function frees up the KVStore resources. -// If the SMST has already been flushed to disk, it returns the cached root hash. -func (st *sessionTree) Flush() (SMSTRoot []byte, err error) { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - // We already have the root hash, return it. - if st.claimedRoot != nil { - return st.claimedRoot, nil - } - - st.claimedRoot = st.sessionSMT.Root() - - // Commit the tree to disk - if err := st.sessionSMT.Commit(); err != nil { - return nil, err - } - - // Stop the KVStore - if err := st.treeStore.Stop(); err != nil { - return nil, err - } - - st.treeStore = nil - st.sessionSMT = nil - - return st.claimedRoot, nil -} - -// Delete deletes the SMST from the KVStore and removes the sessionTree from the RelayerSessionsManager. -// WARNING: This function deletes the KVStore associated to the session and should be -// called only after the proof has been successfully submitted on-chain and the servicer -// has confirmed that it has been rewarded. -func (st *sessionTree) Delete() error { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - st.removeFromRelayerSessions(st.sessionHeader) - - if err := st.treeStore.ClearAll(); err != nil { - return err - } - - if err := st.treeStore.Stop(); err != nil { - return err - } - - // Delete the KVStore from disk - return os.RemoveAll(filepath.Dir(st.storePath)) -} - -// StartClaiming marks the session tree as being picked up for claiming, -// so it won't be picked up by the relayer again. -// It returns an error if it has already been marked as such. -func (st *sessionTree) StartClaiming() error { - st.sessionMu.Lock() - defer st.sessionMu.Unlock() - - if st.isClaiming { - return ErrSessionTreeAlreadyMarkedAsClaimed - } - - st.isClaiming = true - return nil -} diff --git a/pkg/relayer/session/sessiontree_test.go b/pkg/relayer/session/sessiontree_test.go deleted file mode 100644 index 4e199dcfe..000000000 --- a/pkg/relayer/session/sessiontree_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package session_test - -// TODO: Add tests to the sessionTree logic diff --git a/pkg/relayer/types.go b/pkg/relayer/types.go deleted file mode 100644 index 1216dd25e..000000000 --- a/pkg/relayer/types.go +++ /dev/null @@ -1,10 +0,0 @@ -package relayer - -import "github.com/pokt-network/poktroll/x/service/types" - -// MinedRelay is a wrapper around a relay that has been serialized and hashed. -type MinedRelay struct { - types.Relay - Bytes []byte - Hash []byte -} diff --git a/pkg/retry/retry.go b/pkg/retry/retry.go deleted file mode 100644 index bd06af941..000000000 --- a/pkg/retry/retry.go +++ /dev/null @@ -1,77 +0,0 @@ -package retry - -import ( - "context" - "time" - - "github.com/pokt-network/poktroll/pkg/polylog" -) - -type RetryFunc func() chan error - -// OnError continuously invokes the provided work function (workFn) until either the context (ctx) -// is canceled or the error channel returned by workFn is closed. If workFn encounters an error, -// OnError will retry invoking workFn based on the provided retry parameters. -// -// Parameters: -// - ctx: the context to monitor for cancellation. If canceled, OnError will exit without error. -// - retryLimit: the maximum number of retries for workFn upon encountering an error. -// - retryDelay: the duration to wait before retrying workFn after an error. -// - retryResetCount: Specifies the duration of continuous error-free operation required -// before the retry count is reset. If the work function operates without -// errors for this duration, any subsequent error will restart the retry -// count from the beginning. -// - workName: a name or descriptor for the work function, used for logging purposes. -// - workFn: a function that performs some work and returns an error channel. -// This channel emits errors encountered during the work. -// -// Returns: -// - If the context is canceled, the function returns nil. -// - If the error channel is closed, a warning is logged, and the function returns nil. -// - If the retry limit is reached, the function returns the error from the channel. -// -// Note: After each error, a delay specified by retryDelay is introduced before retrying workFn.func OnError( -func OnError( - ctx context.Context, - retryLimit int, - retryDelay time.Duration, - retryResetTimeout time.Duration, - workName string, - workFn RetryFunc, -) error { - logger := polylog.Ctx(ctx) - - var retryCount int - errCh := workFn() - for { - select { - case <-ctx.Done(): - return nil - case <-time.After(retryResetTimeout): - retryCount = 0 - case err, ok := <-errCh: - // Exit the retry loop if the error channel is closed. - if !ok { - logger.Warn(). - Str("work_name", workName). - Msg("error channel closed, will no longer retry on error") - return nil - } - - if retryCount >= retryLimit { - return err - } - - // Wait retryDelay before retrying. - time.Sleep(retryDelay) - - // Increment retryCount and retry workFn. - retryCount++ - errCh = workFn() - logger.Error(). - Str("work_name", workName). - Err(err). - Msgf("on retry: %d", retryCount) - } - } -} diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go deleted file mode 100644 index d328bda73..000000000 --- a/pkg/retry/retry_test.go +++ /dev/null @@ -1,337 +0,0 @@ -package retry_test - -/* TODO_TECHDEBT: improve this test: -- fix race condition around the logOutput buffer -- factor our common setup and assertion code -- drive out flakiness -- improve comments -*/ - -import ( - "bytes" - "context" - "fmt" - "log" - "strings" - "sync/atomic" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/retry" -) - -var testErr = fmt.Errorf("test error") - -// TestOnError verifies the behavior of the OnError function in the retry package. -// It ensures that the function correctly retries a failing operation for a specified -// number of times with the expected delay between retries. -func TestOnError(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") - - // Setting up the test variables. - var ( - // logOutput captures the log output for verification of logged messages. - logOutput bytes.Buffer - // expectedRetryDelay is the duration we expect between retries. - expectedRetryDelay = time.Millisecond - // expectedRetryLimit is the maximum number of retries the test expects. - expectedRetryLimit = 5 - // retryResetTimeout is the duration after which the retry count should reset. - retryResetTimeout = time.Second - // testFnCallCount keeps track of how many times the test function is called. - testFnCallCount int32 - // testFnCallTimeCh is a channel receives a time.Time each when the test - // function is called. - testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) - ctx = context.Background() - ) - - // Redirect the standard logger's output to our custom buffer for later verification. - log.SetOutput(&logOutput) - - // Define testFn, a function that simulates a failing operation and logs its invocation times. - testFn := func() chan error { - // Record the current time to track the delay between retries. - testFnCallTimeCh <- time.Now() - - // Create a channel to return an error, simulating a failing operation. - errCh := make(chan error, 1) - errCh <- testErr - - // Increment the call count safely across goroutine boundaries. - atomic.AddInt32(&testFnCallCount, 1) - - return errCh - } - - // Create a channel to receive the error result from the OnError function. - retryOnErrorErrCh := make(chan error, 1) - - // Start the OnError function in a separate goroutine, simulating concurrent operation. - go func() { - // Call the OnError function with the test parameters and function. - retryOnErrorErrCh <- retry.OnError( - ctx, - expectedRetryLimit, - expectedRetryDelay, - retryResetTimeout, - "TestOnError", - testFn, - ) - }() - - // Calculate the total expected time for all retries to complete. - totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) - // Wait for the OnError function to execute and retry the expected number of times. - time.Sleep(totalExpectedDelay + 100*time.Millisecond) - - // Verify that the test function was called the expected number of times. - require.Equal(t, expectedRetryLimit, int(testFnCallCount), "Test function was not called the expected number of times") - - // Verify the delay between retries of the test function. - var prevCallTime time.Time - for i := 0; i < expectedRetryLimit; i++ { - // Retrieve the next function call time from the channel. - nextCallTime, ok := <-testFnCallTimeCh - if !ok { - t.Fatalf("expected %d calls to testFn, but channel closed after %d", expectedRetryLimit, i) - } - - // For all calls after the first, check that the delay since the previous call meets expectations. - if i != 0 { - actualRetryDelay := nextCallTime.Sub(prevCallTime) - require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay, "Retry delay was less than expected") - } - - // Update prevCallTime for the next iteration. - prevCallTime = nextCallTime - } - - // Verify that the OnError function returned the expected error. - select { - case err := <-retryOnErrorErrCh: - require.ErrorIs(t, err, testErr, "OnError did not return the expected error") - case <-time.After(100 * time.Millisecond): - t.Fatal("expected error from OnError, but none received") - } - - // Verify the error messages logged during the retries. - expectedErrorLine := "ERROR: retrying TestOnError after error: test error" - trimmedLogOutput := strings.Trim(logOutput.String(), "\n") - logOutputLines := strings.Split(trimmedLogOutput, "\n") - require.Lenf(t, logOutputLines, expectedRetryLimit, "unexpected number of log lines") - for _, line := range logOutputLines { - require.Contains(t, line, expectedErrorLine, "log line does not contain the expected prefix") - } -} - -// TODO_TECHDEBT: assert that the retry loop exits when the context is closed. -func TestOnError_ExitsWhenCtxCloses(t *testing.T) { - t.SkipNow() -} - -func TestOnError_ExitsWhenErrChCloses(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") - - // Setup test variables and log capture - var ( - logOutput bytes.Buffer - testFnCallCount int32 - expectedRetryDelay = time.Millisecond - expectedRetryLimit = 3 - retryLimit = 5 - retryResetTimeout = time.Second - testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) - ctx = context.Background() - ) - - // Redirect the log output for verification later - log.SetOutput(&logOutput) - - // Define the test function that simulates an error and counts its invocations - testFn := func() chan error { - atomic.AddInt32(&testFnCallCount, 1) // Increment the invocation count atomically - testFnCallTimeCh <- time.Now() // Track the invocation time - - errCh := make(chan error, 1) - if atomic.LoadInt32(&testFnCallCount) >= int32(expectedRetryLimit) { - close(errCh) - return errCh - } - - errCh <- testErr - return errCh - } - - retryOnErrorErrCh := make(chan error, 1) - // Spawn a goroutine to test the OnError function - go func() { - retryOnErrorErrCh <- retry.OnError( - ctx, - retryLimit, - expectedRetryDelay, - retryResetTimeout, - "TestOnError_ExitsWhenErrChCloses", - testFn, - ) - }() - - // Wait for the OnError function to execute and retry the expected number of times - totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) - time.Sleep(totalExpectedDelay + 100*time.Millisecond) - - // Assert that the test function was called the expected number of times - require.Equal(t, expectedRetryLimit, int(testFnCallCount)) - - // Assert that the retry delay between function calls matches the expected delay - var prevCallTime = new(time.Time) - for i := 0; i < expectedRetryLimit; i++ { - select { - case nextCallTime := <-testFnCallTimeCh: - if i != 0 { - actualRetryDelay := nextCallTime.Sub(*prevCallTime) - require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay) - } - - *prevCallTime = nextCallTime - default: - t.Fatalf( - "expected %d calls to testFn, but only received %d", - expectedRetryLimit, i+1, - ) - } - } - - select { - case err := <-retryOnErrorErrCh: - require.NoError(t, err) - case <-time.After(100 * time.Millisecond): - t.Fatalf("expected error from OnError, but none received") - } - - // Verify the logged error messages - var ( - logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") - errorLines = logOutputLines[:len(logOutputLines)-1] - warnLine = logOutputLines[len(logOutputLines)-1] - expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses closed, will no longer retry on error" - expectedErrorMsg = "ERROR: retrying TestOnError_ExitsWhenErrChCloses after error: test error" - ) - - require.Lenf( - t, logOutputLines, - expectedRetryLimit, - "expected %d log lines, got %d", - expectedRetryLimit, len(logOutputLines), - ) - for _, line := range errorLines { - require.Contains(t, line, expectedErrorMsg) - } - require.Contains(t, warnLine, expectedWarnMsg) -} - -// assert that retryCount resets on success -func TestOnError_RetryCountResetTimeout(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") - - // Setup test variables and log capture - var ( - logOutput bytes.Buffer - testFnCallCount int32 - expectedRetryDelay = time.Millisecond - expectedRetryLimit = 9 - retryLimit = 5 - retryResetTimeout = 3 * time.Millisecond - testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) - ctx = context.Background() - ) - - // Redirect the log output for verification later - log.SetOutput(&logOutput) - - // Define the test function that simulates an error and counts its invocations - testFn := func() chan error { - // Track the invocation time - testFnCallTimeCh <- time.Now() - - errCh := make(chan error, 1) - - count := atomic.LoadInt32(&testFnCallCount) - if count == int32(retryLimit) { - go func() { - time.Sleep(retryResetTimeout) - errCh <- testErr - }() - } else { - errCh <- testErr - } - - // Increment the invocation count atomically - atomic.AddInt32(&testFnCallCount, 1) - return errCh - } - - retryOnErrorErrCh := make(chan error, 1) - // Spawn a goroutine to test the OnError function - go func() { - retryOnErrorErrCh <- retry.OnError( - ctx, - retryLimit, - expectedRetryDelay, - retryResetTimeout, - "TestOnError", - testFn, - ) - }() - - // Wait for the OnError function to execute and retry the expected number of times - totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) - time.Sleep(totalExpectedDelay + 100*time.Millisecond) - - // Assert that the test function was called the expected number of times - require.Equal(t, expectedRetryLimit, int(testFnCallCount)) - - // Assert that the retry delay between function calls matches the expected delay - var prevCallTime = new(time.Time) - for i := 0; i < expectedRetryLimit; i++ { - select { - case nextCallTime := <-testFnCallTimeCh: - if i != 0 { - actualRetryDelay := nextCallTime.Sub(*prevCallTime) - require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay) - } - - *prevCallTime = nextCallTime - default: - t.Fatalf( - "expected %d calls to testFn, but only received %d", - expectedRetryLimit, i+1, - ) - } - } - - // Verify the logged error messages - var ( - logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") - expectedPrefix = "ERROR: retrying TestOnError after error: test error" - ) - - select { - case err := <-retryOnErrorErrCh: - require.ErrorIs(t, err, testErr) - case <-time.After(100 * time.Millisecond): - t.Fatalf("expected error from OnError, but none received") - } - - require.Lenf( - t, logOutputLines, - expectedRetryLimit-1, - "expected %d log lines, got %d", - expectedRetryLimit-1, len(logOutputLines), - ) - for _, line := range logOutputLines { - require.Contains(t, line, expectedPrefix) - } -} diff --git a/pkg/sdk/deps_builder.go b/pkg/sdk/deps_builder.go deleted file mode 100644 index cfd0ff4b3..000000000 --- a/pkg/sdk/deps_builder.go +++ /dev/null @@ -1,94 +0,0 @@ -package sdk - -import ( - "context" - - "cosmossdk.io/depinject" - grpctypes "github.com/cosmos/gogoproto/grpc" - grpc "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - - block "github.com/pokt-network/poktroll/pkg/client/block" - "github.com/pokt-network/poktroll/pkg/client/delegation" - eventsquery "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/client/query" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -// buildDeps builds the dependencies for the POKTRollSDK if they are not provided -// in the config. This is useful for the SDK consumers that do not want or -// cannot provide the dependencies through depinject. -func (sdk *poktrollSDK) buildDeps( - ctx context.Context, - config *POKTRollSDKConfig, -) (depinject.Config, error) { - pocketNodeWebsocketURL := HostToWebsocketURL(config.QueryNodeUrl.Host) - - // Have a new depinject config - deps := depinject.Configs() - - // Supply the logger - deps = depinject.Configs(deps, depinject.Supply(polylog.Ctx(ctx))) - - // Create and supply the events query client - eventsQueryClient := eventsquery.NewEventsQueryClient(pocketNodeWebsocketURL) - deps = depinject.Configs(deps, depinject.Supply(eventsQueryClient)) - - // Create and supply the block client that depends on the events query client - blockClient, err := block.NewBlockClient(ctx, deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(blockClient)) - - // Create and supply the grpc client used by the queriers - // TODO_TECHDEBT: Configure the grpc client options from the config. - var grpcClient grpctypes.ClientConn - grpcClient, err = grpc.Dial( - config.QueryNodeGRPCUrl.Host, - grpc.WithTransportCredentials(insecure.NewCredentials()), - ) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(grpcClient)) - - // Create and supply the account querier - accountQuerier, err := query.NewAccountQuerier(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(accountQuerier)) - - // Create and supply the application querier - applicationQuerier, err := query.NewApplicationQuerier(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(applicationQuerier)) - - // Create and supply the session querier - sessionQuerier, err := query.NewSessionQuerier(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(sessionQuerier)) - - // Create and supply the delegation client - delegationClient, err := delegation.NewDelegationClient(ctx, deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(delegationClient)) - - // Create and supply the ring cache that depends on: - // the logger, application and account querier and the delegation client - ringCache, err := rings.NewRingCache(deps) - if err != nil { - return nil, err - } - deps = depinject.Configs(deps, depinject.Supply(ringCache)) - - return deps, nil -} diff --git a/pkg/sdk/errors.go b/pkg/sdk/errors.go deleted file mode 100644 index fa42d684a..000000000 --- a/pkg/sdk/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package sdk - -import ( - sdkerrors "cosmossdk.io/errors" -) - -// TODO_TECHDEBT: Do a source code wise find-replace using regex pattern match -// of `sdkerrors\.Wrapf\(([a-zA-Z]+), ` with `$1.Wrapf(` -var ( - codespace = "poktrollsdk" - ErrSDKHandleRelay = sdkerrors.Register(codespace, 1, "internal error handling relay request") - ErrSDKInvalidRelayResponseSignature = sdkerrors.Register(codespace, 2, "invalid relay response signature") - ErrSDKEmptyRelayResponseSignature = sdkerrors.Register(codespace, 3, "empty relay response signature") - ErrSDKVerifyResponseSignature = sdkerrors.Register(codespace, 4, "error verifying relay response signature") - ErrSDKGetApplications = sdkerrors.Register(codespace, 5, "error querying on-chain applications") - ErrSDKEmptySupplierPubKey = sdkerrors.Register(codespace, 6, "empty supplier public key") -) diff --git a/pkg/sdk/interface.go b/pkg/sdk/interface.go deleted file mode 100644 index aa462abd6..000000000 --- a/pkg/sdk/interface.go +++ /dev/null @@ -1,32 +0,0 @@ -package sdk - -import ( - "context" - "net/http" - - apptypes "github.com/pokt-network/poktroll/x/application/types" - servicetypes "github.com/pokt-network/poktroll/x/service/types" -) - -// POKTRollSDK is the interface for the POKTRoll SDK. It is used by gateways -// and/or applications to interact with the Pocket protocol. -type POKTRollSDK interface { - // GetApplications queries a list of all on-chain applications, optionally filtered by - // delegated gateway - GetApplications(ctx context.Context, options GetApplicationsOptions) ([]apptypes.Application, error) - - // GetSessionSupplierEndpoints returns the suppliers endpoints of the current session for - // the given application and service. - GetSessionSupplierEndpoints( - ctx context.Context, - appAddress string, - serviceId string, - ) (session *SessionSuppliers, err error) - - // SendRelay sends a relay request to the given supplier's endpoint. - SendRelay( - ctx context.Context, - sessionSupplierEndpoint *SingleSupplierEndpoint, - request *http.Request, - ) (response *servicetypes.RelayResponse, err error) -} diff --git a/pkg/sdk/relay_verifier.go b/pkg/sdk/relay_verifier.go deleted file mode 100644 index 6b487a9a6..000000000 --- a/pkg/sdk/relay_verifier.go +++ /dev/null @@ -1,82 +0,0 @@ -package sdk - -import ( - "context" - - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - - "github.com/pokt-network/poktroll/pkg/polylog" - "github.com/pokt-network/poktroll/x/service/types" -) - -// verifyResponse verifies the relay response signature. -func (sdk *poktrollSDK) verifyResponse( - ctx context.Context, - supplierAddress string, - relayResponse *types.RelayResponse, -) error { - logger := polylog.Ctx(context.Background()) - - // Get the supplier's public key. - supplierPubKey, err := sdk.getSupplierPubKeyFromAddress(ctx, supplierAddress) - if err != nil { - return err - } - - // Extract the supplier's signature - if relayResponse.Meta == nil { - return ErrSDKEmptyRelayResponseSignature.Wrapf( - "response payload: %s", relayResponse.Payload, - ) - } - supplierSignature := relayResponse.Meta.SupplierSignature - - // Get the relay response signable bytes and hash them. - responseSignableBz, err := relayResponse.GetSignableBytesHash() - if err != nil { - return err - } - - logger.Debug(). - Str("supplier", supplierAddress). - Str("application", relayResponse.Meta.SessionHeader.ApplicationAddress). - Str("service", relayResponse.Meta.SessionHeader.Service.Id). - Int64("end_height", relayResponse.Meta.SessionHeader.SessionEndBlockHeight). - Msg("About to verify relay response signature.") - - // Verify the relay response signature. - if !supplierPubKey.VerifySignature(responseSignableBz[:], supplierSignature) { - return ErrSDKInvalidRelayResponseSignature - } - - return nil -} - -// getSupplierPubKeyFromAddress gets the supplier's public key from the cache or -// queries if it is not found. The public key is then cached before being returned. -func (sdk *poktrollSDK) getSupplierPubKeyFromAddress( - ctx context.Context, - supplierAddress string, -) (cryptotypes.PubKey, error) { - supplierPubKey, ok := sdk.supplierAccountCache[supplierAddress] - if ok { - return supplierPubKey, nil - } - - // Query for the supplier account to get the application's public key - // to verify the relay request signature. - acc, err := sdk.accountQuerier.GetAccount(ctx, supplierAddress) - if err != nil { - return nil, err - } - - fetchedPubKey := acc.GetPubKey() - if fetchedPubKey == nil { - return nil, ErrSDKEmptySupplierPubKey - } - - // Cache the retrieved public key. - sdk.supplierAccountCache[supplierAddress] = fetchedPubKey - - return fetchedPubKey, nil -} diff --git a/pkg/sdk/sdk.go b/pkg/sdk/sdk.go deleted file mode 100644 index c2c836e6b..000000000 --- a/pkg/sdk/sdk.go +++ /dev/null @@ -1,115 +0,0 @@ -package sdk - -import ( - "context" - "fmt" - "net/url" - "sync" - - "cosmossdk.io/depinject" - ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" - ringtypes "github.com/athanorlabs/go-dleq/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/polylog" -) - -var _ POKTRollSDK = (*poktrollSDK)(nil) - -// POKTRollSDKConfig is the configuration for the POKTRollSDK. -// It contains the Pocket Node URL to be used by the queriers and the private key -// to be used for signing relay requests. -// Deps is an optional field that can be used to provide the needed dependencies -// for the SDK. If it is not provided, the SDK will build the dependencies itself. -type POKTRollSDKConfig struct { - QueryNodeGRPCUrl *url.URL - QueryNodeUrl *url.URL - PrivateKey cryptotypes.PrivKey - Deps depinject.Config -} - -// poktrollSDK is the implementation of the POKTRollSDK. -type poktrollSDK struct { - logger polylog.Logger - config *POKTRollSDKConfig - - // signingKey is the scalar representation of the private key to be used - // for signing relay requests. - signingKey ringtypes.Scalar - - // ringCache is used to obtain and store the ring for the application. - ringCache crypto.RingCache - - // sessionQuerier is the querier for the session module. - // It used to get the current session for the application given a requested service. - sessionQuerier client.SessionQueryClient - - // serviceSessionSuppliersMu is a mutex to protect latestSessions map reads and updates. - serviceSessionSuppliersMu sync.RWMutex - - // serviceSessionSuppliers is a map of serviceId -> {appAddress -> SessionSuppliers} - // for a specific session - serviceSessionSuppliers map[string]map[string]*SessionSuppliers - - // accountQuerier is the querier for the account module. - // It is used to get the the supplier's public key to verify the relay response signature. - accountQuerier client.AccountQueryClient - - // applicationQuerier is the querier for the application module. - // It is used to query a specific application or all applications - applicationQuerier client.ApplicationQueryClient - - // blockClient is the client for the block module. - // It is used to get the current block height to query for the current session. - blockClient client.BlockClient - - // accountCache is a cache of the supplier accounts that has been queried - // TODO_TECHDEBT: Add a size limit to the cache. - supplierAccountCache map[string]cryptotypes.PubKey -} - -// NewPOKTRollSDK creates a new POKTRollSDK instance with the given configuration. -func NewPOKTRollSDK(ctx context.Context, config *POKTRollSDKConfig) (POKTRollSDK, error) { - sdk := &poktrollSDK{ - config: config, - serviceSessionSuppliers: make(map[string]map[string]*SessionSuppliers), - supplierAccountCache: make(map[string]cryptotypes.PubKey), - } - - var err error - var deps depinject.Config - - // Build the dependencies if they are not provided in the config. - if config.Deps != nil { - deps = config.Deps - } else if deps, err = sdk.buildDeps(ctx, config); err != nil { - return nil, err - } - - if err := depinject.Inject( - deps, - &sdk.logger, - &sdk.ringCache, - &sdk.sessionQuerier, - &sdk.accountQuerier, - &sdk.applicationQuerier, - &sdk.blockClient, - ); err != nil { - return nil, err - } - - // Store the private key as a ring scalar to be used for ring signatures. - crv := ring_secp256k1.NewCurve() - sdk.signingKey, err = crv.DecodeToScalar(config.PrivateKey.Bytes()) - if err != nil { - return nil, fmt.Errorf("failed to decode private key: %w", err) - } - - // Start the ring cache, when the context is canceled, the ring cache - // will stop. And clear any cached rings. - sdk.ringCache.Start(ctx) - - return sdk, nil -} diff --git a/pkg/sdk/send_relay.go b/pkg/sdk/send_relay.go deleted file mode 100644 index 45e93a728..000000000 --- a/pkg/sdk/send_relay.go +++ /dev/null @@ -1,109 +0,0 @@ -package sdk - -import ( - "bytes" - "context" - "io" - "net/http" - - "github.com/pokt-network/poktroll/pkg/signer" - "github.com/pokt-network/poktroll/x/service/types" -) - -// SendRelay sends a relay request to the given supplier's endpoint. -// It signs the request, relays it to the supplier and verifies the response signature. -// It takes an http.Request as an argument and uses its method and headers to create -// the relay request. -func (sdk *poktrollSDK) SendRelay( - ctx context.Context, - supplierEndpoint *SingleSupplierEndpoint, - request *http.Request, -) (response *types.RelayResponse, err error) { - payloadBz, err := io.ReadAll(request.Body) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("reading request body: %s", err) - } - - // Create the relay request. - relayRequest := &types.RelayRequest{ - Meta: &types.RelayRequestMetadata{ - SessionHeader: supplierEndpoint.Header, - Signature: nil, // signature added below - }, - Payload: payloadBz, - } - - // Get the application's signer. - appAddress := supplierEndpoint.Header.ApplicationAddress - appRing, err := sdk.ringCache.GetRingForAddress(ctx, appAddress) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("getting app ring: %s", err) - } - signer := signer.NewRingSigner(appRing, sdk.signingKey) - - // Hash and sign the request's signable bytes. - signableBz, err := relayRequest.GetSignableBytesHash() - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error getting signable bytes: %s", err) - } - - requestSig, err := signer.Sign(signableBz) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error signing relay: %s", err) - } - relayRequest.Meta.Signature = requestSig - - // Marshal the relay request to bytes and create a reader to be used as an HTTP request body. - cdc := types.ModuleCdc - relayRequestBz, err := cdc.Marshal(relayRequest) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error marshaling relay request: %s", err) - } - relayRequestReader := io.NopCloser(bytes.NewReader(relayRequestBz)) - var relayReq types.RelayRequest - if err := relayReq.Unmarshal(relayRequestBz); err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error unmarshaling relay request: %s", err) - } - - // Create the HTTP request to send the request to the relayer. - // All the RPC protocols to be supported (JSONRPC, Rest, Websockets, gRPC, etc) - // use HTTP under the hood. - relayHTTPRequest := &http.Request{ - Method: request.Method, - Header: request.Header, - URL: supplierEndpoint.Url, - Body: relayRequestReader, - } - - sdk.logger.Debug(). - Str("supplier_url", supplierEndpoint.Url.String()). - Msg("sending relay request") - relayHTTPResponse, err := http.DefaultClient.Do(relayHTTPRequest) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error sending relay request: %s", err) - } - - // Read the response body bytes. - relayResponseBz, err := io.ReadAll(relayHTTPResponse.Body) - if err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error reading relay response body: %s", err) - } - - // Unmarshal the response bytes into a RelayResponse. - relayResponse := &types.RelayResponse{} - if err := relayResponse.Unmarshal(relayResponseBz); err != nil { - return nil, ErrSDKHandleRelay.Wrapf("error unmarshaling relay response: %s", err) - } - - // Verify the response signature. We use the supplier address that we got from - // the getRelayerUrl function since this is the address we are expecting to sign the response. - // TODO_TECHDEBT: if the RelayResponse is an internal error response, we should not verify the signature - // as in some relayer early failures, it may not be signed by the supplier. - // TODO_IMPROVE: Add more logging & telemetry so we can get visibility and signal into - // failed responses. - if err := sdk.verifyResponse(ctx, supplierEndpoint.SupplierAddress, relayResponse); err != nil { - return nil, ErrSDKVerifyResponseSignature.Wrapf("%s", err) - } - - return relayResponse, nil -} diff --git a/pkg/sdk/session.go b/pkg/sdk/session.go deleted file mode 100644 index 634f7a7d1..000000000 --- a/pkg/sdk/session.go +++ /dev/null @@ -1,114 +0,0 @@ -package sdk - -import ( - "context" - "net/url" - - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// SessionSuppliers is the structure that represents a session's end block height -// and its matching suppliers. -type SessionSuppliers struct { - // Session is the fully hydrated session object returned by the query. - Session *sessiontypes.Session - - // SuppliersEndpoints is a slice of the session's suppliers endpoints each - // item representing a single supplier endpoint augmented with the session - // header and the supplier's address. - // An item from this slice is what needs to be passed to the `SendRelay` - // function so it has all the information needed to send the relay request. - SuppliersEndpoints []*SingleSupplierEndpoint -} - -// SingleSupplierEndpoint is the structure that represents a supplier's endpoint -// augmented with the session's header and the supplier's address for easy -// access to the needed information when sending a relay request. -type SingleSupplierEndpoint struct { - Url *url.URL - RpcType sharedtypes.RPCType - SupplierAddress string - Header *sessiontypes.SessionHeader -} - -// GetSessionSupplierEndpoints returns a flattened structure of the endpoints -// from all suppliers in the session and returns them as a SupplierEndpoint slice. -// It queries for the latest session and caches it if the cached one is outdated. -func (sdk *poktrollSDK) GetSessionSupplierEndpoints( - ctx context.Context, - appAddress, serviceId string, -) (*SessionSuppliers, error) { - sdk.serviceSessionSuppliersMu.RLock() - defer sdk.serviceSessionSuppliersMu.RUnlock() - - latestBlockHeight := sdk.blockClient.LastNBlocks(ctx, 1)[0].Height() - - // Create the latestSessions map entry for the serviceId if it doesn't exist. - if _, ok := sdk.serviceSessionSuppliers[serviceId]; !ok { - sdk.serviceSessionSuppliers[serviceId] = map[string]*SessionSuppliers{} - } - - // Create the latestSessions[serviceId] map entry for the appAddress if it doesn't exist. - if _, ok := sdk.serviceSessionSuppliers[serviceId][appAddress]; !ok { - sdk.serviceSessionSuppliers[serviceId][appAddress] = &SessionSuppliers{} - } - - // currentSession is guaranteed to exist after the checks above. - currentSession := sdk.serviceSessionSuppliers[serviceId][appAddress] - - // Return the current session's SuppliersEndpoints if the session is still valid. - if currentSession.Session != nil && - latestBlockHeight < currentSession.Session.Header.SessionEndBlockHeight { - return currentSession, nil - } - - // Query for the current session. - session, err := sdk.sessionQuerier.GetSession( - ctx, - appAddress, - serviceId, - latestBlockHeight, - ) - if err != nil { - return nil, err - } - - // Override the old Session and SessionSuppliers and construct the new one. - currentSession.Session = session - currentSession.SuppliersEndpoints = []*SingleSupplierEndpoint{} - - for _, supplier := range session.Suppliers { - for _, service := range supplier.Services { - // Skip the session's services that don't match the requested serviceId. - if service.Service.Id != serviceId { - continue - } - - // Loop through the services' endpoints and add them to the - // SessionSuppliers.SuppliersEndpoints slice. - for _, endpoint := range service.Endpoints { - url, err := url.Parse(endpoint.Url) - if err != nil { - sdk.logger.Error(). - Str("url", endpoint.Url). - Err(err). - Msg("failed to parse url") - continue - } - - currentSession.SuppliersEndpoints = append( - currentSession.SuppliersEndpoints, - &SingleSupplierEndpoint{ - Url: url, - RpcType: endpoint.RpcType, - SupplierAddress: supplier.Address, - Header: session.Header, - }, - ) - } - } - } - - return currentSession, nil -} diff --git a/pkg/sdk/urls.go b/pkg/sdk/urls.go deleted file mode 100644 index de182f150..000000000 --- a/pkg/sdk/urls.go +++ /dev/null @@ -1,10 +0,0 @@ -package sdk - -import "fmt" - -// HostToWebsocketURL converts the provided host into a websocket URL that can -// be used to subscribe to onchain events and query the chain via a client -// context or send transactions via a tx client context. -func HostToWebsocketURL(host string) string { - return fmt.Sprintf("ws://%s/websocket", host) -} diff --git a/pkg/signer/interface.go b/pkg/signer/interface.go deleted file mode 100644 index 63b40b86d..000000000 --- a/pkg/signer/interface.go +++ /dev/null @@ -1,9 +0,0 @@ -package signer - -// Signer is an interface that abstracts the signing of a message, it is used -// to sign both relay requests and responses via one of the two implementations. -// The Signer interface expects a 32 byte message (sha256 hash) and returns a -// byte slice containing the signature or any error that occurred during signing. -type Signer interface { - Sign(msg [32]byte) (signature []byte, err error) -} diff --git a/pkg/signer/ring_signer.go b/pkg/signer/ring_signer.go deleted file mode 100644 index b2c46a5ce..000000000 --- a/pkg/signer/ring_signer.go +++ /dev/null @@ -1,34 +0,0 @@ -package signer - -import ( - "fmt" - - ringtypes "github.com/athanorlabs/go-dleq/types" - ring "github.com/noot/ring-go" -) - -var _ Signer = (*RingSigner)(nil) - -// RingSigner is a signer implementation that uses a ring to sign messages, for -// verification the ring signature must be verified and confirmed to be using -// the expected ring. -type RingSigner struct { - ring *ring.Ring - privKey ringtypes.Scalar -} - -// NewRingSigner creates a new RingSigner instance with the ring and private -// key provided -func NewRingSigner(ring *ring.Ring, privKey ringtypes.Scalar) *RingSigner { - return &RingSigner{ring: ring, privKey: privKey} -} - -// Sign uses the ring and private key to sign the message provided and returns the -// serialized ring signature that can be deserialized and verified by the verifier -func (r *RingSigner) Sign(msg [32]byte) ([]byte, error) { - ringSig, err := r.ring.Sign(msg, r.privKey) - if err != nil { - return nil, fmt.Errorf("failed to sign message [%v]: %w", msg, err) - } - return ringSig.Serialize() -} diff --git a/pkg/signer/simple_signer.go b/pkg/signer/simple_signer.go deleted file mode 100644 index 432c1c8a3..000000000 --- a/pkg/signer/simple_signer.go +++ /dev/null @@ -1,23 +0,0 @@ -package signer - -import "github.com/cosmos/cosmos-sdk/crypto/keyring" - -var _ Signer = (*SimpleSigner)(nil) - -// SimpleSigner is a signer implementation that uses the local keyring to sign -// messages, for verification using the signer's corresponding public key -type SimpleSigner struct { - keyring keyring.Keyring - keyName string -} - -// NewSimpleSigner creates a new SimpleSigner instance with the keyring and keyName provided -func NewSimpleSigner(keyring keyring.Keyring, keyName string) *SimpleSigner { - return &SimpleSigner{keyring: keyring, keyName: keyName} -} - -// Sign signs the given message using the SimpleSigner's keyring and keyName -func (s *SimpleSigner) Sign(msg [32]byte) (signature []byte, err error) { - sig, _, err := s.keyring.Sign(s.keyName, msg[:]) - return sig, err -} From 93398968e07edc499edf5afa6f51b9dd133ea75d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 12:49:03 +0100 Subject: [PATCH 05/54] chore: temporarily remove E2E tests --- e2e/tests/help.feature | 7 - e2e/tests/init_test.go | 422 -------------------------------- e2e/tests/node.go | 154 ------------ e2e/tests/relay.feature | 20 -- e2e/tests/send.feature | 13 - e2e/tests/session.feature | 44 ---- e2e/tests/session_steps_test.go | 226 ----------------- e2e/tests/stake.feature | 25 -- 8 files changed, 911 deletions(-) delete mode 100644 e2e/tests/help.feature delete mode 100644 e2e/tests/init_test.go delete mode 100644 e2e/tests/node.go delete mode 100644 e2e/tests/relay.feature delete mode 100644 e2e/tests/send.feature delete mode 100644 e2e/tests/session.feature delete mode 100644 e2e/tests/session_steps_test.go delete mode 100644 e2e/tests/stake.feature diff --git a/e2e/tests/help.feature b/e2e/tests/help.feature deleted file mode 100644 index 7d0867f99..000000000 --- a/e2e/tests/help.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Root Namespace - - Scenario: User Needs Help - Given the user has the pocketd binary installed - When the user runs the command "help" - Then the user should be able to see standard output containing "Available Commands" - And the pocketd binary should exit without error diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go deleted file mode 100644 index 5afc0409f..000000000 --- a/e2e/tests/init_test.go +++ /dev/null @@ -1,422 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "flag" - "fmt" - "io/ioutil" - "log" - "os" - "regexp" - "strconv" - "strings" - "testing" - "time" - - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/regen-network/gocuke" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/testutil/testclient" - apptypes "github.com/pokt-network/poktroll/x/application/types" - sessiontypes "github.com/pokt-network/poktroll/x/session/types" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -var ( - addrRe *regexp.Regexp - amountRe *regexp.Regexp - - accNameToAddrMap = make(map[string]string) - accAddrToNameMap = make(map[string]string) - accNameToAppMap = make(map[string]apptypes.Application) - accNameToSupplierMap = make(map[string]sharedtypes.Supplier) - - flagFeaturesPath string - keyRingFlag = "--keyring-backend=test" - appGateServerUrl = "http://localhost:42069" // Keeping localhost by default because that is how we run the tests on our machines locally -) - -func init() { - addrRe = regexp.MustCompile(`address:\s+(\S+)\s+name:\s+(\S+)`) - amountRe = regexp.MustCompile(`amount:\s+"(.+?)"\s+denom:\s+upokt`) - - flag.StringVar(&flagFeaturesPath, "features-path", "*.feature", "Specifies glob paths for the runner to look up .feature files") - - // If "APPGATE_SERVER_URL" envar is present, use it for appGateServerUrl - if url := os.Getenv("APPGATE_SERVER_URL"); url != "" { - appGateServerUrl = url - } -} - -func TestMain(m *testing.M) { - flag.Parse() - log.Printf("features path: %s", flagFeaturesPath) - m.Run() -} - -type suite struct { - gocuke.TestingT - // TODO_TECHDEBT: rename to `poktrolld`. - pocketd *pocketdBin - scenarioState map[string]any // temporary state for each scenario - cdc codec.Codec - supplierQueryClient suppliertypes.QueryClient -} - -func (s *suite) Before() { - s.pocketd = new(pocketdBin) - s.scenarioState = make(map[string]any) - s.cdc = app.MakeEncodingConfig().Marshaler - s.buildAddrMap() - s.buildAppMap() - s.buildSupplierMap() - - flagSet := testclient.NewLocalnetFlagSet(s) - clientCtx := testclient.NewLocalnetClientCtx(s, flagSet) - s.supplierQueryClient = suppliertypes.NewQueryClient(clientCtx) -} - -// TestFeatures runs the e2e tests specified in any .features files in this directory -// * This test suite assumes that a LocalNet is running -func TestFeatures(t *testing.T) { - gocuke.NewRunner(t, &suite{}).Path(flagFeaturesPath).Run() -} - -// TODO_TECHDEBT: rename `pocketd` to `poktrolld`. -func (s *suite) TheUserHasThePocketdBinaryInstalled() { - s.TheUserRunsTheCommand("help") -} - -func (s *suite) ThePocketdBinaryShouldExitWithoutError() { - require.NoError(s, s.pocketd.result.Err) -} - -func (s *suite) TheUserRunsTheCommand(cmd string) { - cmds := strings.Split(cmd, " ") - res, err := s.pocketd.RunCommand(cmds...) - s.pocketd.result = res - if err != nil { - s.Fatalf("error running command %s: %s", cmd, err) - } -} - -func (s *suite) TheUserShouldBeAbleToSeeStandardOutputContaining(arg1 string) { - if !strings.Contains(s.pocketd.result.Stdout, arg1) { - s.Fatalf("stdout must contain %s", arg1) - } -} - -func (s *suite) TheUserSendsUpoktFromAccountToAccount(amount int64, accName1, accName2 string) { - args := []string{ - "tx", - "bank", - "send", - accNameToAddrMap[accName1], - accNameToAddrMap[accName2], - fmt.Sprintf("%dupokt", amount), - keyRingFlag, - "-y", - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error sending upokt: %s", err) - } - s.pocketd.result = res -} - -func (s *suite) TheAccountHasABalanceGreaterThanUpokt(accName string, amount int64) { - bal := s.getAccBalance(accName) - if int64(bal) < amount { - s.Fatalf("account %s does not have enough upokt: %d < %d", accName, bal, amount) - } - s.scenarioState[accName] = bal // save the balance for later -} - -func (s *suite) AnAccountExistsFor(accName string) { - bal := s.getAccBalance(accName) - s.scenarioState[accName] = bal // save the balance for later -} - -func (s *suite) TheAccountBalanceOfShouldBeUpoktThanBefore(accName string, amount int64, condition string) { - prev, ok := s.scenarioState[accName] - if !ok { - s.Fatalf("no previous balance found for %s", accName) - } - - bal := s.getAccBalance(accName) - switch condition { - case "more": - if bal <= prev.(int) { - s.Fatalf("account %s expected to have more upokt but: %d <= %d", accName, bal, prev) - } - case "less": - if bal >= prev.(int) { - s.Fatalf("account %s expected to have less upokt but: %d >= %d", accName, bal, prev) - } - default: - s.Fatalf("unknown condition %s", condition) - } -} - -func (s *suite) TheUserShouldWaitForSeconds(dur int64) { - time.Sleep(time.Duration(dur) * time.Second) -} - -func (s *suite) TheUserStakesAWithUpoktFromTheAccount(actorType string, amount int64, accName string) { - // Create a temporary config file - configPathPattern := fmt.Sprintf("%s_stake_config_*.yaml", accName) - configContent := fmt.Sprintf(`stake_amount: %d upokt`, amount) - configFile, err := ioutil.TempFile("", configPathPattern) - if err != nil { - s.Fatalf("error creating config file: %q", err) - } - if _, err = configFile.Write([]byte(configContent)); err != nil { - s.Fatalf("error writing config file: %q", err) - } - - args := []string{ - "tx", - actorType, - fmt.Sprintf("stake-%s", actorType), - "--config", - configFile.Name(), - "--from", - accName, - keyRingFlag, - "-y", - } - res, err := s.pocketd.RunCommandOnHost("", args...) - - // Remove the temporary config file - err = os.Remove(configFile.Name()) - if err != nil { - s.Fatalf("error removing config file: %q", err) - } - - if err != nil { - s.Fatalf("error staking %s: %s", actorType, err) - } - s.pocketd.result = res -} - -func (s *suite) TheUserUnstakesAFromTheAccount(actorType string, accName string) { - args := []string{ - "tx", - actorType, - fmt.Sprintf("unstake-%s", actorType), - "--from", - accName, - keyRingFlag, - "-y", - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error unstaking %s: %s", actorType, err) - } - s.pocketd.result = res -} - -func (s *suite) TheForAccountIsNotStaked(actorType, accName string) { - found, _ := s.getStakedAmount(actorType, accName) - if found { - s.Fatalf("account %s should not be staked", accName) - } -} - -func (s *suite) TheForAccountIsStakedWithUpokt(actorType, accName string, amount int64) { - found, stakeAmount := s.getStakedAmount(actorType, accName) - if !found { - s.Fatalf("account %s should be staked", accName) - } - if int64(stakeAmount) != amount { - s.Fatalf("account %s stake amount is not %d", accName, amount) - } -} - -func (s *suite) TheApplicationIsStakedForService(appName string, serviceId string) { - for _, serviceConfig := range accNameToAppMap[appName].ServiceConfigs { - if serviceConfig.Service.Id == serviceId { - return - } - } - s.Fatalf("application %s is not staked for service %s", appName, serviceId) -} - -func (s *suite) TheSupplierIsStakedForService(supplierName string, serviceId string) { - for _, serviceConfig := range accNameToSupplierMap[supplierName].Services { - if serviceConfig.Service.Id == serviceId { - return - } - } - s.Fatalf("supplier %s is not staked for service %s", supplierName, serviceId) -} - -func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName string, serviceId string, supplierName string) { - app, found := accNameToAppMap[appName] - if !found { - s.Fatalf("application %s not found", appName) - } - expectedSupplier, found := accNameToSupplierMap[supplierName] - if !found { - s.Fatalf("supplier %s not found", supplierName) - } - argsAndFlags := []string{ - "query", - "session", - "get-session", - app.Address, - serviceId, - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) - if err != nil { - s.Fatalf("error getting session for app %s and service %s: %s", appName, serviceId, err) - } - var resp sessiontypes.QueryGetSessionResponse - responseBz := []byte(strings.TrimSpace(res.Stdout)) - s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, supplier := range resp.Session.Suppliers { - if supplier.Address == expectedSupplier.Address { - return - } - } - s.Fatalf("session for app %s and service %s does not contain supplier %s", appName, serviceId, supplierName) -} - -func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, requestData string) { - res, err := s.pocketd.RunCurl(appGateServerUrl, serviceId, requestData) - if err != nil { - s.Fatalf("error sending relay request from app %s to supplier %s for service %s: %v", appName, supplierName, serviceId, err) - } - - relayKey := relayReferenceKey(appName, supplierName) - s.scenarioState[relayKey] = res.Stdout -} - -func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName string, supplierName string) { - relayKey := relayReferenceKey(appName, supplierName) - stdout, ok := s.scenarioState[relayKey] - - require.Truef(s, ok, "no relay response found for %s", relayKey) - require.Contains(s, stdout, `"result":"0x`) -} - -func (s *suite) getStakedAmount(actorType, accName string) (bool, int) { - s.Helper() - args := []string{ - "query", - actorType, - fmt.Sprintf("list-%s", actorType), - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error getting %s: %s", actorType, err) - } - s.pocketd.result = res - found := strings.Contains(res.Stdout, accNameToAddrMap[accName]) - amount := 0 - if found { - escapedAddress := regexp.QuoteMeta(accNameToAddrMap[accName]) - stakedAmountRe := regexp.MustCompile(`address: ` + escapedAddress + `\s+stake:\s+amount: "(\d+)"`) - matches := stakedAmountRe.FindStringSubmatch(res.Stdout) - if len(matches) < 2 { - s.Fatalf("no stake amount found for %s", accName) - } - amount, err = strconv.Atoi(matches[1]) - require.NoError(s, err) - } - return found, amount -} - -func (s *suite) buildAddrMap() { - s.Helper() - res, err := s.pocketd.RunCommand( - "keys", "list", keyRingFlag, - ) - if err != nil { - s.Fatalf("error getting keys: %s", err) - } - s.pocketd.result = res - matches := addrRe.FindAllStringSubmatch(res.Stdout, -1) - for _, match := range matches { - name := match[2] - address := match[1] - accNameToAddrMap[name] = address - accAddrToNameMap[address] = name - } -} - -func (s *suite) buildAppMap() { - s.Helper() - argsAndFlags := []string{ - "query", - "application", - "list-application", - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) - if err != nil { - s.Fatalf("error getting application list: %s", err) - } - s.pocketd.result = res - var resp apptypes.QueryAllApplicationResponse - responseBz := []byte(strings.TrimSpace(res.Stdout)) - s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, app := range resp.Application { - accNameToAppMap[accAddrToNameMap[app.Address]] = app - } -} - -func (s *suite) buildSupplierMap() { - s.Helper() - argsAndFlags := []string{ - "query", - "supplier", - "list-supplier", - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) - if err != nil { - s.Fatalf("error getting supplier list: %s", err) - } - s.pocketd.result = res - var resp suppliertypes.QueryAllSupplierResponse - responseBz := []byte(strings.TrimSpace(res.Stdout)) - s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, supplier := range resp.Supplier { - accNameToSupplierMap[accAddrToNameMap[supplier.Address]] = supplier - } -} - -func (s *suite) getAccBalance(accName string) int { - s.Helper() - args := []string{ - "query", - "bank", - "balances", - accNameToAddrMap[accName], - } - res, err := s.pocketd.RunCommandOnHost("", args...) - if err != nil { - s.Fatalf("error getting balance: %s", err) - } - s.pocketd.result = res - match := amountRe.FindStringSubmatch(res.Stdout) - if len(match) < 2 { - s.Fatalf("no balance found for %s", accName) - } - found, err := strconv.Atoi(match[1]) - require.NoError(s, err) - return found -} - -// TODO_IMPROVE: use `sessionId` and `supplierName` since those are the two values -// used to create the primary composite key on-chain to uniquely distinguish relays. -func relayReferenceKey(appName, supplierName string) string { - return fmt.Sprintf("%s/%s", appName, supplierName) -} diff --git a/e2e/tests/node.go b/e2e/tests/node.go deleted file mode 100644 index 5bf187556..000000000 --- a/e2e/tests/node.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "bytes" - "fmt" - "os" - "os/exec" - "strings" -) - -// TODO_TECHDEBT(https://github.com/ignite/cli/issues/3737): We're using a combination -// of `pocketd` (legacy) and `poktrolld` (current) because of an issue of how ignite works. -var ( - // defaultRPCURL used by pocketdBin to run remote commands - defaultRPCURL = os.Getenv("POCKET_NODE") - // defaultRPCPort is the default RPC port that pocketd listens on - defaultRPCPort = 36657 - // defaultRPCHost is the default RPC host that pocketd listens on - defaultRPCHost = "127.0.0.1" - // defaultHome is the default home directory for pocketd - defaultHome = os.Getenv("POKTROLLD_HOME") - // defaultAppGateServerURL used by curl commands to send relay requests - defaultAppGateServerURL = os.Getenv("APPGATE_SERVER") - // defaultDebugOutput provides verbose output on manipulations with binaries (cli command, stdout, stderr) - defaultDebugOutput = os.Getenv("E2E_DEBUG_OUTPUT") -) - -func init() { - if defaultRPCURL == "" { - defaultRPCURL = fmt.Sprintf("tcp://%s:%d", defaultRPCHost, defaultRPCPort) - } - if defaultHome == "" { - defaultHome = "../../localnet/poktrolld" - } -} - -// commandResult combines the stdout, stderr, and err of an operation -type commandResult struct { - Command string // the command that was executed - Stdout string // standard output - Stderr string // standard error - Err error // execution error, if any -} - -// PocketClient is a single function interface for interacting with a node -type PocketClient interface { - RunCommand(args ...string) (*commandResult, error) - RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) - RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) -} - -// Ensure that pocketdBin struct fulfills PocketClient -var _ PocketClient = (*pocketdBin)(nil) - -// pocketdBin holds the reults of the last command that was run -type pocketdBin struct { - result *commandResult // stores the result of the last command that was run -} - -// RunCommand runs a command on the local machine using the pocketd binary -func (p *pocketdBin) RunCommand(args ...string) (*commandResult, error) { - return p.runPocketCmd(args...) -} - -// RunCommandOnHost runs a command on specified host with the given args -func (p *pocketdBin) RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) { - if rpcUrl == "" { - rpcUrl = defaultRPCURL - } - args = append(args, "--node", rpcUrl) - return p.runPocketCmd(args...) -} - -// RunCurl runs a curl command on the local machine -func (p *pocketdBin) RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) { - if rpcUrl == "" { - rpcUrl = defaultAppGateServerURL - } - return p.runCurlPostCmd(rpcUrl, service, data, args...) -} - -// runPocketCmd is a helper to run a command using the local pocketd binary with the flags provided -func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) { - base := []string{"--home", defaultHome} - args = append(base, args...) - commandStr := "poktrolld " + strings.Join(args, " ") // Create a string representation of the command - cmd := exec.Command("poktrolld", args...) - - var stdoutBuf, stderrBuf bytes.Buffer - cmd.Stdout = &stdoutBuf - cmd.Stderr = &stderrBuf - - err := cmd.Run() - r := &commandResult{ - Command: commandStr, // Set the command string - Stdout: stdoutBuf.String(), - Stderr: stderrBuf.String(), - Err: err, - } - p.result = r - - if err != nil { - // Include the command executed in the error message for context - err = fmt.Errorf("error running command [%s]: %v, stderr: %s", commandStr, err, stderrBuf.String()) - } - - if defaultDebugOutput == "true" { - fmt.Printf("%#v\n", r) - } - - return r, err -} - -// runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided -func (p *pocketdBin) runCurlPostCmd(rpcUrl string, service string, data string, args ...string) (*commandResult, error) { - dataStr := fmt.Sprintf("%s", data) - urlStr := fmt.Sprintf("%s/%s", rpcUrl, service) - base := []string{ - "-v", // verbose output - "-sS", // silent with error - "-X", "POST", // HTTP method - "-H", "Content-Type: application/json", // HTTP headers - "--data", dataStr, urlStr, // POST data - } - args = append(base, args...) - commandStr := "curl " + strings.Join(args, " ") // Create a string representation of the command - cmd := exec.Command("curl", args...) - - var stdoutBuf, stderrBuf bytes.Buffer - cmd.Stdout = &stdoutBuf - cmd.Stderr = &stderrBuf - - err := cmd.Run() - r := &commandResult{ - Command: commandStr, // Set the command string - Stdout: stdoutBuf.String(), - Stderr: stderrBuf.String(), - Err: err, - } - p.result = r - - if defaultDebugOutput == "true" { - fmt.Printf("%#v\n", r) - } - - if err != nil { - // Include the command executed in the error message for context - err = fmt.Errorf("error running command [%s]: %v, stderr: %s", commandStr, err, stderrBuf.String()) - } - - return r, err -} diff --git a/e2e/tests/relay.feature b/e2e/tests/relay.feature deleted file mode 100644 index 31d82af34..000000000 --- a/e2e/tests/relay.feature +++ /dev/null @@ -1,20 +0,0 @@ -Feature: Relay Namespace - - # NB: `make acc_initialize_pubkeys` must have been executed before this test is run - Scenario: App can send relay to Supplier - Given the user has the pocketd binary installed - And the application "app1" is staked for service "anvil" - And the supplier "supplier1" is staked for service "anvil" - And the session for application "app1" and service "anvil" contains the supplier "supplier1" - When the application "app1" sends the supplier "supplier1" a request for service "anvil" with data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' - Then the application "app1" receives a successful relay response signed by "supplier1" - - # TODO_TEST(@Olshansk): - # - Successful relay if using a gateway to proxy the relay - # - Succeedful relays when using multiple suppliers for app in some session - # - Successful deduction of app's balance after claim & proof lifecycle (requires querying claims, proofs, session start/end) - # - Successful inflatino of supplier's balance after claim & proof lifecycle (requires querying claims, proofs, session start/end) - # - Error if app1 is not staked for svc1 but relay is sent - # - Error if supplier is not staked for svc1 but relay is sent - # - Error if claiming the session too early - # - Error if proving the session too early \ No newline at end of file diff --git a/e2e/tests/send.feature b/e2e/tests/send.feature deleted file mode 100644 index 4df818bf2..000000000 --- a/e2e/tests/send.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Tx Namespace - - Scenario: User can send uPOKT - Given the user has the pocketd binary installed - And the account "app1" has a balance greater than "1000" uPOKT - And an account exists for "app2" - When the user sends "1000" uPOKT from account "app1" to account "app2" - Then the user should be able to see standard output containing "txhash:" - And the user should be able to see standard output containing "code: 0" - And the pocketd binary should exit without error - And the user should wait for "5" seconds - And the account balance of "app1" should be "1000" uPOKT "less" than before - And the account balance of "app2" should be "1000" uPOKT "more" than before diff --git a/e2e/tests/session.feature b/e2e/tests/session.feature deleted file mode 100644 index f0626011d..000000000 --- a/e2e/tests/session.feature +++ /dev/null @@ -1,44 +0,0 @@ -Feature: Session Namespace - - # TODO_TECHDEBT(@Olshansk, #180): This test requires you to run `make supplier1_stake && make app1_stake` first - # As a shorter workaround, we can also add steps that stake the application and supplier as part of the scenario. - Scenario: Supplier completes claim/proof lifecycle for a valid session - Given the user has the pocketd binary installed - When the supplier "supplier1" has serviced a session with "5" relays for service "svc1" for application "app1" - # TODO_TECHDEBT: Once the session grace period is configurable, set it to 0 at the beginning of this test. - # The timeout for when a claim can be submitted on-chain depends on `createClaimWindowStartHeight`, which - # is a function of `SessionGracePeriod`. The higher this value, the higher this timeout needs to be. Since - # this test is not dependant on the grace period, setting it to 0 and having a lower grace period will simplify it. - And the user should wait for "7" seconds - Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain - # TODO_IMPROVE: And an event should be emitted... - And after the supplier submits a proof for the session for service "svc1" for application "app1" - Then the proof submitted by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain - # TODO_IMPROVE: And an event should be emitted... - -# TODO_BLOCKER(@red-0ne): Make sure to implement and validate this test -# One way to exercise this behavior is to close the `RelayMiner` port to prevent -# the `RelayRequest` from being received and processed then reopen it after the -# the defined number of blocks has passed. -# Scenario: A late Relay inside the SessionGracePeriod is handled -# Given the user has the pocketd binary installed -# And the parameter "NumBlockPerSession" is "4" -# And the parameter "SessionGracePeriod" is "1" -# When the application "app1" sends a relay request to supplier "supplier1" for service "svc1" with session number "1" -# And the supplier "supplier1" waits "5" blocks -# And the supllier "supplier1" calls GetSession and gets session number "2" -# Then the supplier "supplier1" replys with a relay response for service "svc1" for application "app1" with session number "1" -# And the application "app1" receives a successful relay response signed by "supplier1" for session number "1" -# And after the supplier "supplier1" updates a claim for session number "1" for service "svc1" for application "app1" -# Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain -# -# Scenario: A late Relay outside the SessionGracePeriod is rejected -# Given the user has the pocketd binary installed -# And the parameter "NumBlockPerSession" is "4" -# And the parameter "SessionGracePeriod" is "1" -# When the application "app1" sends a relay request to supplier "supplier1" for service "svc1" with session number "1" -# And the supplier "supplier1" waits "10" blocks -# And the supllier "supplier1" calls GetSession and gets session number "3" -# Then the supplier "supplier1" replys to application "app1" with a "session mismatch" error relay response -# And the application "app1" receives a failed relay response with a "session mismatch" error -# And the supplier "supplier1" do not update a claim for session number "1" for service "svc1" for application "app1" diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go deleted file mode 100644 index dff132d9c..000000000 --- a/e2e/tests/session_steps_test.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build e2e - -package e2e - -import ( - "context" - "encoding/json" - "fmt" - "strconv" - "strings" - "time" - - "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/pkg/client" - "github.com/pokt-network/poktroll/pkg/client/events" - "github.com/pokt-network/poktroll/pkg/observable/channel" - "github.com/pokt-network/poktroll/testutil/testclient" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" -) - -const ( - // txEventTimeout is the duration of time to wait after sending a valid tx - // before the test should time out (fail). - txEventTimeout = 10 * time.Second - // txSenderEventSubscriptionQueryFmt is the format string which yields the - // cosmos-sdk event subscription "query" string for a given sender address. - // This is used by an events replay client to subscribe to tx events from the supplier. - // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events - txSenderEventSubscriptionQueryFmt = "tm.event='Tx' AND message.sender='%s'" - testEventsReplayClientBufferSize = 100 - testServiceId = "anvil" - // eventsReplayClientKey is the suite#scenarioState key for the events replay client - // which is subscribed to tx events where the tx sender is the scenario's supplier. - eventsReplayClientKey = "eventsReplayClientKey" - // preExistingClaimsKey is the suite#scenarioState key for any pre-existing - // claims when querying for all claims prior to running the scenario. - preExistingClaimsKey = "preExistingClaimsKey" - // preExistingProofsKey is the suite#scenarioState key for any pre-existing - // proofs when querying for all proofs prior to running the scenario. - preExistingProofsKey = "preExistingProofsKey" -) - -func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(serviceId, appName string) { - s.waitForMessageAction("/pocket.supplier.MsgCreateClaim") -} - -func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { - ctx := context.Background() - - allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{ - Filter: &suppliertypes.QueryAllClaimsRequest_SupplierAddress{ - SupplierAddress: accNameToAddrMap[supplierName], - }, - }) - require.NoError(s, err) - require.NotNil(s, allClaimsRes) - - // Assert that the number of claims has increased by one. - preExistingClaims, ok := s.scenarioState[preExistingClaimsKey].([]suppliertypes.Claim) - require.True(s, ok, "preExistingClaimsKey not found in scenarioState") - // NB: We are avoiding the use of require.Len here because it provides unreadable output - // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number - // of blocks per session, multiple claims may be created throughout the duration of the test. Until - // these values are appropriately adjusted - require.Greater(s, len(allClaimsRes.Claim), len(preExistingClaims), "number of claims must have increased") - - // TODO_IMPROVE: assert that the root hash of the claim contains the correct - // SMST sum. The sum can be retrieved by parsing the last 8 bytes as a - // binary-encoded uint64; e.g. something like: - // `binary.Uvarint(claim.RootHash[len(claim.RootHash-8):])` - - // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate - // them into the scenarioState key(s). - - claim := allClaimsRes.Claim[0] - require.Equal(s, accNameToAddrMap[supplierName], claim.SupplierAddress) -} - -func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication(supplierName, relayCountStr, serviceId, appName string) { - ctx := context.Background() - - relayCount, err := strconv.Atoi(relayCountStr) - require.NoError(s, err) - - // Query for any existing claims so that we can compare against them in - // future assertions about changes in on-chain claims. - allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{}) - require.NoError(s, err) - s.scenarioState[preExistingClaimsKey] = allClaimsRes.Claim - - // Query for any existing proofs so that we can compare against them in - // future assertions about changes in on-chain proofs. - allProofsRes, err := s.supplierQueryClient.AllProofs(ctx, &suppliertypes.QueryAllProofsRequest{}) - require.NoError(s, err) - s.scenarioState[preExistingProofsKey] = allProofsRes.Proof - - // Construct an events query client to listen for tx events from the supplier. - msgSenderQuery := fmt.Sprintf(txSenderEventSubscriptionQueryFmt, accNameToAddrMap[supplierName]) - - deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) - eventsReplayClient, err := events.NewEventsReplayClient[*abci.TxResult]( - ctx, - deps, - msgSenderQuery, - func(eventBz []byte) (*abci.TxResult, error) { - if strings.Contains(string(eventBz), "jsonrpc") { - return nil, nil - } - - // Unmarshal event data into an ABCI TxResult object. - txResult := &abci.TxResult{} - err = json.Unmarshal(eventBz, txResult) - require.NoError(s, err) - - return txResult, nil - }, - testEventsReplayClientBufferSize, - ) - require.NoError(s, err) - - s.scenarioState[eventsReplayClientKey] = eventsReplayClient - - s.sendRelaysForSession( - appName, - supplierName, - testServiceId, - relayCount, - ) -} - -func (s *suite) AfterTheSupplierSubmitsAProofForTheSessionForServiceForApplication(a string, b string) { - s.waitForMessageAction("/pocket.supplier.MsgSubmitProof") -} - -func (s *suite) TheProofSubmittedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { - ctx := context.Background() - - // Retrieve all on-chain proofs for supplierName - allProofsRes, err := s.supplierQueryClient.AllProofs(ctx, &suppliertypes.QueryAllProofsRequest{ - Filter: &suppliertypes.QueryAllProofsRequest_SupplierAddress{ - SupplierAddress: accNameToAddrMap[supplierName], - }, - }) - require.NoError(s, err) - require.NotNil(s, allProofsRes) - - // Assert that the number of proofs has increased by one. - preExistingProofs, ok := s.scenarioState[preExistingProofsKey].([]suppliertypes.Proof) - require.True(s, ok, "preExistingProofsKey not found in scenarioState") - // NB: We are avoiding the use of require.Len here because it provides unreadable output - // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number - // of blocks per session, multiple proofs may be created throughout the duration of the test. Until - // these values are appropriately adjusted, we assert on an increase in proofs rather than +1. - require.Greater(s, len(allProofsRes.Proof), len(preExistingProofs), "number of proofs must have increased") - - // TODO_UPNEXT(@bryanchriswhite): assert that the root hash of the proof contains the correct - // SMST sum. The sum can be retrieved via the `GetSum` function exposed - // by the SMT. - - // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate - // them into the scenarioState key(s). - - proof := allProofsRes.Proof[0] - require.Equal(s, accNameToAddrMap[supplierName], proof.SupplierAddress) -} - -func (s *suite) sendRelaysForSession( - appName string, - supplierName string, - serviceId string, - relayLimit int, -) { - s.TheApplicationIsStakedForService(appName, serviceId) - s.TheSupplierIsStakedForService(supplierName, serviceId) - s.TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceId, supplierName) - - // TODO_IMPROVE/TODO_COMMUNITY: hard-code a default set of RPC calls to iterate over for coverage. - data := `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}` - - for i := 0; i < relayLimit; i++ { - s.TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, data) - s.TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName, supplierName) - } -} - -// waitForMessageAction waits for an event to be observed which has the given message action. -func (s *suite) waitForMessageAction(action string) { - ctx, done := context.WithCancel(context.Background()) - - eventsReplayClient, ok := s.scenarioState[eventsReplayClientKey].(client.EventsReplayClient[*abci.TxResult]) - require.True(s, ok, "eventsReplayClientKey not found in scenarioState") - require.NotNil(s, eventsReplayClient) - - // For each observed event, **asynchronously** check if it contains the given action. - channel.ForEach[*abci.TxResult]( - ctx, eventsReplayClient.EventsSequence(ctx), - func(_ context.Context, txEvent *abci.TxResult) { - if txEvent == nil { - return - } - - // Range over each event's attributes to find the "action" attribute - // and compare its value to that of the action provided. - for _, event := range txEvent.Result.Events { - for _, attribute := range event.Attributes { - if attribute.Key == "action" { - if attribute.Value == action { - done() - return - } - } - } - } - }, - ) - - select { - case <-time.After(txEventTimeout): - s.Fatalf("timed out waiting for message with action %q", action) - case <-ctx.Done(): - s.Log("Success; message detected before timeout.") - } -} diff --git a/e2e/tests/stake.feature b/e2e/tests/stake.feature deleted file mode 100644 index 1171ef3d6..000000000 --- a/e2e/tests/stake.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Stake Namespaces - - Scenario: User can stake a Gateway - Given the user has the pocketd binary installed - And the "gateway" for account "gateway1" is not staked - And the account "gateway1" has a balance greater than "1000" uPOKT - When the user stakes a "gateway" with "1000" uPOKT from the account "gateway1" - Then the user should be able to see standard output containing "txhash:" - And the user should be able to see standard output containing "code: 0" - And the pocketd binary should exit without error - And the user should wait for "5" seconds - And the "gateway" for account "gateway1" is staked with "1000" uPOKT - And the account balance of "gateway1" should be "1000" uPOKT "less" than before - - Scenario: User can unstake a Gateway - Given the user has the pocketd binary installed - And the "gateway" for account "gateway1" is staked with "1000" uPOKT - And an account exists for "gateway1" - When the user unstakes a "gateway" from the account "gateway1" - Then the user should be able to see standard output containing "txhash:" - And the user should be able to see standard output containing "code: 0" - And the pocketd binary should exit without error - And the user should wait for "5" seconds - And the "gateway" for account "gateway1" is not staked - And the account balance of "gateway1" should be "1000" uPOKT "more" than before From a2680d6f451e6ab751e30bcf018620977a09e8ba Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 12:49:49 +0100 Subject: [PATCH 06/54] chore: re-scaffold `tools` pkg --- tools/tools.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/tools.go b/tools/tools.go index 6e7a12d40..c2f88d474 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -3,9 +3,13 @@ package tools import ( + _ "github.com/bufbuild/buf/cmd/buf" + _ "github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar" _ "github.com/cosmos/gogoproto/protoc-gen-gocosmos" _ "github.com/golang/protobuf/protoc-gen-go" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" + _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" + _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) From 4aeb68001aba548e4be7b150e3a08466f67d5af6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 12:50:39 +0100 Subject: [PATCH 07/54] chore: update `localnet_regenesis` Make target --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b1493f336..76f2e43f0 100644 --- a/Makefile +++ b/Makefile @@ -175,6 +175,9 @@ localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localn cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ + ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json); \ + PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json); \ + jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "900000000", "name": "sequencer1"}]' $(POKTROLLD_HOME)/config/genesis.json > temp.json && mv temp.json $(POKTROLLD_HOME)/config/genesis.json # TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state. # cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml @@ -252,7 +255,7 @@ go_develop: proto_regen go_mockgen ## Generate protos and mocks go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests .PHONY: load_test_simple -load_test_simple: ## Runs the simpliest load test through the whole stack (appgate -> relayminer -> anvil) +load_test_simple: ## Runs the simplest load test through the whole stack (appgate -> relayminer -> anvil) k6 run load-testing/tests/appGateServerEtherium.js ############# From bc8b8210588874282ecd91690ec7533446c3410a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 12:55:29 +0100 Subject: [PATCH 08/54] chore: re-scaffold chain & ensure sequencer produces blocks --- app/app.go | 443 + app/app_config.go | 304 + app/export.go | 234 + app/genesis.go | 14 + app/genesis_account.go | 47 + app/ibc.go | 205 + app/sim_bench_test.go | 150 + app/sim_test.go | 427 + buf.work.yaml | 8 + cmd/poktrolld/cmd/commands.go | 191 + cmd/poktrolld/cmd/config.go | 91 + cmd/poktrolld/cmd/root.go | 173 + cmd/poktrolld/main.go | 19 + cmd/signals/on_exit.go | 24 + config.yml | 118 + docs/docs.go | 40 + docs/static/openapi.yml | 26547 ++++++++++++++++++++++++++++++++ docs/template/index.tpl | 28 + go.mod | 339 + go.sum | 3018 ++++ proto/buf.gen.gogo.yaml | 18 + proto/buf.gen.pulsar.yaml | 22 + proto/buf.gen.sta.yaml | 15 + proto/buf.gen.swagger.yaml | 14 + proto/buf.gen.ts.yaml | 18 + proto/buf.lock | 35 + proto/buf.yaml | 25 + testutil/network/network.go | 80 + testutil/nullify/nullify.go | 57 + testutil/sample/sample.go | 13 + 30 files changed, 32717 insertions(+) create mode 100644 app/app.go create mode 100644 app/app_config.go create mode 100644 app/export.go create mode 100644 app/genesis.go create mode 100644 app/genesis_account.go create mode 100644 app/ibc.go create mode 100644 app/sim_bench_test.go create mode 100644 app/sim_test.go create mode 100644 buf.work.yaml create mode 100644 cmd/poktrolld/cmd/commands.go create mode 100644 cmd/poktrolld/cmd/config.go create mode 100644 cmd/poktrolld/cmd/root.go create mode 100644 cmd/poktrolld/main.go create mode 100644 cmd/signals/on_exit.go create mode 100644 config.yml create mode 100644 docs/docs.go create mode 100644 docs/static/openapi.yml create mode 100644 docs/template/index.tpl create mode 100644 go.mod create mode 100644 go.sum create mode 100644 proto/buf.gen.gogo.yaml create mode 100644 proto/buf.gen.pulsar.yaml create mode 100644 proto/buf.gen.sta.yaml create mode 100644 proto/buf.gen.swagger.yaml create mode 100644 proto/buf.gen.ts.yaml create mode 100644 proto/buf.lock create mode 100644 proto/buf.yaml create mode 100644 testutil/network/network.go create mode 100644 testutil/nullify/nullify.go create mode 100644 testutil/sample/sample.go diff --git a/app/app.go b/app/app.go new file mode 100644 index 000000000..9f05ee7de --- /dev/null +++ b/app/app.go @@ -0,0 +1,443 @@ +package app + +import ( + "io" + "os" + "path/filepath" + + "cosmossdk.io/depinject" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + 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" + consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + + // this line is used by starport scaffolding # stargate/app/moduleImport + + "github.com/pokt-network/poktroll/docs" +) + +const ( + AccountAddressPrefix = "cosmos" + Name = "poktroll" +) + +var ( + // DefaultNodeHome default home directories for the application daemon + DefaultNodeHome string +) + +var ( + _ runtime.AppI = (*App)(nil) + _ servertypes.Application = (*App)(nil) +) + +// App extends an ABCI application, but with most of its parameters exported. +// They are exported for convenience in creating helper functions, as object +// capabilities aren't needed for testing. +type App struct { + *runtime.App + legacyAmino *codec.LegacyAmino + appCodec codec.Codec + txConfig client.TxConfig + interfaceRegistry codectypes.InterfaceRegistry + + // keepers + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper *govkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + AuthzKeeper authzkeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + GroupKeeper groupkeeper.Keeper + ConsensusParamsKeeper consensuskeeper.Keeper + CircuitBreakerKeeper circuitkeeper.Keeper + + // IBC + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + CapabilityKeeper *capabilitykeeper.Keeper + IBCFeeKeeper ibcfeekeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + + // Scoped IBC + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + + // this line is used by starport scaffolding # stargate/app/keeperDeclaration + + // simulation manager + sm *module.SimulationManager +} + +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } + + DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) +} + +// getGovProposalHandlers return the chain proposal handlers. +func getGovProposalHandlers() []govclient.ProposalHandler { + var govProposalHandlers []govclient.ProposalHandler + // this line is used by starport scaffolding # stargate/app/govProposalHandlers + + govProposalHandlers = append(govProposalHandlers, + paramsclient.ProposalHandler, + // this line is used by starport scaffolding # stargate/app/govProposalHandler + ) + + return govProposalHandlers +} + +// AppConfig returns the default app config. +func AppConfig() depinject.Config { + return depinject.Configs( + appConfig, + // Loads the ao config from a YAML file. + // appconfig.LoadYAML(AppConfigYAML), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + // this line is used by starport scaffolding # stargate/appConfig/moduleBasic + }, + ), + ) +} + +// New returns a reference to an initialized App. +func New( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + loadLatest bool, + appOpts servertypes.AppOptions, + baseAppOptions ...func(*baseapp.BaseApp), +) (*App, error) { + var ( + app = &App{} + appBuilder *runtime.AppBuilder + + // merge the AppConfig and other configuration in one config + appConfig = depinject.Configs( + AppConfig(), + depinject.Supply( + // Supply the application options + appOpts, + // Supply with IBC keeper getter for the IBC modules with App Wiring. + // The IBC Keeper cannot be passed because it has not been initiated yet. + // Passing the getter, the app IBC Keeper will always be accessible. + // This needs to be removed after IBC supports App Wiring. + app.GetIBCKeeper, + app.GetCapabilityScopedKeeper, + // Supply the logger + logger, + + // ADVANCED CONFIGURATION + // + // AUTH + // + // For providing a custom function required in auth to generate custom account types + // add it below. By default the auth module uses simulation.RandomGenesisAccounts. + // + // authtypes.RandomGenesisAccountsFn(simulation.RandomGenesisAccounts), + // + // For providing a custom a base account type add it below. + // By default the auth module uses authtypes.ProtoBaseAccount(). + // + // func() sdk.AccountI { return authtypes.ProtoBaseAccount() }, + // + // For providing a different address codec, add it below. + // By default the auth module uses a Bech32 address codec, + // with the prefix defined in the auth module configuration. + // + // func() address.Codec { return <- custom address codec type -> } + + // + // STAKING + // + // For provinding a different validator and consensus address codec, add it below. + // By default the staking module uses the bech32 prefix provided in the auth config, + // and appends "valoper" and "valcons" for validator and consensus addresses respectively. + // When providing a custom address codec in auth, custom address codecs must be provided here as well. + // + // func() runtime.ValidatorAddressCodec { return <- custom validator address codec type -> } + // func() runtime.ConsensusAddressCodec { return <- custom consensus address codec type -> } + + // + // MINT + // + + // For providing a custom inflation function for x/mint add here your + // custom function that implements the minttypes.InflationCalculationFn + // interface. + ), + ) + ) + + if err := depinject.Inject(appConfig, + &appBuilder, + &app.appCodec, + &app.legacyAmino, + &app.txConfig, + &app.interfaceRegistry, + &app.AccountKeeper, + &app.BankKeeper, + &app.StakingKeeper, + &app.SlashingKeeper, + &app.MintKeeper, + &app.DistrKeeper, + &app.GovKeeper, + &app.CrisisKeeper, + &app.UpgradeKeeper, + &app.ParamsKeeper, + &app.AuthzKeeper, + &app.EvidenceKeeper, + &app.FeeGrantKeeper, + &app.GroupKeeper, + &app.ConsensusParamsKeeper, + &app.CircuitBreakerKeeper, + // this line is used by starport scaffolding # stargate/app/keeperDefinition + ); err != nil { + panic(err) + } + + // Below we could construct and set an application specific mempool and + // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are + // already set in the SDK's BaseApp, this shows an example of how to override + // them. + // + // Example: + // + // app.App = appBuilder.Build(...) + // nonceMempool := mempool.NewSenderNonceMempool() + // abciPropHandler := NewDefaultProposalHandler(nonceMempool, app.App.BaseApp) + // + // app.App.BaseApp.SetMempool(nonceMempool) + // app.App.BaseApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // app.App.BaseApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) + // + // Alternatively, you can construct BaseApp options, append those to + // baseAppOptions and pass them to the appBuilder. + // + // Example: + // + // prepareOpt = func(app *baseapp.BaseApp) { + // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) + // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) + // } + // baseAppOptions = append(baseAppOptions, prepareOpt) + // + // create and set vote extension handler + // voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtHandler := NewVoteExtensionHandler() + // voteExtHandler.SetHandlers(bApp) + // } + + app.App = appBuilder.Build(db, traceStore, baseAppOptions...) + + // Register legacy modules + app.registerIBCModules() + + // register streaming services + if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { + return nil, err + } + + /**** Module Options ****/ + + app.ModuleManager.RegisterInvariants(app.CrisisKeeper) + + // add test gRPC service for testing gRPC queries in isolation + testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) + + // create the simulation manager and define the order of the modules for deterministic simulations + // + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions + overrideModules := map[string]module.AppModuleSimulation{ + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + } + app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) + + app.sm.RegisterStoreDecoders() + + // A custom InitChainer can be set if extra pre-init-genesis logic is required. + // By default, when using app wiring enabled module, this is not required. + // For instance, the upgrade module will set automatically the module version map in its init genesis thanks to app wiring. + // However, when registering a module manually (i.e. that does not support app wiring), the module version map + // must be set manually as follow. The upgrade module will de-duplicate the module version map. + // + // app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { + // app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + // return app.App.InitChainer(ctx, req) + // }) + + if err := app.Load(loadLatest); err != nil { + return nil, err + } + + return app, nil +} + +// LegacyAmino returns App's amino codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *App) LegacyAmino() *codec.LegacyAmino { + return app.legacyAmino +} + +// AppCodec returns App's app codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *App) AppCodec() codec.Codec { + return app.appCodec +} + +// GetKey returns the KVStoreKey for the provided store key. +func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { + kvStoreKey, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface. +func (app *App) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } + + // register app's OpenAPI routes. + docs.RegisterOpenAPIService(Name, apiSvr.Router) +} + +// GetIBCKeeper returns the IBC keeper. +func (app *App) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper +} + +// GetCapabilityScopedKeeper returns the capability scoped keeper. +func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper { + return app.CapabilityKeeper.ScopeToModule(moduleName) +} + +// GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. +func GetMaccPerms() map[string][]string { + dup := make(map[string][]string) + for _, perms := range moduleAccPerms { + dup[perms.Account] = perms.Permissions + } + return dup +} + +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { + result := make(map[string]bool) + if len(blockAccAddrs) > 0 { + for _, addr := range blockAccAddrs { + result[addr] = true + } + } else { + for addr := range GetMaccPerms() { + result[addr] = true + } + } + return result +} diff --git a/app/app_config.go b/app/app_config.go new file mode 100644 index 000000000..29f20c962 --- /dev/null +++ b/app/app_config.go @@ -0,0 +1,304 @@ +package app + +import ( + "time" + + runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" + appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" + authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" + bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" + circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" + consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" + distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" + evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" + feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" + genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" + govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1" + groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" + mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" + paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" + slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" + stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" + txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" + upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" + vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" + "cosmossdk.io/core/appconfig" + _ "cosmossdk.io/x/circuit" // import for side-effects + circuittypes "cosmossdk.io/x/circuit/types" + _ "cosmossdk.io/x/evidence" // import for side-effects + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + _ "cosmossdk.io/x/feegrant/module" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/runtime" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + "google.golang.org/protobuf/types/known/durationpb" + // this line is used by starport scaffolding # stargate/app/moduleImport +) + +var ( + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + genesisModuleOrder = []string{ + // cosmos-sdk/ibc modules + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + ibcexported.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + circuittypes.ModuleName, + group.ModuleName, + consensusparamtypes.ModuleName, + circuittypes.ModuleName, + // chain modules + // this line is used by starport scaffolding # stargate/app/initGenesis + } + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + beginBlockers = []string{ + // cosmos sdk modules + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authz.ModuleName, + genutiltypes.ModuleName, + // ibc modules + capabilitytypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + // this line is used by starport scaffolding # stargate/app/beginBlockers + } + + endBlockers = []string{ + // cosmos sdk modules + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, + genutiltypes.ModuleName, + // ibc modules + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + // this line is used by starport scaffolding # stargate/app/endBlockers + } + + preBlockers = []string{ + upgradetypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/preBlockers + } + + // module account permissions + moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ + {Account: authtypes.FeeCollectorName}, + {Account: distrtypes.ModuleName}, + {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, + {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, + {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: ibcfeetypes.ModuleName}, + {Account: icatypes.ModuleName}, + // this line is used by starport scaffolding # stargate/app/maccPerms + } + + // blocked account addresses + blockAccAddrs = []string{ + authtypes.FeeCollectorName, + distrtypes.ModuleName, + minttypes.ModuleName, + stakingtypes.BondedPoolName, + stakingtypes.NotBondedPoolName, + // We allow the following module accounts to receive funds: + // govtypes.ModuleName + } + + // appConfig application configuration (used by depinject) + appConfig = appconfig.Compose(&appv1alpha1.Config{ + Modules: []*appv1alpha1.ModuleConfig{ + { + Name: runtime.ModuleName, + Config: appconfig.WrapAny(&runtimev1alpha1.Module{ + AppName: Name, + PreBlockers: preBlockers, + BeginBlockers: beginBlockers, + EndBlockers: endBlockers, + InitGenesis: genesisModuleOrder, + OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ + { + ModuleName: authtypes.ModuleName, + KvStoreKey: "acc", + }, + }, + // When ExportGenesis is not specified, the export genesis module order + // is equal to the init genesis order + // ExportGenesis: genesisModuleOrder, + // Uncomment if you want to set a custom migration order here. + // OrderMigrations: nil, + }), + }, + { + Name: authtypes.ModuleName, + Config: appconfig.WrapAny(&authmodulev1.Module{ + Bech32Prefix: AccountAddressPrefix, + ModuleAccountPermissions: moduleAccPerms, + // By default modules authority is the governance module. This is configurable with the following: + // Authority: "group", // A custom module authority can be set using a module name + // Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address + }), + }, + { + Name: vestingtypes.ModuleName, + Config: appconfig.WrapAny(&vestingmodulev1.Module{}), + }, + { + Name: banktypes.ModuleName, + Config: appconfig.WrapAny(&bankmodulev1.Module{ + BlockedModuleAccountsOverride: blockAccAddrs, + }), + }, + { + Name: stakingtypes.ModuleName, + Config: appconfig.WrapAny(&stakingmodulev1.Module{ + // NOTE: specifying a prefix is only necessary when using bech32 addresses + // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + Bech32PrefixValidator: AccountAddressPrefix + "valoper", + Bech32PrefixConsensus: AccountAddressPrefix + "valcons", + }), + }, + { + Name: slashingtypes.ModuleName, + Config: appconfig.WrapAny(&slashingmodulev1.Module{}), + }, + { + Name: paramstypes.ModuleName, + Config: appconfig.WrapAny(¶msmodulev1.Module{}), + }, + { + Name: "tx", + Config: appconfig.WrapAny(&txconfigv1.Config{}), + }, + { + Name: genutiltypes.ModuleName, + Config: appconfig.WrapAny(&genutilmodulev1.Module{}), + }, + { + Name: authz.ModuleName, + Config: appconfig.WrapAny(&authzmodulev1.Module{}), + }, + { + Name: upgradetypes.ModuleName, + Config: appconfig.WrapAny(&upgrademodulev1.Module{}), + }, + { + Name: distrtypes.ModuleName, + Config: appconfig.WrapAny(&distrmodulev1.Module{}), + }, + { + Name: evidencetypes.ModuleName, + Config: appconfig.WrapAny(&evidencemodulev1.Module{}), + }, + { + Name: minttypes.ModuleName, + Config: appconfig.WrapAny(&mintmodulev1.Module{}), + }, + { + Name: group.ModuleName, + Config: appconfig.WrapAny(&groupmodulev1.Module{ + MaxExecutionPeriod: durationpb.New(time.Second * 1209600), + MaxMetadataLen: 255, + }), + }, + { + Name: feegrant.ModuleName, + Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), + }, + { + Name: govtypes.ModuleName, + Config: appconfig.WrapAny(&govmodulev1.Module{}), + }, + { + Name: crisistypes.ModuleName, + Config: appconfig.WrapAny(&crisismodulev1.Module{}), + }, + { + Name: consensustypes.ModuleName, + Config: appconfig.WrapAny(&consensusmodulev1.Module{}), + }, + { + Name: circuittypes.ModuleName, + Config: appconfig.WrapAny(&circuitmodulev1.Module{}), + }, + // this line is used by starport scaffolding # stargate/app/moduleConfig + }, + }) +) diff --git a/app/export.go b/app/export.go new file mode 100644 index 000000000..21203b274 --- /dev/null +++ b/app/export.go @@ -0,0 +1,234 @@ +package app + +import ( + "encoding/json" + "fmt" + "log" + + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// ExportAppStateAndValidators exports the state of the application for a genesis +// file. +func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { + // as if they could withdraw from the start of the next block + ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) + + // We export at last height + 1, because that's the height at which + // CometBFT will start InitChain. + height := app.LastBlockHeight() + 1 + if forZeroHeight { + height = 0 + app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) + } + + genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + if err != nil { + return servertypes.ExportedApp{}, err + } + + appState, err := json.MarshalIndent(genState, "", " ") + if err != nil { + return servertypes.ExportedApp{}, err + } + + validators, err := staking.WriteValidators(ctx, app.StakingKeeper) + return servertypes.ExportedApp{ + AppState: appState, + Validators: validators, + Height: height, + ConsensusParams: app.BaseApp.GetConsensusParams(ctx), + }, err +} + +// prepare for fresh start at zero height +// NOTE zero height genesis is a temporary feature which will be deprecated +// +// in favor of export at a block height +func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { + applyAllowedAddrs := false + + // check if there is a allowed address list + if len(jailAllowedAddrs) > 0 { + applyAllowedAddrs = true + } + + allowedAddrsMap := make(map[string]bool) + + for _, addr := range jailAllowedAddrs { + _, err := sdk.ValAddressFromBech32(addr) + if err != nil { + log.Fatal(err) + } + allowedAddrsMap[addr] = true + } + + /* Just to be safe, assert the invariants on current state. */ + app.CrisisKeeper.AssertInvariants(ctx) + + /* Handle fee distribution state. */ + + // withdraw all validator commission + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) + return false + }) + if err != nil { + panic(err) + } + + // withdraw all delegator rewards + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + + for _, delegation := range dels { + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) + } + + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + + _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) + } + + // clear validator slash events + app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) + + // clear validator historical rewards + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + + // set context height to zero + height := ctx.BlockHeight() + ctx = ctx.WithBlockHeight(0) + + // reinitialize all validators + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + // donate any unwithdrawn outstanding reward fraction tokens to the community pool + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } + feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + panic(err) + } + + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { + panic(err) + } + return false + }) + + // reinitialize all delegations + for _, del := range dels { + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + if err != nil { + panic(err) + } + delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) + + if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { + // never called as BeforeDelegationCreated always returns nil + panic(fmt.Errorf("error while incrementing period: %w", err)) + } + + if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil { + // never called as AfterDelegationModified always returns nil + panic(fmt.Errorf("error while creating a new delegation period record: %w", err)) + } + } + + // reset context height + ctx = ctx.WithBlockHeight(height) + + /* Handle staking state. */ + + // iterate through redelegations, reset creation height + app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + for i := range red.Entries { + red.Entries[i].CreationHeight = 0 + } + err = app.StakingKeeper.SetRedelegation(ctx, red) + if err != nil { + panic(err) + } + return false + }) + + // iterate through unbonding delegations, reset creation height + app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + for i := range ubd.Entries { + ubd.Entries[i].CreationHeight = 0 + } + err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + if err != nil { + panic(err) + } + return false + }) + + // Iterate through validators by power descending, reset bond heights, and + // update bond intra-tx counters. + store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + counter := int16(0) + + for ; iter.Valid(); iter.Next() { + addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { + panic("expected validator, not found") + } + + validator.UnbondingHeight = 0 + if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { + validator.Jailed = true + } + + app.StakingKeeper.SetValidator(ctx, validator) + counter++ + } + + if err := iter.Close(); err != nil { + app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err) + return + } + + _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + log.Fatal(err) + } + + /* Handle slashing state. */ + + // reset start height on signing infos + app.SlashingKeeper.IterateValidatorSigningInfos( + ctx, + func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { + info.StartHeight = 0 + app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + return false + }, + ) +} diff --git a/app/genesis.go b/app/genesis.go new file mode 100644 index 000000000..e4e849fc2 --- /dev/null +++ b/app/genesis.go @@ -0,0 +1,14 @@ +package app + +import ( + "encoding/json" +) + +// GenesisState of the blockchain is represented here as a map of raw json +// messages key'd by a identifier string. +// The identifier is used to determine which module genesis information belongs +// to so it may be appropriately routed during init chain. +// Within this application default genesis information is retrieved from +// the ModuleBasicManager which populates json from each BasicModule +// object provided to it during init. +type GenesisState map[string]json.RawMessage diff --git a/app/genesis_account.go b/app/genesis_account.go new file mode 100644 index 000000000..91ff4dfc4 --- /dev/null +++ b/app/genesis_account.go @@ -0,0 +1,47 @@ +package app + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +var _ authtypes.GenesisAccount = (*GenesisAccount)(nil) + +// GenesisAccount defines a type that implements the GenesisAccount interface +// to be used for simulation accounts in the genesis state. +type GenesisAccount struct { + *authtypes.BaseAccount + + // vesting account fields + OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization + DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation + DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation + StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time) + EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time) + + // module account fields + ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account + ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account +} + +// Validate checks for errors on the vesting and module account parameters +func (sga GenesisAccount) Validate() error { + if !sga.OriginalVesting.IsZero() { + if sga.StartTime >= sga.EndTime { + return errors.New("vesting start-time cannot be before end-time") + } + } + + if sga.ModuleName != "" { + ma := authtypes.ModuleAccount{ + BaseAccount: sga.BaseAccount, Name: sga.ModuleName, Permissions: sga.ModulePermissions, + } + if err := ma.Validate(); err != nil { + return err + } + } + + return sga.BaseAccount.Validate() +} diff --git a/app/ibc.go b/app/ibc.go new file mode 100644 index 000000000..2b0bd5691 --- /dev/null +++ b/app/ibc.go @@ -0,0 +1,205 @@ +package app + +import ( + "cosmossdk.io/core/appmodule" + storetypes "cosmossdk.io/store/types" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + icamodule "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + // this line is used by starport scaffolding # ibc/app/import +) + +// registerIBCModules register IBC keepers and non dependency inject modules. +func (app *App) registerIBCModules() { + // set up non depinject support modules store keys + if err := app.RegisterStores( + storetypes.NewKVStoreKey(capabilitytypes.StoreKey), + storetypes.NewKVStoreKey(ibcexported.StoreKey), + storetypes.NewKVStoreKey(ibctransfertypes.StoreKey), + storetypes.NewKVStoreKey(ibcfeetypes.StoreKey), + storetypes.NewKVStoreKey(icahosttypes.StoreKey), + storetypes.NewKVStoreKey(icacontrollertypes.StoreKey), + storetypes.NewMemoryStoreKey(capabilitytypes.MemStoreKey), + storetypes.NewTransientStoreKey(paramstypes.TStoreKey), + ); err != nil { + panic(err) + } + + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + app.ParamsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + app.ParamsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + app.ParamsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) + + // add capability keeper and ScopeToModule for ibc module + app.CapabilityKeeper = capabilitykeeper.NewKeeper( + app.AppCodec(), + app.GetKey(capabilitytypes.StoreKey), + app.GetMemKey(capabilitytypes.MemStoreKey), + ) + + // add capability keeper and ScopeToModule for ibc module + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + scopedIBCTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + + // Create IBC keeper + app.IBCKeeper = ibckeeper.NewKeeper( + app.appCodec, + app.GetKey(ibcexported.StoreKey), + app.GetSubspace(ibcexported.ModuleName), + app.StakingKeeper, + app.UpgradeKeeper, + scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://docs.cosmos.network/main/modules/gov#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler) + + app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + app.appCodec, app.GetKey(ibcfeetypes.StoreKey), + app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + ) + + // Create IBC transfer keeper + app.TransferKeeper = ibctransferkeeper.NewKeeper( + app.appCodec, + app.GetKey(ibctransfertypes.StoreKey), + app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCFeeKeeper, + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + app.AccountKeeper, + app.BankKeeper, + scopedIBCTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Create interchain account keepers + app.ICAHostKeeper = icahostkeeper.NewKeeper( + app.appCodec, + app.GetKey(icahosttypes.StoreKey), + app.GetSubspace(icahosttypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + app.AccountKeeper, + scopedICAHostKeeper, + app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + app.appCodec, + app.GetKey(icacontrollertypes.StoreKey), + app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, + app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.GovKeeper.SetLegacyRouter(govRouter) + + // Create IBC modules with ibcfee middleware + transferIBCModule := ibcfee.NewIBCMiddleware(ibctransfer.NewIBCModule(app.TransferKeeper), app.IBCFeeKeeper) + + // integration point for custom authentication modules + var noAuthzModule porttypes.IBCModule + icaControllerIBCModule := ibcfee.NewIBCMiddleware( + icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper), + app.IBCFeeKeeper, + ) + + icaHostIBCModule := ibcfee.NewIBCMiddleware(icahost.NewIBCModule(app.ICAHostKeeper), app.IBCFeeKeeper) + + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter(). + AddRoute(ibctransfertypes.ModuleName, transferIBCModule). + AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). + AddRoute(icahosttypes.SubModuleName, icaHostIBCModule) + + // this line is used by starport scaffolding # ibc/app/module + + app.IBCKeeper.SetRouter(ibcRouter) + + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedIBCTransferKeeper = scopedIBCTransferKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + + // register IBC modules + if err := app.RegisterModules( + ibc.NewAppModule(app.IBCKeeper), + ibctransfer.NewAppModule(app.TransferKeeper), + ibcfee.NewAppModule(app.IBCFeeKeeper), + icamodule.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), + capability.NewAppModule(app.appCodec, *app.CapabilityKeeper, false), + ibctm.AppModule{}, + solomachine.AppModule{}, + ); err != nil { + panic(err) + } +} + +// Since the IBC modules don't support dependency injection, we need to +// manually register the modules on the client side. +// This needs to be removed after IBC supports App Wiring. +func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppModule { + modules := map[string]appmodule.AppModule{ + ibcexported.ModuleName: ibc.AppModule{}, + ibctransfertypes.ModuleName: ibctransfer.AppModule{}, + ibcfeetypes.ModuleName: ibcfee.AppModule{}, + icatypes.ModuleName: icamodule.AppModule{}, + capabilitytypes.ModuleName: capability.AppModule{}, + ibctm.ModuleName: ibctm.AppModule{}, + solomachine.ModuleName: solomachine.AppModule{}, + } + + for _, module := range modules { + if mod, ok := module.(interface { + RegisterInterfaces(registry cdctypes.InterfaceRegistry) + }); ok { + mod.RegisterInterfaces(registry) + } + } + + return modules +} diff --git a/app/sim_bench_test.go b/app/sim_bench_test.go new file mode 100644 index 000000000..91d1eb1f4 --- /dev/null +++ b/app/sim_bench_test.go @@ -0,0 +1,150 @@ +package app_test + +import ( + "fmt" + "os" + "testing" + + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app" +) + +// Profile with: +// `go test -benchmem -run=^$ -bench ^BenchmarkFullAppSimulation ./app -Commit=true -cpuprofile cpu.out` +func BenchmarkFullAppSimulation(b *testing.B) { + b.ReportAllocs() + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "goleveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if err != nil { + b.Fatalf("simulation setup failed: %s", err.Error()) + } + + if skip { + b.Skip("skipping benchmark application simulation") + } + + defer func() { + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + require.NoError(b, err) + require.Equal(b, app.Name, bApp.Name()) + + // run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( + b, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + if err = simtestutil.CheckExportSimulation(bApp, config, simParams); err != nil { + b.Fatal(err) + } + + if simErr != nil { + b.Fatal(simErr) + } + + if config.Commit { + simtestutil.PrintStats(db) + } +} + +func BenchmarkInvariants(b *testing.B) { + b.ReportAllocs() + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-invariant-bench", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if err != nil { + b.Fatalf("simulation setup failed: %s", err.Error()) + } + + if skip { + b.Skip("skipping benchmark application simulation") + } + + config.AllInvariants = false + + defer func() { + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + require.NoError(b, err) + require.Equal(b, app.Name, bApp.Name()) + + // run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( + b, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + if err = simtestutil.CheckExportSimulation(bApp, config, simParams); err != nil { + b.Fatal(err) + } + + if simErr != nil { + b.Fatal(simErr) + } + + if config.Commit { + simtestutil.PrintStats(db) + } + + ctx := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight() + 1}) + + // 3. Benchmark each invariant separately + // + // NOTE: We use the crisis keeper as it has all the invariants registered with + // their respective metadata which makes it useful for testing/benchmarking. + for _, cr := range bApp.CrisisKeeper.Routes() { + cr := cr + b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { + if res, stop := cr.Invar(ctx); stop { + b.Fatalf( + "broken invariant at block %d of %d\n%s", + ctx.BlockHeight()-1, config.NumBlocks, res, + ) + } + }) + } +} diff --git a/app/sim_test.go b/app/sim_test.go new file mode 100644 index 000000000..c40e55ef6 --- /dev/null +++ b/app/sim_test.go @@ -0,0 +1,427 @@ +package app_test + +import ( + "encoding/json" + "flag" + "fmt" + "math/rand" + "os" + "runtime/debug" + "strings" + "testing" + "time" + + "cosmossdk.io/log" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/feegrant" + abci "github.com/cometbft/cometbft/abci/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + "github.com/cosmos/cosmos-sdk/x/simulation" + simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/spf13/viper" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app" +) + +const ( + SimAppChainID = "poktroll-simapp" +) + +var FlagEnableStreamingValue bool + +// Get flags every time the simulator is run +func init() { + simcli.GetSimulatorFlags() + flag.BoolVar(&FlagEnableStreamingValue, "EnableStreaming", false, "Enable streaming service") +} + +// 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()) +} + +// BenchmarkSimulation run the chain simulation +// Running using starport command: +// `ignite chain simulate -v --numBlocks 200 --blockSize 50` +// Running as go benchmark test: +// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true` +func BenchmarkSimulation(b *testing.B) { + simcli.FlagSeedValue = time.Now().Unix() + simcli.FlagVerboseValue = true + simcli.FlagCommitValue = true + simcli.FlagEnabledValue = true + + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if skip { + b.Skip("skipping application simulation") + } + require.NoError(b, err, "simulation setup failed") + + defer func() { + require.NoError(b, db.Close()) + require.NoError(b, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(b, err) + require.Equal(b, app.Name, bApp.Name()) + + // run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( + b, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simulationtypes.RandomAccounts, + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + err = simtestutil.CheckExportSimulation(bApp, config, simParams) + require.NoError(b, err) + require.NoError(b, simErr) + + if config.Commit { + simtestutil.PrintStats(db) + } +} + +func TestAppImportExport(t *testing.T) { + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if skip { + t.Skip("skipping application import/export simulation") + } + require.NoError(t, err, "simulation setup failed") + + defer func() { + require.NoError(t, db.Close()) + require.NoError(t, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, bApp.Name()) + + // Run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( + t, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simulationtypes.RandomAccounts, + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + err = simtestutil.CheckExportSimulation(bApp, config, simParams) + require.NoError(t, err) + require.NoError(t, simErr) + + if config.Commit { + simtestutil.PrintStats(db) + } + + fmt.Printf("exporting genesis...\n") + + exported, err := bApp.ExportAppStateAndValidators(false, []string{}, []string{}) + require.NoError(t, err) + + fmt.Printf("importing genesis...\n") + + newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + require.NoError(t, err, "simulation setup failed") + + defer func() { + require.NoError(t, newDB.Close()) + require.NoError(t, os.RemoveAll(newDir)) + }() + + newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, newApp.Name()) + + var genesisState app.GenesisState + err = json.Unmarshal(exported.AppState, &genesisState) + require.NoError(t, err) + + ctxA := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) + ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) + _, err = newApp.ModuleManager.InitGenesis(ctxB, bApp.AppCodec(), genesisState) + + if err != nil { + if strings.Contains(err.Error(), "validator set is empty after InitGenesis") { + logger.Info("Skipping simulation as all validators have been unbonded") + logger.Info("err", err, "stacktrace", string(debug.Stack())) + return + } + } + require.NoError(t, err) + err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + require.NoError(t, err) + fmt.Printf("comparing stores...\n") + + // skip certain prefixes + skipPrefixes := map[string][][]byte{ + stakingtypes.StoreKey: { + stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, + stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, + stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, + }, + authzkeeper.StoreKey: {authzkeeper.GrantQueuePrefix}, + feegrant.StoreKey: {feegrant.FeeAllowanceQueueKeyPrefix}, + slashingtypes.StoreKey: {slashingtypes.ValidatorMissedBlockBitmapKeyPrefix}, + } + + storeKeys := bApp.GetStoreKeys() + require.NotEmpty(t, storeKeys) + + for _, appKeyA := range storeKeys { + // only compare kvstores + if _, ok := appKeyA.(*storetypes.KVStoreKey); !ok { + continue + } + + keyName := appKeyA.Name() + appKeyB := newApp.GetKey(keyName) + + storeA := ctxA.KVStore(appKeyA) + storeB := ctxB.KVStore(appKeyB) + + failedKVAs, failedKVBs := simtestutil.DiffKVStores(storeA, storeB, skipPrefixes[keyName]) + require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare %s", keyName) + + fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), appKeyA, appKeyB) + + require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(keyName, bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + } +} + +func TestAppSimulationAfterImport(t *testing.T) { + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID + + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if skip { + t.Skip("skipping application simulation after import") + } + require.NoError(t, err, "simulation setup failed") + + defer func() { + require.NoError(t, db.Close()) + require.NoError(t, os.RemoveAll(dir)) + }() + + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = app.DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, bApp.Name()) + + // Run randomized simulation + stopEarly, simParams, simErr := simulation.SimulateFromSeed( + t, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simulationtypes.RandomAccounts, + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + + // export state and simParams before the simulation error is checked + err = simtestutil.CheckExportSimulation(bApp, config, simParams) + require.NoError(t, err) + require.NoError(t, simErr) + + if config.Commit { + simtestutil.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 := bApp.ExportAppStateAndValidators(true, []string{}, []string{}) + require.NoError(t, err) + + fmt.Printf("importing genesis...\n") + + newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + require.NoError(t, err, "simulation setup failed") + + defer func() { + require.NoError(t, newDB.Close()) + require.NoError(t, os.RemoveAll(newDir)) + }() + + newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, newApp.Name()) + + _, err = newApp.InitChain(&abci.RequestInitChain{ + AppStateBytes: exported.AppState, + ChainId: SimAppChainID, + }) + require.NoError(t, err) + + _, _, err = simulation.SimulateFromSeed( + t, + os.Stdout, + newApp.BaseApp, + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simulationtypes.RandomAccounts, + simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + require.NoError(t, err) +} + +func TestAppStateDeterminism(t *testing.T) { + if !simcli.FlagEnabledValue { + t.Skip("skipping application simulation") + } + + config := simcli.NewConfigFromFlags() + config.InitialBlockHeight = 1 + config.ExportParamsPath = "" + config.OnOperation = true + config.AllInvariants = true + + numSeeds := 3 + numTimesToRunPerSeed := 3 // This used to be set to 5, but we've temporarily reduced it to 3 for the sake of faster CI. + appHashList := make([]json.RawMessage, numTimesToRunPerSeed) + + // We will be overriding the random seed and just run a single simulation on the provided seed value + if config.Seed != simcli.DefaultSeedValue { + numSeeds = 1 + } + + appOptions := viper.New() + if FlagEnableStreamingValue { + m := make(map[string]interface{}) + m["streaming.abci.keys"] = []string{"*"} + m["streaming.abci.plugin"] = "abci_v1" + m["streaming.abci.stop-node-on-err"] = true + for key, value := range m { + appOptions.SetDefault(key, value) + } + } + appOptions.SetDefault(flags.FlagHome, app.DefaultNodeHome) + appOptions.SetDefault(server.FlagInvCheckPeriod, simcli.FlagPeriodValue) + if simcli.FlagVerboseValue { + appOptions.SetDefault(flags.FlagLogLevel, "debug") + } + + for i := 0; i < numSeeds; i++ { + if config.Seed == simcli.DefaultSeedValue { + config.Seed = rand.Int63() + } + fmt.Println("config.Seed: ", config.Seed) + + for j := 0; j < numTimesToRunPerSeed; j++ { + var logger log.Logger + if simcli.FlagVerboseValue { + logger = log.NewTestLogger(t) + } else { + logger = log.NewNopLogger() + } + chainID := fmt.Sprintf("chain-id-%d-%d", i, j) + config.ChainID = chainID + + db := dbm.NewMemDB() + bApp, err := app.New( + logger, + db, + nil, + true, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(chainID), + ) + require.NoError(t, err) + + fmt.Printf( + "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", + config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + + _, _, err = simulation.SimulateFromSeed( + t, + os.Stdout, + bApp.BaseApp, + simtestutil.AppStateFn( + bApp.AppCodec(), + bApp.SimulationManager(), + bApp.DefaultGenesis(), + ), + simulationtypes.RandomAccounts, + simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), + app.BlockedAddresses(), + config, + bApp.AppCodec(), + ) + require.NoError(t, err) + + if config.Commit { + simtestutil.PrintStats(db) + } + + appHash := bApp.LastCommitID().Hash + appHashList[j] = appHash + + if j != 0 { + require.Equal( + t, string(appHashList[0]), string(appHashList[j]), + "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + } + } + } +} diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 000000000..1b4a0d95c --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,8 @@ +# Generated by "buf config migrate-v1beta1". Edit as necessary, and +# remove this comment when you're finished. +# +# This workspace file points to the roots found in your +# previous "buf.yaml" configuration. +version: v1 +directories: + - proto diff --git a/cmd/poktrolld/cmd/commands.go b/cmd/poktrolld/cmd/commands.go new file mode 100644 index 000000000..7eb957904 --- /dev/null +++ b/cmd/poktrolld/cmd/commands.go @@ -0,0 +1,191 @@ +package cmd + +import ( + "errors" + "io" + + "cosmossdk.io/log" + confixcmd "cosmossdk.io/tools/confix/cmd" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/types/module" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/pokt-network/poktroll/app" +) + +func initRootCmd( + rootCmd *cobra.Command, + txConfig client.TxConfig, + interfaceRegistry codectypes.InterfaceRegistry, + appCodec codec.Codec, + basicManager module.BasicManager, +) { + rootCmd.AddCommand( + genutilcli.InitCmd(basicManager, app.DefaultNodeHome), + debug.Cmd(), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, app.DefaultNodeHome), + snapshot.Cmd(newApp), + ) + + server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) + + // add keybase, auxiliary RPC, query, genesis, and tx child commands + rootCmd.AddCommand( + server.StatusCommand(), + genesisCommand(txConfig, basicManager), + queryCommand(), + txCommand(), + keys.Commands(), + ) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) +} + +// genesisCommand builds genesis-related `poktrolld genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + rpc.QueryEventForTxCmd(), + rpc.ValidatorCommand(), + server.QueryBlockCmd(), + authcmd.QueryTxsByEventsCmd(), + server.QueryBlocksCmd(), + authcmd.QueryTxCmd(), + server.QueryBlockResultsCmd(), + ) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + authcmd.GetSimulateCmd(), + ) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +// newApp creates the application +func newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + baseappOptions := server.DefaultBaseappOptions(appOpts) + + app, err := app.New( + logger, db, traceStore, true, + appOpts, + baseappOptions..., + ) + if err != nil { + panic(err) + } + return app +} + +// appExport creates a new app (optionally at a given height) and exports state. +func appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var ( + bApp *app.App + err error + ) + + // this check is necessary as we use the flag in x/upgrade. + // we can exit more gracefully by checking the flag here. + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home not set") + } + + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + + if height != -1 { + bApp, err = app.New(logger, db, traceStore, false, appOpts) + if err != nil { + return servertypes.ExportedApp{}, err + } + + if err := bApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } else { + bApp, err = app.New(logger, db, traceStore, true, appOpts) + if err != nil { + return servertypes.ExportedApp{}, err + } + } + + return bApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} diff --git a/cmd/poktrolld/cmd/config.go b/cmd/poktrolld/cmd/config.go new file mode 100644 index 000000000..0041179d1 --- /dev/null +++ b/cmd/poktrolld/cmd/config.go @@ -0,0 +1,91 @@ +package cmd + +import ( + "sync" + + cmtcfg "github.com/cometbft/cometbft/config" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/app" +) + +var once sync.Once + +func InitSDKConfig() { + once.Do(func() { + initSDKConfig() + }) +} + +func initSDKConfig() { + // Set prefixes + accountPubKeyPrefix := app.AccountAddressPrefix + "pub" + validatorAddressPrefix := app.AccountAddressPrefix + "valoper" + validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" + consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" + consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" + + // Set and seal config + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) + config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) + config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) + config.Seal() +} + +// initCometBFTConfig helps to override default CometBFT Config values. +// return cmtcfg.DefaultConfig if no custom configuration is required for the application. +func initCometBFTConfig() *cmtcfg.Config { + cfg := cmtcfg.DefaultConfig() + + // these values put a higher strain on node memory + // cfg.P2P.MaxNumInboundPeers = 100 + // cfg.P2P.MaxNumOutboundPeers = 40 + + return cfg +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + type CustomAppConfig struct { + serverconfig.Config `mapstructure:",squash"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In tests, we set the min gas prices to 0. + // srvCfg.MinGasPrices = "0stake" + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + // Edit the default template file + // + // customAppTemplate := serverconfig.DefaultConfigTemplate + ` + // [wasm] + // # This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries + // query_gas_limit = 300000 + // # This is the number of wasm vm instances we keep cached in memory for speed-up + // # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally + // lru_size = 0` + + return customAppTemplate, customAppConfig +} diff --git a/cmd/poktrolld/cmd/root.go b/cmd/poktrolld/cmd/root.go new file mode 100644 index 000000000..64ac47d0e --- /dev/null +++ b/cmd/poktrolld/cmd/root.go @@ -0,0 +1,173 @@ +package cmd + +import ( + "os" + "strings" + + "cosmossdk.io/client/v2/autocli" + clientv2keyring "cosmossdk.io/client/v2/autocli/keyring" + "cosmossdk.io/core/address" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + + "github.com/pokt-network/poktroll/app" +) + +// NewRootCmd creates a new root command for poktrolld. It is called once in the main function. +func NewRootCmd() *cobra.Command { + initSDKConfig() + + var ( + txConfigOpts tx.ConfigOptions + autoCliOpts autocli.AppOptions + moduleBasicManager module.BasicManager + clientCtx client.Context + ) + + if err := depinject.Inject( + depinject.Configs(app.AppConfig(), + depinject.Supply( + log.NewNopLogger(), + ), + depinject.Provide( + ProvideClientContext, + ProvideKeyring, + ), + ), + &txConfigOpts, + &autoCliOpts, + &moduleBasicManager, + &clientCtx, + ); err != nil { + panic(err) + } + + rootCmd := &cobra.Command{ + Use: app.Name + "d", + Short: "Start poktroll node", + SilenceErrors: true, + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + // set the default command outputs + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + + clientCtx = clientCtx.WithCmdContext(cmd.Context()) + clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + clientCtx, err = config.ReadFromClientConfig(clientCtx) + if err != nil { + return err + } + + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. + txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx) + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + codec.NewProtoCodec(clientCtx.InterfaceRegistry), + txConfigOpts, + ) + if err != nil { + return err + } + + clientCtx = clientCtx.WithTxConfig(txConfigWithTextual) + if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { + return err + } + + if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + customCMTConfig := initCometBFTConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) + }, + } + + // Since the IBC modules don't support dependency injection, we need to + // manually register the modules on the client side. + // This needs to be removed after IBC supports App Wiring. + ibcModules := app.RegisterIBC(clientCtx.InterfaceRegistry) + for name, module := range ibcModules { + autoCliOpts.Modules[name] = module + } + initRootCmd(rootCmd, clientCtx.TxConfig, clientCtx.InterfaceRegistry, clientCtx.Codec, moduleBasicManager) + + overwriteFlagDefaults(rootCmd, map[string]string{ + flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), + flags.FlagKeyringBackend: "test", + }) + + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + + return rootCmd +} + +func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { + set := func(s *pflag.FlagSet, key, val string) { + if f := s.Lookup(key); f != nil { + f.DefValue = val + f.Value.Set(val) + } + } + for key, val := range defaults { + set(c.Flags(), key, val) + set(c.PersistentFlags(), key, val) + } + for _, c := range c.Commands() { + overwriteFlagDefaults(c, defaults) + } +} + +func ProvideClientContext( + appCodec codec.Codec, + interfaceRegistry codectypes.InterfaceRegistry, + txConfig client.TxConfig, + legacyAmino *codec.LegacyAmino, +) client.Context { + clientCtx := client.Context{}. + WithCodec(appCodec). + WithInterfaceRegistry(interfaceRegistry). + WithTxConfig(txConfig). + WithLegacyAmino(legacyAmino). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(app.DefaultNodeHome). + WithViper(app.Name) // env variable prefix + + // Read the config again to overwrite the default values with the values from the config file + clientCtx, _ = config.ReadFromClientConfig(clientCtx) + + return clientCtx +} + +func ProvideKeyring(clientCtx client.Context, addressCodec address.Codec) (clientv2keyring.Keyring, error) { + kb, err := client.NewKeyringFromBackend(clientCtx, clientCtx.Keyring.Backend()) + if err != nil { + return nil, err + } + + return keyring.NewAutoCLIKeyring(kb) +} diff --git a/cmd/poktrolld/main.go b/cmd/poktrolld/main.go new file mode 100644 index 000000000..c5aee5e20 --- /dev/null +++ b/cmd/poktrolld/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "os" + + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + + "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" +) + +func main() { + rootCmd := cmd.NewRootCmd() + if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { + fmt.Fprintln(rootCmd.OutOrStderr(), err) + os.Exit(1) + } +} diff --git a/cmd/signals/on_exit.go b/cmd/signals/on_exit.go new file mode 100644 index 000000000..5b8625dd4 --- /dev/null +++ b/cmd/signals/on_exit.go @@ -0,0 +1,24 @@ +package signals + +import ( + "os" + "os/signal" + "syscall" +) + +// GoOnExitSignal calls the given callback when the process receives an interrupt +// or terminate signal. +func GoOnExitSignal(onInterrupt func()) { + go func() { + // Set up sigCh to receive when this process receives an interrupt or + // terminate signal. + sigCh := make(chan os.Signal, 1) + signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM) + + // Block until we receive an interrupt or kill signal (OS-agnostic) + <-sigCh + + // Call the onInterrupt callback. + onInterrupt() + }() +} diff --git a/config.yml b/config.yml new file mode 100644 index 000000000..7ba4164c1 --- /dev/null +++ b/config.yml @@ -0,0 +1,118 @@ +version: 1 +build: + main: cmd/poktrolld +accounts: + - name: faucet + mnemonic: "baby advance work soap slow exclude blur humble lucky rough teach wide chuckle captain rack laundry butter main very cannon donate armor dress follow" + coins: + - 999999999999999999upokt + # PNF represents the multisig address that acts on behalf of the DAO + - name: pnf + mnemonic: "crumble shrimp south strategy speed kick green topic stool seminar track stand rhythm almost bubble pet knock steel pull flag weekend country major blade" + coins: + - 69000000000000000000042upokt + - name: sequencer1 + mnemonic: "creek path rule retire evolve vehicle bargain champion roof whisper prize endorse unknown anchor fashion energy club sauce elder parent cotton old affair visa" + coins: + - 900000000000000upokt + - name: app1 + mnemonic: "mention spy involve verb exercise fiction catalog order agent envelope mystery text defy sing royal fringe return face alpha knife wonder vocal virus drum" + coins: + - 100000000upokt + - name: app2 + mnemonic: "material little labor strong search device trick amateur action crouch invite glide provide elite mango now paper sense found hamster neglect work install bulk" + coins: + - 200000000upokt + - name: app3 + mnemonic: "involve clean slab term real human green immune valid swing protect talk silent unique cart few ice era right thunder again drop among bounce" + coins: + - 300000000upokt + - name: supplier1 + mnemonic: "cool industry busy tumble funny relax error state height like board wing goat emerge visual idle never unveil announce hill primary okay spatial frog" + coins: + - 110000000upokt + - name: supplier2 + mnemonic: "peanut hen enroll meat legal have error input bulk later correct denial onion fossil wing excuse elephant object apology switch claim rare decide surface" + coins: + - 220000000upokt + - name: supplier3 + mnemonic: "client city senior tenant source soda spread buffalo shaft amused bar carbon keen off feel coral easily announce metal orphan sustain maple expand loop" + coins: + - 330000000upokt + - name: gateway1 + mnemonic: "salt iron goat also absorb depend involve agent apology between lift shy door left bulb arrange industry father jelly olive rifle return predict into" + coins: + - 100000000upokt + - name: gateway2 + mnemonic: "suffer wet jelly furnace cousin flip layer render finish frequent pledge feature economy wink like water disease final erase goat include apple state furnace" + coins: + - 200000000upokt + - name: gateway3 + mnemonic: "elder spatial erosion soap athlete tide subject recipe also awkward head pattern cart version beach usual oxygen confirm erupt diamond maze smooth census garment" + coins: + - 300000000upokt +faucet: + name: faucet + coins: + - 10000upokt +client: + typescript: + path: ts-client + hooks: + path: react/src/hooks + openapi: + path: docs/static/openapi.yml +validators: + - name: sequencer1 + bonded: 900000000upokt + config: + moniker: "sequencer1" + +# We can persist arbitrary genesis values via 1 to 1 mapping to genesis.json +genesis: + app_state: + mint: + params: + mint_denom: upokt + staking: + params: + bond_denom: upokt + crisis: + constant_fee: + amount: "10000" + denom: upokt + gov: + params: + min_deposit: + - amount: "10000" + denom: upokt + application: + params: + maxDelegatedGateways: 7 + applicationList: + - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 + delegatee_gateway_addresses: [] + service_configs: + - service: + id: anvil + name: "" + stake: + amount: "1000" + denom: upokt + supplier: + supplierList: + - address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj + services: + - endpoints: + - configs: [] + rpc_type: JSON_RPC + url: http://relayminers:8545 + service: + id: anvil + name: "" + stake: + amount: "1000" + denom: upokt + service: + params: + addServiceFee: 1000000000 diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 000000000..1ba96c79d --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,40 @@ +package docs + +import ( + "embed" + httptemplate "html/template" + "net/http" + + "github.com/gorilla/mux" +) + +const ( + apiFile = "/static/openapi.yml" + indexFile = "template/index.tpl" +) + +//go:embed static +var Static embed.FS + +//go:embed template +var template embed.FS + +func RegisterOpenAPIService(appName string, rtr *mux.Router) { + rtr.Handle(apiFile, http.FileServer(http.FS(Static))) + rtr.HandleFunc("/", handler(appName)) +} + +// handler returns an http handler that servers OpenAPI console for an OpenAPI spec at specURL. +func handler(title string) http.HandlerFunc { + t, _ := httptemplate.ParseFS(template, indexFile) + + return func(w http.ResponseWriter, req *http.Request) { + t.Execute(w, struct { + Title string + URL string + }{ + title, + apiFile, + }) + } +} diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml new file mode 100644 index 000000000..3dfa4ed44 --- /dev/null +++ b/docs/static/openapi.yml @@ -0,0 +1,26547 @@ +swagger: '2.0' +info: + title: HTTP API Console + name: '' + description: '' +paths: + /cosmos.auth.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a (governance) operation for updating the x/auth + module + + parameters. The authority defaults to the x/gov module account. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosAuthV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/auth parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + max_memo_characters: + type: string + format: uint64 + tx_sig_limit: + type: string + format: uint64 + tx_size_cost_per_byte: + type: string + format: uint64 + sig_verify_cost_ed25519: + type: string + format: uint64 + sig_verify_cost_secp256k1: + type: string + format: uint64 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.authz.v1beta1.Msg/Exec: + post: + summary: |- + Exec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have only + one signer corresponding to the granter of the authorization. + operationId: CosmosAuthzV1Beta1Msg_Exec + responses: + '200': + description: A successful response. + schema: + type: object + properties: + results: + type: array + items: + type: string + format: byte + description: MsgExecResponse defines the Msg/MsgExecResponse response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgExec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have only + one signer corresponding to the granter of the authorization. + in: body + required: true + schema: + type: object + properties: + grantee: + type: string + msgs: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + description: >- + Execute Msg. + + The x/authz will try to find a grant matching (msg.signers[0], + grantee, MsgTypeURL(msg)) + + triple and validate it. + description: >- + MsgExec attempts to execute the provided messages using + + authorizations granted to the grantee. Each message should have + only + + one signer corresponding to the granter of the authorization. + tags: + - Msg + /cosmos.authz.v1beta1.Msg/Grant: + post: + summary: |- + Grant grants the provided authorization to the grantee on the granter's + account with the provided expiration time. If there is already a grant + for the given (granter, grantee, Authorization) triple, then the grant + will be overwritten. + operationId: CosmosAuthzV1Beta1Msg_Grant + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgGrantResponse defines the Msg/MsgGrant response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgGrant is a request type for Grant method. It declares + authorization to the grantee + + on behalf of the granter with the provided expiration time. + in: body + required: true + schema: + type: object + properties: + granter: + type: string + grantee: + type: string + grant: + type: object + properties: + authorization: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type + of the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be + in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any + values in the form + + of utility functions or additional generated methods of + the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and + the unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will + yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a + custom JSON + + representation, that representation will be embedded + adding a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + expiration: + type: string + format: date-time + title: >- + time when the grant will expire and will be pruned. If + null, then the grant + + doesn't have a time expiration (other conditions in + `authorization` + + may apply to invalidate the grant) + description: |- + Grant gives permissions to execute + the provide method with expiration time. + description: >- + MsgGrant is a request type for Grant method. It declares + authorization to the grantee + + on behalf of the granter with the provided expiration time. + tags: + - Msg + /cosmos.authz.v1beta1.Msg/Revoke: + post: + summary: >- + Revoke revokes any authorization corresponding to the provided method + name on the + + granter's account that has been granted to the grantee. + operationId: CosmosAuthzV1Beta1Msg_Revoke + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgRevoke revokes any authorization with the provided sdk.Msg type + on the + + granter's account with that has been granted to the grantee. + in: body + required: true + schema: + type: object + properties: + granter: + type: string + grantee: + type: string + msg_type_url: + type: string + description: >- + MsgRevoke revokes any authorization with the provided sdk.Msg type + on the + + granter's account with that has been granted to the grantee. + tags: + - Msg + /cosmos.bank.v1beta1.Msg/MultiSend: + post: + summary: >- + MultiSend defines a method for sending coins from some accounts to other + accounts. + operationId: CosmosBankV1Beta1Msg_MultiSend + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgMultiSendResponse defines the Msg/MultiSend response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgMultiSend represents an arbitrary multi-in, multi-out send + message. + in: body + required: true + schema: + type: object + properties: + inputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: Input models transaction input. + description: >- + Inputs, despite being `repeated`, only allows one sender + input. This is + + checked in MsgMultiSend's ValidateBasic. + outputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: Output models transaction outputs. + description: >- + MsgMultiSend represents an arbitrary multi-in, multi-out send + message. + tags: + - Msg + /cosmos.bank.v1beta1.Msg/Send: + post: + summary: >- + Send defines a method for sending coins from one account to another + account. + operationId: CosmosBankV1Beta1Msg_Send + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgSendResponse defines the Msg/Send response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgSend represents a message to send coins from one account to + another. + in: body + required: true + schema: + type: object + properties: + from_address: + type: string + to_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgSend represents a message to send coins from one account to + another. + tags: + - Msg + /cosmos.bank.v1beta1.Msg/SetSendEnabled: + post: + summary: >- + SetSendEnabled is a governance operation for setting the SendEnabled + flag + + on any number of Denoms. Only the entries to add or update should be + + included. Entries that already exist in the store, but that aren't + + included in this message, will be left unchanged. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosBankV1Beta1Msg_SetSendEnabled + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response + type. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgSetSendEnabled is the Msg/SetSendEnabled request type. + + Only entries to add/update/delete need to be included. + Existing SendEnabled entries that are not included in this + message are left unchanged. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: authority is the address that controls the module. + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status + (whether a denom is + + sendable). + description: send_enabled is the list of entries to add or update. + use_default_for: + type: array + items: + type: string + description: >- + use_default_for is a list of denoms that should use the + params.default_send_enabled value. + + Denoms listed here will have their SendEnabled entries + deleted. + + If a denom is included that doesn't have a SendEnabled entry, + + it will be ignored. + description: |- + MsgSetSendEnabled is the Msg/SetSendEnabled request type. + + Only entries to add/update/delete need to be included. + Existing SendEnabled entries that are not included in this + message are left unchanged. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.bank.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/bank + module parameters. + + The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosBankV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/bank parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status + (whether a denom is + + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. + + For genesis, use the newly added send_enabled field in the + genesis object. + + Storage, lookup, and manipulation of this information is + now in the keeper. + + + As of cosmos-sdk 0.47, this only exists for backwards + compatibility of genesis files. + default_send_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos/base/node/v1beta1/config: + get: + summary: Config queries for the operator configuration. + operationId: CosmosBaseNodeV1Beta1Service_Config + responses: + '200': + description: A successful response. + schema: + type: object + properties: + minimum_gas_price: + type: string + pruning_keep_recent: + type: string + title: pruning settings + pruning_interval: + type: string + description: >- + ConfigResponse defines the response structure for the Config gRPC + query. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Service + /cosmos/base/node/v1beta1/status: + get: + summary: Status queries for the node status. + operationId: CosmosBaseNodeV1Beta1Service_Status + responses: + '200': + description: A successful response. + schema: + type: object + properties: + earliest_store_height: + type: string + format: uint64 + title: earliest block height available in the store + height: + type: string + format: uint64 + title: current block height + timestamp: + type: string + format: date-time + title: block height timestamp + app_hash: + type: string + format: byte + title: app hash of the current block + validator_hash: + type: string + format: byte + title: validator hash provided by the consensus header + description: >- + StateResponse defines the response structure for the status of a + node. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Service + /cosmos.consensus.v1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/consensus + module parameters. + + The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosConsensusV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + block: + description: >- + params defines the x/consensus parameters to update. + + VersionsParams is not included in this Msg because it is + tracked + + separarately in x/upgrade. + + + NOTE: All parameters must be supplied. + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: MaxAgeDuration + / {average block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" or + other similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that + can be committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: >- + EvidenceParams determine how we handle evidence of + malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: >- + ValidatorParams restrict the public key types validators can + use. + + NOTE: uses ABCI pubkey naming, not Amino names. + abci: + title: 'Since: cosmos-sdk 0.50' + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height + during which + + vote extensions will be enabled. During this specified + height, and for all + + subsequent heights, precommit messages that do not contain + valid extension data + + will be considered invalid. Prior to this height, vote + extensions will not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the + application in ExtendVote, + + passed to the application for validation in + VerifyVoteExtension and given + + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application + Blockchain Interface. + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /cosmos.crisis.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/crisis + module + + parameters. The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosCrisisV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + constant_fee: + description: constant_fee defines the x/crisis parameter. + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.crisis.v1beta1.Msg/VerifyInvariant: + post: + summary: VerifyInvariant defines a method to verify a particular invariant. + operationId: CosmosCrisisV1Beta1Msg_VerifyInvariant + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgVerifyInvariantResponse defines the Msg/VerifyInvariant + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgVerifyInvariant represents a message to verify a particular + invariance. + in: body + required: true + schema: + type: object + properties: + sender: + type: string + description: >- + sender is the account address of private key to send coins to + fee collector account. + invariant_module_name: + type: string + description: name of the invariant module. + invariant_route: + type: string + description: invariant_route is the msg's invariant route. + description: >- + MsgVerifyInvariant represents a message to verify a particular + invariance. + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/CommunityPoolSpend: + post: + summary: >- + CommunityPoolSpend defines a governance operation for sending tokens + from + + the community pool in the x/distribution module to another account, + which + + could be the governance module itself. The authority is defined in the + + keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosDistributionV1Beta1Msg_CommunityPoolSpend + responses: + '200': + description: A successful response. + schema: + type: object + description: |- + MsgCommunityPoolSpendResponse defines the response to executing a + MsgCommunityPoolSpend message. + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgCommunityPoolSpend defines a message for sending tokens from the + community + + pool to another account. This message is typically executed via a + governance + + proposal with the governance module being the executing authority. + + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + recipient: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgCommunityPoolSpend defines a message for sending tokens from + the community + + pool to another account. This message is typically executed via a + governance + + proposal with the governance module being the executing authority. + + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/DepositValidatorRewardsPool: + post: + summary: >- + DepositValidatorRewardsPool defines a method to provide additional + rewards + + to delegators to a specific validator. + description: 'Since: cosmos-sdk 0.50' + operationId: CosmosDistributionV1Beta1Msg_DepositValidatorRewardsPool + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgDepositValidatorRewardsPoolResponse defines the response to + executing a + + MsgDepositValidatorRewardsPool message. + + + Since: cosmos-sdk 0.50 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + DepositValidatorRewardsPool defines the request structure to provide + additional rewards to delegators from a specific validator. + + Since: cosmos-sdk 0.50 + in: body + required: true + schema: + type: object + properties: + depositor: + type: string + validator_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + DepositValidatorRewardsPool defines the request structure to + provide + + additional rewards to delegators from a specific validator. + + + Since: cosmos-sdk 0.50 + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/FundCommunityPool: + post: + summary: |- + FundCommunityPool defines a method to allow an account to directly + fund the community pool. + operationId: CosmosDistributionV1Beta1Msg_FundCommunityPool + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgFundCommunityPool allows an account to directly + fund the community pool. + in: body + required: true + schema: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + depositor: + type: string + description: |- + MsgFundCommunityPool allows an account to directly + fund the community pool. + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/SetWithdrawAddress: + post: + summary: |- + SetWithdrawAddress defines a method to change the withdraw address + for a delegator (or validator self-delegation). + operationId: CosmosDistributionV1Beta1Msg_SetWithdrawAddress + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress + response + + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgSetWithdrawAddress sets the withdraw address for + a delegator (or validator self-delegation). + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + withdraw_address: + type: string + description: |- + MsgSetWithdrawAddress sets the withdraw address for + a delegator (or validator self-delegation). + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the + x/distribution + + module parameters. The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosDistributionV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/distribution parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + community_tax: + type: string + base_proposer_reward: + type: string + description: >- + Deprecated: The base_proposer_reward field is deprecated + and is no longer used + + in the x/distribution module's reward mechanism. + bonus_proposer_reward: + type: string + description: >- + Deprecated: The bonus_proposer_reward field is deprecated + and is no longer used + + in the x/distribution module's reward mechanism. + withdraw_addr_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/WithdrawDelegatorReward: + post: + summary: >- + WithdrawDelegatorReward defines a method to withdraw rewards of + delegator + + from a single validator. + operationId: CosmosDistributionV1Beta1Msg_WithdrawDelegatorReward + responses: + '200': + description: A successful response. + schema: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: >- + MsgWithdrawDelegatorRewardResponse defines the + Msg/WithdrawDelegatorReward + + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgWithdrawDelegatorReward represents delegation withdrawal to a + delegator + + from a single validator. + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + description: >- + MsgWithdrawDelegatorReward represents delegation withdrawal to a + delegator + + from a single validator. + tags: + - Msg + /cosmos.distribution.v1beta1.Msg/WithdrawValidatorCommission: + post: + summary: |- + WithdrawValidatorCommission defines a method to withdraw the + full commission to the validator address. + operationId: CosmosDistributionV1Beta1Msg_WithdrawValidatorCommission + responses: + '200': + description: A successful response. + schema: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: |- + MsgWithdrawValidatorCommissionResponse defines the + Msg/WithdrawValidatorCommission response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgWithdrawValidatorCommission withdraws the full commission to the + validator + + address. + in: body + required: true + schema: + type: object + properties: + validator_address: + type: string + description: >- + MsgWithdrawValidatorCommission withdraws the full commission to + the validator + + address. + tags: + - Msg + /cosmos.evidence.v1beta1.Msg/SubmitEvidence: + post: + summary: >- + SubmitEvidence submits an arbitrary Evidence of misbehavior such as + equivocation or + + counterfactual signing. + operationId: CosmosEvidenceV1Beta1Msg_SubmitEvidence + responses: + '200': + description: A successful response. + schema: + type: object + properties: + hash: + type: string + format: byte + description: hash defines the hash of the evidence. + description: >- + MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgSubmitEvidence represents a message that supports submitting + arbitrary + + Evidence of misbehavior such as equivocation or counterfactual + signing. + in: body + required: true + schema: + type: object + properties: + submitter: + type: string + description: submitter is the signer account address of evidence. + evidence: + description: evidence defines the evidence of misbehavior. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + MsgSubmitEvidence represents a message that supports submitting + arbitrary + + Evidence of misbehavior such as equivocation or counterfactual + signing. + tags: + - Msg + /cosmos.feegrant.v1beta1.Msg/GrantAllowance: + post: + summary: |- + GrantAllowance grants fee allowance to the grantee on the granter's + account with the provided expiration time. + operationId: CosmosFeegrantV1Beta1Msg_GrantAllowance + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgGrantAllowance adds permission for Grantee to spend up to + Allowance + + of fees from the account of Granter. + in: body + required: true + schema: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of + their funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance + of another user's funds. + allowance: + description: >- + allowance can be any of basic, periodic, allowed fee + allowance. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + MsgGrantAllowance adds permission for Grantee to spend up to + Allowance + + of fees from the account of Granter. + tags: + - Msg + /cosmos.feegrant.v1beta1.Msg/PruneAllowances: + post: + summary: >- + PruneAllowances prunes expired fee allowances, currently up to 75 at a + time. + description: Since cosmos-sdk 0.50 + operationId: CosmosFeegrantV1Beta1Msg_PruneAllowances + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse + response type. + + + Since cosmos-sdk 0.50 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgPruneAllowances prunes expired fee allowances. + + Since cosmos-sdk 0.50 + in: body + required: true + schema: + type: object + properties: + pruner: + type: string + description: pruner is the address of the user pruning expired allowances. + description: |- + MsgPruneAllowances prunes expired fee allowances. + + Since cosmos-sdk 0.50 + tags: + - Msg + /cosmos.feegrant.v1beta1.Msg/RevokeAllowance: + post: + summary: |- + RevokeAllowance revokes any fee allowance of granter's account that + has been granted to the grantee. + operationId: CosmosFeegrantV1Beta1Msg_RevokeAllowance + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgRevokeAllowance removes any existing Allowance from Granter to + Grantee. + in: body + required: true + schema: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of + their funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance + of another user's funds. + description: >- + MsgRevokeAllowance removes any existing Allowance from Granter to + Grantee. + tags: + - Msg + /cosmos.gov.v1.Msg/CancelProposal: + post: + summary: CancelProposal defines a method to cancel governance proposal + description: 'Since: cosmos-sdk 0.50' + operationId: CosmosGovV1Msg_CancelProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + canceled_time: + type: string + format: date-time + description: canceled_time is the time when proposal is canceled. + canceled_height: + type: string + format: uint64 + description: >- + canceled_height defines the block height at which the proposal + is canceled. + description: >- + MsgCancelProposalResponse defines the response structure for + executing a + + MsgCancelProposal message. + + + Since: cosmos-sdk 0.50 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgCancelProposal is the Msg/CancelProposal request type. + + Since: cosmos-sdk 0.50 + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + proposer: + type: string + description: proposer is the account address of the proposer. + description: |- + MsgCancelProposal is the Msg/CancelProposal request type. + + Since: cosmos-sdk 0.50 + tags: + - Msg + /cosmos.gov.v1.Msg/Deposit: + post: + summary: Deposit defines a method to add deposit on a specific proposal. + operationId: CosmosGovV1Msg_Deposit + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgDeposit defines a message to submit a deposit to an existing + proposal. + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: >- + MsgDeposit defines a message to submit a deposit to an existing + proposal. + tags: + - Msg + /cosmos.gov.v1.Msg/ExecLegacyContent: + post: + summary: |- + ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + to execute a legacy content-based proposal. + operationId: CosmosGovV1Msg_ExecLegacyContent + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgExecLegacyContent is used to wrap the legacy content field into a + message. + + This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + in: body + required: true + schema: + type: object + properties: + content: + description: content is the proposal's content. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + authority: + type: string + description: authority must be the gov module address. + description: >- + MsgExecLegacyContent is used to wrap the legacy content field into + a message. + + This ensures backwards compatibility with + v1beta1.MsgSubmitProposal. + tags: + - Msg + /cosmos.gov.v1.Msg/SubmitProposal: + post: + summary: >- + SubmitProposal defines a method to create new proposal given the + messages. + operationId: CosmosGovV1Msg_SubmitProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + description: >- + MsgSubmitProposalResponse defines the Msg/SubmitProposal response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + in: body + required: true + schema: + type: object + properties: + messages: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + description: >- + messages are the arbitrary messages to be executed if proposal + passes. + initial_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at + proposal submission. + proposer: + type: string + description: proposer is the account address of the proposer. + metadata: + type: string + description: metadata is any arbitrary metadata attached to the proposal. + title: + type: string + description: |- + title is the title of the proposal. + + Since: cosmos-sdk 0.47 + summary: + type: string + description: 'Since: cosmos-sdk 0.47' + title: summary is the summary of the proposal + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited or not + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + tags: + - Msg + /cosmos.gov.v1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/gov + module + + parameters. The authority is defined in the keeper. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosGovV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/gov parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. + Initial value: 2 + + months. + voting_period: + type: string + description: Duration of the voting period. + quorum: + type: string + description: >- + Minimum percentage of total stake needed to vote for a + result to be + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.5. + veto_threshold: + type: string + description: >- + Minimum value of Veto votes to Total votes ratio for + proposal to be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value + that must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the + depositors when a proposal is cancelled. + + + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * + deposit) proposal deposits. + + If empty, the (proposal_cancel_ratio * deposit) proposal + deposits will be burned. + + + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: >- + Minimum expedited deposit for a proposal to enter voting + period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value + minimum that must be met when making a deposit. + + Default value: 0.01. Meaning that for a chain with a + min_deposit of 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.gov.v1.Msg/Vote: + post: + summary: Vote defines a method to add a vote on a specific proposal. + operationId: CosmosGovV1Msg_Vote + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgVoteResponse defines the Msg/Vote response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: MsgVote defines a message to cast a vote. + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + metadata: + type: string + description: metadata is any arbitrary metadata attached to the Vote. + description: MsgVote defines a message to cast a vote. + tags: + - Msg + /cosmos.gov.v1.Msg/VoteWeighted: + post: + summary: >- + VoteWeighted defines a method to add a weighted vote on a specific + proposal. + operationId: CosmosGovV1Msg_VoteWeighted + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgVoteWeightedResponse defines the Msg/VoteWeighted response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: MsgVoteWeighted defines a message to cast a vote. + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: + type: array + items: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not + contain duplicate vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: >- + weight is the vote weight associated with the vote + option. + description: WeightedVoteOption defines a unit of vote for vote split. + description: options defines the weighted vote options. + metadata: + type: string + description: >- + metadata is any arbitrary metadata attached to the + VoteWeighted. + description: MsgVoteWeighted defines a message to cast a vote. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/Deposit: + post: + summary: Deposit defines a method to add deposit on a specific proposal. + operationId: CosmosGovV1Beta1Msg_Deposit + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgDeposit defines a message to submit a deposit to an existing + proposal. + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: >- + MsgDeposit defines a message to submit a deposit to an existing + proposal. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/SubmitProposal: + post: + summary: SubmitProposal defines a method to create new proposal given a content. + operationId: CosmosGovV1Beta1Msg_SubmitProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + description: >- + MsgSubmitProposalResponse defines the Msg/SubmitProposal response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + in: body + required: true + schema: + type: object + properties: + content: + description: content is the proposal's content. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + initial_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at + proposal submission. + proposer: + type: string + description: proposer is the account address of the proposer. + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/Vote: + post: + summary: Vote defines a method to add a vote on a specific proposal. + operationId: CosmosGovV1Beta1Msg_Vote + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgVoteResponse defines the Msg/Vote response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: MsgVote defines a message to cast a vote. + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + description: MsgVote defines a message to cast a vote. + tags: + - Msg + /cosmos.gov.v1beta1.Msg/VoteWeighted: + post: + summary: >- + VoteWeighted defines a method to add a weighted vote on a specific + proposal. + description: 'Since: cosmos-sdk 0.43' + operationId: CosmosGovV1Beta1Msg_VoteWeighted + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgVoteWeightedResponse defines the Msg/VoteWeighted response + type. + + + Since: cosmos-sdk 0.43 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgVoteWeighted defines a message to cast a vote. + + Since: cosmos-sdk 0.43 + in: body + required: true + schema: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: + type: array + items: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not + contain duplicate vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: >- + weight is the vote weight associated with the vote + option. + description: |- + WeightedVoteOption defines a unit of vote for vote split. + + Since: cosmos-sdk 0.43 + description: options defines the weighted vote options. + description: |- + MsgVoteWeighted defines a message to cast a vote. + + Since: cosmos-sdk 0.43 + tags: + - Msg + /cosmos.mint.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/mint + module + + parameters. The authority is defaults to the x/gov module account. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosMintV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/mint parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + mint_denom: + type: string + title: type of coin to mint + inflation_rate_change: + type: string + title: maximum annual change in inflation rate + inflation_max: + type: string + title: maximum inflation rate + inflation_min: + type: string + title: minimum inflation rate + goal_bonded: + type: string + title: goal of percent bonded atoms + blocks_per_year: + type: string + format: uint64 + title: expected blocks per year + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos/params/v1beta1/params: + get: + summary: |- + Params queries a specific parameter of a module, given its subspace and + key. + operationId: CosmosParamsV1Beta1Query_Params + responses: + '200': + description: A successful response. + schema: + type: object + properties: + param: + description: param defines the queried parameter. + type: object + properties: + subspace: + type: string + key: + type: string + value: + type: string + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: subspace + description: subspace defines the module to query the parameter for. + in: query + required: false + type: string + - name: key + description: key defines the key of the parameter in the subspace. + in: query + required: false + type: string + tags: + - Query + /cosmos/params/v1beta1/subspaces: + get: + summary: >- + Subspaces queries for all registered subspaces and all keys for a + subspace. + description: 'Since: cosmos-sdk 0.46' + operationId: CosmosParamsV1Beta1Query_Subspaces + responses: + '200': + description: A successful response. + schema: + type: object + properties: + subspaces: + type: array + items: + type: object + properties: + subspace: + type: string + keys: + type: array + items: + type: string + description: >- + Subspace defines a parameter subspace name and all the keys + that exist for + + the subspace. + + + Since: cosmos-sdk 0.46 + description: >- + QuerySubspacesResponse defines the response types for querying for + all + + registered subspaces and all keys for a subspace. + + + Since: cosmos-sdk 0.46 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /cosmos.slashing.v1beta1.Msg/Unjail: + post: + summary: >- + Unjail defines a method for unjailing a jailed validator, thus returning + + them into the bonded validator set, so they can begin receiving + provisions + + and rewards again. + operationId: CosmosSlashingV1Beta1Msg_Unjail + responses: + '200': + description: A successful response. + schema: + type: object + title: MsgUnjailResponse defines the Msg/Unjail response type + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + validator_addr: + type: string + title: MsgUnjail defines the Msg/Unjail request type + tags: + - Msg + /cosmos.slashing.v1beta1.Msg/UpdateParams: + post: + summary: >- + UpdateParams defines a governance operation for updating the x/slashing + module + + parameters. The authority defaults to the x/gov module account. + description: 'Since: cosmos-sdk 0.47' + operationId: CosmosSlashingV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/slashing parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + signed_blocks_window: + type: string + format: int64 + min_signed_per_window: + type: string + format: byte + downtime_jail_duration: + type: string + slash_fraction_double_sign: + type: string + format: byte + slash_fraction_downtime: + type: string + format: byte + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /cosmos.staking.v1beta1.Msg/BeginRedelegate: + post: + summary: >- + BeginRedelegate defines a method for performing a redelegation + + of coins from a delegator and source validator to a destination + validator. + operationId: CosmosStakingV1Beta1Msg_BeginRedelegate + responses: + '200': + description: A successful response. + schema: + type: object + properties: + completion_time: + type: string + format: date-time + description: >- + MsgBeginRedelegateResponse defines the Msg/BeginRedelegate + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgBeginRedelegate defines a SDK message for performing a + redelegation + + of coins from a delegator and source validator to a destination + validator. + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_src_address: + type: string + validator_dst_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgBeginRedelegate defines a SDK message for performing a + redelegation + + of coins from a delegator and source validator to a destination + validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/CancelUnbondingDelegation: + post: + summary: >- + CancelUnbondingDelegation defines a method for performing canceling the + unbonding delegation + + and delegate back to previous validator. + description: 'Since: cosmos-sdk 0.46' + operationId: CosmosStakingV1Beta1Msg_CancelUnbondingDelegation + responses: + '200': + description: A successful response. + schema: + type: object + description: 'Since: cosmos-sdk 0.46' + title: MsgCancelUnbondingDelegationResponse + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: 'Since: cosmos-sdk 0.46' + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: >- + amount is always less than or equal to unbonding delegation + entry balance + creation_height: + type: string + format: int64 + description: creation_height is the height which the unbonding took place. + description: 'Since: cosmos-sdk 0.46' + title: >- + MsgCancelUnbondingDelegation defines the SDK message for + performing a cancel unbonding delegation for delegator + tags: + - Msg + /cosmos.staking.v1beta1.Msg/CreateValidator: + post: + summary: CreateValidator defines a method for creating a new validator. + operationId: CosmosStakingV1Beta1Msg_CreateValidator + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgCreateValidatorResponse defines the Msg/CreateValidator + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgCreateValidator defines a SDK message for creating a new + validator. + in: body + required: true + schema: + type: object + properties: + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort + or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for security + contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + commission: + type: object + properties: + rate: + type: string + description: >- + rate is the commission rate charged to delegators, as a + fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which + validator can ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. + description: >- + CommissionRates defines the initial commission rates to be + used for creating + + a validator. + min_self_delegation: + type: string + delegator_address: + type: string + description: >- + Deprecated: Use of Delegator Address in MsgCreateValidator is + deprecated. + + The validator address bytes and delegator address bytes refer + to the same account while creating validator (defer + + only in bech32 notation). + validator_address: + type: string + pubkey: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + value: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgCreateValidator defines a SDK message for creating a new + validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/Delegate: + post: + summary: |- + Delegate defines a method for performing a delegation of coins + from a delegator to a validator. + operationId: CosmosStakingV1Beta1Msg_Delegate + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgDelegateResponse defines the Msg/Delegate response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgDelegate defines a SDK message for performing a delegation of + coins + + from a delegator to a validator. + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgDelegate defines a SDK message for performing a delegation of + coins + + from a delegator to a validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/EditValidator: + post: + summary: EditValidator defines a method for editing an existing validator. + operationId: CosmosStakingV1Beta1Msg_EditValidator + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgEditValidatorResponse defines the Msg/EditValidator response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgEditValidator defines a SDK message for editing an existing + validator. + in: body + required: true + schema: + type: object + properties: + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort + or Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: >- + security_contact defines an optional email for security + contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + validator_address: + type: string + commission_rate: + type: string + title: >- + We pass a reference to the new commission rate and min self + delegation as + + it's not mandatory to update. If not updated, the deserialized + rate will be + + zero with no way to distinguish if an update was intended. + + REF: #2373 + min_self_delegation: + type: string + description: >- + MsgEditValidator defines a SDK message for editing an existing + validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/Undelegate: + post: + summary: |- + Undelegate defines a method for performing an undelegation from a + delegate and a validator. + operationId: CosmosStakingV1Beta1Msg_Undelegate + responses: + '200': + description: A successful response. + schema: + type: object + properties: + completion_time: + type: string + format: date-time + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: amount returns the amount of undelegated coins + description: MsgUndelegateResponse defines the Msg/Undelegate response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgUndelegate defines a SDK message for performing an undelegation + from a + + delegate and a validator. + in: body + required: true + schema: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + MsgUndelegate defines a SDK message for performing an undelegation + from a + + delegate and a validator. + tags: + - Msg + /cosmos.staking.v1beta1.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines an operation for updating the x/staking module + parameters. + Since: cosmos-sdk 0.47 + operationId: CosmosStakingV1Beta1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + + + Since: cosmos-sdk 0.47 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/staking parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + unbonding_time: + type: string + description: unbonding_time is the time duration of unbonding. + max_validators: + type: integer + format: int64 + description: max_validators is the maximum number of validators. + max_entries: + type: integer + format: int64 + description: >- + max_entries is the max entries for either unbonding + delegation or redelegation (per pair/trio). + historical_entries: + type: integer + format: int64 + description: >- + historical_entries is the number of historical entries to + persist. + bond_denom: + type: string + description: bond_denom defines the bondable coin denomination. + min_commission_rate: + type: string + title: >- + min_commission_rate is the chain-wide minimum commission + rate that a validator can charge their delegators + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + tags: + - Msg + /ibc.applications.fee.v1.Msg/PayPacketFee: + post: + summary: >- + PayPacketFee defines a rpc handler method for MsgPayPacketFee + + PayPacketFee is an open callback that may be called by any module/user + that wishes to escrow funds in order to + + incentivize the relaying of the packet at the next sequence + + NOTE: This method is intended to be used within a multi msg transaction, + where the subsequent msg that follows + + initiates the lifecycle of the incentivized packet + operationId: IbcApplicationsFeeV1Msg_PayPacketFee + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgPayPacketFeeResponse defines the response type for the + PayPacketFee rpc + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated + with an IBC packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + title: the packet timeout fee + source_port_id: + type: string + title: the source port unique identifier + source_channel_id: + type: string + title: the source channel unique identifer + signer: + type: string + title: account address to refund fee if necessary + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to the receive packet fees + title: >- + MsgPayPacketFee defines the request type for the PayPacketFee rpc + + This Msg can be used to pay for a packet at the next sequence send + & should be combined with the Msg that will be + + paid for + tags: + - Msg + /ibc.applications.fee.v1.Msg/PayPacketFeeAsync: + post: + summary: >- + PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync + + PayPacketFeeAsync is an open callback that may be called by any + module/user that wishes to escrow funds in order to + + incentivize the relaying of a known packet (i.e. at a particular + sequence) + operationId: IbcApplicationsFeeV1Msg_PayPacketFeeAsync + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgPayPacketFeeAsyncResponse defines the response type for the + PayPacketFeeAsync rpc + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + packet_id: + title: >- + unique packet identifier comprised of the channel ID, port ID + and sequence + type: object + properties: + port_id: + type: string + title: channel port identifier + channel_id: + type: string + title: channel unique identifier + sequence: + type: string + format: uint64 + title: packet sequence + packet_fee: + title: the packet fee associated with a particular IBC packet + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated + with an IBC packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + title: the packet timeout fee + refund_address: + type: string + title: the refund address for unspent fees + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to receive fees + title: >- + MsgPayPacketFeeAsync defines the request type for the + PayPacketFeeAsync rpc + + This Msg can be used to pay for a packet at a specified sequence + (instead of the next sequence send) + tags: + - Msg + /ibc.applications.fee.v1.Msg/RegisterCounterpartyPayee: + post: + summary: >- + RegisterCounterpartyPayee defines a rpc handler method for + MsgRegisterCounterpartyPayee + + RegisterCounterpartyPayee is called by the relayer on each channelEnd + and allows them to specify the counterparty + + payee address before relaying. This ensures they will be properly + compensated for forward relaying since + + the destination chain must include the registered counterparty payee + address in the acknowledgement. This function + + may be called more than once by a relayer, in which case, the latest + counterparty payee address is always used. + operationId: IbcApplicationsFeeV1Msg_RegisterCounterpartyPayee + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgRegisterCounterpartyPayeeResponse defines the response type for + the RegisterCounterpartyPayee rpc + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + counterparty_payee: + type: string + title: the counterparty payee address + title: >- + MsgRegisterCounterpartyPayee defines the request type for the + RegisterCounterpartyPayee rpc + tags: + - Msg + /ibc.applications.fee.v1.Msg/RegisterPayee: + post: + summary: >- + RegisterPayee defines a rpc handler method for MsgRegisterPayee + + RegisterPayee is called by the relayer on each channelEnd and allows + them to set an optional + + payee to which reverse and timeout relayer packet fees will be paid out. + The payee should be registered on + + the source chain from which packets originate as this is where fee + distribution takes place. This function may be + + called more than once by a relayer, in which case, the latest payee is + always used. + operationId: IbcApplicationsFeeV1Msg_RegisterPayee + responses: + '200': + description: A successful response. + schema: + type: object + title: >- + MsgRegisterPayeeResponse defines the response type for the + RegisterPayee rpc + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + payee: + type: string + title: the payee address + title: >- + MsgRegisterPayee defines the request type for the RegisterPayee + rpc + tags: + - Msg + /ibc.applications.interchain_accounts.controller.v1.Msg/RegisterInterchainAccount: + post: + summary: >- + RegisterInterchainAccount defines a rpc handler for + MsgRegisterInterchainAccount. + operationId: >- + IbcApplicationsInterchainAccountsControllerV1Msg_RegisterInterchainAccount + responses: + '200': + description: A successful response. + schema: + type: object + properties: + channel_id: + type: string + port_id: + type: string + title: >- + MsgRegisterInterchainAccountResponse defines the response for + Msg/RegisterAccount + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + owner: + type: string + connection_id: + type: string + version: + type: string + title: >- + MsgRegisterInterchainAccount defines the payload for + Msg/RegisterAccount + tags: + - Msg + /ibc.applications.interchain_accounts.controller.v1.Msg/SendTx: + post: + summary: SendTx defines a rpc handler for MsgSendTx. + operationId: IbcApplicationsInterchainAccountsControllerV1Msg_SendTx + responses: + '200': + description: A successful response. + schema: + type: object + properties: + sequence: + type: string + format: uint64 + title: MsgSendTxResponse defines the response for MsgSendTx + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + owner: + type: string + connection_id: + type: string + packet_data: + type: object + properties: + type: + type: string + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a + controller chain to its associated interchain accounts + + host + data: + type: string + format: byte + memo: + type: string + description: >- + InterchainAccountPacketData is comprised of a raw transaction, + type of transaction and optional memo field. + relative_timeout: + type: string + format: uint64 + description: >- + Relative timeout timestamp provided will be added to the + current block time during transaction execution. + + The timeout timestamp must be non-zero. + title: MsgSendTx defines the payload for Msg/SendTx + tags: + - Msg + /ibc.applications.interchain_accounts.controller.v1.Msg/UpdateParams: + post: + summary: UpdateParams defines a rpc handler for MsgUpdateParams. + operationId: IbcApplicationsInterchainAccountsControllerV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: >- + params defines the 27-interchain-accounts/controller + parameters to update. + + + NOTE: All parameters must be supplied. + type: object + properties: + controller_enabled: + type: boolean + description: >- + controller_enabled enables or disables the controller + submodule. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + tags: + - Msg + /ibc.applications.interchain_accounts.host.v1.Msg/UpdateParams: + post: + summary: UpdateParams defines a rpc handler for MsgUpdateParams. + operationId: IbcApplicationsInterchainAccountsHostV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: >- + params defines the 27-interchain-accounts/host parameters to + update. + + + NOTE: All parameters must be supplied. + type: object + properties: + host_enabled: + type: boolean + description: host_enabled enables or disables the host submodule. + allow_messages: + type: array + items: + type: string + description: >- + allow_messages defines a list of sdk message typeURLs + allowed to be executed on a host chain. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + tags: + - Msg + /ibc.applications.transfer.v1.Msg/Transfer: + post: + summary: Transfer defines a rpc handler method for MsgTransfer. + operationId: IbcApplicationsTransferV1Msg_Transfer + responses: + '200': + description: A successful response. + schema: + type: object + properties: + sequence: + type: string + format: uint64 + title: sequence number of the transfer packet sent + description: MsgTransferResponse defines the Msg/Transfer response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + source_port: + type: string + title: the port on which the packet will be sent + source_channel: + type: string + title: the channel by which the packet will be sent + token: + title: the tokens to be transferred + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + sender: + type: string + title: the sender address + receiver: + type: string + title: the recipient address on the destination chain + timeout_height: + description: |- + Timeout height relative to the current block height. + The timeout is disabled when set to 0. + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + timeout_timestamp: + type: string + format: uint64 + description: |- + Timeout timestamp in absolute nanoseconds since unix epoch. + The timeout is disabled when set to 0. + memo: + type: string + title: optional memo + title: >- + MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) + between + + ICS20 enabled chains. See ICS Spec here: + + https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + tags: + - Msg + /ibc.applications.transfer.v1.Msg/UpdateParams: + post: + summary: UpdateParams defines a rpc handler for MsgUpdateParams. + operationId: IbcApplicationsTransferV1Msg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the transfer parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: boolean + description: >- + send_enabled enables or disables all cross-chain token + transfers from this + + chain. + receive_enabled: + type: boolean + description: >- + receive_enabled enables or disables all cross-chain token + transfers to this + + chain. + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /ibc.core.channel.v1.Msg/Acknowledgement: + post: + summary: Acknowledgement defines a rpc handler method for MsgAcknowledgement. + operationId: IbcCoreChannelV1Msg_Acknowledgement + responses: + '200': + description: A successful response. + schema: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: >- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: >- + MsgAcknowledgementResponse defines the Msg/Acknowledgement + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet + + with an earlier sequence number must be sent and received + before a Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms + may choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as + the RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + acknowledgement: + type: string + format: byte + proof_acked: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + title: MsgAcknowledgement receives incoming IBC acknowledgement + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelCloseConfirm: + post: + summary: |- + ChannelCloseConfirm defines a rpc handler method for + MsgChannelCloseConfirm. + operationId: IbcCoreChannelV1Msg_ChannelCloseConfirm + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm + response + + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + to acknowledge the change of channel state to CLOSED on Chain A. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + description: |- + MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + to acknowledge the change of channel state to CLOSED on Chain A. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelCloseInit: + post: + summary: ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. + operationId: IbcCoreChannelV1Msg_ChannelCloseInit + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + to close a channel with Chain B. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + signer: + type: string + description: |- + MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + to close a channel with Chain B. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenAck: + post: + summary: ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. + operationId: IbcCoreChannelV1Msg_ChannelOpenAck + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge + + the change of channel state to TRYOPEN on Chain B. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + counterparty_channel_id: + type: string + counterparty_version: + type: string + proof_try: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + description: >- + MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge + + the change of channel state to TRYOPEN on Chain B. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenConfirm: + post: + summary: >- + ChannelOpenConfirm defines a rpc handler method for + MsgChannelOpenConfirm. + operationId: IbcCoreChannelV1Msg_ChannelOpenConfirm + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm + response + + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of channel state to OPEN on Chain A. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel_id: + type: string + proof_ack: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + description: >- + MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B + to + + acknowledge the change of channel state to OPEN on Chain A. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenInit: + post: + summary: ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. + operationId: IbcCoreChannelV1Msg_ChannelOpenInit + responses: + '200': + description: A successful response. + schema: + type: object + properties: + channel_id: + type: string + version: + type: string + description: >- + MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgChannelOpenInit defines an sdk.Msg to initialize a channel + handshake. It + + is called by a relayer on Chain A. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: >- + State defines if a channel is in one of the following + states: + + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other + end of the channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which + packets sent on + + this channel will travel + version: + type: string + title: >- + opaque channel version, which is agreed upon during the + handshake + description: >- + Channel defines pipeline for exactly-once packet delivery + between specific + + modules on separate blockchains, which has at least one end + capable of + + sending packets and one end capable of receiving packets. + signer: + type: string + description: >- + MsgChannelOpenInit defines an sdk.Msg to initialize a channel + handshake. It + + is called by a relayer on Chain A. + tags: + - Msg + /ibc.core.channel.v1.Msg/ChannelOpenTry: + post: + summary: ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. + operationId: IbcCoreChannelV1Msg_ChannelOpenTry + responses: + '200': + description: A successful response. + schema: + type: object + properties: + version: + type: string + channel_id: + type: string + description: >- + MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgChannelOpenInit defines a msg sent by a Relayer to try to open a + channel + + on Chain B. The version field within the Channel field has been + deprecated. Its + + value will be ignored by core IBC. + in: body + required: true + schema: + type: object + properties: + port_id: + type: string + previous_channel_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hello's are no + longer supported in core IBC. + channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: >- + State defines if a channel is in one of the following + states: + + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other + end of the channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which + packets sent on + + this channel will travel + version: + type: string + title: >- + opaque channel version, which is agreed upon during the + handshake + description: >- + Channel defines pipeline for exactly-once packet delivery + between specific + + modules on separate blockchains, which has at least one end + capable of + + sending packets and one end capable of receiving packets. + counterparty_version: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + description: >- + MsgChannelOpenInit defines a msg sent by a Relayer to try to open + a channel + + on Chain B. The version field within the Channel field has been + deprecated. Its + + value will be ignored by core IBC. + tags: + - Msg + /ibc.core.channel.v1.Msg/RecvPacket: + post: + summary: RecvPacket defines a rpc handler method for MsgRecvPacket. + operationId: IbcCoreChannelV1Msg_RecvPacket + responses: + '200': + description: A successful response. + schema: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: >- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: MsgRecvPacketResponse defines the Msg/RecvPacket response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet + + with an earlier sequence number must be sent and received + before a Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms + may choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as + the RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + proof_commitment: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + title: MsgRecvPacket receives incoming IBC packet + tags: + - Msg + /ibc.core.channel.v1.Msg/Timeout: + post: + summary: Timeout defines a rpc handler method for MsgTimeout. + operationId: IbcCoreChannelV1Msg_Timeout + responses: + '200': + description: A successful response. + schema: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: >- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: MsgTimeoutResponse defines the Msg/Timeout response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet + + with an earlier sequence number must be sent and received + before a Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms + may choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as + the RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + proof_unreceived: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + title: MsgTimeout receives timed-out packet + tags: + - Msg + /ibc.core.channel.v1.Msg/TimeoutOnClose: + post: + summary: TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. + operationId: IbcCoreChannelV1Msg_TimeoutOnClose + responses: + '200': + description: A successful response. + schema: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: >- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value + enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the + execution of a message + description: >- + MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgTimeoutOnClose timed-out packet upon counterparty channel + closure. + in: body + required: true + schema: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, + where a Packet + + with an earlier sequence number must be sent and received + before a Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: >- + actual opaque bytes transferred directly to the + application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms + may choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as + the RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: >- + block timestamp (in nanoseconds) after which the packet + times out + title: >- + Packet defines a type that carries data across different + chains through IBC + proof_unreceived: + type: string + format: byte + proof_close: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + description: >- + MsgTimeoutOnClose timed-out packet upon counterparty channel + closure. + tags: + - Msg + /ibc.core.client.v1.Msg/CreateClient: + post: + summary: CreateClient defines a rpc handler method for MsgCreateClient. + operationId: IbcCoreClientV1Msg_CreateClient + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgCreateClientResponse defines the Msg/CreateClient response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + client_state: + title: light client state + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + consensus_state: + description: >- + consensus state associated with the client that corresponds to + a given + + height. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: MsgCreateClient defines a message to create an IBC client + tags: + - Msg + /ibc.core.client.v1.Msg/IBCSoftwareUpgrade: + post: + summary: >- + IBCSoftwareUpgrade defines a rpc handler method for + MsgIBCSoftwareUpgrade. + operationId: IbcCoreClientV1Msg_IBCSoftwareUpgrade + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + plan: + type: object + properties: + name: + type: string + description: >- + Sets the name for the upgrade. This name will be used by + the upgraded + + version of the software to apply any special "on-upgrade" + commands during + + the first BeginBlock method after the upgrade is applied. + It is also used + + to detect whether a software version can handle a given + upgrade. If no + + upgrade handler with this name has been set in the + software, it will be + + assumed that the software is out-of-date when the upgrade + Time or Height is + + reached and the software will exit. + time: + type: string + format: date-time + description: >- + Deprecated: Time based upgrades have been deprecated. Time + based upgrade logic + + has been removed from the SDK. + + If this field is not empty, an error will be thrown. + height: + type: string + format: int64 + description: The height at which the upgrade must be performed. + info: + type: string + title: >- + Any application specific upgrade info to be included + on-chain + + such as a git commit that validators could automatically + upgrade to + upgraded_client_state: + description: >- + Deprecated: UpgradedClientState field has been deprecated. + IBC upgrade logic has been + + moved to the IBC module in the sub module 02-client. + + If this field is not empty, an error will be thrown. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type + of the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be + in a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can + optionally set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results + based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty + scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + Plan specifies information about a planned upgrade and when it + should occur. + upgraded_client_state: + description: >- + An UpgradedClientState must be provided to perform an IBC + breaking upgrade. + + This will make the chain commit to the correct upgraded (self) + client state + + before the upgrade occurs, so that connecting chains can + verify that the + + new upgraded client is valid by verifying a proof on the + previous version + + of the chain. This will allow IBC connections to persist + smoothly across + + planned chain upgrades. Correspondingly, the + UpgradedClientState field has been + + deprecated in the Cosmos SDK to allow for this logic to exist + solely in + + the 02-client module. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: >- + MsgIBCSoftwareUpgrade defines the message used to schedule an + upgrade of an IBC client using a v1 governance proposal + tags: + - Msg + /ibc.core.client.v1.Msg/RecoverClient: + post: + summary: RecoverClient defines a rpc handler method for MsgRecoverClient. + operationId: IbcCoreClientV1Msg_RecoverClient + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgRecoverClientResponse defines the Msg/RecoverClient response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgRecoverClient defines the message used to recover a frozen or + expired client. + in: body + required: true + schema: + type: object + properties: + subject_client_id: + type: string + title: >- + the client identifier for the client to be updated if the + proposal passes + substitute_client_id: + type: string + title: >- + the substitute client identifier for the client which will + replace the subject + + client + signer: + type: string + title: signer address + description: >- + MsgRecoverClient defines the message used to recover a frozen or + expired client. + tags: + - Msg + /ibc.core.client.v1.Msg/SubmitMisbehaviour: + post: + summary: >- + SubmitMisbehaviour defines a rpc handler method for + MsgSubmitMisbehaviour. + operationId: IbcCoreClientV1Msg_SubmitMisbehaviour + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour + response + + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence + for + + light client misbehaviour. + + This message has been deprecated. Use MsgUpdateClient instead. + in: body + required: true + schema: + type: object + properties: + client_id: + type: string + title: client unique identifier + misbehaviour: + title: misbehaviour used for freezing the light client + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: >- + MsgSubmitMisbehaviour defines an sdk.Msg type that submits + Evidence for + + light client misbehaviour. + + This message has been deprecated. Use MsgUpdateClient instead. + tags: + - Msg + /ibc.core.client.v1.Msg/UpdateClient: + post: + summary: UpdateClient defines a rpc handler method for MsgUpdateClient. + operationId: IbcCoreClientV1Msg_UpdateClient + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateClientResponse defines the Msg/UpdateClient response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgUpdateClient defines an sdk.Msg to update a IBC client state + using + + the given client message. + in: body + required: true + schema: + type: object + properties: + client_id: + type: string + title: client unique identifier + client_message: + title: client message to update the light client + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: >- + MsgUpdateClient defines an sdk.Msg to update a IBC client state + using + + the given client message. + tags: + - Msg + /ibc.core.client.v1.Msg/UpdateClientParams: + post: + summary: UpdateClientParams defines a rpc handler method for MsgUpdateParams. + operationId: IbcCoreClientV1Msg_UpdateClientParams + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgUpdateParams defines the sdk.Msg type to update the client + parameters. + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the client parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state + types which can be created + + and interacted with. If a client type is removed from the + allowed clients list, usage + + of this client will be disabled until it is added again to + the list. + description: >- + MsgUpdateParams defines the sdk.Msg type to update the client + parameters. + tags: + - Msg + /ibc.core.client.v1.Msg/UpgradeClient: + post: + summary: UpgradeClient defines a rpc handler method for MsgUpgradeClient. + operationId: IbcCoreClientV1Msg_UpgradeClient + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpgradeClientResponse defines the Msg/UpgradeClient response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + client_id: + type: string + title: client unique identifier + client_state: + title: upgraded client state + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + consensus_state: + title: >- + upgraded consensus state, only contains enough information to + serve as a + + basis of trust in update logic + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_upgrade_client: + type: string + format: byte + title: proof that old chain committed to new client + proof_upgrade_consensus_state: + type: string + format: byte + title: proof that old chain committed to new consensus state + signer: + type: string + title: signer address + title: >- + MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a + new client + + state + tags: + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenAck: + post: + summary: ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenAck + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: |- + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. + in: body + required: true + schema: + type: object + properties: + connection_id: + type: string + counterparty_connection_id: + type: string + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the + IBC verison in + + the connection handshake. + client_state: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + proof_try: + type: string + format: byte + title: >- + proof of the initialization the connection on Chain B: + `UNITIALIZED -> + + TRYOPEN` + proof_client: + type: string + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. + tags: + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenConfirm: + post: + summary: |- + ConnectionOpenConfirm defines a rpc handler method for + MsgConnectionOpenConfirm. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenConfirm + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgConnectionOpenConfirmResponse defines the + Msg/ConnectionOpenConfirm + + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B + to + + acknowledge the change of connection state to OPEN on Chain A. + in: body + required: true + schema: + type: object + properties: + connection_id: + type: string + proof_ack: + type: string + format: byte + title: >- + proof for the change of the connection state on Chain A: `INIT + -> OPEN` + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + description: >- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain + B to + + acknowledge the change of connection state to OPEN on Chain A. + tags: + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenInit: + post: + summary: >- + ConnectionOpenInit defines a rpc handler method for + MsgConnectionOpenInit. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenInit + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit + response + + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgConnectionOpenInit defines the msg sent by an account on Chain A + to + + initialize a connection with Chain B. + in: body + required: true + schema: + type: object + properties: + client_id: + type: string + counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated + with a given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain + associated with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the + IBC verison in + + the connection handshake. + delay_period: + type: string + format: uint64 + signer: + type: string + description: >- + MsgConnectionOpenInit defines the msg sent by an account on Chain + A to + + initialize a connection with Chain B. + tags: + - Msg + /ibc.core.connection.v1.Msg/ConnectionOpenTry: + post: + summary: ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. + operationId: IbcCoreConnectionV1Msg_ConnectionOpenTry + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry + response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgConnectionOpenTry defines a msg sent by a Relayer to try to open + a + + connection on Chain B. + in: body + required: true + schema: + type: object + properties: + client_id: + type: string + previous_connection_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hellos are no + longer supported in core IBC. + client_state: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in + the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default + use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last + '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated + with a given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain + associated with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + delay_period: + type: string + format: uint64 + counterparty_versions: + type: array + items: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: >- + list of features compatible with the specified + identifier + description: >- + Version defines the versioning scheme used to negotiate the + IBC verison in + + the connection handshake. + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + proof_init: + type: string + format: byte + title: >- + proof of the initialization the connection on Chain A: + `UNITIALIZED -> + + INIT` + proof_client: + type: string + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: >- + MsgConnectionOpenTry defines a msg sent by a Relayer to try to + open a + + connection on Chain B. + tags: + - Msg + /ibc.core.connection.v1.Msg/UpdateConnectionParams: + post: + summary: |- + UpdateConnectionParams defines a rpc handler method for + MsgUpdateParams. + operationId: IbcCoreConnectionV1Msg_UpdateConnectionParams + responses: + '200': + description: A successful response. + schema: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + description: >- + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + in: body + required: true + schema: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the connection parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + max_expected_time_per_block: + type: string + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to + enforce block delay. This parameter should reflect the + + largest amount of time that the chain might reasonably + take to produce the next block under normal operating + + conditions. A safe choice is 3-5x the expected time per + block. + description: >- + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + tags: + - Msg +definitions: + cosmos.auth.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/auth parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + max_memo_characters: + type: string + format: uint64 + tx_sig_limit: + type: string + format: uint64 + tx_size_cost_per_byte: + type: string + format: uint64 + sig_verify_cost_ed25519: + type: string + format: uint64 + sig_verify_cost_secp256k1: + type: string + format: uint64 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.auth.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.auth.v1beta1.Params: + type: object + properties: + max_memo_characters: + type: string + format: uint64 + tx_sig_limit: + type: string + format: uint64 + tx_size_cost_per_byte: + type: string + format: uint64 + sig_verify_cost_ed25519: + type: string + format: uint64 + sig_verify_cost_secp256k1: + type: string + format: uint64 + description: Params defines the parameters for the auth module. + google.protobuf.Any: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a canonical + form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types that + they + + expect it to use in the context of Any. However, for URLs which use + the + + scheme `http`, `https`, or no scheme, one can optionally set up a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along with + a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + google.rpc.Status: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up + a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might + be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any + type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + cosmos.authz.v1beta1.Grant: + type: object + properties: + authorization: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + expiration: + type: string + format: date-time + title: >- + time when the grant will expire and will be pruned. If null, then the + grant + + doesn't have a time expiration (other conditions in `authorization` + + may apply to invalidate the grant) + description: |- + Grant gives permissions to execute + the provide method with expiration time. + cosmos.authz.v1beta1.MsgExec: + type: object + properties: + grantee: + type: string + msgs: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up + a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might + be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any + type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + description: >- + Execute Msg. + + The x/authz will try to find a grant matching (msg.signers[0], + grantee, MsgTypeURL(msg)) + + triple and validate it. + description: |- + MsgExec attempts to execute the provided messages using + authorizations granted to the grantee. Each message should have only + one signer corresponding to the granter of the authorization. + cosmos.authz.v1beta1.MsgExecResponse: + type: object + properties: + results: + type: array + items: + type: string + format: byte + description: MsgExecResponse defines the Msg/MsgExecResponse response type. + cosmos.authz.v1beta1.MsgGrant: + type: object + properties: + granter: + type: string + grantee: + type: string + grant: + type: object + properties: + authorization: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally set + up a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on + the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might + be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message + along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any + type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a + field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + expiration: + type: string + format: date-time + title: >- + time when the grant will expire and will be pruned. If null, then + the grant + + doesn't have a time expiration (other conditions in + `authorization` + + may apply to invalidate the grant) + description: |- + Grant gives permissions to execute + the provide method with expiration time. + description: >- + MsgGrant is a request type for Grant method. It declares authorization to + the grantee + + on behalf of the granter with the provided expiration time. + cosmos.authz.v1beta1.MsgGrantResponse: + type: object + description: MsgGrantResponse defines the Msg/MsgGrant response type. + cosmos.authz.v1beta1.MsgRevoke: + type: object + properties: + granter: + type: string + grantee: + type: string + msg_type_url: + type: string + description: |- + MsgRevoke revokes any authorization with the provided sdk.Msg type on the + granter's account with that has been granted to the grantee. + cosmos.authz.v1beta1.MsgRevokeResponse: + type: object + description: MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. + cosmos.bank.v1beta1.Input: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Input models transaction input. + cosmos.bank.v1beta1.MsgMultiSend: + type: object + properties: + inputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: Input models transaction input. + description: >- + Inputs, despite being `repeated`, only allows one sender input. This + is + + checked in MsgMultiSend's ValidateBasic. + outputs: + type: array + items: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: Output models transaction outputs. + description: MsgMultiSend represents an arbitrary multi-in, multi-out send message. + cosmos.bank.v1beta1.MsgMultiSendResponse: + type: object + description: MsgMultiSendResponse defines the Msg/MultiSend response type. + cosmos.bank.v1beta1.MsgSend: + type: object + properties: + from_address: + type: string + to_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: MsgSend represents a message to send coins from one account to another. + cosmos.bank.v1beta1.MsgSendResponse: + type: object + description: MsgSendResponse defines the Msg/Send response type. + cosmos.bank.v1beta1.MsgSetSendEnabled: + type: object + properties: + authority: + type: string + description: authority is the address that controls the module. + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status (whether a + denom is + + sendable). + description: send_enabled is the list of entries to add or update. + use_default_for: + type: array + items: + type: string + description: >- + use_default_for is a list of denoms that should use the + params.default_send_enabled value. + + Denoms listed here will have their SendEnabled entries deleted. + + If a denom is included that doesn't have a SendEnabled entry, + + it will be ignored. + description: |- + MsgSetSendEnabled is the Msg/SetSendEnabled request type. + + Only entries to add/update/delete need to be included. + Existing SendEnabled entries that are not included in this + message are left unchanged. + + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.MsgSetSendEnabledResponse: + type: object + description: |- + MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/bank parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status (whether a + denom is + + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. + + For genesis, use the newly added send_enabled field in the genesis + object. + + Storage, lookup, and manipulation of this information is now in + the keeper. + + + As of cosmos-sdk 0.47, this only exists for backwards + compatibility of genesis files. + default_send_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.bank.v1beta1.Output: + type: object + properties: + address: + type: string + coins: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Output models transaction outputs. + cosmos.bank.v1beta1.Params: + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status (whether a + denom is + + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. + + For genesis, use the newly added send_enabled field in the genesis + object. + + Storage, lookup, and manipulation of this information is now in the + keeper. + + + As of cosmos-sdk 0.47, this only exists for backwards compatibility of + genesis files. + default_send_enabled: + type: boolean + description: Params defines the parameters for the bank module. + cosmos.bank.v1beta1.SendEnabled: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: |- + SendEnabled maps coin denom to a send_enabled status (whether a denom is + sendable). + cosmos.base.v1beta1.Coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + cosmos.base.node.v1beta1.ConfigResponse: + type: object + properties: + minimum_gas_price: + type: string + pruning_keep_recent: + type: string + title: pruning settings + pruning_interval: + type: string + description: ConfigResponse defines the response structure for the Config gRPC query. + cosmos.base.node.v1beta1.StatusResponse: + type: object + properties: + earliest_store_height: + type: string + format: uint64 + title: earliest block height available in the store + height: + type: string + format: uint64 + title: current block height + timestamp: + type: string + format: date-time + title: block height timestamp + app_hash: + type: string + format: byte + title: app hash of the current block + validator_hash: + type: string + format: byte + title: validator hash provided by the consensus header + description: StateResponse defines the response structure for the status of a node. + cosmos.consensus.v1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + block: + description: |- + params defines the x/consensus parameters to update. + VersionsParams is not included in this Msg because it is tracked + separarately in x/upgrade. + + NOTE: All parameters must be supplied. + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: MaxAgeDuration / + {average block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" or other + similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can be + committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + abci: + title: 'Since: cosmos-sdk 0.50' + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height during + which + + vote extensions will be enabled. During this specified height, and + for all + + subsequent heights, precommit messages that do not contain valid + extension data + + will be considered invalid. Prior to this height, vote extensions + will not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the application + in ExtendVote, + + passed to the application for validation in VerifyVoteExtension + and given + + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application + Blockchain Interface. + description: MsgUpdateParams is the Msg/UpdateParams request type. + cosmos.consensus.v1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + tendermint.types.ABCIParams: + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height during which + + vote extensions will be enabled. During this specified height, and for + all + + subsequent heights, precommit messages that do not contain valid + extension data + + will be considered invalid. Prior to this height, vote extensions will + not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the application in + ExtendVote, + + passed to the application for validation in VerifyVoteExtension and + given + + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application Blockchain + Interface. + tendermint.types.BlockParams: + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + description: BlockParams contains limits on the block size. + tendermint.types.EvidenceParams: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: MaxAgeDuration / {average + block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" or other similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can be + committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + tendermint.types.ValidatorParams: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + cosmos.crisis.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + constant_fee: + description: constant_fee defines the x/crisis parameter. + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.crisis.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.crisis.v1beta1.MsgVerifyInvariant: + type: object + properties: + sender: + type: string + description: >- + sender is the account address of private key to send coins to fee + collector account. + invariant_module_name: + type: string + description: name of the invariant module. + invariant_route: + type: string + description: invariant_route is the msg's invariant route. + description: MsgVerifyInvariant represents a message to verify a particular invariance. + cosmos.crisis.v1beta1.MsgVerifyInvariantResponse: + type: object + description: MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type. + cosmos.distribution.v1beta1.MsgCommunityPoolSpend: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + recipient: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: >- + MsgCommunityPoolSpend defines a message for sending tokens from the + community + + pool to another account. This message is typically executed via a + governance + + proposal with the governance module being the executing authority. + + + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse: + type: object + description: |- + MsgCommunityPoolSpendResponse defines the response to executing a + MsgCommunityPoolSpend message. + + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool: + type: object + properties: + depositor: + type: string + validator_address: + type: string + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + DepositValidatorRewardsPool defines the request structure to provide + additional rewards to delegators from a specific validator. + + Since: cosmos-sdk 0.50 + cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse: + type: object + description: |- + MsgDepositValidatorRewardsPoolResponse defines the response to executing a + MsgDepositValidatorRewardsPool message. + + Since: cosmos-sdk 0.50 + cosmos.distribution.v1beta1.MsgFundCommunityPool: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + depositor: + type: string + description: |- + MsgFundCommunityPool allows an account to directly + fund the community pool. + cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse: + type: object + description: >- + MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response + type. + cosmos.distribution.v1beta1.MsgSetWithdrawAddress: + type: object + properties: + delegator_address: + type: string + withdraw_address: + type: string + description: |- + MsgSetWithdrawAddress sets the withdraw address for + a delegator (or validator self-delegation). + cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse: + type: object + description: |- + MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + type. + cosmos.distribution.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/distribution parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + community_tax: + type: string + base_proposer_reward: + type: string + description: >- + Deprecated: The base_proposer_reward field is deprecated and is no + longer used + + in the x/distribution module's reward mechanism. + bonus_proposer_reward: + type: string + description: >- + Deprecated: The bonus_proposer_reward field is deprecated and is + no longer used + + in the x/distribution module's reward mechanism. + withdraw_addr_enabled: + type: boolean + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + description: |- + MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + from a single validator. + cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: |- + MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + response type. + cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission: + type: object + properties: + validator_address: + type: string + description: >- + MsgWithdrawValidatorCommission withdraws the full commission to the + validator + + address. + cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: 'Since: cosmos-sdk 0.46' + description: |- + MsgWithdrawValidatorCommissionResponse defines the + Msg/WithdrawValidatorCommission response type. + cosmos.distribution.v1beta1.Params: + type: object + properties: + community_tax: + type: string + base_proposer_reward: + type: string + description: >- + Deprecated: The base_proposer_reward field is deprecated and is no + longer used + + in the x/distribution module's reward mechanism. + bonus_proposer_reward: + type: string + description: >- + Deprecated: The bonus_proposer_reward field is deprecated and is no + longer used + + in the x/distribution module's reward mechanism. + withdraw_addr_enabled: + type: boolean + description: Params defines the set of params for the distribution module. + cosmos.evidence.v1beta1.MsgSubmitEvidence: + type: object + properties: + submitter: + type: string + description: submitter is the signer account address of evidence. + evidence: + description: evidence defines the evidence of misbehavior. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: |- + MsgSubmitEvidence represents a message that supports submitting arbitrary + Evidence of misbehavior such as equivocation or counterfactual signing. + cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse: + type: object + properties: + hash: + type: string + format: byte + description: hash defines the hash of the evidence. + description: MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. + cosmos.feegrant.v1beta1.MsgGrantAllowance: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of their + funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance of + another user's funds. + allowance: + description: allowance can be any of basic, periodic, allowed fee allowance. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: |- + MsgGrantAllowance adds permission for Grantee to spend up to Allowance + of fees from the account of Granter. + cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse: + type: object + description: >- + MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response + type. + cosmos.feegrant.v1beta1.MsgPruneAllowances: + type: object + properties: + pruner: + type: string + description: pruner is the address of the user pruning expired allowances. + description: |- + MsgPruneAllowances prunes expired fee allowances. + + Since cosmos-sdk 0.50 + cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse: + type: object + description: >- + MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse + response type. + + + Since cosmos-sdk 0.50 + cosmos.feegrant.v1beta1.MsgRevokeAllowance: + type: object + properties: + granter: + type: string + description: >- + granter is the address of the user granting an allowance of their + funds. + grantee: + type: string + description: >- + grantee is the address of the user being granted an allowance of + another user's funds. + description: MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. + cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse: + type: object + description: >- + MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse + response type. + cosmos.gov.v1.MsgCancelProposal: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + proposer: + type: string + description: proposer is the account address of the proposer. + description: |- + MsgCancelProposal is the Msg/CancelProposal request type. + + Since: cosmos-sdk 0.50 + cosmos.gov.v1.MsgCancelProposalResponse: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + canceled_time: + type: string + format: date-time + description: canceled_time is the time when proposal is canceled. + canceled_height: + type: string + format: uint64 + description: >- + canceled_height defines the block height at which the proposal is + canceled. + description: |- + MsgCancelProposalResponse defines the response structure for executing a + MsgCancelProposal message. + + Since: cosmos-sdk 0.50 + cosmos.gov.v1.MsgDeposit: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: MsgDeposit defines a message to submit a deposit to an existing proposal. + cosmos.gov.v1.MsgDepositResponse: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. + cosmos.gov.v1.MsgExecLegacyContent: + type: object + properties: + content: + description: content is the proposal's content. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + authority: + type: string + description: authority must be the gov module address. + description: >- + MsgExecLegacyContent is used to wrap the legacy content field into a + message. + + This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + cosmos.gov.v1.MsgExecLegacyContentResponse: + type: object + description: >- + MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response + type. + cosmos.gov.v1.MsgSubmitProposal: + type: object + properties: + messages: + type: array + items: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up + a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might + be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any + type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + description: messages are the arbitrary messages to be executed if proposal passes. + initial_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at proposal + submission. + proposer: + type: string + description: proposer is the account address of the proposer. + metadata: + type: string + description: metadata is any arbitrary metadata attached to the proposal. + title: + type: string + description: |- + title is the title of the proposal. + + Since: cosmos-sdk 0.47 + summary: + type: string + description: 'Since: cosmos-sdk 0.47' + title: summary is the summary of the proposal + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited or not + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + cosmos.gov.v1.MsgSubmitProposalResponse: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. + cosmos.gov.v1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/gov parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. Initial + value: 2 + + months. + voting_period: + type: string + description: Duration of the voting period. + quorum: + type: string + description: >- + Minimum percentage of total stake needed to vote for a result to + be + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default + value: 0.5. + veto_threshold: + type: string + description: >- + Minimum value of Veto votes to Total votes ratio for proposal to + be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value that + must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the depositors + when a proposal is cancelled. + + + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * deposit) + proposal deposits. + + If empty, the (proposal_cancel_ratio * deposit) proposal deposits + will be burned. + + + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default + value: 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: Minimum expedited deposit for a proposal to enter voting period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value minimum + that must be met when making a deposit. + + Default value: 0.01. Meaning that for a chain with a min_deposit + of 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.gov.v1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.gov.v1.MsgVote: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + metadata: + type: string + description: metadata is any arbitrary metadata attached to the Vote. + description: MsgVote defines a message to cast a vote. + cosmos.gov.v1.MsgVoteResponse: + type: object + description: MsgVoteResponse defines the Msg/Vote response type. + cosmos.gov.v1.MsgVoteWeighted: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: + type: array + items: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not contain + duplicate vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: weight is the vote weight associated with the vote option. + description: WeightedVoteOption defines a unit of vote for vote split. + description: options defines the weighted vote options. + metadata: + type: string + description: metadata is any arbitrary metadata attached to the VoteWeighted. + description: MsgVoteWeighted defines a message to cast a vote. + cosmos.gov.v1.MsgVoteWeightedResponse: + type: object + description: MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + cosmos.gov.v1.Params: + type: object + properties: + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. Initial + value: 2 + + months. + voting_period: + type: string + description: Duration of the voting period. + quorum: + type: string + description: |- + Minimum percentage of total stake needed to vote for a result to be + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default value: + 0.5. + veto_threshold: + type: string + description: |- + Minimum value of Veto votes to Total votes ratio for proposal to be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value that must + be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the depositors + when a proposal is cancelled. + + + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * deposit) + proposal deposits. + + If empty, the (proposal_cancel_ratio * deposit) proposal deposits will + be burned. + + + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default value: + 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Minimum expedited deposit for a proposal to enter voting period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value minimum + that must be met when making a deposit. + + Default value: 0.01. Meaning that for a chain with a min_deposit of + 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 + description: |- + Params defines the parameters for the x/gov module. + + Since: cosmos-sdk 0.47 + cosmos.gov.v1.VoteOption: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given governance + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + cosmos.gov.v1.WeightedVoteOption: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not contain duplicate + vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: weight is the vote weight associated with the vote option. + description: WeightedVoteOption defines a unit of vote for vote split. + cosmos.gov.v1beta1.MsgDeposit: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + depositor: + type: string + description: depositor defines the deposit addresses from the proposals. + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: amount to be deposited by depositor. + description: MsgDeposit defines a message to submit a deposit to an existing proposal. + cosmos.gov.v1beta1.MsgDepositResponse: + type: object + description: MsgDepositResponse defines the Msg/Deposit response type. + cosmos.gov.v1beta1.MsgSubmitProposal: + type: object + properties: + content: + description: content is the proposal's content. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + initial_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: >- + initial_deposit is the deposit value that must be paid at proposal + submission. + proposer: + type: string + description: proposer is the account address of the proposer. + description: >- + MsgSubmitProposal defines an sdk.Msg type that supports submitting + arbitrary + + proposal Content. + cosmos.gov.v1beta1.MsgSubmitProposalResponse: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + description: MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. + cosmos.gov.v1beta1.MsgVote: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + option: + description: option defines the vote option. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + description: MsgVote defines a message to cast a vote. + cosmos.gov.v1beta1.MsgVoteResponse: + type: object + description: MsgVoteResponse defines the Msg/Vote response type. + cosmos.gov.v1beta1.MsgVoteWeighted: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal_id defines the unique id of the proposal. + voter: + type: string + description: voter is the voter address for the proposal. + options: + type: array + items: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not contain + duplicate vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: weight is the vote weight associated with the vote option. + description: |- + WeightedVoteOption defines a unit of vote for vote split. + + Since: cosmos-sdk 0.43 + description: options defines the weighted vote options. + description: |- + MsgVoteWeighted defines a message to cast a vote. + + Since: cosmos-sdk 0.43 + cosmos.gov.v1beta1.MsgVoteWeightedResponse: + type: object + description: |- + MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + + Since: cosmos-sdk 0.43 + cosmos.gov.v1beta1.VoteOption: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given governance + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + cosmos.gov.v1beta1.WeightedVoteOption: + type: object + properties: + option: + description: >- + option defines the valid vote options, it must not contain duplicate + vote options. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + weight: + type: string + description: weight is the vote weight associated with the vote option. + description: |- + WeightedVoteOption defines a unit of vote for vote split. + + Since: cosmos-sdk 0.43 + cosmos.mint.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/mint parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + mint_denom: + type: string + title: type of coin to mint + inflation_rate_change: + type: string + title: maximum annual change in inflation rate + inflation_max: + type: string + title: maximum inflation rate + inflation_min: + type: string + title: minimum inflation rate + goal_bonded: + type: string + title: goal of percent bonded atoms + blocks_per_year: + type: string + format: uint64 + title: expected blocks per year + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.mint.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.mint.v1beta1.Params: + type: object + properties: + mint_denom: + type: string + title: type of coin to mint + inflation_rate_change: + type: string + title: maximum annual change in inflation rate + inflation_max: + type: string + title: maximum inflation rate + inflation_min: + type: string + title: minimum inflation rate + goal_bonded: + type: string + title: goal of percent bonded atoms + blocks_per_year: + type: string + format: uint64 + title: expected blocks per year + description: Params defines the parameters for the x/mint module. + cosmos.params.v1beta1.ParamChange: + type: object + properties: + subspace: + type: string + key: + type: string + value: + type: string + description: |- + ParamChange defines an individual parameter change, for use in + ParameterChangeProposal. + cosmos.params.v1beta1.QueryParamsResponse: + type: object + properties: + param: + description: param defines the queried parameter. + type: object + properties: + subspace: + type: string + key: + type: string + value: + type: string + description: QueryParamsResponse is response type for the Query/Params RPC method. + cosmos.params.v1beta1.QuerySubspacesResponse: + type: object + properties: + subspaces: + type: array + items: + type: object + properties: + subspace: + type: string + keys: + type: array + items: + type: string + description: >- + Subspace defines a parameter subspace name and all the keys that + exist for + + the subspace. + + + Since: cosmos-sdk 0.46 + description: |- + QuerySubspacesResponse defines the response types for querying for all + registered subspaces and all keys for a subspace. + + Since: cosmos-sdk 0.46 + cosmos.params.v1beta1.Subspace: + type: object + properties: + subspace: + type: string + keys: + type: array + items: + type: string + description: |- + Subspace defines a parameter subspace name and all the keys that exist for + the subspace. + + Since: cosmos-sdk 0.46 + cosmos.slashing.v1beta1.MsgUnjail: + type: object + properties: + validator_addr: + type: string + title: MsgUnjail defines the Msg/Unjail request type + cosmos.slashing.v1beta1.MsgUnjailResponse: + type: object + title: MsgUnjailResponse defines the Msg/Unjail response type + cosmos.slashing.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/slashing parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + signed_blocks_window: + type: string + format: int64 + min_signed_per_window: + type: string + format: byte + downtime_jail_duration: + type: string + slash_fraction_double_sign: + type: string + format: byte + slash_fraction_downtime: + type: string + format: byte + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.slashing.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.slashing.v1beta1.Params: + type: object + properties: + signed_blocks_window: + type: string + format: int64 + min_signed_per_window: + type: string + format: byte + downtime_jail_duration: + type: string + slash_fraction_double_sign: + type: string + format: byte + slash_fraction_downtime: + type: string + format: byte + description: Params represents the parameters used for by the slashing module. + cosmos.staking.v1beta1.CommissionRates: + type: object + properties: + rate: + type: string + description: rate is the commission rate charged to delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which validator can ever + charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the validator + commission, as a fraction. + description: >- + CommissionRates defines the initial commission rates to be used for + creating + + a validator. + cosmos.staking.v1beta1.Description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + cosmos.staking.v1beta1.MsgBeginRedelegate: + type: object + properties: + delegator_address: + type: string + validator_src_address: + type: string + validator_dst_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgBeginRedelegate defines a SDK message for performing a redelegation + of coins from a delegator and source validator to a destination validator. + cosmos.staking.v1beta1.MsgBeginRedelegateResponse: + type: object + properties: + completion_time: + type: string + format: date-time + description: MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. + cosmos.staking.v1beta1.MsgCancelUnbondingDelegation: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: >- + amount is always less than or equal to unbonding delegation entry + balance + creation_height: + type: string + format: int64 + description: creation_height is the height which the unbonding took place. + description: 'Since: cosmos-sdk 0.46' + title: >- + MsgCancelUnbondingDelegation defines the SDK message for performing a + cancel unbonding delegation for delegator + cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse: + type: object + description: 'Since: cosmos-sdk 0.46' + title: MsgCancelUnbondingDelegationResponse + cosmos.staking.v1beta1.MsgCreateValidator: + type: object + properties: + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + commission: + type: object + properties: + rate: + type: string + description: rate is the commission rate charged to delegators, as a fraction. + max_rate: + type: string + description: >- + max_rate defines the maximum commission rate which validator can + ever charge, as a fraction. + max_change_rate: + type: string + description: >- + max_change_rate defines the maximum daily increase of the + validator commission, as a fraction. + description: >- + CommissionRates defines the initial commission rates to be used for + creating + + a validator. + min_self_delegation: + type: string + delegator_address: + type: string + description: >- + Deprecated: Use of Delegator Address in MsgCreateValidator is + deprecated. + + The validator address bytes and delegator address bytes refer to the + same account while creating validator (defer + + only in bech32 notation). + validator_address: + type: string + pubkey: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + value: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: MsgCreateValidator defines a SDK message for creating a new validator. + cosmos.staking.v1beta1.MsgCreateValidatorResponse: + type: object + description: MsgCreateValidatorResponse defines the Msg/CreateValidator response type. + cosmos.staking.v1beta1.MsgDelegate: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgDelegate defines a SDK message for performing a delegation of coins + from a delegator to a validator. + cosmos.staking.v1beta1.MsgDelegateResponse: + type: object + description: MsgDelegateResponse defines the Msg/Delegate response type. + cosmos.staking.v1beta1.MsgEditValidator: + type: object + properties: + description: + type: object + properties: + moniker: + type: string + description: moniker defines a human-readable name for the validator. + identity: + type: string + description: >- + identity defines an optional identity signature (ex. UPort or + Keybase). + website: + type: string + description: website defines an optional website link. + security_contact: + type: string + description: security_contact defines an optional email for security contact. + details: + type: string + description: details define other optional details. + description: Description defines a validator description. + validator_address: + type: string + commission_rate: + type: string + title: >- + We pass a reference to the new commission rate and min self delegation + as + + it's not mandatory to update. If not updated, the deserialized rate + will be + + zero with no way to distinguish if an update was intended. + + REF: #2373 + min_self_delegation: + type: string + description: MsgEditValidator defines a SDK message for editing an existing validator. + cosmos.staking.v1beta1.MsgEditValidatorResponse: + type: object + description: MsgEditValidatorResponse defines the Msg/EditValidator response type. + cosmos.staking.v1beta1.MsgUndelegate: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgUndelegate defines a SDK message for performing an undelegation from a + delegate and a validator. + cosmos.staking.v1beta1.MsgUndelegateResponse: + type: object + properties: + completion_time: + type: string + format: date-time + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: amount returns the amount of undelegated coins + description: MsgUndelegateResponse defines the Msg/Undelegate response type. + cosmos.staking.v1beta1.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/staking parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + unbonding_time: + type: string + description: unbonding_time is the time duration of unbonding. + max_validators: + type: integer + format: int64 + description: max_validators is the maximum number of validators. + max_entries: + type: integer + format: int64 + description: >- + max_entries is the max entries for either unbonding delegation or + redelegation (per pair/trio). + historical_entries: + type: integer + format: int64 + description: historical_entries is the number of historical entries to persist. + bond_denom: + type: string + description: bond_denom defines the bondable coin denomination. + min_commission_rate: + type: string + title: >- + min_commission_rate is the chain-wide minimum commission rate that + a validator can charge their delegators + description: |- + MsgUpdateParams is the Msg/UpdateParams request type. + + Since: cosmos-sdk 0.47 + cosmos.staking.v1beta1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + + Since: cosmos-sdk 0.47 + cosmos.staking.v1beta1.Params: + type: object + properties: + unbonding_time: + type: string + description: unbonding_time is the time duration of unbonding. + max_validators: + type: integer + format: int64 + description: max_validators is the maximum number of validators. + max_entries: + type: integer + format: int64 + description: >- + max_entries is the max entries for either unbonding delegation or + redelegation (per pair/trio). + historical_entries: + type: integer + format: int64 + description: historical_entries is the number of historical entries to persist. + bond_denom: + type: string + description: bond_denom defines the bondable coin denomination. + min_commission_rate: + type: string + title: >- + min_commission_rate is the chain-wide minimum commission rate that a + validator can charge their delegators + description: Params defines the parameters for the x/staking module. + ibc.applications.fee.v1.Fee: + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + title: the packet timeout fee + title: Fee defines the ICS29 receive, acknowledgement and timeout fees + ibc.applications.fee.v1.MsgPayPacketFee: + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated with an IBC + packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet timeout fee + source_port_id: + type: string + title: the source port unique identifier + source_channel_id: + type: string + title: the source channel unique identifer + signer: + type: string + title: account address to refund fee if necessary + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to the receive packet fees + title: >- + MsgPayPacketFee defines the request type for the PayPacketFee rpc + + This Msg can be used to pay for a packet at the next sequence send & + should be combined with the Msg that will be + + paid for + ibc.applications.fee.v1.MsgPayPacketFeeAsync: + type: object + properties: + packet_id: + title: >- + unique packet identifier comprised of the channel ID, port ID and + sequence + type: object + properties: + port_id: + type: string + title: channel port identifier + channel_id: + type: string + title: channel unique identifier + sequence: + type: string + format: uint64 + title: packet sequence + packet_fee: + title: the packet fee associated with a particular IBC packet + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated with an + IBC packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet timeout fee + refund_address: + type: string + title: the refund address for unspent fees + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to receive fees + title: >- + MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync + rpc + + This Msg can be used to pay for a packet at a specified sequence (instead + of the next sequence send) + ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse: + type: object + title: >- + MsgPayPacketFeeAsyncResponse defines the response type for the + PayPacketFeeAsync rpc + ibc.applications.fee.v1.MsgPayPacketFeeResponse: + type: object + title: MsgPayPacketFeeResponse defines the response type for the PayPacketFee rpc + ibc.applications.fee.v1.MsgRegisterCounterpartyPayee: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + counterparty_payee: + type: string + title: the counterparty payee address + title: >- + MsgRegisterCounterpartyPayee defines the request type for the + RegisterCounterpartyPayee rpc + ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse: + type: object + title: >- + MsgRegisterCounterpartyPayeeResponse defines the response type for the + RegisterCounterpartyPayee rpc + ibc.applications.fee.v1.MsgRegisterPayee: + type: object + properties: + port_id: + type: string + title: unique port identifier + channel_id: + type: string + title: unique channel identifier + relayer: + type: string + title: the relayer address + payee: + type: string + title: the payee address + title: MsgRegisterPayee defines the request type for the RegisterPayee rpc + ibc.applications.fee.v1.MsgRegisterPayeeResponse: + type: object + title: >- + MsgRegisterPayeeResponse defines the response type for the RegisterPayee + rpc + ibc.applications.fee.v1.PacketFee: + type: object + properties: + fee: + title: >- + fee encapsulates the recv, ack and timeout fees associated with an IBC + packet + type: object + properties: + recv_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet receive fee + ack_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet acknowledgement fee + timeout_fee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + title: the packet timeout fee + refund_address: + type: string + title: the refund address for unspent fees + relayers: + type: array + items: + type: string + title: optional list of relayers permitted to receive fees + title: >- + PacketFee contains ICS29 relayer fees, refund address and optional list of + permitted relayers + ibc.core.channel.v1.PacketId: + type: object + properties: + port_id: + type: string + title: channel port identifier + channel_id: + type: string + title: channel unique identifier + sequence: + type: string + format: uint64 + title: packet sequence + title: |- + PacketId is an identifer for a unique Packet + Source chains refer to packets by source port/channel + Destination chains refer to packets by destination port/channel + ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount: + type: object + properties: + owner: + type: string + connection_id: + type: string + version: + type: string + title: MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount + ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse: + type: object + properties: + channel_id: + type: string + port_id: + type: string + title: >- + MsgRegisterInterchainAccountResponse defines the response for + Msg/RegisterAccount + ibc.applications.interchain_accounts.controller.v1.MsgSendTx: + type: object + properties: + owner: + type: string + connection_id: + type: string + packet_data: + type: object + properties: + type: + type: string + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a controller + chain to its associated interchain accounts + + host + data: + type: string + format: byte + memo: + type: string + description: >- + InterchainAccountPacketData is comprised of a raw transaction, type of + transaction and optional memo field. + relative_timeout: + type: string + format: uint64 + description: >- + Relative timeout timestamp provided will be added to the current block + time during transaction execution. + + The timeout timestamp must be non-zero. + title: MsgSendTx defines the payload for Msg/SendTx + ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse: + type: object + properties: + sequence: + type: string + format: uint64 + title: MsgSendTxResponse defines the response for MsgSendTx + ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: >- + params defines the 27-interchain-accounts/controller parameters to + update. + + + NOTE: All parameters must be supplied. + type: object + properties: + controller_enabled: + type: boolean + description: controller_enabled enables or disables the controller submodule. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + ibc.applications.interchain_accounts.controller.v1.Params: + type: object + properties: + controller_enabled: + type: boolean + description: controller_enabled enables or disables the controller submodule. + description: |- + Params defines the set of on-chain interchain accounts parameters. + The following parameters may be used to disable the controller submodule. + ibc.applications.interchain_accounts.v1.InterchainAccountPacketData: + type: object + properties: + type: + type: string + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a controller + chain to its associated interchain accounts + + host + data: + type: string + format: byte + memo: + type: string + description: >- + InterchainAccountPacketData is comprised of a raw transaction, type of + transaction and optional memo field. + ibc.applications.interchain_accounts.v1.Type: + type: string + enum: + - TYPE_UNSPECIFIED + - TYPE_EXECUTE_TX + default: TYPE_UNSPECIFIED + description: |- + - TYPE_UNSPECIFIED: Default zero value enumeration + - TYPE_EXECUTE_TX: Execute a transaction on an interchain accounts host chain + title: >- + Type defines a classification of message issued from a controller chain to + its associated interchain accounts + + host + ibc.applications.interchain_accounts.host.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the 27-interchain-accounts/host parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + host_enabled: + type: boolean + description: host_enabled enables or disables the host submodule. + allow_messages: + type: array + items: + type: string + description: >- + allow_messages defines a list of sdk message typeURLs allowed to + be executed on a host chain. + title: MsgUpdateParams defines the payload for Msg/UpdateParams + ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse: + type: object + title: MsgUpdateParamsResponse defines the response for Msg/UpdateParams + ibc.applications.interchain_accounts.host.v1.Params: + type: object + properties: + host_enabled: + type: boolean + description: host_enabled enables or disables the host submodule. + allow_messages: + type: array + items: + type: string + description: >- + allow_messages defines a list of sdk message typeURLs allowed to be + executed on a host chain. + description: |- + Params defines the set of on-chain interchain accounts parameters. + The following parameters may be used to disable the host submodule. + ibc.applications.transfer.v1.MsgTransfer: + type: object + properties: + source_port: + type: string + title: the port on which the packet will be sent + source_channel: + type: string + title: the channel by which the packet will be sent + token: + title: the tokens to be transferred + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + sender: + type: string + title: the sender address + receiver: + type: string + title: the recipient address on the destination chain + timeout_height: + description: |- + Timeout height relative to the current block height. + The timeout is disabled when set to 0. + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + timeout_timestamp: + type: string + format: uint64 + description: |- + Timeout timestamp in absolute nanoseconds since unix epoch. + The timeout is disabled when set to 0. + memo: + type: string + title: optional memo + title: >- + MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + + ICS20 enabled chains. See ICS Spec here: + + https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + ibc.applications.transfer.v1.MsgTransferResponse: + type: object + properties: + sequence: + type: string + format: uint64 + title: sequence number of the transfer packet sent + description: MsgTransferResponse defines the Msg/Transfer response type. + ibc.applications.transfer.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the transfer parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + send_enabled: + type: boolean + description: >- + send_enabled enables or disables all cross-chain token transfers + from this + + chain. + receive_enabled: + type: boolean + description: >- + receive_enabled enables or disables all cross-chain token + transfers to this + + chain. + description: MsgUpdateParams is the Msg/UpdateParams request type. + ibc.applications.transfer.v1.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + ibc.applications.transfer.v1.Params: + type: object + properties: + send_enabled: + type: boolean + description: >- + send_enabled enables or disables all cross-chain token transfers from + this + + chain. + receive_enabled: + type: boolean + description: >- + receive_enabled enables or disables all cross-chain token transfers to + this + + chain. + description: >- + Params defines the set of IBC transfer parameters. + + NOTE: To prevent a single token from being transferred, set the + + TransfersEnabled parameter to true and then set the bank module's + SendEnabled + + parameter for the denomination to false. + ibc.core.client.v1.Height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: |- + Normally the RevisionHeight is incremented at each height while keeping + RevisionNumber the same. However some consensus algorithms may choose to + reset the height in certain conditions e.g. hard forks, state-machine + breaking changes In these cases, the RevisionNumber is incremented so that + height continues to be monitonically increasing even as the RevisionHeight + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of updating + and + + freezing clients + ibc.core.channel.v1.Channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: |- + list of connection identifiers, in order, along which packets sent on + this channel will travel + version: + type: string + title: opaque channel version, which is agreed upon during the handshake + description: |- + Channel defines pipeline for exactly-once packet delivery between specific + modules on separate blockchains, which has at least one end capable of + sending packets and one end capable of receiving packets. + ibc.core.channel.v1.Counterparty: + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + title: Counterparty defines a channel end counterparty + ibc.core.channel.v1.MsgAcknowledgement: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet + + with an earlier sequence number must be sent and received before a + Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is incremented + so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + acknowledgement: + type: string + format: byte + proof_acked: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + title: MsgAcknowledgement receives incoming IBC acknowledgement + ibc.core.channel.v1.MsgAcknowledgementResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. + ibc.core.channel.v1.MsgChannelCloseConfirm: + type: object + properties: + port_id: + type: string + channel_id: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + description: |- + MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + to acknowledge the change of channel state to CLOSED on Chain A. + ibc.core.channel.v1.MsgChannelCloseConfirmResponse: + type: object + description: >- + MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm + response + + type. + ibc.core.channel.v1.MsgChannelCloseInit: + type: object + properties: + port_id: + type: string + channel_id: + type: string + signer: + type: string + description: |- + MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + to close a channel with Chain B. + ibc.core.channel.v1.MsgChannelCloseInitResponse: + type: object + description: >- + MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response + type. + ibc.core.channel.v1.MsgChannelOpenAck: + type: object + properties: + port_id: + type: string + channel_id: + type: string + counterparty_channel_id: + type: string + counterparty_version: + type: string + proof_try: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + description: >- + MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge + + the change of channel state to TRYOPEN on Chain B. + ibc.core.channel.v1.MsgChannelOpenAckResponse: + type: object + description: MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. + ibc.core.channel.v1.MsgChannelOpenConfirm: + type: object + properties: + port_id: + type: string + channel_id: + type: string + proof_ack: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + description: |- + MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of channel state to OPEN on Chain A. + ibc.core.channel.v1.MsgChannelOpenConfirmResponse: + type: object + description: |- + MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + type. + ibc.core.channel.v1.MsgChannelOpenInit: + type: object + properties: + port_id: + type: string + channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which packets sent + on + + this channel will travel + version: + type: string + title: opaque channel version, which is agreed upon during the handshake + description: >- + Channel defines pipeline for exactly-once packet delivery between + specific + + modules on separate blockchains, which has at least one end capable of + + sending packets and one end capable of receiving packets. + signer: + type: string + description: >- + MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. + It + + is called by a relayer on Chain A. + ibc.core.channel.v1.MsgChannelOpenInitResponse: + type: object + properties: + channel_id: + type: string + version: + type: string + description: MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. + ibc.core.channel.v1.MsgChannelOpenTry: + type: object + properties: + port_id: + type: string + previous_channel_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hello's are no longer + supported in core IBC. + channel: + type: object + properties: + state: + title: current state of the channel end + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + ordering: + title: whether the channel is ordered or unordered + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + counterparty: + title: counterparty channel end + type: object + properties: + port_id: + type: string + description: >- + port on the counterparty chain which owns the other end of the + channel. + channel_id: + type: string + title: channel end on the counterparty chain + connection_hops: + type: array + items: + type: string + title: >- + list of connection identifiers, in order, along which packets sent + on + + this channel will travel + version: + type: string + title: opaque channel version, which is agreed upon during the handshake + description: >- + Channel defines pipeline for exactly-once packet delivery between + specific + + modules on separate blockchains, which has at least one end capable of + + sending packets and one end capable of receiving packets. + counterparty_version: + type: string + proof_init: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + description: >- + MsgChannelOpenInit defines a msg sent by a Relayer to try to open a + channel + + on Chain B. The version field within the Channel field has been + deprecated. Its + + value will be ignored by core IBC. + ibc.core.channel.v1.MsgChannelOpenTryResponse: + type: object + properties: + version: + type: string + channel_id: + type: string + description: MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. + ibc.core.channel.v1.MsgRecvPacket: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet + + with an earlier sequence number must be sent and received before a + Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is incremented + so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + proof_commitment: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + title: MsgRecvPacket receives incoming IBC packet + ibc.core.channel.v1.MsgRecvPacketResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgRecvPacketResponse defines the Msg/RecvPacket response type. + ibc.core.channel.v1.MsgTimeout: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet + + with an earlier sequence number must be sent and received before a + Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is incremented + so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + proof_unreceived: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + title: MsgTimeout receives timed-out packet + ibc.core.channel.v1.MsgTimeoutOnClose: + type: object + properties: + packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a + Packet + + with an earlier sequence number must be sent and received before a + Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is incremented + so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains + through IBC + proof_unreceived: + type: string + format: byte + proof_close: + type: string + format: byte + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + next_sequence_recv: + type: string + format: uint64 + signer: + type: string + description: MsgTimeoutOnClose timed-out packet upon counterparty channel closure. + ibc.core.channel.v1.MsgTimeoutOnCloseResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. + ibc.core.channel.v1.MsgTimeoutResponse: + type: object + properties: + result: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + description: MsgTimeoutResponse defines the Msg/Timeout response type. + ibc.core.channel.v1.Order: + type: string + enum: + - ORDER_NONE_UNSPECIFIED + - ORDER_UNORDERED + - ORDER_ORDERED + default: ORDER_NONE_UNSPECIFIED + description: |- + - ORDER_NONE_UNSPECIFIED: zero-value for channel ordering + - ORDER_UNORDERED: packets can be delivered in any order, which may differ from the order in + which they were sent. + - ORDER_ORDERED: packets are delivered exactly in the order which they were sent + title: Order defines if a channel is ORDERED or UNORDERED + ibc.core.channel.v1.Packet: + type: object + properties: + sequence: + type: string + format: uint64 + description: >- + number corresponds to the order of sends and receives, where a Packet + + with an earlier sequence number must be sent and received before a + Packet + + with a later sequence number. + source_port: + type: string + description: identifies the port on the sending chain. + source_channel: + type: string + description: identifies the channel end on the sending chain. + destination_port: + type: string + description: identifies the port on the receiving chain. + destination_channel: + type: string + description: identifies the channel end on the receiving chain. + data: + type: string + format: byte + title: actual opaque bytes transferred directly to the application module + timeout_height: + title: block height after which the packet times out + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + timeout_timestamp: + type: string + format: uint64 + title: block timestamp (in nanoseconds) after which the packet times out + title: >- + Packet defines a type that carries data across different chains through + IBC + ibc.core.channel.v1.ResponseResultType: + type: string + enum: + - RESPONSE_RESULT_TYPE_UNSPECIFIED + - RESPONSE_RESULT_TYPE_NOOP + - RESPONSE_RESULT_TYPE_SUCCESS + default: RESPONSE_RESULT_TYPE_UNSPECIFIED + description: |- + - RESPONSE_RESULT_TYPE_UNSPECIFIED: Default zero value enumeration + - RESPONSE_RESULT_TYPE_NOOP: The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) + - RESPONSE_RESULT_TYPE_SUCCESS: The message was executed successfully + title: >- + ResponseResultType defines the possible outcomes of the execution of a + message + ibc.core.channel.v1.State: + type: string + enum: + - STATE_UNINITIALIZED_UNSPECIFIED + - STATE_INIT + - STATE_TRYOPEN + - STATE_OPEN + - STATE_CLOSED + default: STATE_UNINITIALIZED_UNSPECIFIED + description: |- + State defines if a channel is in one of the following states: + CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. + + - STATE_UNINITIALIZED_UNSPECIFIED: Default State + - STATE_INIT: A channel has just started the opening handshake. + - STATE_TRYOPEN: A channel has acknowledged the handshake step on the counterparty chain. + - STATE_OPEN: A channel has completed the handshake. Open channels are + ready to send and receive packets. + - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive + packets. + cosmos.upgrade.v1beta1.Plan: + type: object + properties: + name: + type: string + description: >- + Sets the name for the upgrade. This name will be used by the upgraded + + version of the software to apply any special "on-upgrade" commands + during + + the first BeginBlock method after the upgrade is applied. It is also + used + + to detect whether a software version can handle a given upgrade. If no + + upgrade handler with this name has been set in the software, it will + be + + assumed that the software is out-of-date when the upgrade Time or + Height is + + reached and the software will exit. + time: + type: string + format: date-time + description: >- + Deprecated: Time based upgrades have been deprecated. Time based + upgrade logic + + has been removed from the SDK. + + If this field is not empty, an error will be thrown. + height: + type: string + format: int64 + description: The height at which the upgrade must be performed. + info: + type: string + title: |- + Any application specific upgrade info to be included on-chain + such as a git commit that validators could automatically upgrade to + upgraded_client_state: + description: >- + Deprecated: UpgradedClientState field has been deprecated. IBC upgrade + logic has been + + moved to the IBC module in the sub module 02-client. + + If this field is not empty, an error will be thrown. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + Plan specifies information about a planned upgrade and when it should + occur. + ibc.core.client.v1.MsgCreateClient: + type: object + properties: + client_state: + title: light client state + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + consensus_state: + description: |- + consensus state associated with the client that corresponds to a given + height. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: MsgCreateClient defines a message to create an IBC client + ibc.core.client.v1.MsgCreateClientResponse: + type: object + description: MsgCreateClientResponse defines the Msg/CreateClient response type. + ibc.core.client.v1.MsgIBCSoftwareUpgrade: + type: object + properties: + plan: + type: object + properties: + name: + type: string + description: >- + Sets the name for the upgrade. This name will be used by the + upgraded + + version of the software to apply any special "on-upgrade" commands + during + + the first BeginBlock method after the upgrade is applied. It is + also used + + to detect whether a software version can handle a given upgrade. + If no + + upgrade handler with this name has been set in the software, it + will be + + assumed that the software is out-of-date when the upgrade Time or + Height is + + reached and the software will exit. + time: + type: string + format: date-time + description: >- + Deprecated: Time based upgrades have been deprecated. Time based + upgrade logic + + has been removed from the SDK. + + If this field is not empty, an error will be thrown. + height: + type: string + format: int64 + description: The height at which the upgrade must be performed. + info: + type: string + title: >- + Any application specific upgrade info to be included on-chain + + such as a git commit that validators could automatically upgrade + to + upgraded_client_state: + description: >- + Deprecated: UpgradedClientState field has been deprecated. IBC + upgrade logic has been + + moved to the IBC module in the sub module 02-client. + + If this field is not empty, an error will be thrown. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally set + up a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on + the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might + be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + Plan specifies information about a planned upgrade and when it should + occur. + upgraded_client_state: + description: >- + An UpgradedClientState must be provided to perform an IBC breaking + upgrade. + + This will make the chain commit to the correct upgraded (self) client + state + + before the upgrade occurs, so that connecting chains can verify that + the + + new upgraded client is valid by verifying a proof on the previous + version + + of the chain. This will allow IBC connections to persist smoothly + across + + planned chain upgrades. Correspondingly, the UpgradedClientState field + has been + + deprecated in the Cosmos SDK to allow for this logic to exist solely + in + + the 02-client module. + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + signer: + type: string + title: signer address + title: >- + MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of + an IBC client using a v1 governance proposal + ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse: + type: object + description: >- + MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response + type. + ibc.core.client.v1.MsgRecoverClient: + type: object + properties: + subject_client_id: + type: string + title: >- + the client identifier for the client to be updated if the proposal + passes + substitute_client_id: + type: string + title: >- + the substitute client identifier for the client which will replace the + subject + + client + signer: + type: string + title: signer address + description: >- + MsgRecoverClient defines the message used to recover a frozen or expired + client. + ibc.core.client.v1.MsgRecoverClientResponse: + type: object + description: MsgRecoverClientResponse defines the Msg/RecoverClient response type. + ibc.core.client.v1.MsgSubmitMisbehaviour: + type: object + properties: + client_id: + type: string + title: client unique identifier + misbehaviour: + title: misbehaviour used for freezing the light client + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: |- + MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + light client misbehaviour. + This message has been deprecated. Use MsgUpdateClient instead. + ibc.core.client.v1.MsgSubmitMisbehaviourResponse: + type: object + description: |- + MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + type. + ibc.core.client.v1.MsgUpdateClient: + type: object + properties: + client_id: + type: string + title: client unique identifier + client_message: + title: client message to update the light client + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: |- + MsgUpdateClient defines an sdk.Msg to update a IBC client state using + the given client message. + ibc.core.client.v1.MsgUpdateClientResponse: + type: object + description: MsgUpdateClientResponse defines the Msg/UpdateClient response type. + ibc.core.client.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the client parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state types + which can be created + + and interacted with. If a client type is removed from the allowed + clients list, usage + + of this client will be disabled until it is added again to the + list. + description: MsgUpdateParams defines the sdk.Msg type to update the client parameters. + ibc.core.client.v1.MsgUpdateParamsResponse: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + ibc.core.client.v1.MsgUpgradeClient: + type: object + properties: + client_id: + type: string + title: client unique identifier + client_state: + title: upgraded client state + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + consensus_state: + title: >- + upgraded consensus state, only contains enough information to serve as + a + + basis of trust in update logic + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_upgrade_client: + type: string + format: byte + title: proof that old chain committed to new client + proof_upgrade_consensus_state: + type: string + format: byte + title: proof that old chain committed to new consensus state + signer: + type: string + title: signer address + title: >- + MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new + client + + state + ibc.core.client.v1.MsgUpgradeClientResponse: + type: object + description: MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. + ibc.core.client.v1.Params: + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state types which + can be created + + and interacted with. If a client type is removed from the allowed + clients list, usage + + of this client will be disabled until it is added again to the list. + description: Params defines the set of IBC light client parameters. + ibc.core.commitment.v1.MerklePrefix: + type: object + properties: + key_prefix: + type: string + format: byte + title: |- + MerklePrefix is merkle path prefixed to the key. + The constructed key from the Path and the key will be append(Path.KeyPath, + append(Path.KeyPrefix, key...)) + ibc.core.connection.v1.Counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a connection + end. + ibc.core.connection.v1.MsgConnectionOpenAck: + type: object + properties: + connection_id: + type: string + counterparty_connection_id: + type: string + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in + + the connection handshake. + client_state: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + proof_try: + type: string + format: byte + title: |- + proof of the initialization the connection on Chain B: `UNITIALIZED -> + TRYOPEN` + proof_client: + type: string + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. + ibc.core.connection.v1.MsgConnectionOpenAckResponse: + type: object + description: >- + MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response + type. + ibc.core.connection.v1.MsgConnectionOpenConfirm: + type: object + properties: + connection_id: + type: string + proof_ack: + type: string + format: byte + title: >- + proof for the change of the connection state on Chain A: `INIT -> + OPEN` + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + description: |- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of connection state to OPEN on Chain A. + ibc.core.connection.v1.MsgConnectionOpenConfirmResponse: + type: object + description: |- + MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + response type. + ibc.core.connection.v1.MsgConnectionOpenInit: + type: object + properties: + client_id: + type: string + counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in + + the connection handshake. + delay_period: + type: string + format: uint64 + signer: + type: string + description: |- + MsgConnectionOpenInit defines the msg sent by an account on Chain A to + initialize a connection with Chain B. + ibc.core.connection.v1.MsgConnectionOpenInitResponse: + type: object + description: |- + MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + type. + ibc.core.connection.v1.MsgConnectionOpenTry: + type: object + properties: + client_id: + type: string + previous_connection_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hellos are no longer + supported in core IBC. + client_state: + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + delay_period: + type: string + format: uint64 + counterparty_versions: + type: array + items: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in + + the connection handshake. + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + proof_init: + type: string + format: byte + title: |- + proof of the initialization the connection on Chain A: `UNITIALIZED -> + INIT` + proof_client: + type: string + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: + type: string + host_consensus_state_proof: + type: string + format: byte + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + connection on Chain B. + ibc.core.connection.v1.MsgConnectionOpenTryResponse: + type: object + description: >- + MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response + type. + ibc.core.connection.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the connection parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + max_expected_time_per_block: + type: string + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the + + largest amount of time that the chain might reasonably take to + produce the next block under normal operating + + conditions. A safe choice is 3-5x the expected time per block. + description: >- + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + ibc.core.connection.v1.MsgUpdateParamsResponse: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + ibc.core.connection.v1.Params: + type: object + properties: + max_expected_time_per_block: + type: string + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the + + largest amount of time that the chain might reasonably take to produce + the next block under normal operating + + conditions. A safe choice is 3-5x the expected time per block. + description: Params defines the set of Connection parameters. + ibc.core.connection.v1.Version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: |- + Version defines the versioning scheme used to negotiate the IBC verison in + the connection handshake. diff --git a/docs/template/index.tpl b/docs/template/index.tpl new file mode 100644 index 000000000..ec098e82c --- /dev/null +++ b/docs/template/index.tpl @@ -0,0 +1,28 @@ + + + + + {{ .Title }} + + + + +
+ + + + + +Footer +© 2022 GitHub, Inc. +Footer navigation diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..9b6f89653 --- /dev/null +++ b/go.mod @@ -0,0 +1,339 @@ +module github.com/pokt-network/poktroll + +go 1.21.1 + +toolchain go1.21.6 + +replace ( + // fix upstream GHSA-h395-qcrw-5vmq vulnerability. + github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 + // replace broken goleveldb + github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 +) + +require ( + cosmossdk.io/api v0.7.2 + cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/core v0.11.0 + cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/log v1.2.1 + cosmossdk.io/store v1.0.1 + cosmossdk.io/tools/confix v0.1.1 + cosmossdk.io/x/circuit v0.1.0 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/upgrade v0.1.1 + github.com/bufbuild/buf v1.29.0 + github.com/cometbft/cometbft v0.38.2 + github.com/cosmos/cosmos-db v1.0.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-sdk v0.50.2 + github.com/cosmos/gogoproto v1.4.11 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/golang/protobuf v1.5.3 + github.com/gorilla/mux v1.8.1 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 + github.com/spf13/cobra v1.8.0 + github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.17.0 + github.com/stretchr/testify v1.8.4 + google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac + google.golang.org/grpc v1.60.1 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 + google.golang.org/protobuf v1.32.0 +) + +require ( + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1 // indirect + cloud.google.com/go v0.111.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/storage v1.30.1 // indirect + connectrpc.com/connect v1.14.0 // indirect + connectrpc.com/otelconnect v0.7.0 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/errors v1.0.0 // indirect + cosmossdk.io/math v1.2.0 // indirect + cosmossdk.io/x/tx v0.12.0 // indirect + filippo.io/edwards25519 v1.0.0 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect + github.com/99designs/keyring v1.2.1 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/antlr4-go/antlr/v4 v4.13.0 // indirect + github.com/aws/aws-sdk-go v1.44.224 // indirect + github.com/benbjohnson/clock v1.3.5 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect + github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/bufbuild/protocompile v0.8.0 // indirect + github.com/bufbuild/protovalidate-go v0.5.0 // indirect + github.com/bufbuild/protoyaml-go v0.1.7 // indirect + github.com/celestiaorg/go-header v0.4.1 // indirect + github.com/celestiaorg/go-libp2p-messenger v0.2.0 // indirect + github.com/celestiaorg/utils v0.1.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/chzyer/readline v1.5.1 // indirect + github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft-db v0.9.1 // indirect + github.com/containerd/cgroups v1.1.0 // indirect + github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/go-bip39 v1.0.0 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect + github.com/cosmos/iavl v1.0.0 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect + github.com/creachadair/atomicfile v0.3.1 // indirect + github.com/creachadair/tomledit v0.0.24 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // 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/badger/v3 v3.2103.5 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/distribution/reference v0.5.0 // indirect + github.com/docker/cli v24.0.7+incompatible // indirect + github.com/docker/distribution v2.8.3+incompatible // indirect + github.com/docker/docker v25.0.0+incompatible // indirect + github.com/docker/docker-credential-helpers v0.8.1 // indirect + github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/elastic/gosigar v0.14.2 // indirect + github.com/emicklei/dot v1.6.0 // indirect + github.com/fatih/color v1.15.0 // indirect + github.com/felixge/fgprof v0.9.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/flynn/noise v1.0.0 // indirect + github.com/francoispqt/gojay v1.2.13 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/getsentry/sentry-go v0.25.0 // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-chi/chi/v5 v5.0.11 // indirect + github.com/go-kit/kit v0.13.0 // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gofrs/uuid/v5 v5.0.0 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.2.0 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.1.2 // indirect + github.com/google/cel-go v0.19.0 // indirect + github.com/google/flatbuffers v1.12.1 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-containerregistry v0.18.0 // indirect + github.com/google/gopacket v1.1.19 // indirect + github.com/google/orderedcode v0.0.1 // indirect + github.com/google/pprof v0.0.0-20240117000934-35fc243c5815 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/rpc v1.2.1 // indirect + github.com/gorilla/websocket v1.5.1 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect + github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-getter v1.7.3 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect + github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.5.2 // indirect + github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/huandu/skiplist v1.2.0 // indirect + github.com/huin/goupnp v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect + github.com/improbable-eng/grpc-web v0.15.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/ipfs/boxo v0.8.0 // indirect + github.com/ipfs/go-cid v0.4.1 // indirect + github.com/ipfs/go-datastore v0.6.0 // indirect + github.com/ipfs/go-ds-badger3 v0.0.2 // indirect + github.com/ipfs/go-ipfs-util v0.0.2 // indirect + github.com/ipfs/go-log v1.0.5 // indirect + github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/ipld/go-ipld-prime v0.20.0 // indirect + github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect + github.com/jbenet/goprocess v0.1.4 // indirect + github.com/jdx/go-netrc v1.0.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/jmhodges/levigo v1.0.0 // indirect + github.com/klauspost/compress v1.17.4 // indirect + github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/pgzip v1.2.6 // indirect + github.com/koron/go-ssdp v0.0.4 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/lib/pq v1.10.7 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-cidranger v1.1.0 // indirect + github.com/libp2p/go-flow-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.30.0 // indirect + github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect + github.com/libp2p/go-libp2p-kad-dht v0.23.0 // indirect + github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect + github.com/libp2p/go-libp2p-pubsub v0.9.3 // indirect + github.com/libp2p/go-libp2p-record v0.2.0 // indirect + github.com/libp2p/go-msgio v0.3.0 // indirect + github.com/libp2p/go-nat v0.2.0 // indirect + github.com/libp2p/go-netroute v0.2.1 // indirect + github.com/libp2p/go-reuseport v0.4.0 // indirect + github.com/libp2p/go-yamux/v4 v4.0.1 // indirect + github.com/linxGnu/grocksdb v1.8.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/manifoldco/promptui v0.9.0 // indirect + github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect + github.com/miekg/dns v1.1.55 // indirect + github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect + github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect + github.com/minio/highwayhash v1.0.2 // indirect + github.com/minio/sha256-simd v1.0.1 // 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/moby/term v0.5.0 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/mtibben/percent v0.2.1 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multiaddr v0.12.0 // indirect + github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multistream v0.4.1 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/onsi/ginkgo/v2 v2.11.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc5 // indirect + github.com/opencontainers/runtime-spec v1.1.0 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/profile v1.7.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/polydawn/refmt v0.89.0 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/quic-go/qpack v0.4.0 // indirect + github.com/quic-go/qtls-go1-20 v0.3.2 // indirect + github.com/quic-go/quic-go v0.37.6 // indirect + github.com/quic-go/webtransport-go v0.5.3 // indirect + github.com/raulk/go-watchdog v1.3.0 // indirect + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rollkit/go-da v0.0.0-20231207150926-93600f28d67d // indirect + github.com/rollkit/rollkit v0.11.9 // indirect + github.com/rs/cors v1.10.1 // indirect + github.com/rs/zerolog v1.31.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spf13/afero v1.10.0 // indirect + github.com/spf13/cast v1.5.1 // indirect + github.com/stoewer/go-strcase v1.3.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect + github.com/tendermint/go-amino v0.16.0 // indirect + github.com/tendermint/tendermint v0.35.9 // indirect + github.com/tetratelabs/wazero v1.6.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect + github.com/vbatts/tar-split v0.11.5 // indirect + github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // 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/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/sdk v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/dig v1.17.0 // indirect + go.uber.org/fx v1.20.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.26.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/oauth2 v0.13.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.17.0 // indirect + gonum.org/v1/gonum v0.12.0 // indirect + google.golang.org/api v0.149.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect + lukechampine.com/blake3 v1.2.1 // indirect + nhooyr.io/websocket v1.8.7 // indirect + pgregory.net/rapid v1.1.0 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect +) + +replace github.com/cosmos/cosmos-sdk => github.com/bryanchriswhite/cosmos-sdk v0.50.1-fix-sequencer-check diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..1668e73ba --- /dev/null +++ b/go.sum @@ -0,0 +1,3018 @@ +4d63.com/gochecknoglobals v0.1.0/go.mod h1:wfdC5ZjKSPr7CybKEcgJhUOgeAQW1+7WcyK8OvUilfo= +bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1 h1:u0olL4yf2p7Tl5jfsAK5keaFi+JFJuv1CDHrbiXkxkk= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20231115204500-e097f827e652.1/go.mod h1:tiTMKD8j6Pd/D2WzREoweufjzaJKHZg35f/VGcZ2v3I= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.31.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.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.60.0/go.mod h1:yw2G51M9IfRboUH61Us8GqCeF1PzPblB823Mn2q2eAU= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/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.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= +cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= +cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= +cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= +cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= +cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= +cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= +cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= +cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= +cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= +cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= +cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= +cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= +cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= +cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= +cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= +cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= +cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= +cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= +cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= +cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= +cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= +cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= +cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= +cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= +cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= +cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= +cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= +cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= +cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= +cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= +cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= +cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= +cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= +cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= +cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= +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.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= +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/pubsub v1.5.0/go.mod h1:ZEwJccE3z93Z2HWvstpri00jOg7oO4UZDtKhwDwqF0w= +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/spanner v1.7.0/go.mod h1:sd3K2gZ9Fd0vMPLXzeCrF6fq4i63Q7aTLW/lBIfBkIk= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= +cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +connectrpc.com/connect v1.14.0 h1:PDS+J7uoz5Oui2VEOMcfz6Qft7opQM9hPiKvtGC01pA= +connectrpc.com/connect v1.14.0/go.mod h1:uoAq5bmhhn43TwhaKdGKN/bZcGtzPW1v+ngDTn5u+8s= +connectrpc.com/otelconnect v0.7.0 h1:ZH55ZZtcJOTKWWLy3qmL4Pam4RzRWBJFOqTPyAqCXkY= +connectrpc.com/otelconnect v0.7.0/go.mod h1:Bt2ivBymHZHqxvo4HkJ0EwHuUzQN6k2l0oH+mp/8nwc= +contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= +cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= +cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= +cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= +cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/store v1.0.1 h1:XBDhCqlL+2MUgE8CHWwndKVJ4beX+TyaPIjB5SV62dM= +cosmossdk.io/store v1.0.1/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= +cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= +cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= +cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= +cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= +cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= +cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= +cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/x/tx v0.12.0 h1:Ry2btjQdrfrje9qZ3iZeZSmDArjgxUJMMcLMrX4wj5U= +cosmossdk.io/x/tx v0.12.0/go.mod h1:qTth2coAGkwCwOCjqQ8EAQg+9udXNRzcnSbMgGKGEI0= +cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= +cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= +dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= +dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= +dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= +filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= +filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= +github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= +github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= +github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= +github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.0/go.mod h1:n/vLeA7V+QY84iYAGwMkkUUp9ooeuftMEvaDrSVch+Q= +github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +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/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= +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/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= +github.com/alingse/asasalint v0.0.10/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= +github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= +github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= +github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +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.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= +github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= +github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= +github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= +github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= +github.com/bryanchriswhite/cosmos-sdk v0.50.1-fix-sequencer-check h1:F+o3sTVGPa+H0T81ewP+R0IwEiKZ/7yWUgS/uDU2iqM= +github.com/bryanchriswhite/cosmos-sdk v0.50.1-fix-sequencer-check/go.mod h1:XGySaVuQoLe3plWUIm/i51pJIptOIeoQ9s+xF53qVck= +github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= +github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= +github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +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/buf v1.3.1/go.mod h1:CTRUb23N+zlm1U8ZIBKz0Sqluk++qQloB2i/MZNZHIs= +github.com/bufbuild/buf v1.29.0 h1:llP6HqOcCaSGBxOfnrp/mwvcY1O/dciEOl1QaMEOB3M= +github.com/bufbuild/buf v1.29.0/go.mod h1:UTjvPXTObvKQiGqxod32wt9zRz70TJsMpaigpbIZGuc= +github.com/bufbuild/protocompile v0.8.0 h1:9Kp1q6OkS9L4nM3FYbr8vlJnEwtbpDPQlQOVXfR+78s= +github.com/bufbuild/protocompile v0.8.0/go.mod h1:+Etjg4guZoAqzVk2czwEQP12yaxLJ8DxuqCJ9qHdH94= +github.com/bufbuild/protovalidate-go v0.5.0 h1:xFery2RlLh07FQTvB7hlasKqPrDK2ug+uw6DUiuadjo= +github.com/bufbuild/protovalidate-go v0.5.0/go.mod h1:3XAwFeJ2x9sXyPLgkxufH9sts1tQRk8fdt1AW93NiUU= +github.com/bufbuild/protoyaml-go v0.1.7 h1:3uKIoNb/l5zrZ93u+Xzsg6cdAO06lveZE/K7UUbUQLw= +github.com/bufbuild/protoyaml-go v0.1.7/go.mod h1:R8vE2+l49bSiIExP4VJpxOXleHE+FDzZ6HVxr3cYunw= +github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= +github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= +github.com/celestiaorg/go-header v0.4.1 h1:bjbUcKDnhrJJ9EoE7vtPpgleNLVjc2S+cB4/qe8nQmo= +github.com/celestiaorg/go-header v0.4.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= +github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao= +github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo= +github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo= +github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU= +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/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/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/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= +github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4/go.mod h1:W8EnPSQ8Nv4fUjc/v1/8tHFqhuOJXnRub0dTfuAQktU= +github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= +github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= +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/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= +github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= +github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb h1:6Po+YYKT5B5ZXN0wd2rwFBaebM0LufPf8p4zxOd48Kg= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb/go.mod h1:acMRUGd/BK8AUmQNK3spUCCGzFLZU2bSST3NMXSq2Kc= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/cometbft/cometbft v0.38.2 h1:io0JCh5EPxINKN5ZMI5hCdpW3QVZRy+o8qWe3mlJa/8= +github.com/cometbft/cometbft v0.38.2/go.mod h1:PIi48BpzwlHqtV3mzwPyQgOyOnU94BNBimLS2ebBHOg= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= +github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= +github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= +github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= +github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/stargz-snapshotter/estargz v0.15.1 h1:eXJjw9RbkLFgioVaTG+G/ZW/0kEe2oEKCdS/ZxIyoCU= +github.com/containerd/stargz-snapshotter/estargz v0.15.1/go.mod h1:gr2RNwukQ/S9Nv33Lt6UC7xEx58C+LHRdoqbEKjz1Kk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +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/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= +github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= +github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= +github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= +github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= +github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= +github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= +github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= +github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= +github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= +github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/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/atomicfile v0.2.6/go.mod h1:BRq8Une6ckFneYXZQ+kO7p1ZZP3I2fzVzf28JxrIkBc= +github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= +github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= +github.com/creachadair/command v0.0.0-20220426235536-a748effdf6a1/go.mod h1:bAM+qFQb/KwWyCc9MLC4U1jvn3XyakqP5QRkds5T6cY= +github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= +github.com/creachadair/tomledit v0.0.22/go.mod h1:cIu/4x5L855oSRejIqr+WRFh+mv9g4fWLiUFaApYn/Y= +github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= +github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/daixiang0/gci v0.4.2/go.mod h1:d0f+IJhr9loBtIq+ebwhRoTt1LGbPH96ih8bKlsRT9E= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= +github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= +github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= +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.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= +github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= +github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= +github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= +github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= +github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= +github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= +github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v25.0.0+incompatible h1:g9b6wZTblhMgzOT2tspESstfw6ySZ9kdm94BLDKaZac= +github.com/docker/docker v25.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= +github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= +github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= +github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= +github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= +github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= +github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= +github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= +github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= +github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= +github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= +github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= +github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-critic/go-critic v0.6.3/go.mod h1:c6b3ZP1MQ7o6lPR7Rv3lEf7pYQUmAcx8ABHgdZCQt/k= +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= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= +github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= +github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= +github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astequal v1.0.1/go.mod h1:4oGA3EZXTVItV/ipGiOx7NWkY5veFfcsOJVS2YxltLw= +github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= +github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= +github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= +github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= +github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= +github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +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/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +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.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= +github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= +github.com/golangci/golangci-lint v1.47.0/go.mod h1:3TZhfF5KolbIkXYjUFvER6G9CoxzLEaafr/u/QI1S5A= +github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= +github.com/golangci/misspell v0.3.5/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= +github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2/go.mod h1:LK+zW4MpyytAWQRz0M4xnzEk50lSvqDQKfx304apFkY= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/cel-go v0.19.0 h1:vVgaZoHPBDd1lXCYGQOh5A06L4EtuIfmqQ/qnSXSKiU= +github.com/google/cel-go v0.19.0/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= +github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= +github.com/google/certificate-transparency-go v1.1.1/go.mod h1:FDKqPvSXawb2ecErVRrD+nfy23RCzyl7eqVCEmlT1Zs= +github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= +github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-containerregistry v0.18.0 h1:ShE7erKNPqRh5ue6Z9DUOlk04WsnFWPO6YGr3OxnfoQ= +github.com/google/go-containerregistry v0.18.0/go.mod h1:u0qB2l7mvtWVR5kNcbFIhFY1hLbf8eeGapA+vbFDCtQ= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= +github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +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-20200507031123-427632fa3b1c/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-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/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= +github.com/google/pprof v0.0.0-20240117000934-35fc243c5815 h1:WzfWbQz/Ze8v6l++GGbGNFZnUShVpP/0xffCPLL+ax8= +github.com/google/pprof v0.0.0-20240117000934-35fc243c5815/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +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/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/trillian v1.3.11/go.mod h1:0tPraVHrSDkA3BO6vKX67zgLXs6SsOAbHEivX+9mPgw= +github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +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.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.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.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= +github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= +github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= +github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k= +github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptRfGk= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= +github.com/gostaticanalysis/analysisutil v0.4.1/go.mod h1:18U/DLpRgIUd459wGxVHE0fRgmo1UgHDcbw7F5idXu0= +github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= +github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= +github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= +github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= +github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= +github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= +github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= +github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +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/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.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= +github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= +github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= +github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.2 h1:ErEYO2f//CjKsUDw4SmLzelsK6L3ZmOAR/4P9iS7ruY= +github.com/hashicorp/go-metrics v0.5.2/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvHgwfx2Vm4= +github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= +github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +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/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= +github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= +github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= +github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= +github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/ipfs/boxo v0.8.0 h1:UdjAJmHzQHo/j3g3b1bAcAXCj/GM6iTwvSlBDvPBNBs= +github.com/ipfs/boxo v0.8.0/go.mod h1:RIsi4CnTyQ7AUsNn5gXljJYZlQrHBMnJp94p73liFiA= +github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= +github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= +github.com/ipfs/go-cid v0.1.0/go.mod h1:rH5/Xv83Rfy8Rw6xG+id3DYAMUVmem1MowoKwdXmN2o= +github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= +github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= +github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= +github.com/ipfs/go-datastore v0.5.1/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= +github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= +github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= +github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= +github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= +github.com/ipfs/go-ds-badger v0.3.0/go.mod h1:1ke6mXNqeV8K3y5Ak2bAA0osoTfmxUdupVCGm4QUIek= +github.com/ipfs/go-ds-badger3 v0.0.2 h1:+pME0YfRnbUKhvySnakNMuCMsUUhmGfwIsH/nnHZ7QY= +github.com/ipfs/go-ds-badger3 v0.0.2/go.mod h1:6/yjF1KaOU+IpCaqMV43yoWIdxHqOAJlO9EhWLnZSkI= +github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q= +github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= +github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= +github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= +github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= +github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs= +github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= +github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= +github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= +github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= +github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM= +github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= +github.com/ipfs/go-log/v2 v2.3.0/go.mod h1:QqGoj30OTpnKaG/LKTGTxoP2mmQtjVMEnK72gynbe/g= +github.com/ipfs/go-log/v2 v2.5.0/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= +github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= +github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= +github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= +github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= +github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= +github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= +github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= +github.com/jdx/go-netrc v1.0.0 h1:QbLMLyCZGj0NA8glAhxUpf1zDg6cxnWgMBbjq40W0gQ= +github.com/jdx/go-netrc v1.0.0/go.mod h1:Gh9eFQJnoTNIRHXl2j5bJXA1u84hQWJWgGh569zF3v8= +github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= +github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +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/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= +github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f/go.mod h1:qr2b5kx4HbFS7/g4uYO5qv9ei8303JMsC7ESbYiqr2Q= +github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= +github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= +github.com/jhump/protoreflect v1.15.4 h1:mrwJhfQGGljwvR/jPEocli8KA6G9afbQpH8NY2wORcI= +github.com/jhump/protoreflect v1.15.4/go.mod h1:2B+zwrnMY3TTIqEK01OG/d3pyUycQBfDf+bx8fE2DNg= +github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= +github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= +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/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/errcheck v1.6.1/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= +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.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.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= +github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= +github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= +github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= +github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= +github.com/koron/go-ssdp v0.0.2/go.mod h1:XoLfkAiA2KeZsYh4DbHxD7h3nR2AZNqVQOa+LJuqPYs= +github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= +github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= +github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= +github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= +github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= +github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= +github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= +github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/libp2p/go-addr-util v0.1.0/go.mod h1:6I3ZYuFr2O/9D+SoyM0zEw0EF3YkldtTX406BpdQMqw= +github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +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/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= +github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= +github.com/libp2p/go-conn-security-multistream v0.3.0/go.mod h1:EEP47t4fw/bTelVmEzIDqSe69hO/ip52xBEhZMLWAHM= +github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= +github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= +github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= +github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= +github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= +github.com/libp2p/go-libp2p v0.19.0/go.mod h1:Ki9jJXLO2YqrTIFxofV7Twyd3INWPT97+r8hGt7XPjI= +github.com/libp2p/go-libp2p v0.30.0 h1:9EZwFtJPFBcs/yJTnP90TpN1hgrT/EsFfM+OZuwV87U= +github.com/libp2p/go-libp2p v0.30.0/go.mod h1:nr2g5V7lfftwgiJ78/HrID+pwvayLyqKCEirT2Y3Byg= +github.com/libp2p/go-libp2p-asn-util v0.1.0/go.mod h1:wu+AnM9Ii2KgO5jMmS1rz9dvzTdj8BXqsPR9HR0XB7I= +github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= +github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= +github.com/libp2p/go-libp2p-blankhost v0.2.0/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ= +github.com/libp2p/go-libp2p-blankhost v0.3.0/go.mod h1:urPC+7U01nCGgJ3ZsV8jdwTp6Ji9ID0dMTvq+aJ+nZU= +github.com/libp2p/go-libp2p-circuit v0.6.0/go.mod h1:kB8hY+zCpMeScyvFrKrGicRdid6vNXbunKE4rXATZ0M= +github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= +github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw= +github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= +github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= +github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= +github.com/libp2p/go-libp2p-core v0.6.0/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= +github.com/libp2p/go-libp2p-core v0.8.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= +github.com/libp2p/go-libp2p-core v0.8.6/go.mod h1:dgHr0l0hIKfWpGpqAMbpo19pen9wJfdCGv51mTmdpmM= +github.com/libp2p/go-libp2p-core v0.10.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQRAMf0sX9mf2sbGg= +github.com/libp2p/go-libp2p-core v0.11.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQRAMf0sX9mf2sbGg= +github.com/libp2p/go-libp2p-core v0.12.0/go.mod h1:ECdxehoYosLYHgDDFa2N4yE8Y7aQRAMf0sX9mf2sbGg= +github.com/libp2p/go-libp2p-core v0.14.0/go.mod h1:tLasfcVdTXnixsLB0QYaT1syJOhsbrhG7q6pGrHtBg8= +github.com/libp2p/go-libp2p-core v0.15.1/go.mod h1:agSaboYM4hzB1cWekgVReqV5M4g5M+2eNNejV+1EEhs= +github.com/libp2p/go-libp2p-kad-dht v0.23.0 h1:sxE6LxLopp79eLeV695n7+c77V/Vn4AMF28AdM/XFqM= +github.com/libp2p/go-libp2p-kad-dht v0.23.0/go.mod h1:oO5N308VT2msnQI6qi5M61wzPmJYg7Tr9e16m5n7uDU= +github.com/libp2p/go-libp2p-kbucket v0.5.0 h1:g/7tVm8ACHDxH29BGrpsQlnNeu+6OF1A9bno/4/U1oA= +github.com/libp2p/go-libp2p-kbucket v0.5.0/go.mod h1:zGzGCpQd78b5BNTDGHNDLaTt9aDK/A02xeZp9QeFC4U= +github.com/libp2p/go-libp2p-mplex v0.4.1/go.mod h1:cmy+3GfqfM1PceHTLL7zQzAAYaryDu6iPSC+CIb094g= +github.com/libp2p/go-libp2p-mplex v0.5.0/go.mod h1:eLImPJLkj3iG5t5lq68w3Vm5NAQ5BcKwrrb2VmOYb3M= +github.com/libp2p/go-libp2p-nat v0.1.0/go.mod h1:DQzAG+QbDYjN1/C3B6vXucLtz3u9rEonLVPtZVzQqks= +github.com/libp2p/go-libp2p-noise v0.4.0/go.mod h1:BzzY5pyzCYSyJbQy9oD8z5oP2idsafjt4/X42h9DjZU= +github.com/libp2p/go-libp2p-peerstore v0.4.0/go.mod h1:rDJUFyzEWPpXpEwywkcTYYzDHlwza8riYMaUzaN6hX0= +github.com/libp2p/go-libp2p-peerstore v0.6.0/go.mod h1:DGEmKdXrcYpK9Jha3sS7MhqYdInxJy84bIPtSu65bKc= +github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= +github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= +github.com/libp2p/go-libp2p-pubsub v0.9.3/go.mod h1:RYA7aM9jIic5VV47WXu4GkcRxRhrdElWf8xtyli+Dzc= +github.com/libp2p/go-libp2p-quic-transport v0.13.0/go.mod h1:39/ZWJ1TW/jx1iFkKzzUg00W6tDJh73FC0xYudjr7Hc= +github.com/libp2p/go-libp2p-quic-transport v0.16.0/go.mod h1:1BXjVMzr+w7EkPfiHkKnwsWjPjtfaNT0q8RS3tGDvEQ= +github.com/libp2p/go-libp2p-quic-transport v0.17.0/go.mod h1:x4pw61P3/GRCcSLypcQJE/Q2+E9f4X+5aRcZLXf20LM= +github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= +github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= +github.com/libp2p/go-libp2p-resource-manager v0.2.1/go.mod h1:K+eCkiapf+ey/LADO4TaMpMTP9/Qde/uLlrnRqV4PLQ= +github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL0L1lXUZ5ot2Fvc= +github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA= +github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= +github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= +github.com/libp2p/go-libp2p-testing v0.1.2-0.20200422005655-8775583591d8/go.mod h1:Qy8sAncLKpwXtS2dSnDOP8ktexIAHKu+J+pnZOFZLTc= +github.com/libp2p/go-libp2p-testing v0.4.0/go.mod h1:Q+PFXYoiYFN5CAEG2w3gLPEzotlKsNSbKQ/lImlOWF0= +github.com/libp2p/go-libp2p-testing v0.5.0/go.mod h1:QBk8fqIL1XNcno/l3/hhaIEn4aLRijpYOR+zVjjlh+A= +github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2Cl+FAjoWIA2pa0X6E= +github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= +github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= +github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= +github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= +github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= +github.com/libp2p/go-libp2p-transport-upgrader v0.7.0/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= +github.com/libp2p/go-libp2p-transport-upgrader v0.7.1/go.mod h1:GIR2aTRp1J5yjVlkUoFqMkdobfob6RnAwYg/RZPhrzg= +github.com/libp2p/go-libp2p-yamux v0.5.0/go.mod h1:AyR8k5EzyM2QN9Bbdg6X1SkVVuqLwTGf0L4DFq9g6po= +github.com/libp2p/go-libp2p-yamux v0.8.0/go.mod h1:yTkPgN2ib8FHyU1ZcVD7aelzyAqXXwEPbyx+aSKm9h8= +github.com/libp2p/go-libp2p-yamux v0.8.1/go.mod h1:rUozF8Jah2dL9LLGyBaBeTQeARdwhefMCTQVQt6QobE= +github.com/libp2p/go-libp2p-yamux v0.9.1/go.mod h1:wRc6wvyxQINFcKe7daL4BeQ02Iyp+wxyC8WCNfngBrA= +github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= +github.com/libp2p/go-mplex v0.3.0/go.mod h1:0Oy/A9PQlwBytDRp4wSkFnzHYDKcpLot35JQ6msjvYQ= +github.com/libp2p/go-mplex v0.4.0/go.mod h1:y26Lx+wNVtMYMaPu300Cbot5LkEZ4tJaNYeHeT9dh6E= +github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= +github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA= +github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= +github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= +github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk= +github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk= +github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= +github.com/libp2p/go-netroute v0.1.3/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= +github.com/libp2p/go-netroute v0.1.5/go.mod h1:V1SR3AaECRkEQCoFFzYwVYWvYIEtlxx89+O3qcpCl4A= +github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= +github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= +github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= +github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= +github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= +github.com/libp2p/go-openssl v0.0.7/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= +github.com/libp2p/go-reuseport v0.1.0/go.mod h1:bQVn9hmfcTaoo0c9v5pBhOarsU1eNOBZdaAd2hzXRKU= +github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s= +github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= +github.com/libp2p/go-reuseport-transport v0.1.0/go.mod h1:vev0C0uMkzriDY59yFHD9v+ujJvYmDQVLowvAjEOmfw= +github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= +github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= +github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA= +github.com/libp2p/go-stream-muxer-multistream v0.4.0/go.mod h1:nb+dGViZleRP4XcyHuZSVrJCBl55nRBOMmiSL/dyziw= +github.com/libp2p/go-tcp-transport v0.4.0/go.mod h1:0y52Rwrn4076xdJYu/51/qJIdxz+EWDAOG2S45sV3VI= +github.com/libp2p/go-tcp-transport v0.5.0/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= +github.com/libp2p/go-tcp-transport v0.5.1/go.mod h1:UPPL0DIjQqiWRwVAb+CEQlaAG0rp/mCqJfIhFcLHc4Y= +github.com/libp2p/go-ws-transport v0.6.0/go.mod h1:dXqtI9e2JV9FtF1NOtWVZSKXh5zXvnuwPXfj8GPBbYU= +github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= +github.com/libp2p/go-yamux/v3 v3.0.1/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= +github.com/libp2p/go-yamux/v3 v3.0.2/go.mod h1:s2LsDhHbh+RfCsQoICSYt58U2f8ijtPANFD8BmE74Bo= +github.com/libp2p/go-yamux/v3 v3.1.1/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= +github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= +github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= +github.com/libp2p/zeroconf/v2 v2.1.1/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/linxGnu/grocksdb v1.8.6 h1:O7I6SIGPrypf3f/gmrrLUBQDKfO8uOoYdWf4gLS06tc= +github.com/linxGnu/grocksdb v1.8.6/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +github.com/lucas-clemente/quic-go v0.23.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= +github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= +github.com/lucas-clemente/quic-go v0.27.0/go.mod h1:AzgQoPda7N+3IqMMMkywBKggIFo2KT6pfnlrQ2QieeI= +github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +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-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/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/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= +github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= +github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= +github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= +github.com/marten-seemann/qtls-go1-17 v0.1.1/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= +github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= +github.com/marten-seemann/qtls-go1-18 v0.1.1/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= +github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= +github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= +github.com/mgechev/revive v1.2.1/go.mod h1:+Ro3wqY4vakcYNtkBWdZC7dBg1xSB6sp054wWwmeFm0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= +github.com/miekg/dns v1.1.48/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= +github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= +github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= +github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= +github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= +github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +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-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= +github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= +github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= +github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mroth/weightedrand v0.4.1/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= +github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= +github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= +github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= +github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= +github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= +github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI= +github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc= +github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0= +github.com/multiformats/go-multiaddr v0.4.0/go.mod h1:YcpyLH8ZPudLxQlemYBPhSm0/oCXAT8Z4mzFpyoPyRc= +github.com/multiformats/go-multiaddr v0.4.1/go.mod h1:3afI9HfVW8csiF8UZqtpYRiDyew8pRX7qLIGHu9FLuM= +github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar+bR+gh4zgbfr3SNug= +github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= +github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= +github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= +github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= +github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= +github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= +github.com/multiformats/go-multiaddr-net v0.2.0/go.mod h1:gGdH3UXny6U3cKKYCvpXI5rnK7YaOIEOPVDI9tsJbEA= +github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= +github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.4.1/go.mod h1:1Hj/eHRaVWSXiSNNfcEPcwZleTmdNP81xlxDLnWU9GQ= +github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= +github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= +github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= +github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= +github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= +github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= +github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= +github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38= +github.com/multiformats/go-multistream v0.2.1/go.mod h1:5GZPQZbkWOLOn3J2y4Y99vVW7vOfsAflxARk3x14o6k= +github.com/multiformats/go-multistream v0.3.0/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= +github.com/multiformats/go-multistream v0.3.1/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= +github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= +github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= +github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= +github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= +github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= +github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.3/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats-server/v2 v2.5.0/go.mod h1:Kj86UtrXAL6LwYRA6H4RqzkHhK0Vcv2ZnKD5WbQ1t3g= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nats.go v1.12.1/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nishanths/exhaustive v0.8.1/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= +github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= +github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20210609091139-0a56a4bca00b/go.mod h1:TLJifjWF6eotcfzDjKZsDqWJ+73Uvj/N85MvVyrvynM= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/oklog/ulid/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.2/go.mod h1:rSAaSIOAGT9odnlyGlUfAJaoc5w2fSBUmeGDbRWPxyQ= +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.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +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/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= +github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= +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.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= +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.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +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.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= +github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= +github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= +github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= +github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= +github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= +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= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18= +github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= +github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= +github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= +github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= +github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/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= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.33.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +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.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= +github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= +github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= +github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a/go.mod h1:VMX+OnnSw4LicdiEGtRSD/1X8kW7GuEscjYNr4cOIT4= +github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.16/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= +github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= +github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= +github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= +github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= +github.com/quic-go/qtls-go1-20 v0.3.2 h1:rRgN3WfnKbyik4dBV8A6girlJVxGand/d+jVKbQq5GI= +github.com/quic-go/qtls-go1-20 v0.3.2/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= +github.com/quic-go/quic-go v0.37.6 h1:2IIUmQzT5YNxAiaPGjs++Z4hGOtIR0q79uS5qE9ccfY= +github.com/quic-go/quic-go v0.37.6/go.mod h1:YsbH1r4mSHPJcLF4k4zruUkLBqctEMBDR6VPvcYjIsU= +github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= +github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= +github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0= +github.com/raulk/go-watchdog v1.2.0/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI= +github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= +github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/remyoudompheng/go-dbus v0.0.0-20121104212943-b7232d34b1d5/go.mod h1:+u151txRmLpwxBmpYn9z3d1sdJdjRPQpsXuYeY9jNls= +github.com/remyoudompheng/go-liblzma v0.0.0-20190506200333-81bf2d431b96/go.mod h1:90HvCY7+oHHUKkbeMCiHt1WuFR2/hPJ9QrljDG+v6ls= +github.com/remyoudompheng/go-misc v0.0.0-20190427085024-2d6ac652a50e/go.mod h1:80FQABjoFzZ2M5uEa6FUaJYEmqU2UOKojlFVak1UAwI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +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.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rollkit/go-da v0.0.0-20231207150926-93600f28d67d h1:VeAbAkj+1+9OMc80BMIt7TokIAJudJrqI/59gTpMeuI= +github.com/rollkit/go-da v0.0.0-20231207150926-93600f28d67d/go.mod h1:cy1LA9kCyCJHgszKkTh9hJn816l5Oa87GMA2c1imfqA= +github.com/rollkit/rollkit v0.11.9 h1:2EY0A1jblAfP51qBDFcWL3PSmIDPwL8HMIQ7AEqUx+A= +github.com/rollkit/rollkit v0.11.9/go.mod h1:SoME6mBxh/aUbCddVAGJ8YsyIZtoD7W4Nhevp94R2Zs= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= +github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryancurrah/gomodguard v1.2.3/go.mod h1:rYbA/4Tg5c54mV1sv4sQTP5WOPBcoLtnBZ7/TEhXAbg= +github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= +github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= +github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= +github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/securego/gosec/v2 v2.12.0/go.mod h1:iTpT+eKTw59bSgklBHlSnH5O2tNygHMDxfvMubA4i7I= +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/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= +github.com/shirou/gopsutil/v3 v3.22.6/go.mod h1:EdIubSnZhbAvBS1yJ7Xi+AShB/hxwLHOMz4MCYz7yMs= +github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= +github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= +github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= +github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= +github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= +github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= +github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= +github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= +github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= +github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +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.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= +github.com/sivchari/nosnakecase v1.5.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= +github.com/sivchari/tenv v1.6.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= +github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= +github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= +github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= +github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= +github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= +github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= +github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= +github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= +github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= +github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= +github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= +github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +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/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= +github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tendermint/tendermint v0.35.9 h1:yUEgfkcNHWSidsU8wHjRDbYPVijV4cHxCclKVITGRAQ= +github.com/tendermint/tendermint v0.35.9/go.mod h1:FYvzUDkmVv1awfFl9V85yl5NKyjxz6XLZGX132+ftAY= +github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= +github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= +github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= +github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= +github.com/tetratelabs/wazero v1.6.0 h1:z0H1iikCdP8t+q341xqepY4EWvHEw8Es7tlqiVzlP3g= +github.com/tetratelabs/wazero v1.6.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= +github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= +github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= +github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tomarrell/wrapcheck/v2 v2.6.2/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= +github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= +github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +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/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= +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 v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.30.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= +github.com/valyala/quicktemplate v1.7.0/go.mod h1:sqKJnoaOF88V07vkO+9FL8fb9uZg/VPSJnLYn+LmLk8= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= +github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= +github.com/vektra/mockery/v2 v2.14.0/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M= +github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= +github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= +github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= +github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= +github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= +github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= +github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= +github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= +github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= +github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/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/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= +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.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= +gitlab.com/bosi/decorder v0.2.2/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +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.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= +go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= +go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= +go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= +go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/sdk/metric v1.19.0 h1:EJoTO5qysMsYCa+w4UghwFV/ptQgqSL/8Ni+hx+8i1k= +go.opentelemetry.io/otel/sdk/metric v1.19.0/go.mod h1:XjG0jQyFJrv2PbMvwND7LwCEhsJzCzV5210euduKcKY= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +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.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= +go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= +go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= +go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= +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.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/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= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= +golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +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-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/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-20190313220215-9f648a60d977/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-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +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-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-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.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/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.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/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-20220513210516-0976fa681c29/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.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191206220618-eeba5f6aabab/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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-20200602225109-6fdc65e7d980/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-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-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-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210317225723-c4fcb01b228e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/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-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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-20210616045830-e2b7044e8c71/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-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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-20220319134239-a9b59b0215f8/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-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/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-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.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.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.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.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +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= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-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-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/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-20190228203856-589c23e65e65/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/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-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190916130336-e45ffcd953cc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/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-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +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-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200630154851-b2d8b0336632/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200706234117-b22de6825cf7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201028025901-8cd080b735b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +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-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= +golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= +golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +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.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= +gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.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.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= +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.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= +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.3.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.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +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-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200626011028-ee7919e894b5/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200707001353-8e8330bf89df/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-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-20220519153652-3a47de7e79bd/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-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= +google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac h1:OZkkudMUu9LVQMCoRUbI/1p5VCo9BOrlvkqMvWtqa6s= +google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= +google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +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.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +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.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +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.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +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.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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/cheggaaa/pb.v1 v1.0.28/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/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.6/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/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= +gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.6/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/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.0/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/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= +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.3.2/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= +lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= +mvdan.cc/gofumpt v0.3.1/go.mod h1:w3ymliuxvzVx8DAutBnVyDqYb1Niy/yCJt/lk821YCE= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= +mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5/go.mod h1:b8RRCBm0eeiWR8cfN88xeq2G5SG3VKGO+5UPWi5FSOY= +nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= +nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +pgregory.net/rapid v0.4.8/go.mod h1:Z5PbWqjvWR1I3UGjvboUuan4fe4ZYEYNLNQLExzCoUs= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/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= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.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= +sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/proto/buf.gen.gogo.yaml b/proto/buf.gen.gogo.yaml new file mode 100644 index 000000000..8d2c14601 --- /dev/null +++ b/proto/buf.gen.gogo.yaml @@ -0,0 +1,18 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.gogo.yaml +# +version: v1 +plugins: + - name: gocosmos + out: . + opt: + - plugins=grpc + - Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types + - Mcosmos/orm/v1/orm.proto=cosmossdk.io/orm + - name: grpc-gateway + out: . + opt: + - logtostderr=true + - allow_colon_final_segments=true diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml new file mode 100644 index 000000000..e8fffdb28 --- /dev/null +++ b/proto/buf.gen.pulsar.yaml @@ -0,0 +1,22 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.pulsar.yaml +# +version: v1 +managed: + enabled: true + go_package_prefix: + default: cosmossdk.io/api + except: + - buf.build/googleapis/googleapis + - buf.build/cosmos/gogo-proto + - buf.build/cosmos/cosmos-proto + override: +plugins: + - name: go-pulsar + out: ./api + opt: paths=source_relative + - name: go-grpc + out: ./api + opt: paths=source_relative diff --git a/proto/buf.gen.sta.yaml b/proto/buf.gen.sta.yaml new file mode 100644 index 000000000..4444f5e75 --- /dev/null +++ b/proto/buf.gen.sta.yaml @@ -0,0 +1,15 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.sta.yaml +# +version: v1 +plugins: + - name: openapiv2 + out: . + opt: + - logtostderr=true + - openapi_naming_strategy=simple + - ignore_comments=true + - simple_operation_ids=false + - json_names_for_fields=false diff --git a/proto/buf.gen.swagger.yaml b/proto/buf.gen.swagger.yaml new file mode 100644 index 000000000..58d30d86e --- /dev/null +++ b/proto/buf.gen.swagger.yaml @@ -0,0 +1,14 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.swagger.yaml +# +version: v1 +plugins: + - name: openapiv2 + out: . + opt: + - logtostderr=true + - openapi_naming_strategy=fqn + - json_names_for_fields=false + - generate_unbound_methods=true \ No newline at end of file diff --git a/proto/buf.gen.ts.yaml b/proto/buf.gen.ts.yaml new file mode 100644 index 000000000..c484fb3ad --- /dev/null +++ b/proto/buf.gen.ts.yaml @@ -0,0 +1,18 @@ +# This file is auto-generated from Ignite. You can edit +# the file content but do not change the file name or path. +# +# buf.gen.ts.yaml +# +version: v1 +managed: + enabled: true +plugins: + - plugin: buf.build/community/stephenh-ts-proto + out: . + opt: + - logtostderr=true + - allow_merge=true + - json_names_for_fields=false + - ts_proto_opt=snakeToCamel=true + - ts_proto_opt=esModuleInterop=true + - ts_proto_out=. diff --git a/proto/buf.lock b/proto/buf.lock new file mode 100644 index 000000000..bbe57edd9 --- /dev/null +++ b/proto/buf.lock @@ -0,0 +1,35 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: aa25660f4ff746388669ce36b3778442 + digest: shake256:a20eb29eb7284d9d0b76e94324a6e24e3665d13682bed0d5beac647d7109b7b2f22080301276779a91f394c97dab334da36dfc01d4252d9f869b090bfc8248aa + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 + - remote: buf.build + owner: cosmos + repository: ibc + commit: 30c7be3837b0465bb385ac55e8130c85 + digest: shake256:915c16dc31b3acb6ee7c8bfdc09c70db3ae1b58ecd5b2c9eae1fc1dff3957ce46e2147eb7898caf8a8ab3ed789c55a1bf88c4722bd84c50f1ed6dfebaef41fa3 + - remote: buf.build + owner: cosmos + repository: ics23 + commit: 3c44d8daa8b44059ac744cd17d4a49d7 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 75b4300737fb4efca0831636be94e517 + - remote: buf.build + owner: protocolbuffers + repository: wellknowntypes + commit: 44e83bc050a4497fa7b36b34d95ca156 diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 000000000..bc581b15e --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,25 @@ +breaking: + use: + - FILE +deps: +- buf.build/protocolbuffers/wellknowntypes +- buf.build/cosmos/cosmos-sdk +- buf.build/cosmos/cosmos-proto +- buf.build/cosmos/gogo-proto +- buf.build/googleapis/googleapis +- buf.build/cosmos/ics23 +- buf.build/cosmos/ibc +lint: + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + ignore: + - tendermint + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE +version: v1 diff --git a/testutil/network/network.go b/testutil/network/network.go new file mode 100644 index 000000000..103480318 --- /dev/null +++ b/testutil/network/network.go @@ -0,0 +1,80 @@ +package network + +import ( + "fmt" + "testing" + + "github.com/cosmos/cosmos-sdk/testutil/network" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app" +) + +type ( + Network = network.Network + Config = network.Config +) + +// New creates instance with fully configured cosmos network. +// Accepts optional config, that will be used in place of the DefaultConfig() if provided. +func New(t *testing.T, configs ...Config) *Network { + t.Helper() + if len(configs) > 1 { + panic("at most one config should be provided") + } + var cfg network.Config + if len(configs) == 0 { + cfg = DefaultConfig() + } else { + cfg = configs[0] + } + net, err := network.New(t, t.TempDir(), cfg) + require.NoError(t, err) + _, err = net.WaitForHeight(1) + require.NoError(t, err) + t.Cleanup(net.Cleanup) + return net +} + +// DefaultConfig will initialize config for the network with custom application, +// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig +func DefaultConfig() network.Config { + cfg, err := network.DefaultConfigWithAppConfig(app.AppConfig()) + if err != nil { + panic(err) + } + ports, err := freePorts(3) + if err != nil { + panic(err) + } + if cfg.APIAddress == "" { + cfg.APIAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[0]) + } + if cfg.RPCAddress == "" { + cfg.RPCAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[1]) + } + if cfg.GRPCAddress == "" { + cfg.GRPCAddress = fmt.Sprintf("0.0.0.0:%s", ports[2]) + } + return cfg +} + +// freePorts return the available ports based on the number of requested ports. +func freePorts(n int) ([]string, error) { + closeFns := make([]func() error, n) + ports := make([]string, n) + for i := 0; i < n; i++ { + _, port, closeFn, err := network.FreeTCPAddr() + if err != nil { + return nil, err + } + ports[i] = port + closeFns[i] = closeFn + } + for _, closeFn := range closeFns { + if err := closeFn(); err != nil { + return nil, err + } + } + return ports, nil +} diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go new file mode 100644 index 000000000..3b968c09c --- /dev/null +++ b/testutil/nullify/nullify.go @@ -0,0 +1,57 @@ +// Package nullify provides methods to init nil values structs for test assertion. +package nullify + +import ( + "reflect" + "unsafe" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + coinType = reflect.TypeOf(sdk.Coin{}) + coinsType = reflect.TypeOf(sdk.Coins{}) +) + +// Fill analyze all struct fields and slices with +// reflection and initialize the nil and empty slices, +// structs, and pointers. +func Fill(x interface{}) interface{} { + v := reflect.Indirect(reflect.ValueOf(x)) + switch v.Kind() { + case reflect.Slice: + for i := 0; i < v.Len(); i++ { + obj := v.Index(i) + objPt := reflect.NewAt(obj.Type(), unsafe.Pointer(obj.UnsafeAddr())).Interface() + objPt = Fill(objPt) + obj.Set(reflect.ValueOf(objPt)) + } + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + f := reflect.Indirect(v.Field(i)) + if !f.CanSet() { + continue + } + switch f.Kind() { + case reflect.Slice: + f.Set(reflect.MakeSlice(f.Type(), 0, 0)) + case reflect.Struct: + switch f.Type() { + case coinType: + coin := reflect.New(coinType).Interface() + s := reflect.ValueOf(coin).Elem() + f.Set(s) + case coinsType: + coins := reflect.New(coinsType).Interface() + s := reflect.ValueOf(coins).Elem() + f.Set(s) + default: + objPt := reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Interface() + s := Fill(objPt) + f.Set(reflect.ValueOf(s)) + } + } + } + } + return reflect.Indirect(v).Interface() +} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go new file mode 100644 index 000000000..98f2153ed --- /dev/null +++ b/testutil/sample/sample.go @@ -0,0 +1,13 @@ +package sample + +import ( + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccAddress returns a sample account address +func AccAddress() string { + pk := ed25519.GenPrivKey().PubKey() + addr := pk.Address() + return sdk.AccAddress(addr).String() +} From c9ba62cf9fa563d8ab6d5fc35f156787127b7bca Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 2 Feb 2024 09:24:03 +0100 Subject: [PATCH 09/54] chore: remove redundant .gitignore lines (cherry picked from commit de3cf5367545f3cde37b877da2a556dc69ba482d) --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 11d396a32..9c6d636a9 100644 --- a/.gitignore +++ b/.gitignore @@ -49,10 +49,6 @@ localnet/*/config/*.json # Frontend utils ts-client/ -# Proto artifacts -**/*.pb.go -**/*.pb.gw.go - # Mock **/*_mock.go From 5eaf296e01fc9bed06dccbd56cfd67a344b5df72 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 2 Feb 2024 09:39:48 +0100 Subject: [PATCH 10/54] chore: add shared service.proto to buf.gen.pulsar.yaml (cherry picked from commit d6a6e21b9ba31b9449dd361f743ce79b978d87c7) --- proto/buf.gen.pulsar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml index e8fffdb28..89a67f2b2 100644 --- a/proto/buf.gen.pulsar.yaml +++ b/proto/buf.gen.pulsar.yaml @@ -16,7 +16,7 @@ managed: plugins: - name: go-pulsar out: ./api - opt: paths=source_relative + opt: paths=source_relative,Mpoktroll/shared/service.proto=github.com/pokt-network/poktroll/api/poktroll/shared - name: go-grpc out: ./api opt: paths=source_relative From 2d01138df733db2e537b5894d7ad6b0d75ec6612 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 7 Feb 2024 10:42:09 +0100 Subject: [PATCH 11/54] chore: add `yq` as a CI dep --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 76f2e43f0..c5af9d309 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ install_ci_deps: ## Installs `mockgen` and other go tools go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 && golangci-lint --version go install golang.org/x/tools/cmd/goimports@latest + go install github.com/mikefarah/yq/v4@latest ######################## ### Makefile Helpers ### From 617ab40b6b40683a5e1e10f86788934733f4e0ac Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 7 Feb 2024 10:42:42 +0100 Subject: [PATCH 12/54] chore: use sequencer name & power from config.yml --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c5af9d309..d6025613b 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,11 @@ localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localn cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json); \ PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json); \ - jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "900000000", "name": "sequencer1"}]' $(POKTROLLD_HOME)/config/genesis.json > temp.json && mv temp.json $(POKTROLLD_HOME)/config/genesis.json + # NB: Currently the stake => power calculation is constant; however, cosmos-sdk \ + # intends to make this parameterizable in the future. \ + POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,'); \ + NAME=$$(yq ".validators[0].name" ./config.yml); \ + jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' $(POKTROLLD_HOME)/config/genesis.json > temp.json && mv temp.json $(POKTROLLD_HOME)/config/genesis.json # TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state. # cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml From 84063d7dbae56114c55d49c823cc02eea29ee3c5 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 7 Feb 2024 10:43:39 +0100 Subject: [PATCH 13/54] chore: use rollkit v0.11.19 cosmos-sdk --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 9b6f89653..010b80c21 100644 --- a/go.mod +++ b/go.mod @@ -336,4 +336,4 @@ require ( sigs.k8s.io/yaml v1.4.0 // indirect ) -replace github.com/cosmos/cosmos-sdk => github.com/bryanchriswhite/cosmos-sdk v0.50.1-fix-sequencer-check +replace github.com/cosmos/cosmos-sdk => github.com/rollkit/cosmos-sdk v0.50.1-rollkit-v0.11.19-no-fraud-proofs From 361a377469afa3cb7e5c0dac001b9f958dae151d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 7 Feb 2024 10:44:09 +0100 Subject: [PATCH 14/54] chore: update go.mod --- go.mod | 31 ++++++++++++------------ go.sum | 74 ++++++++++++++++++++++++++++------------------------------ 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/go.mod b/go.mod index 010b80c21..1480ddd80 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.17.0 + github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac google.golang.org/grpc v1.60.1 @@ -51,7 +51,7 @@ require ( cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.5 // indirect - cloud.google.com/go/storage v1.30.1 // indirect + cloud.google.com/go/storage v1.35.1 // indirect connectrpc.com/connect v1.14.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect cosmossdk.io/collections v0.4.0 // indirect @@ -75,7 +75,7 @@ require ( github.com/bufbuild/protocompile v0.8.0 // indirect github.com/bufbuild/protovalidate-go v0.5.0 // indirect github.com/bufbuild/protoyaml-go v0.1.7 // indirect - github.com/celestiaorg/go-header v0.4.1 // indirect + github.com/celestiaorg/go-header v0.5.1 // indirect github.com/celestiaorg/go-libp2p-messenger v0.2.0 // indirect github.com/celestiaorg/utils v0.1.0 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -107,7 +107,7 @@ require ( 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/badger/v3 v3.2103.5 // indirect + github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/distribution/reference v0.5.0 // indirect @@ -126,7 +126,7 @@ require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/flynn/noise v1.0.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.25.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-chi/chi/v5 v5.0.11 // indirect @@ -185,7 +185,7 @@ require ( github.com/ipfs/boxo v0.8.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect - github.com/ipfs/go-ds-badger3 v0.0.2 // indirect + github.com/ipfs/go-ds-badger4 v0.1.5 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect @@ -238,7 +238,7 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.0 // indirect + github.com/multiformats/go-multiaddr v0.12.1 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect @@ -261,7 +261,7 @@ require ( github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect @@ -272,19 +272,19 @@ require ( github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rollkit/go-da v0.0.0-20231207150926-93600f28d67d // indirect - github.com/rollkit/rollkit v0.11.9 // indirect + github.com/rollkit/go-da v0.2.0 // indirect + github.com/rollkit/rollkit v0.11.19 // indirect github.com/rs/cors v1.10.1 // indirect github.com/rs/zerolog v1.31.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/afero v1.10.0 // indirect - github.com/spf13/cast v1.5.1 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -315,14 +315,15 @@ require ( golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/oauth2 v0.13.0 // indirect + golang.org/x/oauth2 v0.15.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.17.0 // indirect gonum.org/v1/gonum v0.12.0 // indirect - google.golang.org/api v0.149.0 // indirect + google.golang.org/api v0.153.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect diff --git a/go.sum b/go.sum index 1668e73ba..bda8d18ab 100644 --- a/go.sum +++ b/go.sum @@ -185,8 +185,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= +cloud.google.com/go/storage v1.35.1/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= @@ -353,8 +353,6 @@ github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2 github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= -github.com/bryanchriswhite/cosmos-sdk v0.50.1-fix-sequencer-check h1:F+o3sTVGPa+H0T81ewP+R0IwEiKZ/7yWUgS/uDU2iqM= -github.com/bryanchriswhite/cosmos-sdk v0.50.1-fix-sequencer-check/go.mod h1:XGySaVuQoLe3plWUIm/i51pJIptOIeoQ9s+xF53qVck= github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= @@ -392,8 +390,8 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7 github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= -github.com/celestiaorg/go-header v0.4.1 h1:bjbUcKDnhrJJ9EoE7vtPpgleNLVjc2S+cB4/qe8nQmo= -github.com/celestiaorg/go-header v0.4.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= +github.com/celestiaorg/go-header v0.5.1 h1:1s1lw4fcCHalNK0qw/0a3cxg3ezx3Hl020znIxPZvtk= +github.com/celestiaorg/go-header v0.5.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c= github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao= github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo= github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo= @@ -559,8 +557,8 @@ github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrV github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg= -github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw= +github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 h1:yy45brf1ktmnkTCZlHynP1gRlVwZ9g19oz5D9wG81v4= +github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581/go.mod h1:T/uWAYxrXdaXw64ihI++9RMbKTCpKd/yE9+saARew7k= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= @@ -653,14 +651,14 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= @@ -1101,8 +1099,8 @@ github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8 github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.3.0/go.mod h1:1ke6mXNqeV8K3y5Ak2bAA0osoTfmxUdupVCGm4QUIek= -github.com/ipfs/go-ds-badger3 v0.0.2 h1:+pME0YfRnbUKhvySnakNMuCMsUUhmGfwIsH/nnHZ7QY= -github.com/ipfs/go-ds-badger3 v0.0.2/go.mod h1:6/yjF1KaOU+IpCaqMV43yoWIdxHqOAJlO9EhWLnZSkI= +github.com/ipfs/go-ds-badger4 v0.1.5 h1:MwrTsIUJIqH/ChuDdUOzxwxMxHx/Li1ECoSCKsCUxiA= +github.com/ipfs/go-ds-badger4 v0.1.5/go.mod h1:LUU2FbhNdmhAbJmMeoahVRbe4GsduAODSJHWJJh2Vo4= github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= @@ -1517,8 +1515,8 @@ github.com/multiformats/go-multiaddr v0.3.3/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9x github.com/multiformats/go-multiaddr v0.4.0/go.mod h1:YcpyLH8ZPudLxQlemYBPhSm0/oCXAT8Z4mzFpyoPyRc= github.com/multiformats/go-multiaddr v0.4.1/go.mod h1:3afI9HfVW8csiF8UZqtpYRiDyew8pRX7qLIGHu9FLuM= github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar+bR+gh4zgbfr3SNug= -github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= -github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= +github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= +github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -1719,8 +1717,8 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1794,10 +1792,12 @@ github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4 github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rollkit/go-da v0.0.0-20231207150926-93600f28d67d h1:VeAbAkj+1+9OMc80BMIt7TokIAJudJrqI/59gTpMeuI= -github.com/rollkit/go-da v0.0.0-20231207150926-93600f28d67d/go.mod h1:cy1LA9kCyCJHgszKkTh9hJn816l5Oa87GMA2c1imfqA= -github.com/rollkit/rollkit v0.11.9 h1:2EY0A1jblAfP51qBDFcWL3PSmIDPwL8HMIQ7AEqUx+A= -github.com/rollkit/rollkit v0.11.9/go.mod h1:SoME6mBxh/aUbCddVAGJ8YsyIZtoD7W4Nhevp94R2Zs= +github.com/rollkit/cosmos-sdk v0.50.1-rollkit-v0.11.19-no-fraud-proofs h1:ZtbgC7yOv0Rw2efD7v3xyOSTRpAuJcLtxNCI8Mvy+U4= +github.com/rollkit/cosmos-sdk v0.50.1-rollkit-v0.11.19-no-fraud-proofs/go.mod h1:FEBYsCT6onxNk7eNAdU8+O7jDrbn+XJAkO4S1zFoQv0= +github.com/rollkit/go-da v0.2.0 h1:rNpWBa2inczgZ955ky3wy8FbrMajzVbm0UfbBGzm5UE= +github.com/rollkit/go-da v0.2.0/go.mod h1:Kef0XI5ecEKd3TXzI8S+9knAUJnZg0svh2DuXoCsPlM= +github.com/rollkit/rollkit v0.11.19 h1:MVOHw8pYFyvSS+eFx4v3IrUQTnFKatbo/GbLG768nUI= +github.com/rollkit/rollkit v0.11.19/go.mod h1:7qJgRT0LJCOrW5PgVUfufD09MVTvuZ4NLQAKA8Zcrak= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= @@ -1816,8 +1816,8 @@ github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0K github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= -github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= -github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -1891,13 +1891,13 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= @@ -1914,8 +1914,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= -github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= -github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= @@ -2176,7 +2176,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2342,8 +2341,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -2502,7 +2501,6 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2536,8 +2534,8 @@ 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-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -2721,8 +2719,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= -google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= +google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= +google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= 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.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= From 49d161f908842700475165973bbfc75bac203e0e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 6 Feb 2024 18:59:27 +0100 Subject: [PATCH 15/54] reconcile: app account address prefix (cherry picked from commit 7b88b3de89a27a3aff34ee34729e10ddf23085b3) --- app/app.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 9f05ee7de..eed96de63 100644 --- a/app/app.go +++ b/app/app.go @@ -59,8 +59,10 @@ import ( ) const ( - AccountAddressPrefix = "cosmos" + AccountAddressPrefix = "pokt" Name = "poktroll" + // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase + DenomuPOKT = "upokt" ) var ( From 15ea3e87a40956616493351cd6142aef58aeb28b Mon Sep 17 00:00:00 2001 From: Dima Kniazev Date: Fri, 9 Feb 2024 15:03:34 -0800 Subject: [PATCH 16/54] [SDK Migration] Switch to celestia-da, bump rollkit, fix CI (#367) --- .github/workflows/main-build.yml | 14 +- .github/workflows/run-tests.yml | 6 +- .tool-versions | 4 +- Dockerfile.dev | 6 +- Makefile | 34 +-- Tiltfile | 2 +- app/app.go | 2 +- go.mod | 6 +- localnet/kubernetes/celestia-rollkit.yaml | 28 +-- localnet/poktrolld/config/app.toml | 288 +++------------------- localnet/poktrolld/config/client.toml | 18 +- localnet/poktrolld/config/config.toml | 93 ++++--- tools/tools.go | 1 + 13 files changed, 143 insertions(+), 359 deletions(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index b13694950..02825a38a 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -17,8 +17,8 @@ jobs: # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. run: | # curl https://get.ignite.com/cli! | bash - wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz - tar -xzf ignite_0.27.2_linux_amd64.tar.gz + wget https://github.com/ignite/cli/releases/download/v28.2.0/ignite_28.2.0_linux_amd64.tar.gz + tar -xzf ignite_28.2.0_linux_amd64.tar.gz sudo mv ignite /usr/local/bin/ignite ignite version @@ -29,7 +29,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.10" + go-version: "1.21.6" - name: Install CI dependencies run: make install_ci_deps @@ -103,11 +103,11 @@ jobs: sparse-checkout: | .github - - id: 'auth' - name: 'Authenticate to Google Cloud' - uses: 'google-github-actions/auth@v1' + - id: "auth" + name: "Authenticate to Google Cloud" + uses: "google-github-actions/auth@v1" with: - credentials_json: '${{ secrets.GKE_PROTOCOL_US_CENTRAL }}' + credentials_json: "${{ secrets.GKE_PROTOCOL_US_CENTRAL }}" - uses: google-github-actions/get-gke-credentials@v1 with: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b843265b6..ea7f2edd3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,8 +21,8 @@ jobs: # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. run: | # curl https://get.ignite.com/cli! | bash - wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz - tar -xzf ignite_0.27.2_linux_amd64.tar.gz + wget https://github.com/ignite/cli/releases/download/v28.2.0/ignite_28.2.0_linux_amd64.tar.gz + tar -xzf ignite_28.2.0_linux_amd64.tar.gz sudo mv ignite /usr/local/bin/ignite ignite version @@ -33,7 +33,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.10" + go-version: "1.21.6" - name: Install CI dependencies run: make install_ci_deps diff --git a/.tool-versions b/.tool-versions index 44c16157f..9b7a6107e 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ # Run `asdf plugin add golang` and `asdf install` to install the dependencies, # and `asdf current` to switch to the versions of dependencies listed below -golang 1.20.10 -go 1.20.10 +golang 1.21.6 +go 1.21.6 diff --git a/Dockerfile.dev b/Dockerfile.dev index be65919a6..585aefa4d 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,12 +1,12 @@ # This Dockerfile is used to build container image for development purposes. # It intentionally contains no security features, ships with code and troubleshooting tools. -FROM golang:1.20 as base +FROM golang:1.21.6 as base RUN apt update && \ apt-get install -y \ - ca-certificates net-tools kubernetes-client \ - curl jq make vim less dnsutils + ca-certificates net-tools kubernetes-client \ + curl jq make vim less dnsutils # enable faster module downloading. ENV GOPROXY https://proxy.golang.org diff --git a/Makefile b/Makefile index d6025613b..14550b5ce 100644 --- a/Makefile +++ b/Makefile @@ -52,8 +52,8 @@ check_go_version: MAJOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 1) && \ MINOR_VERSION=$$(echo $$GO_VERSION | cut -d "." -f 2) && \ \ - if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -ge 21 ] || [ "$$MINOR_VERSION" -le 18 ] ; then \ - echo "Invalid Go version. Expected 1.19.x or 1.20.x but found $$GO_VERSION"; \ + if [ "$$MAJOR_VERSION" -ne 1 ] || [ "$$MINOR_VERSION" -le 20 ] ; then \ + echo "Invalid Go version. Expected 1.21.x or newer but found $$GO_VERSION"; \ exit 1; \ fi @@ -166,23 +166,27 @@ localnet_up: ## Starts localnet .PHONY: localnet_down localnet_down: ## Delete resources created by localnet tilt down - kubectl delete secret celestia-secret || exit 1 .PHONY: localnet_regenesis localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring - ignite chain init - mkdir -p $(POKTROLLD_HOME)/config/ - cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) - cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ - cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ - ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json); \ - PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json); \ - # NB: Currently the stake => power calculation is constant; however, cosmos-sdk \ - # intends to make this parameterizable in the future. \ - POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,'); \ - NAME=$$(yq ".validators[0].name" ./config.yml); \ - jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' $(POKTROLLD_HOME)/config/genesis.json > temp.json && mv temp.json $(POKTROLLD_HOME)/config/genesis.json +# NB: Currently the stake => power calculation is constant; however, cosmos-sdk +# intends to make this parameterizable in the future. + @echo "Initializing chain..." + @set -e ;\ + ignite chain init ;\ + mkdir -p $(POKTROLLD_HOME)/config/ ;\ + cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) ;\ + cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ ;\ + ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ + PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ + POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\ + NAME=$$(yq ".validators[0].name" ./config.yml) ;\ + echo "Regenerating genesis file with new validator..." ;\ + jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' ${HOME}/.poktroll/config/genesis.json > temp.json ;\ + mv temp.json ${HOME}/.poktroll/config/genesis.json ;\ + cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ ;\ + # TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state. # cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml diff --git a/Tiltfile b/Tiltfile index 6a7e88649..d279e7fd0 100644 --- a/Tiltfile +++ b/Tiltfile @@ -97,7 +97,7 @@ local_resource( docker_build_with_restart( "poktrolld", ".", - dockerfile_contents="""FROM golang:1.20.8 + dockerfile_contents="""FROM golang:1.21.6 RUN apt-get -q update && apt-get install -qyy curl jq less RUN go install github.com/go-delve/delve/cmd/dlv@latest COPY bin/poktrolld /usr/local/bin/poktrolld diff --git a/app/app.go b/app/app.go index eed96de63..8f157015a 100644 --- a/app/app.go +++ b/app/app.go @@ -60,7 +60,7 @@ import ( const ( AccountAddressPrefix = "pokt" - Name = "poktroll" + Name = "pocket" // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase DenomuPOKT = "upokt" ) diff --git a/go.mod b/go.mod index 1480ddd80..4dcf1553b 100644 --- a/go.mod +++ b/go.mod @@ -39,8 +39,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac - google.golang.org/grpc v1.60.1 + golang.org/x/tools v0.17.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 google.golang.org/protobuf v1.32.0 ) @@ -321,12 +320,13 @@ require ( golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.17.0 // indirect gonum.org/v1/gonum v0.12.0 // indirect google.golang.org/api v0.153.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect + google.golang.org/grpc v1.60.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/localnet/kubernetes/celestia-rollkit.yaml b/localnet/kubernetes/celestia-rollkit.yaml index 25e81f46a..a836109cd 100644 --- a/localnet/kubernetes/celestia-rollkit.yaml +++ b/localnet/kubernetes/celestia-rollkit.yaml @@ -18,6 +18,10 @@ spec: name: gateway port: 26659 targetPort: 26659 + - protocol: TCP + name: grpc-da + port: 26650 + targetPort: 26650 --- apiVersion: apps/v1 kind: Deployment @@ -37,31 +41,13 @@ spec: # TODO: Add resource limits containers: - name: celestia - image: ghcr.io/rollkit/local-celestia-devnet:v0.12.1 + image: ghcr.io/rollkit/local-celestia-devnet:v0.12.7 ports: + # https://github.com/rollkit/local-celestia-devnet?tab=readme-ov-file#exposed-ports - containerPort: 26657 - containerPort: 26658 - containerPort: 26659 - volumeMounts: - - name: bridge-volume - mountPath: /home/celestia/bridge - - name: secret-update-sidecar - image: ghcr.io/rollkit/local-celestia-devnet:v0.12.1 - command: ["/bin/bash", "-c", "--"] - # TODO(@okdas): Very scary line. Basically, waits until the node key (NJ3XILLTMVRXEZLUFZVHO5A) exists, signs the JWT and pushes it to k8s secret. - args: - [ - 'while true; do if [ -f /home/celestia/bridge/keys/NJ3XILLTMVRXEZLUFZVHO5A ]; then OUTPUT=$(celestia bridge --node.store /home/celestia/bridge auth admin); BASE64_OUTPUT=$(echo -n $OUTPUT | base64 -w 0); TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token); PAYLOAD=$(echo -n ''{"apiVersion":"v1","kind":"Secret","metadata":{"name":"celestia-secret"},"data":{"auth_token":"''${BASE64_OUTPUT}''"}}''); RESPONSE=$(curl -k -H "Authorization: Bearer $TOKEN" -H ''Content-Type: application/json'' -X PUT -d "$PAYLOAD" https://kubernetes.default.svc.cluster.local/api/v1/namespaces/default/secrets/celestia-secret); echo $RESPONSE | grep ''"code": 404'' >/dev/null && curl -k -H "Authorization: Bearer $TOKEN" -H ''Content-Type: application/json'' -X POST -d "$PAYLOAD" https://kubernetes.default.svc.cluster.local/api/v1/namespaces/default/secrets; while true; do sleep 86400; done; fi; sleep 2; done;', - ] - volumeMounts: - - name: bridge-volume - mountPath: /home/celestia/bridge - volumes: - - name: bridge-volume - emptyDir: {} - - name: localnet-celestia-tokens - secret: - secretName: localnet-celestia-tokens + - containerPort: 26650 --- apiVersion: v1 kind: ServiceAccount diff --git a/localnet/poktrolld/config/app.toml b/localnet/poktrolld/config/app.toml index 6b84cd3fd..6578424da 100644 --- a/localnet/poktrolld/config/app.toml +++ b/localnet/poktrolld/config/app.toml @@ -1,264 +1,58 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0upokt" - -# default: the last 362880 states are kept, pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: 2 latest states will be kept; pruning at 10 block intervals. -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-keep-recent = "0" -pruning-interval = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. +app-db-backend = "" halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from Tendermint. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning Tendermint blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: Tendermint block pruning is dependant on this parameter in conunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs Tendermint what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -# IavlCacheSize set the size of the iavl tree cache (in number of nodes). iavl-cache-size = 781250 - -# IAVLDisableFastNode enables or disables the fast node feature of IAVL. -# Default is false. iavl-disable-fastnode = false - -# IAVLLazyLoading enable/disable the lazy loading of iavl store. -# Default is false. -iavl-lazy-loading = false - -# AppDBBackend defines the database backend type to use for the application and snapshots DBs. -# An empty string indicates that a fallback will be used. -# First fallback is the deprecated compile-time types.DBBackend value. -# Second fallback (if the types.DBBackend also isn't set), is the db-backend value set in Tendermint's config.toml. -app-db-backend = "" - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [ -] - -############################################################################### -### API Configuration ### -############################################################################### +index-events = [] +inter-block-cache = true +min-retain-blocks = 0 +minimum-gas-prices = "0upokt" +pruning = "default" +pruning-interval = "0" +pruning-keep-recent = "0" +query-gas-limit = "0" [api] - -# Enable defines if the API server should be enabled. -enable = false - -# Swagger defines if swagger documentation should automatically be registered. -swagger = false - -# Address defines the API server to listen on. -address = "tcp://localhost:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the Tendermint maximum request body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = false - -############################################################################### -### Rosetta Configuration ### -############################################################################### - -[rosetta] - -# Enable defines if the Rosetta API server should be enabled. -enable = false - -# Address defines the Rosetta API server to listen on. -address = ":8080" - -# Network defines the name of the blockchain that will be returned by Rosetta. -blockchain = "app" - -# Network defines the name of the network that will be returned by Rosetta. -network = "network" - -# Retries defines the number of retries when connecting to the node before failing. -retries = 3 - -# Offline defines if Rosetta server should run in offline mode. -offline = false - -# EnableDefaultSuggestedFee defines if the server should suggest fee by default. -# If 'construction/medata' is called without gas limit and gas price, -# suggested fee based on gas-to-suggest and denom-to-suggest will be given. -enable-fee-suggestion = false - -# GasToSuggest defines gas limit when calculating the fee -gas-to-suggest = 200000 - -# DenomToSuggest defines the defult denom for fee suggestion. -# Price must be in minimum-gas-prices. -denom-to-suggest = "uatom" - -############################################################################### -### gRPC Configuration ### -############################################################################### + address = "tcp://0.0.0.0:1317" + enable = true + enabled-unsafe-cors = true + max-open-connections = 1000 + rpc-max-body-bytes = 1000000 + rpc-read-timeout = 10 + rpc-write-timeout = 0 + swagger = false [grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "localhost:9090" - -# MaxRecvMsgSize defines the max message size in bytes the server can receive. -# The default value is 10MB. -max-recv-msg-size = "10485760" - -# MaxSendMsgSize defines the max message size in bytes the server can send. -# The default value is math.MaxInt32. -max-send-msg-size = "2147483647" - -############################################################################### -### gRPC Web Configuration ### -############################################################################### + address = "localhost:9090" + enable = true + max-recv-msg-size = "10485760" + max-send-msg-size = "2147483647" [grpc-web] + enable = true -# GRPCWebEnable defines if the gRPC-web should be enabled. -# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. -enable = true - -# Address defines the gRPC-web server address to bind to. -address = "localhost:9091" - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enable-unsafe-cors = false +[mempool] + max-txs = 5000 -############################################################################### -### State Sync Configuration ### -############################################################################### +[rpc] + cors_allowed_origins = ["*"] -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. [state-sync] + snapshot-interval = 0 + snapshot-keep-recent = 2 -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). -snapshot-interval = 0 +[streaming] -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 + [streaming.abci] + keys = [] + plugin = "" + stop-node-on-err = true -############################################################################### -### Store / State Streaming ### -############################################################################### - -[store] -streamers = [] - -[streamers] -[streamers.file] -keys = ["*", ] -write_dir = "" -prefix = "" - -# output-metadata specifies if output the metadata file which includes the abci request/responses -# during processing the block. -output-metadata = "true" - -# stop-node-on-error specifies if propagate the file streamer errors to consensus state machine. -stop-node-on-error = "true" - -# fsync specifies if call fsync after writing the files. -fsync = "false" - -############################################################################### -### Mempool ### -############################################################################### - -[mempool] -# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool. -# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool. -# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount. -# -# Note, this configuration only applies to SDK built-in app-side mempool -# implementations. -max-txs = "5000" +[telemetry] + enable-hostname = false + enable-hostname-label = false + enable-service-label = false + enabled = false + global-labels = [] + prometheus-retention-time = 0 + service-name = "" diff --git a/localnet/poktrolld/config/client.toml b/localnet/poktrolld/config/client.toml index 4da12cd84..7e41c8b68 100644 --- a/localnet/poktrolld/config/client.toml +++ b/localnet/poktrolld/config/client.toml @@ -1,17 +1,5 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Client Configuration ### -############################################################################### - -# The network chain ID -chain-id = "poktroll" -# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +broadcast-mode = "sync" +chain-id = "" keyring-backend = "test" -# CLI output format (text|json) -output = "text" -# : to Tendermint RPC interface for this chain node = "tcp://localhost:26657" -# Transaction broadcasting mode (sync|async) -broadcast-mode = "sync" +output = "text" diff --git a/localnet/poktrolld/config/config.toml b/localnet/poktrolld/config/config.toml index 2d4cfd233..928e31592 100644 --- a/localnet/poktrolld/config/config.toml +++ b/localnet/poktrolld/config/config.toml @@ -6,6 +6,10 @@ # "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable # or --home cmd flag. +# The version of the CometBFT binary that created or +# last modified the config file. Do not modify this. +version = "0.38.2" + ####################################################################### ### Main Base Config Options ### ####################################################################### @@ -17,14 +21,6 @@ proxy_app = "tcp://127.0.0.1:26658" # A custom human readable name for this node moniker = "sequencer1" -# If this node is many blocks behind the tip of the chain, BlockSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -# -# Deprecated: this key will be removed and BlockSync will be enabled -# unconditionally in the next major release. -block_sync = true - # Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb # * goleveldb (github.com/syndtr/goleveldb - most popular implementation) # - pure go @@ -91,12 +87,12 @@ filter_peers = false [rpc] # TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://127.0.0.1:26657" +laddr = "tcp://0.0.0.0:26657" # A list of origins a cross-domain request can be executed from # Default value '[]' disables cors support # Use '["*"]' to allow any origin -cors_allowed_origins = [] +cors_allowed_origins = ["*", ] # A list of methods the client is allowed to use with cross-domain requests cors_allowed_methods = ["HEAD", "GET", "POST", ] @@ -204,11 +200,9 @@ pprof_laddr = "localhost:6060" # Address to listen for incoming connections laddr = "tcp://0.0.0.0:26656" -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. ip and port are required -# example: 159.89.10.97:26656 +# Address to advertise to peers for them to dial. If empty, will use the same +# port as the laddr, and will introspect on the listener to figure out the +# address. IP and port are required. Example: 159.89.10.97:26656 external_address = "" # Comma separated list of seed nodes to connect to @@ -217,9 +211,6 @@ seeds = "" # Comma separated list of nodes to keep persistent connections to persistent_peers = "" -# UPNP port forwarding -upnp = false - # Path to address book addr_book_file = "config/addrbook.json" @@ -275,13 +266,34 @@ dial_timeout = "3s" ####################################################### [mempool] -# Mempool version to use: -# 1) "v0" - (default) FIFO mempool. -# 2) "v1" - prioritized mempool (deprecated; will be removed in the next release). -version = "v0" - +# The type of mempool for this node to use. +# +# Possible types: +# - "flood" : concurrent linked list mempool with flooding gossip protocol +# (default) +# - "nop" : nop-mempool (short for no operation; the ABCI app is responsible +# for storing, disseminating and proposing txs). "create_empty_blocks=false" is +# not supported. +type = "flood" + +# Recheck (default: true) defines whether CometBFT should recheck the +# validity for all remaining transaction in the mempool after a block. +# Since a block affects the application state, some transactions in the +# mempool may become invalid. If this does not apply to your application, +# you can disable rechecking. recheck = true + +# Broadcast (default: true) defines whether the mempool should relay +# transactions to other peers. Setting this to false will stop the mempool +# from relaying transactions to other peers until they are included in a +# block. In other words, if Broadcast is disabled, only the peer you send +# the tx to will see it until it is included in a block. broadcast = true + +# WalPath (default: "") configures the location of the Write Ahead Log +# (WAL) for the mempool. The WAL is disabled by default. To enable, set +# WalPath to where you want the WAL to be written (e.g. +# "data/mempool.wal"). wal_dir = "" # Maximum number of transactions in the mempool @@ -309,21 +321,20 @@ max_tx_bytes = 1048576 # XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 max_batch_bytes = 0 -# ttl-duration, if non-zero, defines the maximum amount of time a transaction -# can exist for in the mempool. -# -# Note, if ttl-num-blocks is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if it's -# insertion time into the mempool is beyond ttl-duration. -ttl-duration = "0s" - -# ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction -# can exist for in the mempool. -# -# Note, if ttl-duration is also defined, a transaction will be removed if it -# has existed in the mempool at least ttl-num-blocks number of blocks or if -# it's insertion time into the mempool is beyond ttl-duration. -ttl-num-blocks = 0 +# Experimental parameters to limit gossiping txs to up to the specified number of peers. +# We use two independent upper values for persistent and non-persistent peers. +# Unconditional peers are not affected by this feature. +# If we are connected to more than the specified number of persistent peers, only send txs to +# ExperimentalMaxGossipConnectionsToPersistentPeers of them. If one of those +# persistent peers disconnects, activate another persistent peer. +# Similarly for non-persistent peers, with an upper limit of +# ExperimentalMaxGossipConnectionsToNonPersistentPeers. +# If set to 0, the feature is disabled for the corresponding group of peers, that is, the +# number of active connections to that group of peers is not bounded. +# For non-persistent peers, if enabled, a value of 10 is recommended based on experimental +# performance results using the default P2P configuration. +experimental_max_gossip_connections_to_persistent_peers = 0 +experimental_max_gossip_connections_to_non_persistent_peers = 0 ####################################################### ### State Sync Configuration Options ### @@ -367,7 +378,7 @@ chunk_fetchers = "4" [blocksync] # Block Sync version to use: -# +# # In v0.37, v1 and v2 of the block sync protocols were deprecated. # Please use v0 instead. # @@ -382,7 +393,7 @@ version = "v0" wal_file = "data/cs.wal/wal" # How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" +timeout_propose = "1s" # How much timeout_propose increases with each round timeout_propose_delta = "500ms" # How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) @@ -396,7 +407,7 @@ timeout_precommit_delta = "500ms" # How long we wait after committing a block, before starting on the new # height (this gives us a chance to receive some more precommits, even # though we already have +2/3). -timeout_commit = "5s" +timeout_commit = "1s" # How many blocks to look back to check existence of the node's consensus votes before joining consensus # When non-zero, the node will panic upon restart diff --git a/tools/tools.go b/tools/tools.go index c2f88d474..d697c36cb 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -10,6 +10,7 @@ import ( _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" + _ "golang.org/x/tools/cmd/goimports" _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) From f2b2b85a63f1ddfe6f8be44f70cd957084fe49cd Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 12 Feb 2024 08:44:58 +0100 Subject: [PATCH 17/54] chore: add `proto_clean_pulsar` make target --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 14550b5ce..9d24bc33d 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,13 @@ proto_regen: ## Delete existing protobuf artifacts and regenerate them find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm ignite generate proto-go --yes +.PHONY: proto_clean_pulsar +proto_clean_pulsar: ## TODO: explain... + @find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' + find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm + ignite generate proto-go --yes + find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + ####################### ### Docker Helpers ### ####################### From 54e49b7419c046624665935daa5f62934ea4ef8b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 12 Feb 2024 10:16:43 +0100 Subject: [PATCH 18/54] scaffold & reconcile: all modules scaffold: module tokenomics --dep bank,account,application,supplier ignite scaffold module tokenomics --dep bank,account,application,supplier --params compute_units_to_tokens_multiplier:uint reconcile: tokenomics files reconcile: add missing network utils chore: add params cli long description reconcile: reduce formatting noise with main fix: CLI overrides --- .github/workflows/reviewdog.yml | 2 + Makefile | 36 +- .../application/application.pulsar.go | 966 +++ api/poktroll/application/event.pulsar.go | 657 ++ api/poktroll/application/genesis.pulsar.go | 754 +++ .../application/module/module.pulsar.go | 580 ++ api/poktroll/application/params.pulsar.go | 564 ++ api/poktroll/application/query.pulsar.go | 3144 +++++++++ api/poktroll/application/tx.pulsar.go | 5014 ++++++++++++++ api/poktroll/gateway/gateway.pulsar.go | 668 ++ api/poktroll/gateway/genesis.pulsar.go | 750 ++ api/poktroll/gateway/module/module.pulsar.go | 578 ++ api/poktroll/gateway/params.pulsar.go | 499 ++ api/poktroll/gateway/query.pulsar.go | 3137 +++++++++ api/poktroll/gateway/tx.pulsar.go | 2939 ++++++++ api/poktroll/proof/claim.pulsar.go | 745 ++ api/poktroll/proof/genesis.pulsar.go | 903 +++ api/poktroll/proof/module/module.pulsar.go | 577 ++ api/poktroll/proof/params.pulsar.go | 498 ++ api/poktroll/proof/proof.pulsar.go | 746 ++ api/poktroll/proof/query.pulsar.go | 6012 +++++++++++++++++ api/poktroll/proof/tx.pulsar.go | 3189 +++++++++ api/poktroll/service/genesis.pulsar.go | 750 ++ api/poktroll/service/module/module.pulsar.go | 578 ++ api/poktroll/service/params.pulsar.go | 560 ++ api/poktroll/service/query.pulsar.go | 3130 +++++++++ api/poktroll/service/service.pulsar.go | 639 ++ api/poktroll/service/tx.pulsar.go | 2066 ++++++ api/poktroll/session/genesis.pulsar.go | 595 ++ api/poktroll/session/module/module.pulsar.go | 578 ++ api/poktroll/session/params.pulsar.go | 499 ++ api/poktroll/session/query.pulsar.go | 2142 ++++++ api/poktroll/session/session.pulsar.go | 1796 +++++ api/poktroll/session/tx.pulsar.go | 1089 +++ api/poktroll/shared/service.pulsar.go | 3105 +++++++++ api/poktroll/shared/supplier.pulsar.go | 824 +++ api/poktroll/supplier/genesis.pulsar.go | 751 ++ api/poktroll/supplier/module/module.pulsar.go | 579 ++ api/poktroll/supplier/params.pulsar.go | 500 ++ api/poktroll/supplier/query.pulsar.go | 3141 +++++++++ api/poktroll/supplier/tx.pulsar.go | 3096 +++++++++ api/poktroll/tokenomics/genesis.pulsar.go | 597 ++ .../tokenomics/module/module.pulsar.go | 580 ++ api/poktroll/tokenomics/params.pulsar.go | 569 ++ api/poktroll/tokenomics/query.pulsar.go | 1013 +++ api/poktroll/tokenomics/tx.pulsar.go | 1090 +++ app/app.go | 25 +- app/app_config.go | 78 +- cmd/poktrolld/cmd/root.go | 2 +- config.yml | 4 +- go.mod | 19 +- go.sum | 7 + pkg/polylog/LICENSE | 32 + pkg/polylog/context.go | 39 + pkg/polylog/context_example_test.go | 43 + pkg/polylog/context_test.go | 43 + pkg/polylog/godoc.go | 17 + pkg/polylog/interface.go | 193 + pkg/polylog/polyzero/default.go | 15 + pkg/polylog/polyzero/event.go | 205 + pkg/polylog/polyzero/godoc.go | 9 + pkg/polylog/polyzero/levels.go | 47 + pkg/polylog/polyzero/logger.go | 109 + pkg/polylog/polyzero/logger_example_test.go | 37 + pkg/polylog/polyzero/logger_test.go | 392 ++ pkg/polylog/polyzero/options.go | 51 + pkg/polylog/polyzero/test_logger.go | 18 + pkg/polylog/types.go | 3 + proto/buf.gen.pulsar.yaml | 2 +- proto/poktroll/application/application.proto | 17 + proto/poktroll/application/event.proto | 14 + proto/poktroll/application/genesis.proto | 19 + .../poktroll/application/module/module.proto | 14 + proto/poktroll/application/params.proto | 14 + proto/poktroll/application/query.proto | 60 + proto/poktroll/application/tx.proto | 78 + proto/poktroll/gateway/gateway.proto | 13 + proto/poktroll/gateway/genesis.proto | 18 + proto/poktroll/gateway/module/module.proto | 14 + proto/poktroll/gateway/params.proto | 14 + proto/poktroll/gateway/query.proto | 61 + proto/poktroll/gateway/tx.proto | 56 + proto/poktroll/proof/claim.proto | 16 + proto/poktroll/proof/genesis.proto | 21 + proto/poktroll/proof/module/module.proto | 14 + proto/poktroll/proof/params.proto | 15 + proto/poktroll/proof/proof.proto | 16 + proto/poktroll/proof/query.proto | 101 + proto/poktroll/proof/tx.proto | 64 + proto/poktroll/service/genesis.proto | 19 + proto/poktroll/service/module/module.proto | 14 + proto/poktroll/service/params.proto | 16 + proto/poktroll/service/query.proto | 59 + proto/poktroll/service/tx.proto | 54 + proto/poktroll/session/genesis.proto | 17 + proto/poktroll/session/module/module.proto | 14 + proto/poktroll/session/params.proto | 13 + proto/poktroll/session/query.proto | 48 + proto/poktroll/session/session.proto | 33 + proto/poktroll/session/tx.proto | 40 + proto/poktroll/shared/service.proto | 66 + proto/poktroll/shared/supplier.proto | 16 + proto/poktroll/supplier/genesis.proto | 19 + proto/poktroll/supplier/module/module.proto | 14 + proto/poktroll/supplier/params.proto | 15 + proto/poktroll/supplier/query.proto | 61 + proto/poktroll/supplier/tx.proto | 58 + proto/poktroll/tokenomics/genesis.proto | 17 + proto/poktroll/tokenomics/module/module.proto | 14 + proto/poktroll/tokenomics/params.proto | 29 + proto/poktroll/tokenomics/query.proto | 30 + proto/poktroll/tokenomics/tx.proto | 42 + testutil/application/mocks/mocks.go | 11 + testutil/gateway/mocks/mocks.go | 11 + testutil/keeper/application.go | 102 + testutil/keeper/gateway.go | 57 + testutil/keeper/proof.go | 87 + testutil/keeper/service.go | 106 + testutil/keeper/session.go | 227 + testutil/keeper/supplier.go | 59 + testutil/keeper/tokenomics.go | 126 + testutil/network/network.go | 211 + testutil/proof/fixtures.go | 113 + testutil/proof/mocks/mocks.go | 11 + testutil/service/mocks/mocks.go | 11 + testutil/session/mocks/mocks.go | 10 + testutil/supplier/mocks/mocks.go | 11 + testutil/testkeyring/accounts.go | 118 + testutil/testkeyring/accounts_table.go | 111 + testutil/testkeyring/gen_accounts/gen.go | 79 + testutil/testkeyring/gen_accounts/template.go | 26 + testutil/testkeyring/keyring.go | 47 + testutil/testpolylog/event.go | 193 + testutil/testpolylog/logger.go | 21 + testutil/tokenomics/mocks/mocks.go | 11 + testutil/yaml/yaml.go | 31 + x/application/keeper/application.go | 71 + x/application/keeper/application_test.go | 63 + x/application/keeper/keeper.go | 64 + x/application/keeper/msg_server.go | 17 + .../keeper/msg_server_delegate_to_gateway.go | 70 + .../msg_server_delegate_to_gateway_test.go | 277 + .../keeper/msg_server_stake_application.go | 101 + .../msg_server_stake_application_test.go | 179 + x/application/keeper/msg_server_test.go | 24 + .../msg_server_undelegate_from_gateway.go | 59 + ...msg_server_undelegate_from_gateway_test.go | 255 + .../keeper/msg_server_unstake_application.go | 46 + .../msg_server_unstake_application_test.go | 80 + x/application/keeper/msg_update_params.go | 23 + .../keeper/msg_update_params_test.go | 64 + x/application/keeper/params.go | 33 + x/application/keeper/params_test.go | 18 + x/application/keeper/query.go | 7 + x/application/keeper/query_application.go | 55 + .../keeper/query_application_test.go | 124 + x/application/keeper/query_params.go | 20 + x/application/keeper/query_params_test.go | 20 + x/application/module/autocli.go | 104 + .../config/application_configs_reader.go | 91 + .../config/application_configs_reader_test.go | 141 + x/application/module/config/errors.go | 11 + x/application/module/genesis.go | 29 + x/application/module/genesis_test.go | 409 ++ x/application/module/helpers_test.go | 33 + x/application/module/module.go | 218 + x/application/module/query.go | 30 + x/application/module/query_application.go | 86 + .../module/query_application_test.go | 139 + x/application/module/query_params.go | 40 + x/application/module/simulation.go | 156 + x/application/module/tx.go | 35 + .../module/tx_delegate_to_gateway.go | 49 + .../module/tx_delegate_to_gateway_test.go | 117 + x/application/module/tx_stake_application.go | 66 + .../module/tx_stake_application_test.go | 235 + .../module/tx_undelegate_from_gateway.go | 49 + .../module/tx_undelegate_from_gateway_test.go | 117 + .../module/tx_unstake_application.go | 47 + .../module/tx_unstake_application_test.go | 97 + .../simulation/delegate_to_gateway.go | 32 + x/application/simulation/helpers.go | 15 + x/application/simulation/stake_application.go | 31 + .../simulation/undelegate_from_gateway.go | 32 + .../simulation/unstake_application.go | 30 + x/application/types/codec.go | 29 + x/application/types/errors.go | 24 + x/application/types/expected_keepers.go | 34 + x/application/types/genesis.go | 75 + x/application/types/key_application.go | 23 + x/application/types/keys.go | 20 + .../types/message_delegate_to_gateway.go | 34 + .../types/message_delegate_to_gateway_test.go | 58 + .../types/message_stake_application.go | 58 + .../types/message_stake_application_test.go | 173 + .../types/message_undelegate_from_gateway.go | 34 + .../message_undelegate_from_gateway_test.go | 56 + .../types/message_unstake_application.go | 22 + .../types/message_unstake_application_test.go | 46 + x/application/types/msg_update_params.go | 21 + x/application/types/params.go | 69 + x/application/types/types.go | 3 + x/gateway/keeper/gateway.go | 71 + x/gateway/keeper/gateway_test.go | 75 + x/gateway/keeper/keeper.go | 58 + x/gateway/keeper/msg_server.go | 17 + x/gateway/keeper/msg_server_stake_gateway.go | 91 + .../keeper/msg_server_stake_gateway_test.go | 92 + x/gateway/keeper/msg_server_test.go | 24 + .../keeper/msg_server_unstake_gateway.go | 54 + .../keeper/msg_server_unstake_gateway_test.go | 73 + x/gateway/keeper/msg_update_params.go | 26 + x/gateway/keeper/msg_update_params_test.go | 64 + x/gateway/keeper/params.go | 33 + x/gateway/keeper/params_test.go | 18 + x/gateway/keeper/query.go | 7 + x/gateway/keeper/query_gateway.go | 56 + x/gateway/keeper/query_gateway_test.go | 125 + x/gateway/keeper/query_params.go | 20 + x/gateway/keeper/query_params_test.go | 20 + x/gateway/module/autocli.go | 58 + x/gateway/module/config/errors.go | 10 + .../module/config/gateway_config_reader.go | 62 + .../config/gateway_config_reader_test.go | 81 + x/gateway/module/genesis.go | 29 + x/gateway/module/genesis_test.go | 172 + x/gateway/module/helpers_test.go | 31 + x/gateway/module/module.go | 215 + x/gateway/module/query.go | 29 + x/gateway/module/query_gateway.go | 82 + x/gateway/module/query_gateway_test.go | 142 + x/gateway/module/query_params.go | 40 + x/gateway/module/simulation.go | 110 + x/gateway/module/tx.go | 35 + x/gateway/module/tx_stake_gateway.go | 61 + x/gateway/module/tx_stake_gateway_test.go | 150 + x/gateway/module/tx_unstake_gateway.go | 44 + x/gateway/module/tx_unstake_gateway_test.go | 97 + x/gateway/simulation/helpers.go | 15 + x/gateway/simulation/stake_gateway.go | 29 + x/gateway/simulation/unstake_gateway.go | 29 + x/gateway/types/codec.go | 23 + x/gateway/types/errors.go | 17 + x/gateway/types/expected_keepers.go | 37 + x/gateway/types/genesis.go | 53 + x/gateway/types/key_gateway.go | 23 + x/gateway/types/keys.go | 20 + x/gateway/types/message_stake_gateway.go | 41 + x/gateway/types/message_stake_gateway_test.go | 81 + x/gateway/types/message_unstake_gateway.go | 22 + .../types/message_unstake_gateway_test.go | 45 + x/gateway/types/msg_update_params.go | 17 + x/gateway/types/params.go | 32 + x/gateway/types/types.go | 3 + x/proof/keeper/claim.go | 108 + x/proof/keeper/claim_test.go | 78 + x/proof/keeper/keeper.go | 58 + x/proof/keeper/msg_server.go | 17 + x/proof/keeper/msg_server_create_claim.go | 75 + .../keeper/msg_server_create_claim_test.go | 124 + x/proof/keeper/msg_server_submit_proof.go | 136 + x/proof/keeper/msg_server_test.go | 24 + x/proof/keeper/msg_update_params.go | 23 + x/proof/keeper/msg_update_params_test.go | 64 + x/proof/keeper/params.go | 33 + x/proof/keeper/params_test.go | 18 + x/proof/keeper/proof.go | 85 + x/proof/keeper/proof_test.go | 83 + x/proof/keeper/query.go | 7 + x/proof/keeper/query_claim.go | 101 + x/proof/keeper/query_claim_test.go | 235 + x/proof/keeper/query_params.go | 20 + x/proof/keeper/query_params_test.go | 20 + x/proof/keeper/query_proof.go | 98 + x/proof/keeper/query_proof_test.go | 190 + x/proof/keeper/session.go | 80 + x/proof/module/autocli.go | 70 + x/proof/module/flags.go | 7 + x/proof/module/genesis.go | 34 + x/proof/module/genesis_test.go | 55 + x/proof/module/helpers_test.go | 248 + x/proof/module/module.go | 216 + x/proof/module/query.go | 31 + x/proof/module/query_claim.go | 168 + x/proof/module/query_claim_test.go | 285 + x/proof/module/query_params.go | 36 + x/proof/module/query_proof.go | 165 + x/proof/module/query_proof_test.go | 145 + x/proof/module/simulation.go | 110 + x/proof/module/tx.go | 27 + x/proof/module/tx_create_claim.go | 65 + x/proof/module/tx_create_claim_test.go | 3 + x/proof/module/tx_submit_proof.go | 65 + x/proof/module/tx_submit_proof_test.go | 3 + x/proof/simulation/create_claim.go | 29 + x/proof/simulation/helpers.go | 15 + x/proof/simulation/submit_proof.go | 29 + x/proof/types/codec.go | 23 + x/proof/types/errors.go | 26 + x/proof/types/expected_keepers.go | 33 + x/proof/types/genesis.go | 61 + x/proof/types/genesis_test.go | 139 + x/proof/types/key_claim.go | 36 + x/proof/types/key_proof.go | 36 + x/proof/types/keys.go | 29 + x/proof/types/message_create_claim.go | 52 + x/proof/types/message_create_claim_test.go | 109 + x/proof/types/message_submit_proof.go | 50 + x/proof/types/message_submit_proof_test.go | 103 + x/proof/types/msg_update_params.go | 21 + x/proof/types/params.go | 32 + x/proof/types/query_validation.go | 94 + x/proof/types/types.go | 1 + x/service/keeper/keeper.go | 58 + x/service/keeper/msg_server.go | 17 + x/service/keeper/msg_server_add_service.go | 86 + .../keeper/msg_server_add_service_test.go | 197 + x/service/keeper/msg_server_test.go | 24 + x/service/keeper/msg_update_params.go | 23 + x/service/keeper/msg_update_params_test.go | 64 + x/service/keeper/params.go | 33 + x/service/keeper/params_test.go | 18 + x/service/keeper/query.go | 7 + x/service/keeper/query_params.go | 20 + x/service/keeper/query_params_test.go | 20 + x/service/keeper/query_service.go | 60 + x/service/keeper/query_service_test.go | 124 + x/service/keeper/service.go | 70 + x/service/keeper/service_test.go | 79 + x/service/module/autocli.go | 51 + x/service/module/genesis.go | 29 + x/service/module/genesis_test.go | 42 + x/service/module/module.go | 215 + x/service/module/simulation.go | 87 + x/service/module/tx.go | 36 + x/service/module/tx_add_service.go | 51 + x/service/module/tx_add_service_test.go | 144 + x/service/simulation/add_service.go | 29 + x/service/simulation/helpers.go | 15 + x/service/types/codec.go | 20 + x/service/types/errors.go | 21 + x/service/types/expected_keepers.go | 33 + x/service/types/genesis.go | 40 + x/service/types/genesis_test.go | 94 + x/service/types/key_service.go | 21 + x/service/types/keys.go | 20 + x/service/types/message_add_service.go | 36 + x/service/types/message_add_service_test.go | 58 + x/service/types/msg_update_params.go | 21 + x/service/types/params.go | 74 + x/service/types/types.go | 1 + x/session/keeper/block_hash.go | 19 +- x/session/keeper/keeper.go | 86 + x/session/keeper/msg_server.go | 17 + x/session/keeper/msg_server_test.go | 24 + x/session/keeper/msg_update_params.go | 23 + x/session/keeper/msg_update_params_test.go | 64 + x/session/keeper/params.go | 33 + x/session/keeper/params_test.go | 18 + x/session/keeper/query.go | 7 + x/session/keeper/query_get_session.go | 45 + x/session/keeper/query_get_session_test.go | 166 + x/session/keeper/query_params.go | 20 + x/session/keeper/query_params_test.go | 20 + x/session/keeper/session_hydrator.go | 306 + x/session/keeper/session_hydrator_test.go | 359 + x/session/module/autocli.go | 48 + x/session/module/genesis.go | 24 + x/session/module/genesis_test.go | 42 + x/session/module/helpers_test.go | 45 + x/session/module/module.go | 221 + x/session/module/query.go | 31 + x/session/module/query_get_session.go | 63 + x/session/module/query_get_session_test.go | 198 + x/session/module/query_params.go | 36 + x/session/module/simulation.go | 64 + x/session/module/tx.go | 31 + x/session/simulation/helpers.go | 15 + x/session/types/codec.go | 17 + x/session/types/errors.go | 21 + x/session/types/expected_keepers.go | 37 + x/session/types/genesis.go | 24 + x/session/types/key_block_hash.go | 24 + x/session/types/keys.go | 20 + x/session/types/msg_update_params.go | 21 + x/session/types/params.go | 32 + x/session/types/query_get_session_request.go | 39 + x/session/types/types.go | 1 + x/shared/helpers/service.go | 86 + x/shared/helpers/service_configs.go | 81 + x/shared/helpers/service_test.go | 261 + x/shared/types/types.go | 3 + x/supplier/config/errors.go | 15 + x/supplier/config/supplier_configs_reader.go | 192 + .../config/supplier_configs_reader_test.go | 1 + x/supplier/keeper/keeper.go | 58 + x/supplier/keeper/msg_server.go | 17 + .../keeper/msg_server_stake_supplier.go | 103 + .../keeper/msg_server_stake_supplier_test.go | 235 + x/supplier/keeper/msg_server_test.go | 24 + .../keeper/msg_server_unstake_supplier.go | 52 + .../msg_server_unstake_supplier_test.go | 89 + x/supplier/keeper/msg_update_params.go | 23 + x/supplier/keeper/msg_update_params_test.go | 64 + x/supplier/keeper/params.go | 33 + x/supplier/keeper/params_test.go | 18 + x/supplier/keeper/query.go | 7 + x/supplier/keeper/query_params.go | 20 + x/supplier/keeper/query_params_test.go | 20 + x/supplier/keeper/query_supplier.go | 60 + x/supplier/keeper/query_supplier_test.go | 124 + x/supplier/keeper/supplier.go | 72 + x/supplier/keeper/supplier_test.go | 97 + x/supplier/module/autocli.go | 58 + x/supplier/module/genesis.go | 29 + x/supplier/module/genesis_test.go | 72 + x/supplier/module/helpers_test.go | 28 + x/supplier/module/module.go | 215 + x/supplier/module/query.go | 29 + x/supplier/module/query_params.go | 36 + x/supplier/module/query_supplier.go | 78 + x/supplier/module/query_supplier_test.go | 141 + x/supplier/module/simulation.go | 110 + x/supplier/module/tx.go | 37 + x/supplier/module/tx_stake_supplier.go | 67 + x/supplier/module/tx_stake_supplier_test.go | 297 + x/supplier/module/tx_unstake_supplier.go | 42 + x/supplier/module/tx_unstake_supplier_test.go | 97 + x/supplier/simulation/helpers.go | 15 + x/supplier/simulation/stake_supplier.go | 29 + x/supplier/simulation/unstake_supplier.go | 29 + x/supplier/types/codec.go | 23 + x/supplier/types/errors.go | 27 + x/supplier/types/expected_keepers.go | 27 + x/supplier/types/genesis.go | 67 + x/supplier/types/genesis_test.go | 314 + x/supplier/types/key_supplier.go | 23 + x/supplier/types/keys.go | 20 + x/supplier/types/message_stake_supplier.go | 57 + .../types/message_stake_supplier_test.go | 297 + x/supplier/types/message_unstake_supplier.go | 22 + .../types/message_unstake_supplier_test.go | 44 + x/supplier/types/msg_update_params.go | 21 + x/supplier/types/params.go | 32 + x/supplier/types/types.go | 1 + x/tokenomics/keeper/keeper.go | 72 + x/tokenomics/keeper/msg_server.go | 17 + x/tokenomics/keeper/msg_server_test.go | 24 + x/tokenomics/keeper/msg_update_params.go | 42 + x/tokenomics/keeper/msg_update_params_test.go | 136 + x/tokenomics/keeper/params.go | 33 + x/tokenomics/keeper/query.go | 7 + x/tokenomics/keeper/query_params.go | 20 + x/tokenomics/keeper/query_params_test.go | 30 + .../keeper/settle_session_accounting.go | 160 + .../keeper/settle_session_accounting_test.go | 30 +- x/tokenomics/module/autocli.go | 39 + x/tokenomics/module/genesis.go | 24 + x/tokenomics/module/genesis_test.go | 29 + x/tokenomics/module/helpers_test.go | 32 + x/tokenomics/module/module.go | 220 + x/tokenomics/module/query.go | 28 + x/tokenomics/module/query_params.go | 36 + x/tokenomics/module/simulation.go | 64 + x/tokenomics/module/tx.go | 26 + x/tokenomics/module/tx_update_params.go | 59 + x/tokenomics/module/tx_update_params_test.go | 68 + x/tokenomics/simulation/helpers.go | 15 + x/tokenomics/types/codec.go | 17 + x/tokenomics/types/errors.go | 28 + x/tokenomics/types/expected_keepers.go | 42 + x/tokenomics/types/genesis.go | 24 + x/tokenomics/types/genesis_test.go | 53 + x/tokenomics/types/keys.go | 20 + x/tokenomics/types/message_update_params.go | 44 + .../types/message_update_params_test.go | 56 + x/tokenomics/types/params.go | 66 + x/tokenomics/types/types.go | 1 + 478 files changed, 89775 insertions(+), 52 deletions(-) create mode 100644 api/poktroll/application/application.pulsar.go create mode 100644 api/poktroll/application/event.pulsar.go create mode 100644 api/poktroll/application/genesis.pulsar.go create mode 100644 api/poktroll/application/module/module.pulsar.go create mode 100644 api/poktroll/application/params.pulsar.go create mode 100644 api/poktroll/application/query.pulsar.go create mode 100644 api/poktroll/application/tx.pulsar.go create mode 100644 api/poktroll/gateway/gateway.pulsar.go create mode 100644 api/poktroll/gateway/genesis.pulsar.go create mode 100644 api/poktroll/gateway/module/module.pulsar.go create mode 100644 api/poktroll/gateway/params.pulsar.go create mode 100644 api/poktroll/gateway/query.pulsar.go create mode 100644 api/poktroll/gateway/tx.pulsar.go create mode 100644 api/poktroll/proof/claim.pulsar.go create mode 100644 api/poktroll/proof/genesis.pulsar.go create mode 100644 api/poktroll/proof/module/module.pulsar.go create mode 100644 api/poktroll/proof/params.pulsar.go create mode 100644 api/poktroll/proof/proof.pulsar.go create mode 100644 api/poktroll/proof/query.pulsar.go create mode 100644 api/poktroll/proof/tx.pulsar.go create mode 100644 api/poktroll/service/genesis.pulsar.go create mode 100644 api/poktroll/service/module/module.pulsar.go create mode 100644 api/poktroll/service/params.pulsar.go create mode 100644 api/poktroll/service/query.pulsar.go create mode 100644 api/poktroll/service/service.pulsar.go create mode 100644 api/poktroll/service/tx.pulsar.go create mode 100644 api/poktroll/session/genesis.pulsar.go create mode 100644 api/poktroll/session/module/module.pulsar.go create mode 100644 api/poktroll/session/params.pulsar.go create mode 100644 api/poktroll/session/query.pulsar.go create mode 100644 api/poktroll/session/session.pulsar.go create mode 100644 api/poktroll/session/tx.pulsar.go create mode 100644 api/poktroll/shared/service.pulsar.go create mode 100644 api/poktroll/shared/supplier.pulsar.go create mode 100644 api/poktroll/supplier/genesis.pulsar.go create mode 100644 api/poktroll/supplier/module/module.pulsar.go create mode 100644 api/poktroll/supplier/params.pulsar.go create mode 100644 api/poktroll/supplier/query.pulsar.go create mode 100644 api/poktroll/supplier/tx.pulsar.go create mode 100644 api/poktroll/tokenomics/genesis.pulsar.go create mode 100644 api/poktroll/tokenomics/module/module.pulsar.go create mode 100644 api/poktroll/tokenomics/params.pulsar.go create mode 100644 api/poktroll/tokenomics/query.pulsar.go create mode 100644 api/poktroll/tokenomics/tx.pulsar.go create mode 100644 pkg/polylog/LICENSE create mode 100644 pkg/polylog/context.go create mode 100644 pkg/polylog/context_example_test.go create mode 100644 pkg/polylog/context_test.go create mode 100644 pkg/polylog/godoc.go create mode 100644 pkg/polylog/interface.go create mode 100644 pkg/polylog/polyzero/default.go create mode 100644 pkg/polylog/polyzero/event.go create mode 100644 pkg/polylog/polyzero/godoc.go create mode 100644 pkg/polylog/polyzero/levels.go create mode 100644 pkg/polylog/polyzero/logger.go create mode 100644 pkg/polylog/polyzero/logger_example_test.go create mode 100644 pkg/polylog/polyzero/logger_test.go create mode 100644 pkg/polylog/polyzero/options.go create mode 100644 pkg/polylog/polyzero/test_logger.go create mode 100644 pkg/polylog/types.go create mode 100644 proto/poktroll/application/application.proto create mode 100644 proto/poktroll/application/event.proto create mode 100644 proto/poktroll/application/genesis.proto create mode 100644 proto/poktroll/application/module/module.proto create mode 100644 proto/poktroll/application/params.proto create mode 100644 proto/poktroll/application/query.proto create mode 100644 proto/poktroll/application/tx.proto create mode 100644 proto/poktroll/gateway/gateway.proto create mode 100644 proto/poktroll/gateway/genesis.proto create mode 100644 proto/poktroll/gateway/module/module.proto create mode 100644 proto/poktroll/gateway/params.proto create mode 100644 proto/poktroll/gateway/query.proto create mode 100644 proto/poktroll/gateway/tx.proto create mode 100644 proto/poktroll/proof/claim.proto create mode 100644 proto/poktroll/proof/genesis.proto create mode 100644 proto/poktroll/proof/module/module.proto create mode 100644 proto/poktroll/proof/params.proto create mode 100644 proto/poktroll/proof/proof.proto create mode 100644 proto/poktroll/proof/query.proto create mode 100644 proto/poktroll/proof/tx.proto create mode 100644 proto/poktroll/service/genesis.proto create mode 100644 proto/poktroll/service/module/module.proto create mode 100644 proto/poktroll/service/params.proto create mode 100644 proto/poktroll/service/query.proto create mode 100644 proto/poktroll/service/tx.proto create mode 100644 proto/poktroll/session/genesis.proto create mode 100644 proto/poktroll/session/module/module.proto create mode 100644 proto/poktroll/session/params.proto create mode 100644 proto/poktroll/session/query.proto create mode 100644 proto/poktroll/session/session.proto create mode 100644 proto/poktroll/session/tx.proto create mode 100644 proto/poktroll/shared/service.proto create mode 100644 proto/poktroll/shared/supplier.proto create mode 100644 proto/poktroll/supplier/genesis.proto create mode 100644 proto/poktroll/supplier/module/module.proto create mode 100644 proto/poktroll/supplier/params.proto create mode 100644 proto/poktroll/supplier/query.proto create mode 100644 proto/poktroll/supplier/tx.proto create mode 100644 proto/poktroll/tokenomics/genesis.proto create mode 100644 proto/poktroll/tokenomics/module/module.proto create mode 100644 proto/poktroll/tokenomics/params.proto create mode 100644 proto/poktroll/tokenomics/query.proto create mode 100644 proto/poktroll/tokenomics/tx.proto create mode 100644 testutil/application/mocks/mocks.go create mode 100644 testutil/gateway/mocks/mocks.go create mode 100644 testutil/keeper/application.go create mode 100644 testutil/keeper/gateway.go create mode 100644 testutil/keeper/proof.go create mode 100644 testutil/keeper/service.go create mode 100644 testutil/keeper/session.go create mode 100644 testutil/keeper/supplier.go create mode 100644 testutil/keeper/tokenomics.go create mode 100644 testutil/proof/fixtures.go create mode 100644 testutil/proof/mocks/mocks.go create mode 100644 testutil/service/mocks/mocks.go create mode 100644 testutil/session/mocks/mocks.go create mode 100644 testutil/supplier/mocks/mocks.go create mode 100644 testutil/testkeyring/accounts.go create mode 100644 testutil/testkeyring/accounts_table.go create mode 100644 testutil/testkeyring/gen_accounts/gen.go create mode 100644 testutil/testkeyring/gen_accounts/template.go create mode 100644 testutil/testkeyring/keyring.go create mode 100644 testutil/testpolylog/event.go create mode 100644 testutil/testpolylog/logger.go create mode 100644 testutil/tokenomics/mocks/mocks.go create mode 100644 testutil/yaml/yaml.go create mode 100644 x/application/keeper/application.go create mode 100644 x/application/keeper/application_test.go create mode 100644 x/application/keeper/keeper.go create mode 100644 x/application/keeper/msg_server.go create mode 100644 x/application/keeper/msg_server_delegate_to_gateway.go create mode 100644 x/application/keeper/msg_server_delegate_to_gateway_test.go create mode 100644 x/application/keeper/msg_server_stake_application.go create mode 100644 x/application/keeper/msg_server_stake_application_test.go create mode 100644 x/application/keeper/msg_server_test.go create mode 100644 x/application/keeper/msg_server_undelegate_from_gateway.go create mode 100644 x/application/keeper/msg_server_undelegate_from_gateway_test.go create mode 100644 x/application/keeper/msg_server_unstake_application.go create mode 100644 x/application/keeper/msg_server_unstake_application_test.go create mode 100644 x/application/keeper/msg_update_params.go create mode 100644 x/application/keeper/msg_update_params_test.go create mode 100644 x/application/keeper/params.go create mode 100644 x/application/keeper/params_test.go create mode 100644 x/application/keeper/query.go create mode 100644 x/application/keeper/query_application.go create mode 100644 x/application/keeper/query_application_test.go create mode 100644 x/application/keeper/query_params.go create mode 100644 x/application/keeper/query_params_test.go create mode 100644 x/application/module/autocli.go create mode 100644 x/application/module/config/application_configs_reader.go create mode 100644 x/application/module/config/application_configs_reader_test.go create mode 100644 x/application/module/config/errors.go create mode 100644 x/application/module/genesis.go create mode 100644 x/application/module/genesis_test.go create mode 100644 x/application/module/helpers_test.go create mode 100644 x/application/module/module.go create mode 100644 x/application/module/query.go create mode 100644 x/application/module/query_application.go create mode 100644 x/application/module/query_application_test.go create mode 100644 x/application/module/query_params.go create mode 100644 x/application/module/simulation.go create mode 100644 x/application/module/tx.go create mode 100644 x/application/module/tx_delegate_to_gateway.go create mode 100644 x/application/module/tx_delegate_to_gateway_test.go create mode 100644 x/application/module/tx_stake_application.go create mode 100644 x/application/module/tx_stake_application_test.go create mode 100644 x/application/module/tx_undelegate_from_gateway.go create mode 100644 x/application/module/tx_undelegate_from_gateway_test.go create mode 100644 x/application/module/tx_unstake_application.go create mode 100644 x/application/module/tx_unstake_application_test.go create mode 100644 x/application/simulation/delegate_to_gateway.go create mode 100644 x/application/simulation/helpers.go create mode 100644 x/application/simulation/stake_application.go create mode 100644 x/application/simulation/undelegate_from_gateway.go create mode 100644 x/application/simulation/unstake_application.go create mode 100644 x/application/types/codec.go create mode 100644 x/application/types/errors.go create mode 100644 x/application/types/expected_keepers.go create mode 100644 x/application/types/genesis.go create mode 100644 x/application/types/key_application.go create mode 100644 x/application/types/keys.go create mode 100644 x/application/types/message_delegate_to_gateway.go create mode 100644 x/application/types/message_delegate_to_gateway_test.go create mode 100644 x/application/types/message_stake_application.go create mode 100644 x/application/types/message_stake_application_test.go create mode 100644 x/application/types/message_undelegate_from_gateway.go create mode 100644 x/application/types/message_undelegate_from_gateway_test.go create mode 100644 x/application/types/message_unstake_application.go create mode 100644 x/application/types/message_unstake_application_test.go create mode 100644 x/application/types/msg_update_params.go create mode 100644 x/application/types/params.go create mode 100644 x/application/types/types.go create mode 100644 x/gateway/keeper/gateway.go create mode 100644 x/gateway/keeper/gateway_test.go create mode 100644 x/gateway/keeper/keeper.go create mode 100644 x/gateway/keeper/msg_server.go create mode 100644 x/gateway/keeper/msg_server_stake_gateway.go create mode 100644 x/gateway/keeper/msg_server_stake_gateway_test.go create mode 100644 x/gateway/keeper/msg_server_test.go create mode 100644 x/gateway/keeper/msg_server_unstake_gateway.go create mode 100644 x/gateway/keeper/msg_server_unstake_gateway_test.go create mode 100644 x/gateway/keeper/msg_update_params.go create mode 100644 x/gateway/keeper/msg_update_params_test.go create mode 100644 x/gateway/keeper/params.go create mode 100644 x/gateway/keeper/params_test.go create mode 100644 x/gateway/keeper/query.go create mode 100644 x/gateway/keeper/query_gateway.go create mode 100644 x/gateway/keeper/query_gateway_test.go create mode 100644 x/gateway/keeper/query_params.go create mode 100644 x/gateway/keeper/query_params_test.go create mode 100644 x/gateway/module/autocli.go create mode 100644 x/gateway/module/config/errors.go create mode 100644 x/gateway/module/config/gateway_config_reader.go create mode 100644 x/gateway/module/config/gateway_config_reader_test.go create mode 100644 x/gateway/module/genesis.go create mode 100644 x/gateway/module/genesis_test.go create mode 100644 x/gateway/module/helpers_test.go create mode 100644 x/gateway/module/module.go create mode 100644 x/gateway/module/query.go create mode 100644 x/gateway/module/query_gateway.go create mode 100644 x/gateway/module/query_gateway_test.go create mode 100644 x/gateway/module/query_params.go create mode 100644 x/gateway/module/simulation.go create mode 100644 x/gateway/module/tx.go create mode 100644 x/gateway/module/tx_stake_gateway.go create mode 100644 x/gateway/module/tx_stake_gateway_test.go create mode 100644 x/gateway/module/tx_unstake_gateway.go create mode 100644 x/gateway/module/tx_unstake_gateway_test.go create mode 100644 x/gateway/simulation/helpers.go create mode 100644 x/gateway/simulation/stake_gateway.go create mode 100644 x/gateway/simulation/unstake_gateway.go create mode 100644 x/gateway/types/codec.go create mode 100644 x/gateway/types/errors.go create mode 100644 x/gateway/types/expected_keepers.go create mode 100644 x/gateway/types/genesis.go create mode 100644 x/gateway/types/key_gateway.go create mode 100644 x/gateway/types/keys.go create mode 100644 x/gateway/types/message_stake_gateway.go create mode 100644 x/gateway/types/message_stake_gateway_test.go create mode 100644 x/gateway/types/message_unstake_gateway.go create mode 100644 x/gateway/types/message_unstake_gateway_test.go create mode 100644 x/gateway/types/msg_update_params.go create mode 100644 x/gateway/types/params.go create mode 100644 x/gateway/types/types.go create mode 100644 x/proof/keeper/claim.go create mode 100644 x/proof/keeper/claim_test.go create mode 100644 x/proof/keeper/keeper.go create mode 100644 x/proof/keeper/msg_server.go create mode 100644 x/proof/keeper/msg_server_create_claim.go create mode 100644 x/proof/keeper/msg_server_create_claim_test.go create mode 100644 x/proof/keeper/msg_server_submit_proof.go create mode 100644 x/proof/keeper/msg_server_test.go create mode 100644 x/proof/keeper/msg_update_params.go create mode 100644 x/proof/keeper/msg_update_params_test.go create mode 100644 x/proof/keeper/params.go create mode 100644 x/proof/keeper/params_test.go create mode 100644 x/proof/keeper/proof.go create mode 100644 x/proof/keeper/proof_test.go create mode 100644 x/proof/keeper/query.go create mode 100644 x/proof/keeper/query_claim.go create mode 100644 x/proof/keeper/query_claim_test.go create mode 100644 x/proof/keeper/query_params.go create mode 100644 x/proof/keeper/query_params_test.go create mode 100644 x/proof/keeper/query_proof.go create mode 100644 x/proof/keeper/query_proof_test.go create mode 100644 x/proof/keeper/session.go create mode 100644 x/proof/module/autocli.go create mode 100644 x/proof/module/flags.go create mode 100644 x/proof/module/genesis.go create mode 100644 x/proof/module/genesis_test.go create mode 100644 x/proof/module/helpers_test.go create mode 100644 x/proof/module/module.go create mode 100644 x/proof/module/query.go create mode 100644 x/proof/module/query_claim.go create mode 100644 x/proof/module/query_claim_test.go create mode 100644 x/proof/module/query_params.go create mode 100644 x/proof/module/query_proof.go create mode 100644 x/proof/module/query_proof_test.go create mode 100644 x/proof/module/simulation.go create mode 100644 x/proof/module/tx.go create mode 100644 x/proof/module/tx_create_claim.go create mode 100644 x/proof/module/tx_create_claim_test.go create mode 100644 x/proof/module/tx_submit_proof.go create mode 100644 x/proof/module/tx_submit_proof_test.go create mode 100644 x/proof/simulation/create_claim.go create mode 100644 x/proof/simulation/helpers.go create mode 100644 x/proof/simulation/submit_proof.go create mode 100644 x/proof/types/codec.go create mode 100644 x/proof/types/errors.go create mode 100644 x/proof/types/expected_keepers.go create mode 100644 x/proof/types/genesis.go create mode 100644 x/proof/types/genesis_test.go create mode 100644 x/proof/types/key_claim.go create mode 100644 x/proof/types/key_proof.go create mode 100644 x/proof/types/keys.go create mode 100644 x/proof/types/message_create_claim.go create mode 100644 x/proof/types/message_create_claim_test.go create mode 100644 x/proof/types/message_submit_proof.go create mode 100644 x/proof/types/message_submit_proof_test.go create mode 100644 x/proof/types/msg_update_params.go create mode 100644 x/proof/types/params.go create mode 100644 x/proof/types/query_validation.go create mode 100644 x/proof/types/types.go create mode 100644 x/service/keeper/keeper.go create mode 100644 x/service/keeper/msg_server.go create mode 100644 x/service/keeper/msg_server_add_service.go create mode 100644 x/service/keeper/msg_server_add_service_test.go create mode 100644 x/service/keeper/msg_server_test.go create mode 100644 x/service/keeper/msg_update_params.go create mode 100644 x/service/keeper/msg_update_params_test.go create mode 100644 x/service/keeper/params.go create mode 100644 x/service/keeper/params_test.go create mode 100644 x/service/keeper/query.go create mode 100644 x/service/keeper/query_params.go create mode 100644 x/service/keeper/query_params_test.go create mode 100644 x/service/keeper/query_service.go create mode 100644 x/service/keeper/query_service_test.go create mode 100644 x/service/keeper/service.go create mode 100644 x/service/keeper/service_test.go create mode 100644 x/service/module/autocli.go create mode 100644 x/service/module/genesis.go create mode 100644 x/service/module/genesis_test.go create mode 100644 x/service/module/module.go create mode 100644 x/service/module/simulation.go create mode 100644 x/service/module/tx.go create mode 100644 x/service/module/tx_add_service.go create mode 100644 x/service/module/tx_add_service_test.go create mode 100644 x/service/simulation/add_service.go create mode 100644 x/service/simulation/helpers.go create mode 100644 x/service/types/codec.go create mode 100644 x/service/types/errors.go create mode 100644 x/service/types/expected_keepers.go create mode 100644 x/service/types/genesis.go create mode 100644 x/service/types/genesis_test.go create mode 100644 x/service/types/key_service.go create mode 100644 x/service/types/keys.go create mode 100644 x/service/types/message_add_service.go create mode 100644 x/service/types/message_add_service_test.go create mode 100644 x/service/types/msg_update_params.go create mode 100644 x/service/types/params.go create mode 100644 x/service/types/types.go create mode 100644 x/session/keeper/keeper.go create mode 100644 x/session/keeper/msg_server.go create mode 100644 x/session/keeper/msg_server_test.go create mode 100644 x/session/keeper/msg_update_params.go create mode 100644 x/session/keeper/msg_update_params_test.go create mode 100644 x/session/keeper/params.go create mode 100644 x/session/keeper/params_test.go create mode 100644 x/session/keeper/query.go create mode 100644 x/session/keeper/query_get_session.go create mode 100644 x/session/keeper/query_get_session_test.go create mode 100644 x/session/keeper/query_params.go create mode 100644 x/session/keeper/query_params_test.go create mode 100644 x/session/keeper/session_hydrator.go create mode 100644 x/session/keeper/session_hydrator_test.go create mode 100644 x/session/module/autocli.go create mode 100644 x/session/module/genesis.go create mode 100644 x/session/module/genesis_test.go create mode 100644 x/session/module/helpers_test.go create mode 100644 x/session/module/module.go create mode 100644 x/session/module/query.go create mode 100644 x/session/module/query_get_session.go create mode 100644 x/session/module/query_get_session_test.go create mode 100644 x/session/module/query_params.go create mode 100644 x/session/module/simulation.go create mode 100644 x/session/module/tx.go create mode 100644 x/session/simulation/helpers.go create mode 100644 x/session/types/codec.go create mode 100644 x/session/types/errors.go create mode 100644 x/session/types/expected_keepers.go create mode 100644 x/session/types/genesis.go create mode 100644 x/session/types/key_block_hash.go create mode 100644 x/session/types/keys.go create mode 100644 x/session/types/msg_update_params.go create mode 100644 x/session/types/params.go create mode 100644 x/session/types/query_get_session_request.go create mode 100644 x/session/types/types.go create mode 100644 x/shared/helpers/service.go create mode 100644 x/shared/helpers/service_configs.go create mode 100644 x/shared/helpers/service_test.go create mode 100644 x/shared/types/types.go create mode 100644 x/supplier/config/errors.go create mode 100644 x/supplier/config/supplier_configs_reader.go create mode 100644 x/supplier/config/supplier_configs_reader_test.go create mode 100644 x/supplier/keeper/keeper.go create mode 100644 x/supplier/keeper/msg_server.go create mode 100644 x/supplier/keeper/msg_server_stake_supplier.go create mode 100644 x/supplier/keeper/msg_server_stake_supplier_test.go create mode 100644 x/supplier/keeper/msg_server_test.go create mode 100644 x/supplier/keeper/msg_server_unstake_supplier.go create mode 100644 x/supplier/keeper/msg_server_unstake_supplier_test.go create mode 100644 x/supplier/keeper/msg_update_params.go create mode 100644 x/supplier/keeper/msg_update_params_test.go create mode 100644 x/supplier/keeper/params.go create mode 100644 x/supplier/keeper/params_test.go create mode 100644 x/supplier/keeper/query.go create mode 100644 x/supplier/keeper/query_params.go create mode 100644 x/supplier/keeper/query_params_test.go create mode 100644 x/supplier/keeper/query_supplier.go create mode 100644 x/supplier/keeper/query_supplier_test.go create mode 100644 x/supplier/keeper/supplier.go create mode 100644 x/supplier/keeper/supplier_test.go create mode 100644 x/supplier/module/autocli.go create mode 100644 x/supplier/module/genesis.go create mode 100644 x/supplier/module/genesis_test.go create mode 100644 x/supplier/module/helpers_test.go create mode 100644 x/supplier/module/module.go create mode 100644 x/supplier/module/query.go create mode 100644 x/supplier/module/query_params.go create mode 100644 x/supplier/module/query_supplier.go create mode 100644 x/supplier/module/query_supplier_test.go create mode 100644 x/supplier/module/simulation.go create mode 100644 x/supplier/module/tx.go create mode 100644 x/supplier/module/tx_stake_supplier.go create mode 100644 x/supplier/module/tx_stake_supplier_test.go create mode 100644 x/supplier/module/tx_unstake_supplier.go create mode 100644 x/supplier/module/tx_unstake_supplier_test.go create mode 100644 x/supplier/simulation/helpers.go create mode 100644 x/supplier/simulation/stake_supplier.go create mode 100644 x/supplier/simulation/unstake_supplier.go create mode 100644 x/supplier/types/codec.go create mode 100644 x/supplier/types/errors.go create mode 100644 x/supplier/types/expected_keepers.go create mode 100644 x/supplier/types/genesis.go create mode 100644 x/supplier/types/genesis_test.go create mode 100644 x/supplier/types/key_supplier.go create mode 100644 x/supplier/types/keys.go create mode 100644 x/supplier/types/message_stake_supplier.go create mode 100644 x/supplier/types/message_stake_supplier_test.go create mode 100644 x/supplier/types/message_unstake_supplier.go create mode 100644 x/supplier/types/message_unstake_supplier_test.go create mode 100644 x/supplier/types/msg_update_params.go create mode 100644 x/supplier/types/params.go create mode 100644 x/supplier/types/types.go create mode 100644 x/tokenomics/keeper/keeper.go create mode 100644 x/tokenomics/keeper/msg_server.go create mode 100644 x/tokenomics/keeper/msg_server_test.go create mode 100644 x/tokenomics/keeper/msg_update_params.go create mode 100644 x/tokenomics/keeper/msg_update_params_test.go create mode 100644 x/tokenomics/keeper/params.go create mode 100644 x/tokenomics/keeper/query.go create mode 100644 x/tokenomics/keeper/query_params.go create mode 100644 x/tokenomics/keeper/query_params_test.go create mode 100644 x/tokenomics/keeper/settle_session_accounting.go create mode 100644 x/tokenomics/module/autocli.go create mode 100644 x/tokenomics/module/genesis.go create mode 100644 x/tokenomics/module/genesis_test.go create mode 100644 x/tokenomics/module/helpers_test.go create mode 100644 x/tokenomics/module/module.go create mode 100644 x/tokenomics/module/query.go create mode 100644 x/tokenomics/module/query_params.go create mode 100644 x/tokenomics/module/simulation.go create mode 100644 x/tokenomics/module/tx.go create mode 100644 x/tokenomics/module/tx_update_params.go create mode 100644 x/tokenomics/module/tx_update_params_test.go create mode 100644 x/tokenomics/simulation/helpers.go create mode 100644 x/tokenomics/types/codec.go create mode 100644 x/tokenomics/types/errors.go create mode 100644 x/tokenomics/types/expected_keepers.go create mode 100644 x/tokenomics/types/genesis.go create mode 100644 x/tokenomics/types/genesis_test.go create mode 100644 x/tokenomics/types/keys.go create mode 100644 x/tokenomics/types/message_update_params.go create mode 100644 x/tokenomics/types/message_update_params_test.go create mode 100644 x/tokenomics/types/params.go create mode 100644 x/tokenomics/types/types.go diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 60d5ee2d5..c327b6617 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -69,3 +69,5 @@ jobs: reporter: github-check level: warning locale: "US" + +# TODO_IMPROVE: Enforce using k.Logger() when logging in the `x/` directory code. \ No newline at end of file diff --git a/Makefile b/Makefile index 9d24bc33d..5f1955457 100644 --- a/Makefile +++ b/Makefile @@ -142,12 +142,25 @@ warn_destructive: ## Print WARNING to the user proto_regen: ## Delete existing protobuf artifacts and regenerate them find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm ignite generate proto-go --yes + $(MAKE) proto_fix_self_import + +.PHONY: proto_fix_self_import +proto_fix_self_import: ## TODO: explain + @for dir in $(wildcard ./api/poktroll/*/); do \ + module=$$(basename $$dir); \ + echo "Processing module $$module"; \ + grep -lRP '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ + echo "Modifying file: $$file"; \ + sed -i -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ + sed -i 's,'$$module'\.,,g' "$$file"; \ + done; \ + done .PHONY: proto_clean_pulsar proto_clean_pulsar: ## TODO: explain... @find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm - ignite generate proto-go --yes + $(MAKE) proto_regen find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' ####################### @@ -177,7 +190,7 @@ localnet_down: ## Delete resources created by localnet .PHONY: localnet_regenesis localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring -# NB: Currently the stake => power calculation is constant; however, cosmos-sdk +# TODO_TECHDEBT: Currently the stake => power calculation is constant; however, cosmos-sdk # intends to make this parameterizable in the future. @echo "Initializing chain..." @set -e ;\ @@ -187,8 +200,8 @@ localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localn cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ ;\ ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ - POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\ - NAME=$$(yq ".validators[0].name" ./config.yml) ;\ + POWER=$$(yq -r ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\ + NAME=$$(yq -r ".validators[0].name" ./config.yml) ;\ echo "Regenerating genesis file with new validator..." ;\ jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' ${HOME}/.poktroll/config/genesis.json > temp.json ;\ mv temp.json ${HOME}/.poktroll/config/genesis.json ;\ @@ -245,12 +258,13 @@ itest: check_go_version ## Run tests iteratively (see usage for more) .PHONY: go_mockgen go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all the modules. find . -name "*_mock.go" | xargs --no-run-if-empty rm - # go generate ./x/application/types/ - # go generate ./x/gateway/types/ - # go generate ./x/supplier/types/ - # go generate ./x/session/types/ - # go generate ./x/service/types/ - # go generate ./x/tokenomics/types/ + go generate ./x/application/types/ + go generate ./x/gateway/types/ + go generate ./x/supplier/types/ + go generate ./x/session/types/ + go generate ./x/service/types/ + go generate ./x/proof/types/ + go generate ./x/tokenomics/types/ go generate ./pkg/client/interface.go go generate ./pkg/miner/interface.go go generate ./pkg/relayer/interface.go @@ -690,4 +704,4 @@ act_list: check_act ## List all github actions that can be executed locally with act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so: `GITHUB_TOKEN=$(gh auth token) make act_reviewdog` $(eval CONTAINER_ARCH := $(shell make -s detect_arch)) @echo "Detected architecture: $(CONTAINER_ARCH)" - act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) + act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) \ No newline at end of file diff --git a/api/poktroll/application/application.pulsar.go b/api/poktroll/application/application.pulsar.go new file mode 100644 index 000000000..24ca85c5c --- /dev/null +++ b/api/poktroll/application/application.pulsar.go @@ -0,0 +1,966 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package application + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_Application_3_list)(nil) + +type _Application_3_list struct { + list *[]*shared.ApplicationServiceConfig +} + +func (x *_Application_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Application_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Application_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.ApplicationServiceConfig) + (*x.list)[i] = concreteValue +} + +func (x *_Application_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.ApplicationServiceConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Application_3_list) AppendMutable() protoreflect.Value { + v := new(shared.ApplicationServiceConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Application_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Application_3_list) NewElement() protoreflect.Value { + v := new(shared.ApplicationServiceConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Application_3_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_Application_4_list)(nil) + +type _Application_4_list struct { + list *[]string +} + +func (x *_Application_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Application_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_Application_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_Application_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_Application_4_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message Application at list field DelegateeGatewayAddresses as it is not of Message kind")) +} + +func (x *_Application_4_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_Application_4_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_Application_4_list) IsValid() bool { + return x.list != nil +} + +var ( + md_Application protoreflect.MessageDescriptor + fd_Application_address protoreflect.FieldDescriptor + fd_Application_stake protoreflect.FieldDescriptor + fd_Application_service_configs protoreflect.FieldDescriptor + fd_Application_delegatee_gateway_addresses protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_application_proto_init() + md_Application = File_poktroll_application_application_proto.Messages().ByName("Application") + fd_Application_address = md_Application.Fields().ByName("address") + fd_Application_stake = md_Application.Fields().ByName("stake") + fd_Application_service_configs = md_Application.Fields().ByName("service_configs") + fd_Application_delegatee_gateway_addresses = md_Application.Fields().ByName("delegatee_gateway_addresses") +} + +var _ protoreflect.Message = (*fastReflection_Application)(nil) + +type fastReflection_Application Application + +func (x *Application) ProtoReflect() protoreflect.Message { + return (*fastReflection_Application)(x) +} + +func (x *Application) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_application_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Application_messageType fastReflection_Application_messageType +var _ protoreflect.MessageType = fastReflection_Application_messageType{} + +type fastReflection_Application_messageType struct{} + +func (x fastReflection_Application_messageType) Zero() protoreflect.Message { + return (*fastReflection_Application)(nil) +} +func (x fastReflection_Application_messageType) New() protoreflect.Message { + return new(fastReflection_Application) +} +func (x fastReflection_Application_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Application +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Application) Descriptor() protoreflect.MessageDescriptor { + return md_Application +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Application) Type() protoreflect.MessageType { + return _fastReflection_Application_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Application) New() protoreflect.Message { + return new(fastReflection_Application) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Application) Interface() protoreflect.ProtoMessage { + return (*Application)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Application) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_Application_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_Application_stake, value) { + return + } + } + if len(x.ServiceConfigs) != 0 { + value := protoreflect.ValueOfList(&_Application_3_list{list: &x.ServiceConfigs}) + if !f(fd_Application_service_configs, value) { + return + } + } + if len(x.DelegateeGatewayAddresses) != 0 { + value := protoreflect.ValueOfList(&_Application_4_list{list: &x.DelegateeGatewayAddresses}) + if !f(fd_Application_delegatee_gateway_addresses, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Application) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.Application.address": + return x.Address != "" + case "poktroll.application.Application.stake": + return x.Stake != nil + case "poktroll.application.Application.service_configs": + return len(x.ServiceConfigs) != 0 + case "poktroll.application.Application.delegatee_gateway_addresses": + return len(x.DelegateeGatewayAddresses) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Application")) + } + panic(fmt.Errorf("message poktroll.application.Application does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Application) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.Application.address": + x.Address = "" + case "poktroll.application.Application.stake": + x.Stake = nil + case "poktroll.application.Application.service_configs": + x.ServiceConfigs = nil + case "poktroll.application.Application.delegatee_gateway_addresses": + x.DelegateeGatewayAddresses = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Application")) + } + panic(fmt.Errorf("message poktroll.application.Application does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Application) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.Application.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.application.Application.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.application.Application.service_configs": + if len(x.ServiceConfigs) == 0 { + return protoreflect.ValueOfList(&_Application_3_list{}) + } + listValue := &_Application_3_list{list: &x.ServiceConfigs} + return protoreflect.ValueOfList(listValue) + case "poktroll.application.Application.delegatee_gateway_addresses": + if len(x.DelegateeGatewayAddresses) == 0 { + return protoreflect.ValueOfList(&_Application_4_list{}) + } + listValue := &_Application_4_list{list: &x.DelegateeGatewayAddresses} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Application")) + } + panic(fmt.Errorf("message poktroll.application.Application does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Application) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.Application.address": + x.Address = value.Interface().(string) + case "poktroll.application.Application.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.application.Application.service_configs": + lv := value.List() + clv := lv.(*_Application_3_list) + x.ServiceConfigs = *clv.list + case "poktroll.application.Application.delegatee_gateway_addresses": + lv := value.List() + clv := lv.(*_Application_4_list) + x.DelegateeGatewayAddresses = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Application")) + } + panic(fmt.Errorf("message poktroll.application.Application does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Application) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.Application.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.application.Application.service_configs": + if x.ServiceConfigs == nil { + x.ServiceConfigs = []*shared.ApplicationServiceConfig{} + } + value := &_Application_3_list{list: &x.ServiceConfigs} + return protoreflect.ValueOfList(value) + case "poktroll.application.Application.delegatee_gateway_addresses": + if x.DelegateeGatewayAddresses == nil { + x.DelegateeGatewayAddresses = []string{} + } + value := &_Application_4_list{list: &x.DelegateeGatewayAddresses} + return protoreflect.ValueOfList(value) + case "poktroll.application.Application.address": + panic(fmt.Errorf("field address of message poktroll.application.Application is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Application")) + } + panic(fmt.Errorf("message poktroll.application.Application does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Application) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.Application.address": + return protoreflect.ValueOfString("") + case "poktroll.application.Application.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.application.Application.service_configs": + list := []*shared.ApplicationServiceConfig{} + return protoreflect.ValueOfList(&_Application_3_list{list: &list}) + case "poktroll.application.Application.delegatee_gateway_addresses": + list := []string{} + return protoreflect.ValueOfList(&_Application_4_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Application")) + } + panic(fmt.Errorf("message poktroll.application.Application does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Application) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.Application", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Application) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Application) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Application) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Application) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Application) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.ServiceConfigs) > 0 { + for _, e := range x.ServiceConfigs { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.DelegateeGatewayAddresses) > 0 { + for _, s := range x.DelegateeGatewayAddresses { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Application) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.DelegateeGatewayAddresses) > 0 { + for iNdEx := len(x.DelegateeGatewayAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.DelegateeGatewayAddresses[iNdEx]) + copy(dAtA[i:], x.DelegateeGatewayAddresses[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegateeGatewayAddresses[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(x.ServiceConfigs) > 0 { + for iNdEx := len(x.ServiceConfigs) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ServiceConfigs[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Application) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Application: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Application: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceConfigs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceConfigs = append(x.ServiceConfigs, &shared.ApplicationServiceConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ServiceConfigs[len(x.ServiceConfigs)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegateeGatewayAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.DelegateeGatewayAddresses = append(x.DelegateeGatewayAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/application.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Application defines the type used to store an on-chain definition and state for an application +type Application struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the application has staked + ServiceConfigs []*shared.ApplicationServiceConfig `protobuf:"bytes,3,rep,name=service_configs,json=serviceConfigs,proto3" json:"service_configs,omitempty"` // The list of services this appliccation is configured to request service for + DelegateeGatewayAddresses []string `protobuf:"bytes,4,rep,name=delegatee_gateway_addresses,json=delegateeGatewayAddresses,proto3" json:"delegatee_gateway_addresses,omitempty"` // The Bech32 encoded addresses for all delegatee Gateways, in a non-nullable slice +} + +func (x *Application) Reset() { + *x = Application{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_application_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Application) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Application) ProtoMessage() {} + +// Deprecated: Use Application.ProtoReflect.Descriptor instead. +func (*Application) Descriptor() ([]byte, []int) { + return file_poktroll_application_application_proto_rawDescGZIP(), []int{0} +} + +func (x *Application) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Application) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *Application) GetServiceConfigs() []*shared.ApplicationServiceConfig { + if x != nil { + return x.ServiceConfigs + } + return nil +} + +func (x *Application) GetDelegateeGatewayAddresses() []string { + if x != nil { + return x.DelegateeGatewayAddresses + } + return nil +} + +var File_poktroll_application_application_proto protoreflect.FileDescriptor + +var file_poktroll_application_application_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x14, + 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, + 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa4, + 0x02, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x5c, 0x0a, 0x1b, 0x64, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x65, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x42, 0x1c, 0xc8, 0xde, + 0x1f, 0x00, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x19, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x42, 0xc4, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x42, 0x10, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, + 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_application_proto_rawDescOnce sync.Once + file_poktroll_application_application_proto_rawDescData = file_poktroll_application_application_proto_rawDesc +) + +func file_poktroll_application_application_proto_rawDescGZIP() []byte { + file_poktroll_application_application_proto_rawDescOnce.Do(func() { + file_poktroll_application_application_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_application_proto_rawDescData) + }) + return file_poktroll_application_application_proto_rawDescData +} + +var file_poktroll_application_application_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_application_application_proto_goTypes = []interface{}{ + (*Application)(nil), // 0: poktroll.application.Application + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin + (*shared.ApplicationServiceConfig)(nil), // 2: poktroll.shared.ApplicationServiceConfig +} +var file_poktroll_application_application_proto_depIdxs = []int32{ + 1, // 0: poktroll.application.Application.stake:type_name -> cosmos.base.v1beta1.Coin + 2, // 1: poktroll.application.Application.service_configs:type_name -> poktroll.shared.ApplicationServiceConfig + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_application_application_proto_init() } +func file_poktroll_application_application_proto_init() { + if File_poktroll_application_application_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_application_application_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Application); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_application_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_application_application_proto_goTypes, + DependencyIndexes: file_poktroll_application_application_proto_depIdxs, + MessageInfos: file_poktroll_application_application_proto_msgTypes, + }.Build() + File_poktroll_application_application_proto = out.File + file_poktroll_application_application_proto_rawDesc = nil + file_poktroll_application_application_proto_goTypes = nil + file_poktroll_application_application_proto_depIdxs = nil +} diff --git a/api/poktroll/application/event.pulsar.go b/api/poktroll/application/event.pulsar.go new file mode 100644 index 000000000..9a53ee35e --- /dev/null +++ b/api/poktroll/application/event.pulsar.go @@ -0,0 +1,657 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package application + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_EventRedelegation protoreflect.MessageDescriptor + fd_EventRedelegation_app_address protoreflect.FieldDescriptor + fd_EventRedelegation_gateway_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_event_proto_init() + md_EventRedelegation = File_poktroll_application_event_proto.Messages().ByName("EventRedelegation") + fd_EventRedelegation_app_address = md_EventRedelegation.Fields().ByName("app_address") + fd_EventRedelegation_gateway_address = md_EventRedelegation.Fields().ByName("gateway_address") +} + +var _ protoreflect.Message = (*fastReflection_EventRedelegation)(nil) + +type fastReflection_EventRedelegation EventRedelegation + +func (x *EventRedelegation) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventRedelegation)(x) +} + +func (x *EventRedelegation) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_event_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventRedelegation_messageType fastReflection_EventRedelegation_messageType +var _ protoreflect.MessageType = fastReflection_EventRedelegation_messageType{} + +type fastReflection_EventRedelegation_messageType struct{} + +func (x fastReflection_EventRedelegation_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventRedelegation)(nil) +} +func (x fastReflection_EventRedelegation_messageType) New() protoreflect.Message { + return new(fastReflection_EventRedelegation) +} +func (x fastReflection_EventRedelegation_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventRedelegation +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventRedelegation) Descriptor() protoreflect.MessageDescriptor { + return md_EventRedelegation +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventRedelegation) Type() protoreflect.MessageType { + return _fastReflection_EventRedelegation_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventRedelegation) New() protoreflect.Message { + return new(fastReflection_EventRedelegation) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventRedelegation) Interface() protoreflect.ProtoMessage { + return (*EventRedelegation)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventRedelegation) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AppAddress != "" { + value := protoreflect.ValueOfString(x.AppAddress) + if !f(fd_EventRedelegation_app_address, value) { + return + } + } + if x.GatewayAddress != "" { + value := protoreflect.ValueOfString(x.GatewayAddress) + if !f(fd_EventRedelegation_gateway_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventRedelegation) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.EventRedelegation.app_address": + return x.AppAddress != "" + case "poktroll.application.EventRedelegation.gateway_address": + return x.GatewayAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.EventRedelegation")) + } + panic(fmt.Errorf("message poktroll.application.EventRedelegation does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRedelegation) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.EventRedelegation.app_address": + x.AppAddress = "" + case "poktroll.application.EventRedelegation.gateway_address": + x.GatewayAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.EventRedelegation")) + } + panic(fmt.Errorf("message poktroll.application.EventRedelegation does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventRedelegation) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.EventRedelegation.app_address": + value := x.AppAddress + return protoreflect.ValueOfString(value) + case "poktroll.application.EventRedelegation.gateway_address": + value := x.GatewayAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.EventRedelegation")) + } + panic(fmt.Errorf("message poktroll.application.EventRedelegation does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRedelegation) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.EventRedelegation.app_address": + x.AppAddress = value.Interface().(string) + case "poktroll.application.EventRedelegation.gateway_address": + x.GatewayAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.EventRedelegation")) + } + panic(fmt.Errorf("message poktroll.application.EventRedelegation does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRedelegation) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.EventRedelegation.app_address": + panic(fmt.Errorf("field app_address of message poktroll.application.EventRedelegation is not mutable")) + case "poktroll.application.EventRedelegation.gateway_address": + panic(fmt.Errorf("field gateway_address of message poktroll.application.EventRedelegation is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.EventRedelegation")) + } + panic(fmt.Errorf("message poktroll.application.EventRedelegation does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventRedelegation) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.EventRedelegation.app_address": + return protoreflect.ValueOfString("") + case "poktroll.application.EventRedelegation.gateway_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.EventRedelegation")) + } + panic(fmt.Errorf("message poktroll.application.EventRedelegation does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventRedelegation) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.EventRedelegation", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventRedelegation) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventRedelegation) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventRedelegation) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventRedelegation) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventRedelegation) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.AppAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.GatewayAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventRedelegation) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.GatewayAddress) > 0 { + i -= len(x.GatewayAddress) + copy(dAtA[i:], x.GatewayAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.GatewayAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.AppAddress) > 0 { + i -= len(x.AppAddress) + copy(dAtA[i:], x.AppAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AppAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventRedelegation) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventRedelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventRedelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AppAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.AppAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GatewayAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GatewayAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/event.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// EventRedelegation is an event emitted whenever an application changes its +// delegatee gateways on chain. This is in response to both a DelegateToGateway +// and UndelegateFromGateway message. +type EventRedelegation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AppAddress string `protobuf:"bytes,1,opt,name=app_address,json=appAddress,proto3" json:"app_address,omitempty"` // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding + GatewayAddress string `protobuf:"bytes,2,opt,name=gateway_address,json=gatewayAddress,proto3" json:"gateway_address,omitempty"` // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding +} + +func (x *EventRedelegation) Reset() { + *x = EventRedelegation{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventRedelegation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventRedelegation) ProtoMessage() {} + +// Deprecated: Use EventRedelegation.ProtoReflect.Descriptor instead. +func (*EventRedelegation) Descriptor() ([]byte, []int) { + return file_poktroll_application_event_proto_rawDescGZIP(), []int{0} +} + +func (x *EventRedelegation) GetAppAddress() string { + if x != nil { + return x.AppAddress + } + return "" +} + +func (x *EventRedelegation) GetGatewayAddress() string { + if x != nil { + return x.GatewayAddress + } + return "" +} + +var File_poktroll_application_event_proto protoreflect.FileDescriptor + +var file_poktroll_application_event_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x11, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x48, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xea, 0xde, 0x1f, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0a, 0x61, + 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x54, 0x0a, 0x0f, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x2b, 0xea, 0xde, 0x1f, 0x0f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x0e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, + 0xbe, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, + 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_event_proto_rawDescOnce sync.Once + file_poktroll_application_event_proto_rawDescData = file_poktroll_application_event_proto_rawDesc +) + +func file_poktroll_application_event_proto_rawDescGZIP() []byte { + file_poktroll_application_event_proto_rawDescOnce.Do(func() { + file_poktroll_application_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_event_proto_rawDescData) + }) + return file_poktroll_application_event_proto_rawDescData +} + +var file_poktroll_application_event_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_application_event_proto_goTypes = []interface{}{ + (*EventRedelegation)(nil), // 0: poktroll.application.EventRedelegation +} +var file_poktroll_application_event_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_application_event_proto_init() } +func file_poktroll_application_event_proto_init() { + if File_poktroll_application_event_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_application_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventRedelegation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_event_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_application_event_proto_goTypes, + DependencyIndexes: file_poktroll_application_event_proto_depIdxs, + MessageInfos: file_poktroll_application_event_proto_msgTypes, + }.Build() + File_poktroll_application_event_proto = out.File + file_poktroll_application_event_proto_rawDesc = nil + file_poktroll_application_event_proto_goTypes = nil + file_poktroll_application_event_proto_depIdxs = nil +} diff --git a/api/poktroll/application/genesis.pulsar.go b/api/poktroll/application/genesis.pulsar.go new file mode 100644 index 000000000..4f327299b --- /dev/null +++ b/api/poktroll/application/genesis.pulsar.go @@ -0,0 +1,754 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package application + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*Application +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Application) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Application) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(Application) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(Application) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_application_list protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_genesis_proto_init() + md_GenesisState = File_poktroll_application_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_application_list = md_GenesisState.Fields().ByName("application_list") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.ApplicationList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.ApplicationList}) + if !f(fd_GenesisState_application_list, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.GenesisState.params": + return x.Params != nil + case "poktroll.GenesisState.application_list": + return len(x.ApplicationList) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.GenesisState")) + } + panic(fmt.Errorf("message poktroll.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.GenesisState.params": + x.Params = nil + case "poktroll.GenesisState.application_list": + x.ApplicationList = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.GenesisState")) + } + panic(fmt.Errorf("message poktroll.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.GenesisState.application_list": + if len(x.ApplicationList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.ApplicationList} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.GenesisState")) + } + panic(fmt.Errorf("message poktroll.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "poktroll.GenesisState.application_list": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.ApplicationList = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.GenesisState")) + } + panic(fmt.Errorf("message poktroll.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.GenesisState.application_list": + if x.ApplicationList == nil { + x.ApplicationList = []*Application{} + } + value := &_GenesisState_2_list{list: &x.ApplicationList} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.GenesisState")) + } + panic(fmt.Errorf("message poktroll.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.GenesisState.application_list": + list := []*Application{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.GenesisState")) + } + panic(fmt.Errorf("message poktroll.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.ApplicationList) > 0 { + for _, e := range x.ApplicationList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ApplicationList) > 0 { + for iNdEx := len(x.ApplicationList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ApplicationList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ApplicationList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ApplicationList = append(x.ApplicationList, &Application{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ApplicationList[len(x.ApplicationList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the application module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + ApplicationList []*Application `protobuf:"bytes,2,rep,name=application_list,json=applicationList,proto3" json:"application_list,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_application_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetApplicationList() []*Application { + if x != nil { + return x.ApplicationList + } + return nil +} + +var File_poktroll_application_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_application_genesis_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, + 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, + 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, + 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x3f, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, + 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x52, 0x0a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4c, 0x69, 0x73, 0x74, 0x42, 0xc0, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, + 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_genesis_proto_rawDescOnce sync.Once + file_poktroll_application_genesis_proto_rawDescData = file_poktroll_application_genesis_proto_rawDesc +) + +func file_poktroll_application_genesis_proto_rawDescGZIP() []byte { + file_poktroll_application_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_application_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_genesis_proto_rawDescData) + }) + return file_poktroll_application_genesis_proto_rawDescData +} + +var file_poktroll_application_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_application_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.GenesisState + (*Params)(nil), // 1: poktroll.Params + (*Application)(nil), // 2: poktroll.Application +} +var file_poktroll_application_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.GenesisState.params:type_name -> poktroll.Params + 2, // 1: poktroll.GenesisState.application_list:type_name -> poktroll.Application + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_application_genesis_proto_init() } +func file_poktroll_application_genesis_proto_init() { + if File_poktroll_application_genesis_proto != nil { + return + } + file_poktroll_application_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_application_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_application_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_application_genesis_proto_depIdxs, + MessageInfos: file_poktroll_application_genesis_proto_msgTypes, + }.Build() + File_poktroll_application_genesis_proto = out.File + file_poktroll_application_genesis_proto_rawDesc = nil + file_poktroll_application_genesis_proto_goTypes = nil + file_poktroll_application_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/application/module/module.pulsar.go b/api/poktroll/application/module/module.pulsar.go new file mode 100644 index 000000000..ae818b3ba --- /dev/null +++ b/api/poktroll/application/module/module.pulsar.go @@ -0,0 +1,580 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_module_module_proto_init() + md_Module = File_poktroll_application_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.module.Module")) + } + panic(fmt.Errorf("message poktroll.application.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.module.Module")) + } + panic(fmt.Errorf("message poktroll.application.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.module.Module")) + } + panic(fmt.Errorf("message poktroll.application.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.module.Module")) + } + panic(fmt.Errorf("message poktroll.application.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.application.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.module.Module")) + } + panic(fmt.Errorf("message poktroll.application.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.module.Module")) + } + panic(fmt.Errorf("message poktroll.application.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_application_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_application_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_application_module_module_proto_rawDesc = []byte{ + 0x0a, 0x28, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5e, 0x0a, 0x06, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x3a, 0x36, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x30, 0x0a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xea, 0x01, 0x0a, 0x1f, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x4d, + 0xaa, 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, + 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x27, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_module_module_proto_rawDescOnce sync.Once + file_poktroll_application_module_module_proto_rawDescData = file_poktroll_application_module_module_proto_rawDesc +) + +func file_poktroll_application_module_module_proto_rawDescGZIP() []byte { + file_poktroll_application_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_application_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_module_module_proto_rawDescData) + }) + return file_poktroll_application_module_module_proto_rawDescData +} + +var file_poktroll_application_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_application_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.application.module.Module +} +var file_poktroll_application_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_application_module_module_proto_init() } +func file_poktroll_application_module_module_proto_init() { + if File_poktroll_application_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_application_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_application_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_application_module_module_proto_depIdxs, + MessageInfos: file_poktroll_application_module_module_proto_msgTypes, + }.Build() + File_poktroll_application_module_module_proto = out.File + file_poktroll_application_module_module_proto_rawDesc = nil + file_poktroll_application_module_module_proto_goTypes = nil + file_poktroll_application_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/application/params.pulsar.go b/api/poktroll/application/params.pulsar.go new file mode 100644 index 000000000..4f740c6cb --- /dev/null +++ b/api/poktroll/application/params.pulsar.go @@ -0,0 +1,564 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package application + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor + fd_Params_max_delegated_gateways protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_params_proto_init() + md_Params = File_poktroll_application_params_proto.Messages().ByName("Params") + fd_Params_max_delegated_gateways = md_Params.Fields().ByName("max_delegated_gateways") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.MaxDelegatedGateways != uint64(0) { + value := protoreflect.ValueOfUint64(x.MaxDelegatedGateways) + if !f(fd_Params_max_delegated_gateways, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.Params.max_delegated_gateways": + return x.MaxDelegatedGateways != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) + } + panic(fmt.Errorf("message poktroll.application.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.Params.max_delegated_gateways": + x.MaxDelegatedGateways = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) + } + panic(fmt.Errorf("message poktroll.application.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.Params.max_delegated_gateways": + value := x.MaxDelegatedGateways + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) + } + panic(fmt.Errorf("message poktroll.application.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.Params.max_delegated_gateways": + x.MaxDelegatedGateways = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) + } + panic(fmt.Errorf("message poktroll.application.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.Params.max_delegated_gateways": + panic(fmt.Errorf("field max_delegated_gateways of message poktroll.application.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) + } + panic(fmt.Errorf("message poktroll.application.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.Params.max_delegated_gateways": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) + } + panic(fmt.Errorf("message poktroll.application.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.MaxDelegatedGateways != 0 { + n += 1 + runtime.Sov(uint64(x.MaxDelegatedGateways)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.MaxDelegatedGateways != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxDelegatedGateways)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxDelegatedGateways", wireType) + } + x.MaxDelegatedGateways = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.MaxDelegatedGateways |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_application_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetMaxDelegatedGateways() uint64 { + if x != nil { + return x.MaxDelegatedGateways + } + return 0 +} + +var File_poktroll_application_params_proto protoreflect.FileDescriptor + +var file_poktroll_application_params_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, + 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x89, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x57, 0x0a, + 0x16, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x21, 0xf2, + 0xde, 0x1f, 0x1d, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x22, + 0x52, 0x14, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x3a, 0x26, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, + 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xbf, + 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, + 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_params_proto_rawDescOnce sync.Once + file_poktroll_application_params_proto_rawDescData = file_poktroll_application_params_proto_rawDesc +) + +func file_poktroll_application_params_proto_rawDescGZIP() []byte { + file_poktroll_application_params_proto_rawDescOnce.Do(func() { + file_poktroll_application_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_params_proto_rawDescData) + }) + return file_poktroll_application_params_proto_rawDescData +} + +var file_poktroll_application_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_application_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.application.Params +} +var file_poktroll_application_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_application_params_proto_init() } +func file_poktroll_application_params_proto_init() { + if File_poktroll_application_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_application_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_application_params_proto_goTypes, + DependencyIndexes: file_poktroll_application_params_proto_depIdxs, + MessageInfos: file_poktroll_application_params_proto_msgTypes, + }.Build() + File_poktroll_application_params_proto = out.File + file_poktroll_application_params_proto_rawDesc = nil + file_poktroll_application_params_proto_goTypes = nil + file_poktroll_application_params_proto_depIdxs = nil +} diff --git a/api/poktroll/application/query.pulsar.go b/api/poktroll/application/query.pulsar.go new file mode 100644 index 000000000..8447e3de9 --- /dev/null +++ b/api/poktroll/application/query.pulsar.go @@ -0,0 +1,3144 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package application + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_application_query_proto_init() + md_QueryParamsRequest = File_poktroll_application_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_query_proto_init() + md_QueryParamsResponse = File_poktroll_application_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetApplicationRequest protoreflect.MessageDescriptor + fd_QueryGetApplicationRequest_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_query_proto_init() + md_QueryGetApplicationRequest = File_poktroll_application_query_proto.Messages().ByName("QueryGetApplicationRequest") + fd_QueryGetApplicationRequest_address = md_QueryGetApplicationRequest.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetApplicationRequest)(nil) + +type fastReflection_QueryGetApplicationRequest QueryGetApplicationRequest + +func (x *QueryGetApplicationRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetApplicationRequest)(x) +} + +func (x *QueryGetApplicationRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetApplicationRequest_messageType fastReflection_QueryGetApplicationRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetApplicationRequest_messageType{} + +type fastReflection_QueryGetApplicationRequest_messageType struct{} + +func (x fastReflection_QueryGetApplicationRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetApplicationRequest)(nil) +} +func (x fastReflection_QueryGetApplicationRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetApplicationRequest) +} +func (x fastReflection_QueryGetApplicationRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetApplicationRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetApplicationRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetApplicationRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetApplicationRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetApplicationRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetApplicationRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetApplicationRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetApplicationRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetApplicationRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetApplicationRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryGetApplicationRequest_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetApplicationRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryGetApplicationRequest.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryGetApplicationRequest.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetApplicationRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryGetApplicationRequest.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryGetApplicationRequest.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetApplicationRequest.address": + panic(fmt.Errorf("field address of message poktroll.QueryGetApplicationRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetApplicationRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetApplicationRequest.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetApplicationRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryGetApplicationRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetApplicationRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetApplicationRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetApplicationRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetApplicationRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetApplicationRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetApplicationRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetApplicationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetApplicationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetApplicationResponse protoreflect.MessageDescriptor + fd_QueryGetApplicationResponse_application protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_query_proto_init() + md_QueryGetApplicationResponse = File_poktroll_application_query_proto.Messages().ByName("QueryGetApplicationResponse") + fd_QueryGetApplicationResponse_application = md_QueryGetApplicationResponse.Fields().ByName("application") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetApplicationResponse)(nil) + +type fastReflection_QueryGetApplicationResponse QueryGetApplicationResponse + +func (x *QueryGetApplicationResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetApplicationResponse)(x) +} + +func (x *QueryGetApplicationResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetApplicationResponse_messageType fastReflection_QueryGetApplicationResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetApplicationResponse_messageType{} + +type fastReflection_QueryGetApplicationResponse_messageType struct{} + +func (x fastReflection_QueryGetApplicationResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetApplicationResponse)(nil) +} +func (x fastReflection_QueryGetApplicationResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetApplicationResponse) +} +func (x fastReflection_QueryGetApplicationResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetApplicationResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetApplicationResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetApplicationResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetApplicationResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetApplicationResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetApplicationResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetApplicationResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetApplicationResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetApplicationResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetApplicationResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Application != nil { + value := protoreflect.ValueOfMessage(x.Application.ProtoReflect()) + if !f(fd_QueryGetApplicationResponse_application, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetApplicationResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryGetApplicationResponse.application": + return x.Application != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryGetApplicationResponse.application": + x.Application = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetApplicationResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryGetApplicationResponse.application": + value := x.Application + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryGetApplicationResponse.application": + x.Application = value.Message().Interface().(*Application) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetApplicationResponse.application": + if x.Application == nil { + x.Application = new(Application) + } + return protoreflect.ValueOfMessage(x.Application.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetApplicationResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetApplicationResponse.application": + m := new(Application) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetApplicationResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryGetApplicationResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetApplicationResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetApplicationResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetApplicationResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetApplicationResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetApplicationResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Application != nil { + l = options.Size(x.Application) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetApplicationResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Application != nil { + encoded, err := options.Marshal(x.Application) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetApplicationResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetApplicationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetApplicationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Application", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Application == nil { + x.Application = &Application{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Application); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllApplicationRequest protoreflect.MessageDescriptor + fd_QueryAllApplicationRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_query_proto_init() + md_QueryAllApplicationRequest = File_poktroll_application_query_proto.Messages().ByName("QueryAllApplicationRequest") + fd_QueryAllApplicationRequest_pagination = md_QueryAllApplicationRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllApplicationRequest)(nil) + +type fastReflection_QueryAllApplicationRequest QueryAllApplicationRequest + +func (x *QueryAllApplicationRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllApplicationRequest)(x) +} + +func (x *QueryAllApplicationRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_query_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllApplicationRequest_messageType fastReflection_QueryAllApplicationRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllApplicationRequest_messageType{} + +type fastReflection_QueryAllApplicationRequest_messageType struct{} + +func (x fastReflection_QueryAllApplicationRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllApplicationRequest)(nil) +} +func (x fastReflection_QueryAllApplicationRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationRequest) +} +func (x fastReflection_QueryAllApplicationRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllApplicationRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllApplicationRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllApplicationRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllApplicationRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllApplicationRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllApplicationRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllApplicationRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllApplicationRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllApplicationRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryAllApplicationRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryAllApplicationRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllApplicationRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryAllApplicationRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryAllApplicationRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryAllApplicationRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllApplicationRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryAllApplicationRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllApplicationRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryAllApplicationRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllApplicationRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllApplicationRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllApplicationRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllApplicationRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllApplicationRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllApplicationRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllApplicationResponse_1_list)(nil) + +type _QueryAllApplicationResponse_1_list struct { + list *[]*Application +} + +func (x *_QueryAllApplicationResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllApplicationResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllApplicationResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Application) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllApplicationResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Application) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllApplicationResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Application) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllApplicationResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllApplicationResponse_1_list) NewElement() protoreflect.Value { + v := new(Application) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllApplicationResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllApplicationResponse protoreflect.MessageDescriptor + fd_QueryAllApplicationResponse_application protoreflect.FieldDescriptor + fd_QueryAllApplicationResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_query_proto_init() + md_QueryAllApplicationResponse = File_poktroll_application_query_proto.Messages().ByName("QueryAllApplicationResponse") + fd_QueryAllApplicationResponse_application = md_QueryAllApplicationResponse.Fields().ByName("application") + fd_QueryAllApplicationResponse_pagination = md_QueryAllApplicationResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllApplicationResponse)(nil) + +type fastReflection_QueryAllApplicationResponse QueryAllApplicationResponse + +func (x *QueryAllApplicationResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllApplicationResponse)(x) +} + +func (x *QueryAllApplicationResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_query_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllApplicationResponse_messageType fastReflection_QueryAllApplicationResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllApplicationResponse_messageType{} + +type fastReflection_QueryAllApplicationResponse_messageType struct{} + +func (x fastReflection_QueryAllApplicationResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllApplicationResponse)(nil) +} +func (x fastReflection_QueryAllApplicationResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationResponse) +} +func (x fastReflection_QueryAllApplicationResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllApplicationResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllApplicationResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllApplicationResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllApplicationResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllApplicationResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllApplicationResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllApplicationResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Application) != 0 { + value := protoreflect.ValueOfList(&_QueryAllApplicationResponse_1_list{list: &x.Application}) + if !f(fd_QueryAllApplicationResponse_application, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllApplicationResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllApplicationResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryAllApplicationResponse.application": + return len(x.Application) != 0 + case "poktroll.QueryAllApplicationResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryAllApplicationResponse.application": + x.Application = nil + case "poktroll.QueryAllApplicationResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllApplicationResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryAllApplicationResponse.application": + if len(x.Application) == 0 { + return protoreflect.ValueOfList(&_QueryAllApplicationResponse_1_list{}) + } + listValue := &_QueryAllApplicationResponse_1_list{list: &x.Application} + return protoreflect.ValueOfList(listValue) + case "poktroll.QueryAllApplicationResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryAllApplicationResponse.application": + lv := value.List() + clv := lv.(*_QueryAllApplicationResponse_1_list) + x.Application = *clv.list + case "poktroll.QueryAllApplicationResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryAllApplicationResponse.application": + if x.Application == nil { + x.Application = []*Application{} + } + value := &_QueryAllApplicationResponse_1_list{list: &x.Application} + return protoreflect.ValueOfList(value) + case "poktroll.QueryAllApplicationResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllApplicationResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryAllApplicationResponse.application": + list := []*Application{} + return protoreflect.ValueOfList(&_QueryAllApplicationResponse_1_list{list: &list}) + case "poktroll.QueryAllApplicationResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllApplicationResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryAllApplicationResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllApplicationResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllApplicationResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllApplicationResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllApplicationResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Application) > 0 { + for _, e := range x.Application { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllApplicationResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Application) > 0 { + for iNdEx := len(x.Application) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Application[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllApplicationResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Application", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Application = append(x.Application, &Application{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Application[len(x.Application)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_application_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetApplicationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *QueryGetApplicationRequest) Reset() { + *x = QueryGetApplicationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetApplicationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetApplicationRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetApplicationRequest.ProtoReflect.Descriptor instead. +func (*QueryGetApplicationRequest) Descriptor() ([]byte, []int) { + return file_poktroll_application_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetApplicationRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type QueryGetApplicationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Application *Application `protobuf:"bytes,1,opt,name=application,proto3" json:"application,omitempty"` +} + +func (x *QueryGetApplicationResponse) Reset() { + *x = QueryGetApplicationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetApplicationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetApplicationResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetApplicationResponse.ProtoReflect.Descriptor instead. +func (*QueryGetApplicationResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetApplicationResponse) GetApplication() *Application { + if x != nil { + return x.Application + } + return nil +} + +type QueryAllApplicationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllApplicationRequest) Reset() { + *x = QueryAllApplicationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllApplicationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllApplicationRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllApplicationRequest.ProtoReflect.Descriptor instead. +func (*QueryAllApplicationRequest) Descriptor() ([]byte, []int) { + return file_poktroll_application_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllApplicationRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllApplicationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Application []*Application `protobuf:"bytes,1,rep,name=application,proto3" json:"application,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllApplicationResponse) Reset() { + *x = QueryAllApplicationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllApplicationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllApplicationResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllApplicationResponse.ProtoReflect.Descriptor instead. +func (*QueryAllApplicationResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllApplicationResponse) GetApplication() []*Application { + if x != nil { + return x.Application + } + return nil +} + +func (x *QueryAllApplicationResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_poktroll_application_query_proto protoreflect.FileDescriptor + +var file_poktroll_application_query_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x14, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, + 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, + 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, + 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x56, 0x0a, 0x13, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x68, 0x0a, 0x1b, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0b, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb1, 0x01, 0x0a, + 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0b, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x32, 0x81, 0x04, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x90, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0xb4, 0x01, + 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3a, 0x12, 0x38, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x7d, 0x12, 0xad, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6c, 0x6c, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xbe, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_query_proto_rawDescOnce sync.Once + file_poktroll_application_query_proto_rawDescData = file_poktroll_application_query_proto_rawDesc +) + +func file_poktroll_application_query_proto_rawDescGZIP() []byte { + file_poktroll_application_query_proto_rawDescOnce.Do(func() { + file_poktroll_application_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_query_proto_rawDescData) + }) + return file_poktroll_application_query_proto_rawDescData +} + +var file_poktroll_application_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_application_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.QueryParamsResponse + (*QueryGetApplicationRequest)(nil), // 2: poktroll.QueryGetApplicationRequest + (*QueryGetApplicationResponse)(nil), // 3: poktroll.QueryGetApplicationResponse + (*QueryAllApplicationRequest)(nil), // 4: poktroll.QueryAllApplicationRequest + (*QueryAllApplicationResponse)(nil), // 5: poktroll.QueryAllApplicationResponse + (*Params)(nil), // 6: poktroll.Params + (*Application)(nil), // 7: poktroll.Application + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse +} +var file_poktroll_application_query_proto_depIdxs = []int32{ + 6, // 0: poktroll.QueryParamsResponse.params:type_name -> poktroll.Params + 7, // 1: poktroll.QueryGetApplicationResponse.application:type_name -> poktroll.Application + 8, // 2: poktroll.QueryAllApplicationRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.QueryAllApplicationResponse.application:type_name -> poktroll.Application + 9, // 4: poktroll.QueryAllApplicationResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.Query.Params:input_type -> poktroll.QueryParamsRequest + 2, // 6: poktroll.Query.Application:input_type -> poktroll.QueryGetApplicationRequest + 4, // 7: poktroll.Query.ApplicationAll:input_type -> poktroll.QueryAllApplicationRequest + 1, // 8: poktroll.Query.Params:output_type -> poktroll.QueryParamsResponse + 3, // 9: poktroll.Query.Application:output_type -> poktroll.QueryGetApplicationResponse + 5, // 10: poktroll.Query.ApplicationAll:output_type -> poktroll.QueryAllApplicationResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_poktroll_application_query_proto_init() } +func file_poktroll_application_query_proto_init() { + if File_poktroll_application_query_proto != nil { + return + } + file_poktroll_application_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_application_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetApplicationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetApplicationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllApplicationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllApplicationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_application_query_proto_goTypes, + DependencyIndexes: file_poktroll_application_query_proto_depIdxs, + MessageInfos: file_poktroll_application_query_proto_msgTypes, + }.Build() + File_poktroll_application_query_proto = out.File + file_poktroll_application_query_proto_rawDesc = nil + file_poktroll_application_query_proto_goTypes = nil + file_poktroll_application_query_proto_depIdxs = nil +} diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go new file mode 100644 index 000000000..865bf664f --- /dev/null +++ b/api/poktroll/application/tx.pulsar.go @@ -0,0 +1,5014 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package application + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUpdateParams = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.application.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.application.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.application.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.application.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.application.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.application.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.application.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_MsgStakeApplication_3_list)(nil) + +type _MsgStakeApplication_3_list struct { + list *[]*shared.ApplicationServiceConfig +} + +func (x *_MsgStakeApplication_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgStakeApplication_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgStakeApplication_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.ApplicationServiceConfig) + (*x.list)[i] = concreteValue +} + +func (x *_MsgStakeApplication_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.ApplicationServiceConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgStakeApplication_3_list) AppendMutable() protoreflect.Value { + v := new(shared.ApplicationServiceConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgStakeApplication_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgStakeApplication_3_list) NewElement() protoreflect.Value { + v := new(shared.ApplicationServiceConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgStakeApplication_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgStakeApplication protoreflect.MessageDescriptor + fd_MsgStakeApplication_address protoreflect.FieldDescriptor + fd_MsgStakeApplication_stake protoreflect.FieldDescriptor + fd_MsgStakeApplication_services protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgStakeApplication = File_poktroll_application_tx_proto.Messages().ByName("MsgStakeApplication") + fd_MsgStakeApplication_address = md_MsgStakeApplication.Fields().ByName("address") + fd_MsgStakeApplication_stake = md_MsgStakeApplication.Fields().ByName("stake") + fd_MsgStakeApplication_services = md_MsgStakeApplication.Fields().ByName("services") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeApplication)(nil) + +type fastReflection_MsgStakeApplication MsgStakeApplication + +func (x *MsgStakeApplication) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeApplication)(x) +} + +func (x *MsgStakeApplication) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeApplication_messageType fastReflection_MsgStakeApplication_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeApplication_messageType{} + +type fastReflection_MsgStakeApplication_messageType struct{} + +func (x fastReflection_MsgStakeApplication_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeApplication)(nil) +} +func (x fastReflection_MsgStakeApplication_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeApplication) +} +func (x fastReflection_MsgStakeApplication_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeApplication +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeApplication) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeApplication +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgStakeApplication) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeApplication_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeApplication) New() protoreflect.Message { + return new(fastReflection_MsgStakeApplication) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeApplication) Interface() protoreflect.ProtoMessage { + return (*MsgStakeApplication)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgStakeApplication) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgStakeApplication_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_MsgStakeApplication_stake, value) { + return + } + } + if len(x.Services) != 0 { + value := protoreflect.ValueOfList(&_MsgStakeApplication_3_list{list: &x.Services}) + if !f(fd_MsgStakeApplication_services, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeApplication) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.MsgStakeApplication.address": + return x.Address != "" + case "poktroll.application.MsgStakeApplication.stake": + return x.Stake != nil + case "poktroll.application.MsgStakeApplication.services": + return len(x.Services) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplication does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplication) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.MsgStakeApplication.address": + x.Address = "" + case "poktroll.application.MsgStakeApplication.stake": + x.Stake = nil + case "poktroll.application.MsgStakeApplication.services": + x.Services = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplication does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgStakeApplication) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.MsgStakeApplication.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.application.MsgStakeApplication.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.application.MsgStakeApplication.services": + if len(x.Services) == 0 { + return protoreflect.ValueOfList(&_MsgStakeApplication_3_list{}) + } + listValue := &_MsgStakeApplication_3_list{list: &x.Services} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplication does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplication) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.MsgStakeApplication.address": + x.Address = value.Interface().(string) + case "poktroll.application.MsgStakeApplication.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.application.MsgStakeApplication.services": + lv := value.List() + clv := lv.(*_MsgStakeApplication_3_list) + x.Services = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplication does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplication) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgStakeApplication.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.application.MsgStakeApplication.services": + if x.Services == nil { + x.Services = []*shared.ApplicationServiceConfig{} + } + value := &_MsgStakeApplication_3_list{list: &x.Services} + return protoreflect.ValueOfList(value) + case "poktroll.application.MsgStakeApplication.address": + panic(fmt.Errorf("field address of message poktroll.application.MsgStakeApplication is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplication does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgStakeApplication) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgStakeApplication.address": + return protoreflect.ValueOfString("") + case "poktroll.application.MsgStakeApplication.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.application.MsgStakeApplication.services": + list := []*shared.ApplicationServiceConfig{} + return protoreflect.ValueOfList(&_MsgStakeApplication_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplication does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgStakeApplication) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgStakeApplication", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgStakeApplication) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplication) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgStakeApplication) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgStakeApplication) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeApplication) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Services) > 0 { + for _, e := range x.Services { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeApplication) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Services) > 0 { + for iNdEx := len(x.Services) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Services[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeApplication) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeApplication: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeApplication: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Services = append(x.Services, &shared.ApplicationServiceConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Services[len(x.Services)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgStakeApplicationResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgStakeApplicationResponse = File_poktroll_application_tx_proto.Messages().ByName("MsgStakeApplicationResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeApplicationResponse)(nil) + +type fastReflection_MsgStakeApplicationResponse MsgStakeApplicationResponse + +func (x *MsgStakeApplicationResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeApplicationResponse)(x) +} + +func (x *MsgStakeApplicationResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeApplicationResponse_messageType fastReflection_MsgStakeApplicationResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeApplicationResponse_messageType{} + +type fastReflection_MsgStakeApplicationResponse_messageType struct{} + +func (x fastReflection_MsgStakeApplicationResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeApplicationResponse)(nil) +} +func (x fastReflection_MsgStakeApplicationResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeApplicationResponse) +} +func (x fastReflection_MsgStakeApplicationResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeApplicationResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeApplicationResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeApplicationResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgStakeApplicationResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeApplicationResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeApplicationResponse) New() protoreflect.Message { + return new(fastReflection_MsgStakeApplicationResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeApplicationResponse) Interface() protoreflect.ProtoMessage { + return (*MsgStakeApplicationResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgStakeApplicationResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeApplicationResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplicationResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgStakeApplicationResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplicationResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplicationResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplicationResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgStakeApplicationResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgStakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgStakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgStakeApplicationResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgStakeApplicationResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgStakeApplicationResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeApplicationResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgStakeApplicationResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgStakeApplicationResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeApplicationResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeApplicationResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeApplicationResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeApplicationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeApplicationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUnstakeApplication protoreflect.MessageDescriptor + fd_MsgUnstakeApplication_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUnstakeApplication = File_poktroll_application_tx_proto.Messages().ByName("MsgUnstakeApplication") + fd_MsgUnstakeApplication_address = md_MsgUnstakeApplication.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeApplication)(nil) + +type fastReflection_MsgUnstakeApplication MsgUnstakeApplication + +func (x *MsgUnstakeApplication) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeApplication)(x) +} + +func (x *MsgUnstakeApplication) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUnstakeApplication_messageType fastReflection_MsgUnstakeApplication_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeApplication_messageType{} + +type fastReflection_MsgUnstakeApplication_messageType struct{} + +func (x fastReflection_MsgUnstakeApplication_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeApplication)(nil) +} +func (x fastReflection_MsgUnstakeApplication_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeApplication) +} +func (x fastReflection_MsgUnstakeApplication_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeApplication +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeApplication) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeApplication +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUnstakeApplication) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeApplication_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeApplication) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeApplication) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeApplication) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeApplication)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUnstakeApplication) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgUnstakeApplication_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeApplication) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.MsgUnstakeApplication.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplication does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplication) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.MsgUnstakeApplication.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplication does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUnstakeApplication) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.MsgUnstakeApplication.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplication does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplication) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.MsgUnstakeApplication.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplication does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplication) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgUnstakeApplication.address": + panic(fmt.Errorf("field address of message poktroll.application.MsgUnstakeApplication is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplication does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUnstakeApplication) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgUnstakeApplication.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplication")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplication does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUnstakeApplication) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUnstakeApplication", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUnstakeApplication) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplication) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUnstakeApplication) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUnstakeApplication) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeApplication) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeApplication) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeApplication) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeApplication: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeApplication: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUnstakeApplicationResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUnstakeApplicationResponse = File_poktroll_application_tx_proto.Messages().ByName("MsgUnstakeApplicationResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeApplicationResponse)(nil) + +type fastReflection_MsgUnstakeApplicationResponse MsgUnstakeApplicationResponse + +func (x *MsgUnstakeApplicationResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeApplicationResponse)(x) +} + +func (x *MsgUnstakeApplicationResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUnstakeApplicationResponse_messageType fastReflection_MsgUnstakeApplicationResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeApplicationResponse_messageType{} + +type fastReflection_MsgUnstakeApplicationResponse_messageType struct{} + +func (x fastReflection_MsgUnstakeApplicationResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeApplicationResponse)(nil) +} +func (x fastReflection_MsgUnstakeApplicationResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeApplicationResponse) +} +func (x fastReflection_MsgUnstakeApplicationResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeApplicationResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeApplicationResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeApplicationResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUnstakeApplicationResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeApplicationResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeApplicationResponse) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeApplicationResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeApplicationResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeApplicationResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUnstakeApplicationResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeApplicationResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplicationResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUnstakeApplicationResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplicationResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplicationResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplicationResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUnstakeApplicationResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUnstakeApplicationResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUnstakeApplicationResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUnstakeApplicationResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUnstakeApplicationResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUnstakeApplicationResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeApplicationResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUnstakeApplicationResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUnstakeApplicationResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeApplicationResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeApplicationResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeApplicationResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeApplicationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeApplicationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgDelegateToGateway protoreflect.MessageDescriptor + fd_MsgDelegateToGateway_app_address protoreflect.FieldDescriptor + fd_MsgDelegateToGateway_gateway_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgDelegateToGateway = File_poktroll_application_tx_proto.Messages().ByName("MsgDelegateToGateway") + fd_MsgDelegateToGateway_app_address = md_MsgDelegateToGateway.Fields().ByName("app_address") + fd_MsgDelegateToGateway_gateway_address = md_MsgDelegateToGateway.Fields().ByName("gateway_address") +} + +var _ protoreflect.Message = (*fastReflection_MsgDelegateToGateway)(nil) + +type fastReflection_MsgDelegateToGateway MsgDelegateToGateway + +func (x *MsgDelegateToGateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgDelegateToGateway)(x) +} + +func (x *MsgDelegateToGateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgDelegateToGateway_messageType fastReflection_MsgDelegateToGateway_messageType +var _ protoreflect.MessageType = fastReflection_MsgDelegateToGateway_messageType{} + +type fastReflection_MsgDelegateToGateway_messageType struct{} + +func (x fastReflection_MsgDelegateToGateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgDelegateToGateway)(nil) +} +func (x fastReflection_MsgDelegateToGateway_messageType) New() protoreflect.Message { + return new(fastReflection_MsgDelegateToGateway) +} +func (x fastReflection_MsgDelegateToGateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDelegateToGateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgDelegateToGateway) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDelegateToGateway +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgDelegateToGateway) Type() protoreflect.MessageType { + return _fastReflection_MsgDelegateToGateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgDelegateToGateway) New() protoreflect.Message { + return new(fastReflection_MsgDelegateToGateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgDelegateToGateway) Interface() protoreflect.ProtoMessage { + return (*MsgDelegateToGateway)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgDelegateToGateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AppAddress != "" { + value := protoreflect.ValueOfString(x.AppAddress) + if !f(fd_MsgDelegateToGateway_app_address, value) { + return + } + } + if x.GatewayAddress != "" { + value := protoreflect.ValueOfString(x.GatewayAddress) + if !f(fd_MsgDelegateToGateway_gateway_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgDelegateToGateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.MsgDelegateToGateway.app_address": + return x.AppAddress != "" + case "poktroll.application.MsgDelegateToGateway.gateway_address": + return x.GatewayAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGateway does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.MsgDelegateToGateway.app_address": + x.AppAddress = "" + case "poktroll.application.MsgDelegateToGateway.gateway_address": + x.GatewayAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGateway does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgDelegateToGateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.MsgDelegateToGateway.app_address": + value := x.AppAddress + return protoreflect.ValueOfString(value) + case "poktroll.application.MsgDelegateToGateway.gateway_address": + value := x.GatewayAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGateway does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.MsgDelegateToGateway.app_address": + x.AppAddress = value.Interface().(string) + case "poktroll.application.MsgDelegateToGateway.gateway_address": + x.GatewayAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGateway does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgDelegateToGateway.app_address": + panic(fmt.Errorf("field app_address of message poktroll.application.MsgDelegateToGateway is not mutable")) + case "poktroll.application.MsgDelegateToGateway.gateway_address": + panic(fmt.Errorf("field gateway_address of message poktroll.application.MsgDelegateToGateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGateway does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgDelegateToGateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgDelegateToGateway.app_address": + return protoreflect.ValueOfString("") + case "poktroll.application.MsgDelegateToGateway.gateway_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGateway does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgDelegateToGateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgDelegateToGateway", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgDelegateToGateway) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGateway) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgDelegateToGateway) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgDelegateToGateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgDelegateToGateway) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.AppAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.GatewayAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgDelegateToGateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.GatewayAddress) > 0 { + i -= len(x.GatewayAddress) + copy(dAtA[i:], x.GatewayAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.GatewayAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.AppAddress) > 0 { + i -= len(x.AppAddress) + copy(dAtA[i:], x.AppAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AppAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgDelegateToGateway) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateToGateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateToGateway: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AppAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.AppAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GatewayAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GatewayAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgDelegateToGatewayResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgDelegateToGatewayResponse = File_poktroll_application_tx_proto.Messages().ByName("MsgDelegateToGatewayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgDelegateToGatewayResponse)(nil) + +type fastReflection_MsgDelegateToGatewayResponse MsgDelegateToGatewayResponse + +func (x *MsgDelegateToGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgDelegateToGatewayResponse)(x) +} + +func (x *MsgDelegateToGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgDelegateToGatewayResponse_messageType fastReflection_MsgDelegateToGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgDelegateToGatewayResponse_messageType{} + +type fastReflection_MsgDelegateToGatewayResponse_messageType struct{} + +func (x fastReflection_MsgDelegateToGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgDelegateToGatewayResponse)(nil) +} +func (x fastReflection_MsgDelegateToGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgDelegateToGatewayResponse) +} +func (x fastReflection_MsgDelegateToGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDelegateToGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgDelegateToGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgDelegateToGatewayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgDelegateToGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgDelegateToGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgDelegateToGatewayResponse) New() protoreflect.Message { + return new(fastReflection_MsgDelegateToGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgDelegateToGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgDelegateToGatewayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgDelegateToGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgDelegateToGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgDelegateToGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGatewayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgDelegateToGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgDelegateToGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgDelegateToGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgDelegateToGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgDelegateToGatewayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgDelegateToGatewayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgDelegateToGatewayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgDelegateToGatewayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgDelegateToGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgDelegateToGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgDelegateToGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgDelegateToGatewayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateToGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateToGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUndelegateFromGateway protoreflect.MessageDescriptor + fd_MsgUndelegateFromGateway_app_address protoreflect.FieldDescriptor + fd_MsgUndelegateFromGateway_gateway_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUndelegateFromGateway = File_poktroll_application_tx_proto.Messages().ByName("MsgUndelegateFromGateway") + fd_MsgUndelegateFromGateway_app_address = md_MsgUndelegateFromGateway.Fields().ByName("app_address") + fd_MsgUndelegateFromGateway_gateway_address = md_MsgUndelegateFromGateway.Fields().ByName("gateway_address") +} + +var _ protoreflect.Message = (*fastReflection_MsgUndelegateFromGateway)(nil) + +type fastReflection_MsgUndelegateFromGateway MsgUndelegateFromGateway + +func (x *MsgUndelegateFromGateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUndelegateFromGateway)(x) +} + +func (x *MsgUndelegateFromGateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUndelegateFromGateway_messageType fastReflection_MsgUndelegateFromGateway_messageType +var _ protoreflect.MessageType = fastReflection_MsgUndelegateFromGateway_messageType{} + +type fastReflection_MsgUndelegateFromGateway_messageType struct{} + +func (x fastReflection_MsgUndelegateFromGateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUndelegateFromGateway)(nil) +} +func (x fastReflection_MsgUndelegateFromGateway_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUndelegateFromGateway) +} +func (x fastReflection_MsgUndelegateFromGateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUndelegateFromGateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUndelegateFromGateway) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUndelegateFromGateway +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUndelegateFromGateway) Type() protoreflect.MessageType { + return _fastReflection_MsgUndelegateFromGateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUndelegateFromGateway) New() protoreflect.Message { + return new(fastReflection_MsgUndelegateFromGateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUndelegateFromGateway) Interface() protoreflect.ProtoMessage { + return (*MsgUndelegateFromGateway)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUndelegateFromGateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AppAddress != "" { + value := protoreflect.ValueOfString(x.AppAddress) + if !f(fd_MsgUndelegateFromGateway_app_address, value) { + return + } + } + if x.GatewayAddress != "" { + value := protoreflect.ValueOfString(x.GatewayAddress) + if !f(fd_MsgUndelegateFromGateway_gateway_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUndelegateFromGateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.application.MsgUndelegateFromGateway.app_address": + return x.AppAddress != "" + case "poktroll.application.MsgUndelegateFromGateway.gateway_address": + return x.GatewayAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGateway does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.application.MsgUndelegateFromGateway.app_address": + x.AppAddress = "" + case "poktroll.application.MsgUndelegateFromGateway.gateway_address": + x.GatewayAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGateway does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUndelegateFromGateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.application.MsgUndelegateFromGateway.app_address": + value := x.AppAddress + return protoreflect.ValueOfString(value) + case "poktroll.application.MsgUndelegateFromGateway.gateway_address": + value := x.GatewayAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGateway does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.application.MsgUndelegateFromGateway.app_address": + x.AppAddress = value.Interface().(string) + case "poktroll.application.MsgUndelegateFromGateway.gateway_address": + x.GatewayAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGateway does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgUndelegateFromGateway.app_address": + panic(fmt.Errorf("field app_address of message poktroll.application.MsgUndelegateFromGateway is not mutable")) + case "poktroll.application.MsgUndelegateFromGateway.gateway_address": + panic(fmt.Errorf("field gateway_address of message poktroll.application.MsgUndelegateFromGateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGateway does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUndelegateFromGateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.application.MsgUndelegateFromGateway.app_address": + return protoreflect.ValueOfString("") + case "poktroll.application.MsgUndelegateFromGateway.gateway_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGateway")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGateway does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUndelegateFromGateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUndelegateFromGateway", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUndelegateFromGateway) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGateway) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUndelegateFromGateway) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUndelegateFromGateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUndelegateFromGateway) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.AppAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.GatewayAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUndelegateFromGateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.GatewayAddress) > 0 { + i -= len(x.GatewayAddress) + copy(dAtA[i:], x.GatewayAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.GatewayAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.AppAddress) > 0 { + i -= len(x.AppAddress) + copy(dAtA[i:], x.AppAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AppAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUndelegateFromGateway) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateFromGateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateFromGateway: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AppAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.AppAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GatewayAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GatewayAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUndelegateFromGatewayResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUndelegateFromGatewayResponse = File_poktroll_application_tx_proto.Messages().ByName("MsgUndelegateFromGatewayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUndelegateFromGatewayResponse)(nil) + +type fastReflection_MsgUndelegateFromGatewayResponse MsgUndelegateFromGatewayResponse + +func (x *MsgUndelegateFromGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUndelegateFromGatewayResponse)(x) +} + +func (x *MsgUndelegateFromGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUndelegateFromGatewayResponse_messageType fastReflection_MsgUndelegateFromGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUndelegateFromGatewayResponse_messageType{} + +type fastReflection_MsgUndelegateFromGatewayResponse_messageType struct{} + +func (x fastReflection_MsgUndelegateFromGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUndelegateFromGatewayResponse)(nil) +} +func (x fastReflection_MsgUndelegateFromGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUndelegateFromGatewayResponse) +} +func (x fastReflection_MsgUndelegateFromGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUndelegateFromGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUndelegateFromGatewayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUndelegateFromGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) New() protoreflect.Message { + return new(fastReflection_MsgUndelegateFromGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUndelegateFromGatewayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGatewayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUndelegateFromGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.application.MsgUndelegateFromGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUndelegateFromGatewayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUndelegateFromGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUndelegateFromGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUndelegateFromGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUndelegateFromGatewayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateFromGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateFromGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{1} +} + +type MsgStakeApplication struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) + Services []*shared.ApplicationServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The list of services this application is staked to request service for +} + +func (x *MsgStakeApplication) Reset() { + *x = MsgStakeApplication{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeApplication) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeApplication) ProtoMessage() {} + +// Deprecated: Use MsgStakeApplication.ProtoReflect.Descriptor instead. +func (*MsgStakeApplication) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeApplication) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgStakeApplication) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *MsgStakeApplication) GetServices() []*shared.ApplicationServiceConfig { + if x != nil { + return x.Services + } + return nil +} + +type MsgStakeApplicationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeApplicationResponse) Reset() { + *x = MsgStakeApplicationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeApplicationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeApplicationResponse) ProtoMessage() {} + +// Deprecated: Use MsgStakeApplicationResponse.ProtoReflect.Descriptor instead. +func (*MsgStakeApplicationResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{3} +} + +type MsgUnstakeApplication struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *MsgUnstakeApplication) Reset() { + *x = MsgUnstakeApplication{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeApplication) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeApplication) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeApplication.ProtoReflect.Descriptor instead. +func (*MsgUnstakeApplication) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgUnstakeApplication) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type MsgUnstakeApplicationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUnstakeApplicationResponse) Reset() { + *x = MsgUnstakeApplicationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeApplicationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeApplicationResponse) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeApplicationResponse.ProtoReflect.Descriptor instead. +func (*MsgUnstakeApplicationResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{5} +} + +type MsgDelegateToGateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AppAddress string `protobuf:"bytes,1,opt,name=app_address,json=appAddress,proto3" json:"app_address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + GatewayAddress string `protobuf:"bytes,2,opt,name=gateway_address,json=gatewayAddress,proto3" json:"gateway_address,omitempty"` // The Bech32 address of the gateway the application wants to delegate to using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding +} + +func (x *MsgDelegateToGateway) Reset() { + *x = MsgDelegateToGateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgDelegateToGateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgDelegateToGateway) ProtoMessage() {} + +// Deprecated: Use MsgDelegateToGateway.ProtoReflect.Descriptor instead. +func (*MsgDelegateToGateway) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgDelegateToGateway) GetAppAddress() string { + if x != nil { + return x.AppAddress + } + return "" +} + +func (x *MsgDelegateToGateway) GetGatewayAddress() string { + if x != nil { + return x.GatewayAddress + } + return "" +} + +type MsgDelegateToGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgDelegateToGatewayResponse) Reset() { + *x = MsgDelegateToGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgDelegateToGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgDelegateToGatewayResponse) ProtoMessage() {} + +// Deprecated: Use MsgDelegateToGatewayResponse.ProtoReflect.Descriptor instead. +func (*MsgDelegateToGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{7} +} + +type MsgUndelegateFromGateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AppAddress string `protobuf:"bytes,1,opt,name=app_address,json=appAddress,proto3" json:"app_address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + GatewayAddress string `protobuf:"bytes,2,opt,name=gateway_address,json=gatewayAddress,proto3" json:"gateway_address,omitempty"` // The Bech32 address of the gateway the application wants to undelegate from using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding +} + +func (x *MsgUndelegateFromGateway) Reset() { + *x = MsgUndelegateFromGateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUndelegateFromGateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUndelegateFromGateway) ProtoMessage() {} + +// Deprecated: Use MsgUndelegateFromGateway.ProtoReflect.Descriptor instead. +func (*MsgUndelegateFromGateway) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgUndelegateFromGateway) GetAppAddress() string { + if x != nil { + return x.AppAddress + } + return "" +} + +func (x *MsgUndelegateFromGateway) GetGatewayAddress() string { + if x != nil { + return x.GatewayAddress + } + return "" +} + +type MsgUndelegateFromGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUndelegateFromGatewayResponse) Reset() { + *x = MsgUndelegateFromGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUndelegateFromGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUndelegateFromGatewayResponse) ProtoMessage() {} + +// Deprecated: Use MsgUndelegateFromGatewayResponse.ProtoReflect.Descriptor instead. +func (*MsgUndelegateFromGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{9} +} + +var File_poktroll_application_tx_proto protoreflect.FileDescriptor + +var file_poktroll_application_tx_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x14, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, + 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, + 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, + 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x12, 0x3f, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x3a, 0x39, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x26, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, + 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcf, 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x53, + 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x12, 0x45, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, + 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, + 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, + 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, + 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, + 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x14, 0x4d, + 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, + 0x0a, 0x0f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x0e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x3a, 0x10, 0x82, 0xe7, 0xb0, 0x2a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x22, 0x1e, 0x0a, 0x1c, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x12, 0x39, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x0a, 0x61, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x10, + 0x82, 0xe7, 0xb0, 0x2a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x22, 0x22, 0x0a, 0x20, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xd2, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, + 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, 0x11, + 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x32, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, + 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, + 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, + 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, + 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01, 0x0a, 0x18, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, + 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_application_tx_proto_rawDescOnce sync.Once + file_poktroll_application_tx_proto_rawDescData = file_poktroll_application_tx_proto_rawDesc +) + +func file_poktroll_application_tx_proto_rawDescGZIP() []byte { + file_poktroll_application_tx_proto_rawDescOnce.Do(func() { + file_poktroll_application_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_application_tx_proto_rawDescData) + }) + return file_poktroll_application_tx_proto_rawDescData +} + +var file_poktroll_application_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_poktroll_application_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.application.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.application.MsgUpdateParamsResponse + (*MsgStakeApplication)(nil), // 2: poktroll.application.MsgStakeApplication + (*MsgStakeApplicationResponse)(nil), // 3: poktroll.application.MsgStakeApplicationResponse + (*MsgUnstakeApplication)(nil), // 4: poktroll.application.MsgUnstakeApplication + (*MsgUnstakeApplicationResponse)(nil), // 5: poktroll.application.MsgUnstakeApplicationResponse + (*MsgDelegateToGateway)(nil), // 6: poktroll.application.MsgDelegateToGateway + (*MsgDelegateToGatewayResponse)(nil), // 7: poktroll.application.MsgDelegateToGatewayResponse + (*MsgUndelegateFromGateway)(nil), // 8: poktroll.application.MsgUndelegateFromGateway + (*MsgUndelegateFromGatewayResponse)(nil), // 9: poktroll.application.MsgUndelegateFromGatewayResponse + (*Params)(nil), // 10: poktroll.application.Params + (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin + (*shared.ApplicationServiceConfig)(nil), // 12: poktroll.shared.ApplicationServiceConfig +} +var file_poktroll_application_tx_proto_depIdxs = []int32{ + 10, // 0: poktroll.application.MsgUpdateParams.params:type_name -> poktroll.application.Params + 11, // 1: poktroll.application.MsgStakeApplication.stake:type_name -> cosmos.base.v1beta1.Coin + 12, // 2: poktroll.application.MsgStakeApplication.services:type_name -> poktroll.shared.ApplicationServiceConfig + 0, // 3: poktroll.application.Msg.UpdateParams:input_type -> poktroll.application.MsgUpdateParams + 2, // 4: poktroll.application.Msg.StakeApplication:input_type -> poktroll.application.MsgStakeApplication + 4, // 5: poktroll.application.Msg.UnstakeApplication:input_type -> poktroll.application.MsgUnstakeApplication + 6, // 6: poktroll.application.Msg.DelegateToGateway:input_type -> poktroll.application.MsgDelegateToGateway + 8, // 7: poktroll.application.Msg.UndelegateFromGateway:input_type -> poktroll.application.MsgUndelegateFromGateway + 1, // 8: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse + 3, // 9: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse + 5, // 10: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse + 7, // 11: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse + 9, // 12: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse + 8, // [8:13] is the sub-list for method output_type + 3, // [3:8] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_poktroll_application_tx_proto_init() } +func file_poktroll_application_tx_proto_init() { + if File_poktroll_application_tx_proto != nil { + return + } + file_poktroll_application_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_application_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeApplication); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeApplicationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeApplication); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeApplicationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgDelegateToGateway); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgDelegateToGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUndelegateFromGateway); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_application_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUndelegateFromGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_application_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_application_tx_proto_goTypes, + DependencyIndexes: file_poktroll_application_tx_proto_depIdxs, + MessageInfos: file_poktroll_application_tx_proto_msgTypes, + }.Build() + File_poktroll_application_tx_proto = out.File + file_poktroll_application_tx_proto_rawDesc = nil + file_poktroll_application_tx_proto_goTypes = nil + file_poktroll_application_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/gateway.pulsar.go b/api/poktroll/gateway/gateway.pulsar.go new file mode 100644 index 000000000..76b5d7dff --- /dev/null +++ b/api/poktroll/gateway/gateway.pulsar.go @@ -0,0 +1,668 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Gateway protoreflect.MessageDescriptor + fd_Gateway_address protoreflect.FieldDescriptor + fd_Gateway_stake protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_gateway_proto_init() + md_Gateway = File_poktroll_gateway_gateway_proto.Messages().ByName("Gateway") + fd_Gateway_address = md_Gateway.Fields().ByName("address") + fd_Gateway_stake = md_Gateway.Fields().ByName("stake") +} + +var _ protoreflect.Message = (*fastReflection_Gateway)(nil) + +type fastReflection_Gateway Gateway + +func (x *Gateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_Gateway)(x) +} + +func (x *Gateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_gateway_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Gateway_messageType fastReflection_Gateway_messageType +var _ protoreflect.MessageType = fastReflection_Gateway_messageType{} + +type fastReflection_Gateway_messageType struct{} + +func (x fastReflection_Gateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_Gateway)(nil) +} +func (x fastReflection_Gateway_messageType) New() protoreflect.Message { + return new(fastReflection_Gateway) +} +func (x fastReflection_Gateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Gateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Gateway) Descriptor() protoreflect.MessageDescriptor { + return md_Gateway +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Gateway) Type() protoreflect.MessageType { + return _fastReflection_Gateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Gateway) New() protoreflect.Message { + return new(fastReflection_Gateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Gateway) Interface() protoreflect.ProtoMessage { + return (*Gateway)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Gateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_Gateway_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_Gateway_stake, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Gateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + return x.Address != "" + case "poktroll.gateway.Gateway.stake": + return x.Stake != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Gateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + x.Address = "" + case "poktroll.gateway.Gateway.stake": + x.Stake = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Gateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.Gateway.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.gateway.Gateway.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Gateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + x.Address = value.Interface().(string) + case "poktroll.gateway.Gateway.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Gateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.Gateway.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.gateway.Gateway.address": + panic(fmt.Errorf("field address of message poktroll.gateway.Gateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Gateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + return protoreflect.ValueOfString("") + case "poktroll.gateway.Gateway.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Gateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.Gateway", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Gateway) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Gateway) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Gateway) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Gateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Gateway) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Gateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Gateway) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Gateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Gateway: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/gateway.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Gateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the gateway + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the gateway has staked +} + +func (x *Gateway) Reset() { + *x = Gateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_gateway_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Gateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Gateway) ProtoMessage() {} + +// Deprecated: Use Gateway.ProtoReflect.Descriptor instead. +func (*Gateway) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_gateway_proto_rawDescGZIP(), []int{0} +} + +func (x *Gateway) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Gateway) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +var File_poktroll_gateway_gateway_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_gateway_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, + 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, + 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_gateway_proto_rawDescOnce sync.Once + file_poktroll_gateway_gateway_proto_rawDescData = file_poktroll_gateway_gateway_proto_rawDesc +) + +func file_poktroll_gateway_gateway_proto_rawDescGZIP() []byte { + file_poktroll_gateway_gateway_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_gateway_proto_rawDescData) + }) + return file_poktroll_gateway_gateway_proto_rawDescData +} + +var file_poktroll_gateway_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_gateway_proto_goTypes = []interface{}{ + (*Gateway)(nil), // 0: poktroll.gateway.Gateway + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin +} +var file_poktroll_gateway_gateway_proto_depIdxs = []int32{ + 1, // 0: poktroll.gateway.Gateway.stake:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_gateway_proto_init() } +func file_poktroll_gateway_gateway_proto_init() { + if File_poktroll_gateway_gateway_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Gateway); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_gateway_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_gateway_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_gateway_proto_depIdxs, + MessageInfos: file_poktroll_gateway_gateway_proto_msgTypes, + }.Build() + File_poktroll_gateway_gateway_proto = out.File + file_poktroll_gateway_gateway_proto_rawDesc = nil + file_poktroll_gateway_gateway_proto_goTypes = nil + file_poktroll_gateway_gateway_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/genesis.pulsar.go b/api/poktroll/gateway/genesis.pulsar.go new file mode 100644 index 000000000..d178c96d9 --- /dev/null +++ b/api/poktroll/gateway/genesis.pulsar.go @@ -0,0 +1,750 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*Gateway +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(Gateway) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(Gateway) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_gateway_list protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_genesis_proto_init() + md_GenesisState = File_poktroll_gateway_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_gateway_list = md_GenesisState.Fields().ByName("gateway_list") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.GatewayList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.GatewayList}) + if !f(fd_GenesisState_gateway_list, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + return x.Params != nil + case "poktroll.gateway.GenesisState.gateway_list": + return len(x.GatewayList) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + x.Params = nil + case "poktroll.gateway.GenesisState.gateway_list": + x.GatewayList = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.gateway.GenesisState.gateway_list": + if len(x.GatewayList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.GatewayList} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "poktroll.gateway.GenesisState.gateway_list": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.GatewayList = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.gateway.GenesisState.gateway_list": + if x.GatewayList == nil { + x.GatewayList = []*Gateway{} + } + value := &_GenesisState_2_list{list: &x.GatewayList} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.gateway.GenesisState.gateway_list": + list := []*Gateway{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.GatewayList) > 0 { + for _, e := range x.GatewayList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.GatewayList) > 0 { + for iNdEx := len(x.GatewayList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.GatewayList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GatewayList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GatewayList = append(x.GatewayList, &Gateway{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.GatewayList[len(x.GatewayList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the gateway module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + GatewayList []*Gateway `protobuf:"bytes,2,rep,name=gateway_list,json=gatewayList,proto3" json:"gateway_list,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetGatewayList() []*Gateway { + if x != nil { + return x.GatewayList + } + return nil +} + +var File_poktroll_gateway_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x0c, 0x47, + 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0c, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x0b, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa8, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, + 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_genesis_proto_rawDescOnce sync.Once + file_poktroll_gateway_genesis_proto_rawDescData = file_poktroll_gateway_genesis_proto_rawDesc +) + +func file_poktroll_gateway_genesis_proto_rawDescGZIP() []byte { + file_poktroll_gateway_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_genesis_proto_rawDescData) + }) + return file_poktroll_gateway_genesis_proto_rawDescData +} + +var file_poktroll_gateway_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.gateway.GenesisState + (*Params)(nil), // 1: poktroll.gateway.Params + (*Gateway)(nil), // 2: poktroll.gateway.Gateway +} +var file_poktroll_gateway_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.gateway.GenesisState.params:type_name -> poktroll.gateway.Params + 2, // 1: poktroll.gateway.GenesisState.gateway_list:type_name -> poktroll.gateway.Gateway + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_genesis_proto_init() } +func file_poktroll_gateway_genesis_proto_init() { + if File_poktroll_gateway_genesis_proto != nil { + return + } + file_poktroll_gateway_params_proto_init() + file_poktroll_gateway_gateway_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_genesis_proto_depIdxs, + MessageInfos: file_poktroll_gateway_genesis_proto_msgTypes, + }.Build() + File_poktroll_gateway_genesis_proto = out.File + file_poktroll_gateway_genesis_proto_rawDesc = nil + file_poktroll_gateway_genesis_proto_goTypes = nil + file_poktroll_gateway_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/module/module.pulsar.go b/api/poktroll/gateway/module/module.pulsar.go new file mode 100644 index 000000000..07c2e332a --- /dev/null +++ b/api/poktroll/gateway/module/module.pulsar.go @@ -0,0 +1,578 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_module_module_proto_init() + md_Module = File_poktroll_gateway_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.gateway.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_gateway_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_module_module_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, + 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x5a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x32, 0xba, 0xc0, 0x96, 0xda, 0x01, + 0x2c, 0x0a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xd2, 0x01, + 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x4d, 0xaa, 0x02, 0x17, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x17, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0xe2, 0x02, 0x23, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_module_module_proto_rawDescOnce sync.Once + file_poktroll_gateway_module_module_proto_rawDescData = file_poktroll_gateway_module_module_proto_rawDesc +) + +func file_poktroll_gateway_module_module_proto_rawDescGZIP() []byte { + file_poktroll_gateway_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_module_module_proto_rawDescData) + }) + return file_poktroll_gateway_module_module_proto_rawDescData +} + +var file_poktroll_gateway_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.gateway.module.Module +} +var file_poktroll_gateway_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_module_module_proto_init() } +func file_poktroll_gateway_module_module_proto_init() { + if File_poktroll_gateway_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_module_module_proto_depIdxs, + MessageInfos: file_poktroll_gateway_module_module_proto_msgTypes, + }.Build() + File_poktroll_gateway_module_module_proto = out.File + file_poktroll_gateway_module_module_proto_rawDesc = nil + file_poktroll_gateway_module_module_proto_goTypes = nil + file_poktroll_gateway_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/params.pulsar.go b/api/poktroll/gateway/params.pulsar.go new file mode 100644 index 000000000..19969e717 --- /dev/null +++ b/api/poktroll/gateway/params.pulsar.go @@ -0,0 +1,499 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_params_proto_init() + md_Params = File_poktroll_gateway_params_proto.Messages().ByName("Params") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_params_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_gateway_params_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_params_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_params_proto_rawDescOnce sync.Once + file_poktroll_gateway_params_proto_rawDescData = file_poktroll_gateway_params_proto_rawDesc +) + +func file_poktroll_gateway_params_proto_rawDescGZIP() []byte { + file_poktroll_gateway_params_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_params_proto_rawDescData) + }) + return file_poktroll_gateway_params_proto_rawDescData +} + +var file_poktroll_gateway_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.gateway.Params +} +var file_poktroll_gateway_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_params_proto_init() } +func file_poktroll_gateway_params_proto_init() { + if File_poktroll_gateway_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_params_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_params_proto_depIdxs, + MessageInfos: file_poktroll_gateway_params_proto_msgTypes, + }.Build() + File_poktroll_gateway_params_proto = out.File + file_poktroll_gateway_params_proto_rawDesc = nil + file_poktroll_gateway_params_proto_goTypes = nil + file_poktroll_gateway_params_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go new file mode 100644 index 000000000..f7318f7e2 --- /dev/null +++ b/api/poktroll/gateway/query.pulsar.go @@ -0,0 +1,3137 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryParamsRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryParamsResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetGatewayRequest protoreflect.MessageDescriptor + fd_QueryGetGatewayRequest_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryGetGatewayRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryGetGatewayRequest") + fd_QueryGetGatewayRequest_address = md_QueryGetGatewayRequest.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetGatewayRequest)(nil) + +type fastReflection_QueryGetGatewayRequest QueryGetGatewayRequest + +func (x *QueryGetGatewayRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetGatewayRequest)(x) +} + +func (x *QueryGetGatewayRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetGatewayRequest_messageType fastReflection_QueryGetGatewayRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetGatewayRequest_messageType{} + +type fastReflection_QueryGetGatewayRequest_messageType struct{} + +func (x fastReflection_QueryGetGatewayRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetGatewayRequest)(nil) +} +func (x fastReflection_QueryGetGatewayRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayRequest) +} +func (x fastReflection_QueryGetGatewayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetGatewayRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetGatewayRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetGatewayRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetGatewayRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetGatewayRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetGatewayRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetGatewayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryGetGatewayRequest_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetGatewayRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetGatewayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + panic(fmt.Errorf("field address of message poktroll.gateway.QueryGetGatewayRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetGatewayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetGatewayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryGetGatewayRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetGatewayRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetGatewayRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetGatewayRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetGatewayRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetGatewayRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetGatewayRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetGatewayRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetGatewayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetGatewayResponse protoreflect.MessageDescriptor + fd_QueryGetGatewayResponse_gateway protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryGetGatewayResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryGetGatewayResponse") + fd_QueryGetGatewayResponse_gateway = md_QueryGetGatewayResponse.Fields().ByName("gateway") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetGatewayResponse)(nil) + +type fastReflection_QueryGetGatewayResponse QueryGetGatewayResponse + +func (x *QueryGetGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetGatewayResponse)(x) +} + +func (x *QueryGetGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetGatewayResponse_messageType fastReflection_QueryGetGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetGatewayResponse_messageType{} + +type fastReflection_QueryGetGatewayResponse_messageType struct{} + +func (x fastReflection_QueryGetGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetGatewayResponse)(nil) +} +func (x fastReflection_QueryGetGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayResponse) +} +func (x fastReflection_QueryGetGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetGatewayResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetGatewayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Gateway != nil { + value := protoreflect.ValueOfMessage(x.Gateway.ProtoReflect()) + if !f(fd_QueryGetGatewayResponse_gateway, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + return x.Gateway != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + x.Gateway = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + value := x.Gateway + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + x.Gateway = value.Message().Interface().(*Gateway) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + if x.Gateway == nil { + x.Gateway = new(Gateway) + } + return protoreflect.ValueOfMessage(x.Gateway.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + m := new(Gateway) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryGetGatewayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetGatewayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetGatewayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetGatewayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Gateway != nil { + l = options.Size(x.Gateway) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Gateway != nil { + encoded, err := options.Marshal(x.Gateway) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetGatewayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Gateway", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Gateway == nil { + x.Gateway = &Gateway{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateway); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllGatewayRequest protoreflect.MessageDescriptor + fd_QueryAllGatewayRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryAllGatewayRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayRequest") + fd_QueryAllGatewayRequest_pagination = md_QueryAllGatewayRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllGatewayRequest)(nil) + +type fastReflection_QueryAllGatewayRequest QueryAllGatewayRequest + +func (x *QueryAllGatewayRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewayRequest)(x) +} + +func (x *QueryAllGatewayRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllGatewayRequest_messageType fastReflection_QueryAllGatewayRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewayRequest_messageType{} + +type fastReflection_QueryAllGatewayRequest_messageType struct{} + +func (x fastReflection_QueryAllGatewayRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewayRequest)(nil) +} +func (x fastReflection_QueryAllGatewayRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayRequest) +} +func (x fastReflection_QueryAllGatewayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllGatewayRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllGatewayRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewayRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllGatewayRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllGatewayRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewayRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllGatewayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllGatewayRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllGatewayRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllGatewayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllGatewayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllGatewayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllGatewayRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllGatewayRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllGatewayRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllGatewayRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllGatewayRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllGatewayResponse_1_list)(nil) + +type _QueryAllGatewayResponse_1_list struct { + list *[]*Gateway +} + +func (x *_QueryAllGatewayResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllGatewayResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllGatewayResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllGatewayResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllGatewayResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Gateway) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllGatewayResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllGatewayResponse_1_list) NewElement() protoreflect.Value { + v := new(Gateway) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllGatewayResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllGatewayResponse protoreflect.MessageDescriptor + fd_QueryAllGatewayResponse_gateway protoreflect.FieldDescriptor + fd_QueryAllGatewayResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryAllGatewayResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayResponse") + fd_QueryAllGatewayResponse_gateway = md_QueryAllGatewayResponse.Fields().ByName("gateway") + fd_QueryAllGatewayResponse_pagination = md_QueryAllGatewayResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllGatewayResponse)(nil) + +type fastReflection_QueryAllGatewayResponse QueryAllGatewayResponse + +func (x *QueryAllGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewayResponse)(x) +} + +func (x *QueryAllGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllGatewayResponse_messageType fastReflection_QueryAllGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewayResponse_messageType{} + +type fastReflection_QueryAllGatewayResponse_messageType struct{} + +func (x fastReflection_QueryAllGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewayResponse)(nil) +} +func (x fastReflection_QueryAllGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayResponse) +} +func (x fastReflection_QueryAllGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllGatewayResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Gateway) != 0 { + value := protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &x.Gateway}) + if !f(fd_QueryAllGatewayResponse_gateway, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllGatewayResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + return len(x.Gateway) != 0 + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + x.Gateway = nil + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + if len(x.Gateway) == 0 { + return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{}) + } + listValue := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + return protoreflect.ValueOfList(listValue) + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + lv := value.List() + clv := lv.(*_QueryAllGatewayResponse_1_list) + x.Gateway = *clv.list + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + if x.Gateway == nil { + x.Gateway = []*Gateway{} + } + value := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + return protoreflect.ValueOfList(value) + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + list := []*Gateway{} + return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &list}) + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllGatewayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllGatewayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllGatewayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Gateway) > 0 { + for _, e := range x.Gateway { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Gateway) > 0 { + for iNdEx := len(x.Gateway) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Gateway[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllGatewayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Gateway", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Gateway = append(x.Gateway, &Gateway{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateway[len(x.Gateway)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetGatewayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *QueryGetGatewayRequest) Reset() { + *x = QueryGetGatewayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetGatewayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetGatewayRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetGatewayRequest.ProtoReflect.Descriptor instead. +func (*QueryGetGatewayRequest) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetGatewayRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type QueryGetGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Gateway *Gateway `protobuf:"bytes,1,opt,name=gateway,proto3" json:"gateway,omitempty"` +} + +func (x *QueryGetGatewayResponse) Reset() { + *x = QueryGetGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetGatewayResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetGatewayResponse.ProtoReflect.Descriptor instead. +func (*QueryGetGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetGatewayResponse) GetGateway() *Gateway { + if x != nil { + return x.Gateway + } + return nil +} + +type QueryAllGatewayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllGatewayRequest) Reset() { + *x = QueryAllGatewayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllGatewayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllGatewayRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllGatewayRequest.ProtoReflect.Descriptor instead. +func (*QueryAllGatewayRequest) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllGatewayRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Gateway []*Gateway `protobuf:"bytes,1,rep,name=gateway,proto3" json:"gateway,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllGatewayResponse) Reset() { + *x = QueryAllGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllGatewayResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllGatewayResponse.ProtoReflect.Descriptor instead. +func (*QueryAllGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllGatewayResponse) GetGateway() []*Gateway { + if x != nil { + return x.Gateway + } + return nil +} + +func (x *QueryAllGatewayResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_poktroll_gateway_query_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_query_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, + 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, + 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x32, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x54, 0x0a, 0x17, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, + 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, + 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x28, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, + 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_query_proto_rawDescOnce sync.Once + file_poktroll_gateway_query_proto_rawDescData = file_poktroll_gateway_query_proto_rawDesc +) + +func file_poktroll_gateway_query_proto_rawDescGZIP() []byte { + file_poktroll_gateway_query_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_query_proto_rawDescData) + }) + return file_poktroll_gateway_query_proto_rawDescData +} + +var file_poktroll_gateway_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_gateway_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse + (*QueryGetGatewayRequest)(nil), // 2: poktroll.gateway.QueryGetGatewayRequest + (*QueryGetGatewayResponse)(nil), // 3: poktroll.gateway.QueryGetGatewayResponse + (*QueryAllGatewayRequest)(nil), // 4: poktroll.gateway.QueryAllGatewayRequest + (*QueryAllGatewayResponse)(nil), // 5: poktroll.gateway.QueryAllGatewayResponse + (*Params)(nil), // 6: poktroll.gateway.Params + (*Gateway)(nil), // 7: poktroll.gateway.Gateway + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse +} +var file_poktroll_gateway_query_proto_depIdxs = []int32{ + 6, // 0: poktroll.gateway.QueryParamsResponse.params:type_name -> poktroll.gateway.Params + 7, // 1: poktroll.gateway.QueryGetGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway + 8, // 2: poktroll.gateway.QueryAllGatewayRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.gateway.QueryAllGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway + 9, // 4: poktroll.gateway.QueryAllGatewayResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.gateway.Query.Params:input_type -> poktroll.gateway.QueryParamsRequest + 2, // 6: poktroll.gateway.Query.Gateway:input_type -> poktroll.gateway.QueryGetGatewayRequest + 4, // 7: poktroll.gateway.Query.GatewayAll:input_type -> poktroll.gateway.QueryAllGatewayRequest + 1, // 8: poktroll.gateway.Query.Params:output_type -> poktroll.gateway.QueryParamsResponse + 3, // 9: poktroll.gateway.Query.Gateway:output_type -> poktroll.gateway.QueryGetGatewayResponse + 5, // 10: poktroll.gateway.Query.GatewayAll:output_type -> poktroll.gateway.QueryAllGatewayResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_query_proto_init() } +func file_poktroll_gateway_query_proto_init() { + if File_poktroll_gateway_query_proto != nil { + return + } + file_poktroll_gateway_params_proto_init() + file_poktroll_gateway_gateway_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetGatewayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllGatewayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_gateway_query_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_query_proto_depIdxs, + MessageInfos: file_poktroll_gateway_query_proto_msgTypes, + }.Build() + File_poktroll_gateway_query_proto = out.File + file_poktroll_gateway_query_proto_rawDesc = nil + file_poktroll_gateway_query_proto_goTypes = nil + file_poktroll_gateway_query_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go new file mode 100644 index 000000000..0c3dff1c9 --- /dev/null +++ b/api/poktroll/gateway/tx.pulsar.go @@ -0,0 +1,2939 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUpdateParams = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.gateway.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.gateway.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.gateway.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.gateway.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.gateway.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgStakeGateway protoreflect.MessageDescriptor + fd_MsgStakeGateway_address protoreflect.FieldDescriptor + fd_MsgStakeGateway_stake protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgStakeGateway = File_poktroll_gateway_tx_proto.Messages().ByName("MsgStakeGateway") + fd_MsgStakeGateway_address = md_MsgStakeGateway.Fields().ByName("address") + fd_MsgStakeGateway_stake = md_MsgStakeGateway.Fields().ByName("stake") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeGateway)(nil) + +type fastReflection_MsgStakeGateway MsgStakeGateway + +func (x *MsgStakeGateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeGateway)(x) +} + +func (x *MsgStakeGateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeGateway_messageType fastReflection_MsgStakeGateway_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeGateway_messageType{} + +type fastReflection_MsgStakeGateway_messageType struct{} + +func (x fastReflection_MsgStakeGateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeGateway)(nil) +} +func (x fastReflection_MsgStakeGateway_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeGateway) +} +func (x fastReflection_MsgStakeGateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeGateway) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGateway +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgStakeGateway) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeGateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeGateway) New() protoreflect.Message { + return new(fastReflection_MsgStakeGateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeGateway) Interface() protoreflect.ProtoMessage { + return (*MsgStakeGateway)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgStakeGateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgStakeGateway_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_MsgStakeGateway_stake, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeGateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + return x.Address != "" + case "poktroll.gateway.MsgStakeGateway.stake": + return x.Stake != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + x.Address = "" + case "poktroll.gateway.MsgStakeGateway.stake": + x.Stake = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgStakeGateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgStakeGateway.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + x.Address = value.Interface().(string) + case "poktroll.gateway.MsgStakeGateway.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.gateway.MsgStakeGateway.address": + panic(fmt.Errorf("field address of message poktroll.gateway.MsgStakeGateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgStakeGateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgStakeGateway.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgStakeGateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgStakeGateway", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgStakeGateway) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGateway) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgStakeGateway) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgStakeGateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeGateway) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeGateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeGateway) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeGateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeGateway: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgStakeGatewayResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgStakeGatewayResponse = File_poktroll_gateway_tx_proto.Messages().ByName("MsgStakeGatewayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeGatewayResponse)(nil) + +type fastReflection_MsgStakeGatewayResponse MsgStakeGatewayResponse + +func (x *MsgStakeGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeGatewayResponse)(x) +} + +func (x *MsgStakeGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeGatewayResponse_messageType fastReflection_MsgStakeGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeGatewayResponse_messageType{} + +type fastReflection_MsgStakeGatewayResponse_messageType struct{} + +func (x fastReflection_MsgStakeGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeGatewayResponse)(nil) +} +func (x fastReflection_MsgStakeGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeGatewayResponse) +} +func (x fastReflection_MsgStakeGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGatewayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgStakeGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeGatewayResponse) New() protoreflect.Message { + return new(fastReflection_MsgStakeGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgStakeGatewayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgStakeGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgStakeGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgStakeGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgStakeGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgStakeGatewayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgStakeGatewayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeGatewayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgStakeGatewayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgStakeGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeGatewayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUnstakeGateway protoreflect.MessageDescriptor + fd_MsgUnstakeGateway_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUnstakeGateway = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUnstakeGateway") + fd_MsgUnstakeGateway_address = md_MsgUnstakeGateway.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeGateway)(nil) + +type fastReflection_MsgUnstakeGateway MsgUnstakeGateway + +func (x *MsgUnstakeGateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeGateway)(x) +} + +func (x *MsgUnstakeGateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUnstakeGateway_messageType fastReflection_MsgUnstakeGateway_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeGateway_messageType{} + +type fastReflection_MsgUnstakeGateway_messageType struct{} + +func (x fastReflection_MsgUnstakeGateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeGateway)(nil) +} +func (x fastReflection_MsgUnstakeGateway_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGateway) +} +func (x fastReflection_MsgUnstakeGateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeGateway) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGateway +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUnstakeGateway) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeGateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeGateway) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeGateway) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeGateway)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUnstakeGateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgUnstakeGateway_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeGateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUnstakeGateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + panic(fmt.Errorf("field address of message poktroll.gateway.MsgUnstakeGateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUnstakeGateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUnstakeGateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUnstakeGateway", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUnstakeGateway) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGateway) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUnstakeGateway) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUnstakeGateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeGateway) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeGateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeGateway) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeGateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeGateway: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUnstakeGatewayResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUnstakeGatewayResponse = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUnstakeGatewayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeGatewayResponse)(nil) + +type fastReflection_MsgUnstakeGatewayResponse MsgUnstakeGatewayResponse + +func (x *MsgUnstakeGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeGatewayResponse)(x) +} + +func (x *MsgUnstakeGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUnstakeGatewayResponse_messageType fastReflection_MsgUnstakeGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeGatewayResponse_messageType{} + +type fastReflection_MsgUnstakeGatewayResponse_messageType struct{} + +func (x fastReflection_MsgUnstakeGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeGatewayResponse)(nil) +} +func (x fastReflection_MsgUnstakeGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGatewayResponse) +} +func (x fastReflection_MsgUnstakeGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGatewayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUnstakeGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeGatewayResponse) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeGatewayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUnstakeGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUnstakeGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUnstakeGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUnstakeGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUnstakeGatewayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUnstakeGatewayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeGatewayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUnstakeGatewayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUnstakeGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeGatewayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{1} +} + +type MsgStakeGateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the gateway + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) +} + +func (x *MsgStakeGateway) Reset() { + *x = MsgStakeGateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeGateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeGateway) ProtoMessage() {} + +// Deprecated: Use MsgStakeGateway.ProtoReflect.Descriptor instead. +func (*MsgStakeGateway) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeGateway) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgStakeGateway) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +type MsgStakeGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeGatewayResponse) Reset() { + *x = MsgStakeGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeGatewayResponse) ProtoMessage() {} + +// Deprecated: Use MsgStakeGatewayResponse.ProtoReflect.Descriptor instead. +func (*MsgStakeGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{3} +} + +type MsgUnstakeGateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the gateway +} + +func (x *MsgUnstakeGateway) Reset() { + *x = MsgUnstakeGateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeGateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeGateway) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeGateway.ProtoReflect.Descriptor instead. +func (*MsgUnstakeGateway) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgUnstakeGateway) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type MsgUnstakeGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUnstakeGatewayResponse) Reset() { + *x = MsgUnstakeGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeGatewayResponse) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeGatewayResponse.ProtoReflect.Descriptor instead. +func (*MsgUnstakeGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{5} +} + +var File_poktroll_gateway_tx_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_tx_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, + 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x0c, 0x82, + 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, + 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, + 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, + 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, + 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xac, 0x02, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, + 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, + 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_tx_proto_rawDescOnce sync.Once + file_poktroll_gateway_tx_proto_rawDescData = file_poktroll_gateway_tx_proto_rawDesc +) + +func file_poktroll_gateway_tx_proto_rawDescGZIP() []byte { + file_poktroll_gateway_tx_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_tx_proto_rawDescData) + }) + return file_poktroll_gateway_tx_proto_rawDescData +} + +var file_poktroll_gateway_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.gateway.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.gateway.MsgUpdateParamsResponse + (*MsgStakeGateway)(nil), // 2: poktroll.gateway.MsgStakeGateway + (*MsgStakeGatewayResponse)(nil), // 3: poktroll.gateway.MsgStakeGatewayResponse + (*MsgUnstakeGateway)(nil), // 4: poktroll.gateway.MsgUnstakeGateway + (*MsgUnstakeGatewayResponse)(nil), // 5: poktroll.gateway.MsgUnstakeGatewayResponse + (*Params)(nil), // 6: poktroll.gateway.Params + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin +} +var file_poktroll_gateway_tx_proto_depIdxs = []int32{ + 6, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params + 7, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin + 0, // 2: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams + 2, // 3: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway + 4, // 4: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway + 1, // 5: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 6: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 5, // 7: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_tx_proto_init() } +func file_poktroll_gateway_tx_proto_init() { + if File_poktroll_gateway_tx_proto != nil { + return + } + file_poktroll_gateway_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeGateway); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeGateway); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_gateway_tx_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_tx_proto_depIdxs, + MessageInfos: file_poktroll_gateway_tx_proto_msgTypes, + }.Build() + File_poktroll_gateway_tx_proto = out.File + file_poktroll_gateway_tx_proto_rawDesc = nil + file_poktroll_gateway_tx_proto_goTypes = nil + file_poktroll_gateway_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/claim.pulsar.go b/api/poktroll/proof/claim.pulsar.go new file mode 100644 index 000000000..859f2619f --- /dev/null +++ b/api/poktroll/proof/claim.pulsar.go @@ -0,0 +1,745 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + session "github.com/pokt-network/poktroll/api/poktroll/session" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Claim protoreflect.MessageDescriptor + fd_Claim_supplier_address protoreflect.FieldDescriptor + fd_Claim_session_header protoreflect.FieldDescriptor + fd_Claim_root_hash protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_claim_proto_init() + md_Claim = File_poktroll_proof_claim_proto.Messages().ByName("Claim") + fd_Claim_supplier_address = md_Claim.Fields().ByName("supplier_address") + fd_Claim_session_header = md_Claim.Fields().ByName("session_header") + fd_Claim_root_hash = md_Claim.Fields().ByName("root_hash") +} + +var _ protoreflect.Message = (*fastReflection_Claim)(nil) + +type fastReflection_Claim Claim + +func (x *Claim) ProtoReflect() protoreflect.Message { + return (*fastReflection_Claim)(x) +} + +func (x *Claim) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_claim_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Claim_messageType fastReflection_Claim_messageType +var _ protoreflect.MessageType = fastReflection_Claim_messageType{} + +type fastReflection_Claim_messageType struct{} + +func (x fastReflection_Claim_messageType) Zero() protoreflect.Message { + return (*fastReflection_Claim)(nil) +} +func (x fastReflection_Claim_messageType) New() protoreflect.Message { + return new(fastReflection_Claim) +} +func (x fastReflection_Claim_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Claim +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Claim) Descriptor() protoreflect.MessageDescriptor { + return md_Claim +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Claim) Type() protoreflect.MessageType { + return _fastReflection_Claim_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Claim) New() protoreflect.Message { + return new(fastReflection_Claim) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Claim) Interface() protoreflect.ProtoMessage { + return (*Claim)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Claim) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SupplierAddress != "" { + value := protoreflect.ValueOfString(x.SupplierAddress) + if !f(fd_Claim_supplier_address, value) { + return + } + } + if x.SessionHeader != nil { + value := protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + if !f(fd_Claim_session_header, value) { + return + } + } + if len(x.RootHash) != 0 { + value := protoreflect.ValueOfBytes(x.RootHash) + if !f(fd_Claim_root_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Claim) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.Claim.supplier_address": + return x.SupplierAddress != "" + case "poktroll.proof.Claim.session_header": + return x.SessionHeader != nil + case "poktroll.proof.Claim.root_hash": + return len(x.RootHash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) + } + panic(fmt.Errorf("message poktroll.proof.Claim does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Claim) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.Claim.supplier_address": + x.SupplierAddress = "" + case "poktroll.proof.Claim.session_header": + x.SessionHeader = nil + case "poktroll.proof.Claim.root_hash": + x.RootHash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) + } + panic(fmt.Errorf("message poktroll.proof.Claim does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Claim) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.Claim.supplier_address": + value := x.SupplierAddress + return protoreflect.ValueOfString(value) + case "poktroll.proof.Claim.session_header": + value := x.SessionHeader + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.Claim.root_hash": + value := x.RootHash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) + } + panic(fmt.Errorf("message poktroll.proof.Claim does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Claim) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.Claim.supplier_address": + x.SupplierAddress = value.Interface().(string) + case "poktroll.proof.Claim.session_header": + x.SessionHeader = value.Message().Interface().(*session.SessionHeader) + case "poktroll.proof.Claim.root_hash": + x.RootHash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) + } + panic(fmt.Errorf("message poktroll.proof.Claim does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Claim) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.Claim.session_header": + if x.SessionHeader == nil { + x.SessionHeader = new(session.SessionHeader) + } + return protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + case "poktroll.proof.Claim.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.Claim is not mutable")) + case "poktroll.proof.Claim.root_hash": + panic(fmt.Errorf("field root_hash of message poktroll.proof.Claim is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) + } + panic(fmt.Errorf("message poktroll.proof.Claim does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Claim) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.Claim.supplier_address": + return protoreflect.ValueOfString("") + case "poktroll.proof.Claim.session_header": + m := new(session.SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.Claim.root_hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Claim")) + } + panic(fmt.Errorf("message poktroll.proof.Claim does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Claim) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.Claim", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Claim) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Claim) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Claim) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Claim) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Claim) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.SupplierAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionHeader != nil { + l = options.Size(x.SessionHeader) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.RootHash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Claim) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.RootHash) > 0 { + i -= len(x.RootHash) + copy(dAtA[i:], x.RootHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RootHash))) + i-- + dAtA[i] = 0x1a + } + if x.SessionHeader != nil { + encoded, err := options.Marshal(x.SessionHeader) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.SupplierAddress) > 0 { + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Claim) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Claim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Claim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.SessionHeader == nil { + x.SessionHeader = &session.SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SessionHeader); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RootHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.RootHash = append(x.RootHash[:0], dAtA[iNdEx:postIndex]...) + if x.RootHash == nil { + x.RootHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/claim.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Claim is the serialized object stored on-chain for claims pending to be proven +type Claim struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SupplierAddress string `protobuf:"bytes,1,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` // the address of the supplier that submitted this claim + // The session header of the session that this claim is for. + SessionHeader *session.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` + // Root hash returned from smt.SMST#Root(). + RootHash []byte `protobuf:"bytes,3,opt,name=root_hash,json=rootHash,proto3" json:"root_hash,omitempty"` +} + +func (x *Claim) Reset() { + *x = Claim{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_claim_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Claim) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Claim) ProtoMessage() {} + +// Deprecated: Use Claim.ProtoReflect.Descriptor instead. +func (*Claim) Descriptor() ([]byte, []int) { + return file_poktroll_proof_claim_proto_rawDescGZIP(), []int{0} +} + +func (x *Claim) GetSupplierAddress() string { + if x != nil { + return x.SupplierAddress + } + return "" +} + +func (x *Claim) GetSessionHeader() *session.SessionHeader { + if x != nil { + return x.SessionHeader + } + return nil +} + +func (x *Claim) GetRootHash() []byte { + if x != nil { + return x.RootHash + } + return nil +} + +var File_poktroll_proof_claim_proto protoreflect.FileDescriptor + +var file_poktroll_proof_claim_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x19, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x01, 0x0a, 0x05, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1b, + 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x42, 0x9a, 0x01, 0x0a, 0x12, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x42, 0x0a, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_claim_proto_rawDescOnce sync.Once + file_poktroll_proof_claim_proto_rawDescData = file_poktroll_proof_claim_proto_rawDesc +) + +func file_poktroll_proof_claim_proto_rawDescGZIP() []byte { + file_poktroll_proof_claim_proto_rawDescOnce.Do(func() { + file_poktroll_proof_claim_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_claim_proto_rawDescData) + }) + return file_poktroll_proof_claim_proto_rawDescData +} + +var file_poktroll_proof_claim_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_proof_claim_proto_goTypes = []interface{}{ + (*Claim)(nil), // 0: poktroll.proof.Claim + (*session.SessionHeader)(nil), // 1: poktroll.session.SessionHeader +} +var file_poktroll_proof_claim_proto_depIdxs = []int32{ + 1, // 0: poktroll.proof.Claim.session_header:type_name -> poktroll.session.SessionHeader + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_claim_proto_init() } +func file_poktroll_proof_claim_proto_init() { + if File_poktroll_proof_claim_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_claim_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Claim); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_claim_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_claim_proto_goTypes, + DependencyIndexes: file_poktroll_proof_claim_proto_depIdxs, + MessageInfos: file_poktroll_proof_claim_proto_msgTypes, + }.Build() + File_poktroll_proof_claim_proto = out.File + file_poktroll_proof_claim_proto_rawDesc = nil + file_poktroll_proof_claim_proto_goTypes = nil + file_poktroll_proof_claim_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/genesis.pulsar.go b/api/poktroll/proof/genesis.pulsar.go new file mode 100644 index 000000000..ecc352c4f --- /dev/null +++ b/api/poktroll/proof/genesis.pulsar.go @@ -0,0 +1,903 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*Claim +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Claim) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Claim) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(Claim) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(Claim) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_GenesisState_3_list)(nil) + +type _GenesisState_3_list struct { + list *[]*Proof +} + +func (x *_GenesisState_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Proof) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Proof) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_3_list) AppendMutable() protoreflect.Value { + v := new(Proof) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_3_list) NewElement() protoreflect.Value { + v := new(Proof) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_claimList protoreflect.FieldDescriptor + fd_GenesisState_proofList protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_genesis_proto_init() + md_GenesisState = File_poktroll_proof_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_claimList = md_GenesisState.Fields().ByName("claimList") + fd_GenesisState_proofList = md_GenesisState.Fields().ByName("proofList") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.ClaimList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.ClaimList}) + if !f(fd_GenesisState_claimList, value) { + return + } + } + if len(x.ProofList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_3_list{list: &x.ProofList}) + if !f(fd_GenesisState_proofList, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.GenesisState.params": + return x.Params != nil + case "poktroll.proof.GenesisState.claimList": + return len(x.ClaimList) != 0 + case "poktroll.proof.GenesisState.proofList": + return len(x.ProofList) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.GenesisState")) + } + panic(fmt.Errorf("message poktroll.proof.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.GenesisState.params": + x.Params = nil + case "poktroll.proof.GenesisState.claimList": + x.ClaimList = nil + case "poktroll.proof.GenesisState.proofList": + x.ProofList = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.GenesisState")) + } + panic(fmt.Errorf("message poktroll.proof.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.GenesisState.claimList": + if len(x.ClaimList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.ClaimList} + return protoreflect.ValueOfList(listValue) + case "poktroll.proof.GenesisState.proofList": + if len(x.ProofList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_3_list{}) + } + listValue := &_GenesisState_3_list{list: &x.ProofList} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.GenesisState")) + } + panic(fmt.Errorf("message poktroll.proof.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "poktroll.proof.GenesisState.claimList": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.ClaimList = *clv.list + case "poktroll.proof.GenesisState.proofList": + lv := value.List() + clv := lv.(*_GenesisState_3_list) + x.ProofList = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.GenesisState")) + } + panic(fmt.Errorf("message poktroll.proof.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.proof.GenesisState.claimList": + if x.ClaimList == nil { + x.ClaimList = []*Claim{} + } + value := &_GenesisState_2_list{list: &x.ClaimList} + return protoreflect.ValueOfList(value) + case "poktroll.proof.GenesisState.proofList": + if x.ProofList == nil { + x.ProofList = []*Proof{} + } + value := &_GenesisState_3_list{list: &x.ProofList} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.GenesisState")) + } + panic(fmt.Errorf("message poktroll.proof.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.GenesisState.claimList": + list := []*Claim{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + case "poktroll.proof.GenesisState.proofList": + list := []*Proof{} + return protoreflect.ValueOfList(&_GenesisState_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.GenesisState")) + } + panic(fmt.Errorf("message poktroll.proof.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.ClaimList) > 0 { + for _, e := range x.ClaimList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.ProofList) > 0 { + for _, e := range x.ProofList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ProofList) > 0 { + for iNdEx := len(x.ProofList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ProofList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.ClaimList) > 0 { + for iNdEx := len(x.ClaimList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ClaimList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ClaimList = append(x.ClaimList, &Claim{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ClaimList[len(x.ClaimList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProofList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ProofList = append(x.ProofList, &Proof{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ProofList[len(x.ProofList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the proof module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + ClaimList []*Claim `protobuf:"bytes,2,rep,name=claimList,proto3" json:"claimList,omitempty"` + ProofList []*Proof `protobuf:"bytes,3,rep,name=proofList,proto3" json:"proofList,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_proof_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetClaimList() []*Claim { + if x != nil { + return x.ClaimList + } + return nil +} + +func (x *GenesisState) GetProofList() []*Proof { + if x != nil { + return x.ProofList + } + return nil +} + +var File_poktroll_proof_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_proof_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x11, + 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, + 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x39, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x39, 0x0a, 0x09, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, + 0x69, 0x6d, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4c, 0x69, 0x73, 0x74, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x9c, + 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, + 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_genesis_proto_rawDescOnce sync.Once + file_poktroll_proof_genesis_proto_rawDescData = file_poktroll_proof_genesis_proto_rawDesc +) + +func file_poktroll_proof_genesis_proto_rawDescGZIP() []byte { + file_poktroll_proof_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_proof_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_genesis_proto_rawDescData) + }) + return file_poktroll_proof_genesis_proto_rawDescData +} + +var file_poktroll_proof_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_proof_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.proof.GenesisState + (*Params)(nil), // 1: poktroll.proof.Params + (*Claim)(nil), // 2: poktroll.proof.Claim + (*Proof)(nil), // 3: poktroll.proof.Proof +} +var file_poktroll_proof_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.proof.GenesisState.params:type_name -> poktroll.proof.Params + 2, // 1: poktroll.proof.GenesisState.claimList:type_name -> poktroll.proof.Claim + 3, // 2: poktroll.proof.GenesisState.proofList:type_name -> poktroll.proof.Proof + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_genesis_proto_init() } +func file_poktroll_proof_genesis_proto_init() { + if File_poktroll_proof_genesis_proto != nil { + return + } + file_poktroll_proof_params_proto_init() + file_poktroll_proof_claim_proto_init() + file_poktroll_proof_proof_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_proof_genesis_proto_depIdxs, + MessageInfos: file_poktroll_proof_genesis_proto_msgTypes, + }.Build() + File_poktroll_proof_genesis_proto = out.File + file_poktroll_proof_genesis_proto_rawDesc = nil + file_poktroll_proof_genesis_proto_goTypes = nil + file_poktroll_proof_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/module/module.pulsar.go b/api/poktroll/proof/module/module.pulsar.go new file mode 100644 index 000000000..609885d8e --- /dev/null +++ b/api/poktroll/proof/module/module.pulsar.go @@ -0,0 +1,577 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_module_module_proto_init() + md_Module = File_poktroll_proof_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.module.Module")) + } + panic(fmt.Errorf("message poktroll.proof.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.module.Module")) + } + panic(fmt.Errorf("message poktroll.proof.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.module.Module")) + } + panic(fmt.Errorf("message poktroll.proof.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.module.Module")) + } + panic(fmt.Errorf("message poktroll.proof.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.proof.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.module.Module")) + } + panic(fmt.Errorf("message poktroll.proof.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.module.Module")) + } + panic(fmt.Errorf("message poktroll.proof.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_proof_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_proof_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_proof_module_module_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0x20, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, + 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x30, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2a, 0x0a, 0x28, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0xc6, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, + 0x50, 0x4d, 0xaa, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x15, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0xe2, 0x02, 0x21, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_module_module_proto_rawDescOnce sync.Once + file_poktroll_proof_module_module_proto_rawDescData = file_poktroll_proof_module_module_proto_rawDesc +) + +func file_poktroll_proof_module_module_proto_rawDescGZIP() []byte { + file_poktroll_proof_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_proof_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_module_module_proto_rawDescData) + }) + return file_poktroll_proof_module_module_proto_rawDescData +} + +var file_poktroll_proof_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_proof_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.proof.module.Module +} +var file_poktroll_proof_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_module_module_proto_init() } +func file_poktroll_proof_module_module_proto_init() { + if File_poktroll_proof_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_proof_module_module_proto_depIdxs, + MessageInfos: file_poktroll_proof_module_module_proto_msgTypes, + }.Build() + File_poktroll_proof_module_module_proto = out.File + file_poktroll_proof_module_module_proto_rawDesc = nil + file_poktroll_proof_module_module_proto_goTypes = nil + file_poktroll_proof_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/params.pulsar.go b/api/poktroll/proof/params.pulsar.go new file mode 100644 index 000000000..bdc15b658 --- /dev/null +++ b/api/poktroll/proof/params.pulsar.go @@ -0,0 +1,498 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_proof_params_proto_init() + md_Params = File_poktroll_proof_params_proto.Messages().ByName("Params") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) + } + panic(fmt.Errorf("message poktroll.proof.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) + } + panic(fmt.Errorf("message poktroll.proof.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) + } + panic(fmt.Errorf("message poktroll.proof.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) + } + panic(fmt.Errorf("message poktroll.proof.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) + } + panic(fmt.Errorf("message poktroll.proof.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Params")) + } + panic(fmt.Errorf("message poktroll.proof.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_proof_params_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_proof_params_proto protoreflect.FileDescriptor + +var file_poktroll_proof_params_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2a, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0x9b, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, + 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, + 0x6f, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_params_proto_rawDescOnce sync.Once + file_poktroll_proof_params_proto_rawDescData = file_poktroll_proof_params_proto_rawDesc +) + +func file_poktroll_proof_params_proto_rawDescGZIP() []byte { + file_poktroll_proof_params_proto_rawDescOnce.Do(func() { + file_poktroll_proof_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_params_proto_rawDescData) + }) + return file_poktroll_proof_params_proto_rawDescData +} + +var file_poktroll_proof_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_proof_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.proof.Params +} +var file_poktroll_proof_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_params_proto_init() } +func file_poktroll_proof_params_proto_init() { + if File_poktroll_proof_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_params_proto_goTypes, + DependencyIndexes: file_poktroll_proof_params_proto_depIdxs, + MessageInfos: file_poktroll_proof_params_proto_msgTypes, + }.Build() + File_poktroll_proof_params_proto = out.File + file_poktroll_proof_params_proto_rawDesc = nil + file_poktroll_proof_params_proto_goTypes = nil + file_poktroll_proof_params_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/proof.pulsar.go b/api/poktroll/proof/proof.pulsar.go new file mode 100644 index 000000000..9fd048a47 --- /dev/null +++ b/api/poktroll/proof/proof.pulsar.go @@ -0,0 +1,746 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + session "github.com/pokt-network/poktroll/api/poktroll/session" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Proof protoreflect.MessageDescriptor + fd_Proof_supplier_address protoreflect.FieldDescriptor + fd_Proof_session_header protoreflect.FieldDescriptor + fd_Proof_closest_merkle_proof protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_proof_proto_init() + md_Proof = File_poktroll_proof_proof_proto.Messages().ByName("Proof") + fd_Proof_supplier_address = md_Proof.Fields().ByName("supplier_address") + fd_Proof_session_header = md_Proof.Fields().ByName("session_header") + fd_Proof_closest_merkle_proof = md_Proof.Fields().ByName("closest_merkle_proof") +} + +var _ protoreflect.Message = (*fastReflection_Proof)(nil) + +type fastReflection_Proof Proof + +func (x *Proof) ProtoReflect() protoreflect.Message { + return (*fastReflection_Proof)(x) +} + +func (x *Proof) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_proof_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Proof_messageType fastReflection_Proof_messageType +var _ protoreflect.MessageType = fastReflection_Proof_messageType{} + +type fastReflection_Proof_messageType struct{} + +func (x fastReflection_Proof_messageType) Zero() protoreflect.Message { + return (*fastReflection_Proof)(nil) +} +func (x fastReflection_Proof_messageType) New() protoreflect.Message { + return new(fastReflection_Proof) +} +func (x fastReflection_Proof_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Proof +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Proof) Descriptor() protoreflect.MessageDescriptor { + return md_Proof +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Proof) Type() protoreflect.MessageType { + return _fastReflection_Proof_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Proof) New() protoreflect.Message { + return new(fastReflection_Proof) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Proof) Interface() protoreflect.ProtoMessage { + return (*Proof)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Proof) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SupplierAddress != "" { + value := protoreflect.ValueOfString(x.SupplierAddress) + if !f(fd_Proof_supplier_address, value) { + return + } + } + if x.SessionHeader != nil { + value := protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + if !f(fd_Proof_session_header, value) { + return + } + } + if len(x.ClosestMerkleProof) != 0 { + value := protoreflect.ValueOfBytes(x.ClosestMerkleProof) + if !f(fd_Proof_closest_merkle_proof, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Proof) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.Proof.supplier_address": + return x.SupplierAddress != "" + case "poktroll.proof.Proof.session_header": + return x.SessionHeader != nil + case "poktroll.proof.Proof.closest_merkle_proof": + return len(x.ClosestMerkleProof) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Proof")) + } + panic(fmt.Errorf("message poktroll.proof.Proof does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Proof) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.Proof.supplier_address": + x.SupplierAddress = "" + case "poktroll.proof.Proof.session_header": + x.SessionHeader = nil + case "poktroll.proof.Proof.closest_merkle_proof": + x.ClosestMerkleProof = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Proof")) + } + panic(fmt.Errorf("message poktroll.proof.Proof does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Proof) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.Proof.supplier_address": + value := x.SupplierAddress + return protoreflect.ValueOfString(value) + case "poktroll.proof.Proof.session_header": + value := x.SessionHeader + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.Proof.closest_merkle_proof": + value := x.ClosestMerkleProof + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Proof")) + } + panic(fmt.Errorf("message poktroll.proof.Proof does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Proof) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.Proof.supplier_address": + x.SupplierAddress = value.Interface().(string) + case "poktroll.proof.Proof.session_header": + x.SessionHeader = value.Message().Interface().(*session.SessionHeader) + case "poktroll.proof.Proof.closest_merkle_proof": + x.ClosestMerkleProof = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Proof")) + } + panic(fmt.Errorf("message poktroll.proof.Proof does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Proof) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.Proof.session_header": + if x.SessionHeader == nil { + x.SessionHeader = new(session.SessionHeader) + } + return protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + case "poktroll.proof.Proof.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.Proof is not mutable")) + case "poktroll.proof.Proof.closest_merkle_proof": + panic(fmt.Errorf("field closest_merkle_proof of message poktroll.proof.Proof is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Proof")) + } + panic(fmt.Errorf("message poktroll.proof.Proof does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Proof) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.Proof.supplier_address": + return protoreflect.ValueOfString("") + case "poktroll.proof.Proof.session_header": + m := new(session.SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.Proof.closest_merkle_proof": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.Proof")) + } + panic(fmt.Errorf("message poktroll.proof.Proof does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Proof) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.Proof", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Proof) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Proof) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Proof) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Proof) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Proof) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.SupplierAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionHeader != nil { + l = options.Size(x.SessionHeader) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ClosestMerkleProof) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Proof) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ClosestMerkleProof) > 0 { + i -= len(x.ClosestMerkleProof) + copy(dAtA[i:], x.ClosestMerkleProof) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClosestMerkleProof))) + i-- + dAtA[i] = 0x1a + } + if x.SessionHeader != nil { + encoded, err := options.Marshal(x.SessionHeader) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.SupplierAddress) > 0 { + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Proof) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Proof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.SessionHeader == nil { + x.SessionHeader = &session.SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SessionHeader); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClosestMerkleProof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ClosestMerkleProof = append(x.ClosestMerkleProof[:0], dAtA[iNdEx:postIndex]...) + if x.ClosestMerkleProof == nil { + x.ClosestMerkleProof = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/proof.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Proof struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SupplierAddress string `protobuf:"bytes,1,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` + // The session header of the session that this claim is for. + SessionHeader *session.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` + // The serialized SMST proof from the `#ClosestProof()` method. + ClosestMerkleProof []byte `protobuf:"bytes,3,opt,name=closest_merkle_proof,json=closestMerkleProof,proto3" json:"closest_merkle_proof,omitempty"` +} + +func (x *Proof) Reset() { + *x = Proof{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_proof_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Proof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Proof) ProtoMessage() {} + +// Deprecated: Use Proof.ProtoReflect.Descriptor instead. +func (*Proof) Descriptor() ([]byte, []int) { + return file_poktroll_proof_proof_proto_rawDescGZIP(), []int{0} +} + +func (x *Proof) GetSupplierAddress() string { + if x != nil { + return x.SupplierAddress + } + return "" +} + +func (x *Proof) GetSessionHeader() *session.SessionHeader { + if x != nil { + return x.SessionHeader + } + return nil +} + +func (x *Proof) GetClosestMerkleProof() []byte { + if x != nil { + return x.ClosestMerkleProof + } + return nil +} + +var File_poktroll_proof_proof_proto protoreflect.FileDescriptor + +var file_poktroll_proof_proof_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x19, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc6, 0x01, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x30, + 0x0a, 0x14, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, + 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, + 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_proof_proto_rawDescOnce sync.Once + file_poktroll_proof_proof_proto_rawDescData = file_poktroll_proof_proof_proto_rawDesc +) + +func file_poktroll_proof_proof_proto_rawDescGZIP() []byte { + file_poktroll_proof_proof_proto_rawDescOnce.Do(func() { + file_poktroll_proof_proof_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_proof_proto_rawDescData) + }) + return file_poktroll_proof_proof_proto_rawDescData +} + +var file_poktroll_proof_proof_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_proof_proof_proto_goTypes = []interface{}{ + (*Proof)(nil), // 0: poktroll.proof.Proof + (*session.SessionHeader)(nil), // 1: poktroll.session.SessionHeader +} +var file_poktroll_proof_proof_proto_depIdxs = []int32{ + 1, // 0: poktroll.proof.Proof.session_header:type_name -> poktroll.session.SessionHeader + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_proof_proto_init() } +func file_poktroll_proof_proof_proto_init() { + if File_poktroll_proof_proof_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_proof_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Proof); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_proof_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_proof_proof_proto_goTypes, + DependencyIndexes: file_poktroll_proof_proof_proto_depIdxs, + MessageInfos: file_poktroll_proof_proof_proto_msgTypes, + }.Build() + File_poktroll_proof_proof_proto = out.File + file_poktroll_proof_proof_proto_rawDesc = nil + file_poktroll_proof_proof_proto_goTypes = nil + file_poktroll_proof_proof_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/query.pulsar.go b/api/poktroll/proof/query.pulsar.go new file mode 100644 index 000000000..4b4f62c39 --- /dev/null +++ b/api/poktroll/proof/query.pulsar.go @@ -0,0 +1,6012 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryParamsRequest = File_poktroll_proof_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryParamsResponse = File_poktroll_proof_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetClaimRequest protoreflect.MessageDescriptor + fd_QueryGetClaimRequest_session_id protoreflect.FieldDescriptor + fd_QueryGetClaimRequest_supplier_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryGetClaimRequest = File_poktroll_proof_query_proto.Messages().ByName("QueryGetClaimRequest") + fd_QueryGetClaimRequest_session_id = md_QueryGetClaimRequest.Fields().ByName("session_id") + fd_QueryGetClaimRequest_supplier_address = md_QueryGetClaimRequest.Fields().ByName("supplier_address") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetClaimRequest)(nil) + +type fastReflection_QueryGetClaimRequest QueryGetClaimRequest + +func (x *QueryGetClaimRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetClaimRequest)(x) +} + +func (x *QueryGetClaimRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetClaimRequest_messageType fastReflection_QueryGetClaimRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetClaimRequest_messageType{} + +type fastReflection_QueryGetClaimRequest_messageType struct{} + +func (x fastReflection_QueryGetClaimRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetClaimRequest)(nil) +} +func (x fastReflection_QueryGetClaimRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetClaimRequest) +} +func (x fastReflection_QueryGetClaimRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetClaimRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetClaimRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetClaimRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetClaimRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetClaimRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetClaimRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetClaimRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetClaimRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetClaimRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetClaimRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SessionId != "" { + value := protoreflect.ValueOfString(x.SessionId) + if !f(fd_QueryGetClaimRequest_session_id, value) { + return + } + } + if x.SupplierAddress != "" { + value := protoreflect.ValueOfString(x.SupplierAddress) + if !f(fd_QueryGetClaimRequest_supplier_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetClaimRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimRequest.session_id": + return x.SessionId != "" + case "poktroll.proof.QueryGetClaimRequest.supplier_address": + return x.SupplierAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimRequest.session_id": + x.SessionId = "" + case "poktroll.proof.QueryGetClaimRequest.supplier_address": + x.SupplierAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetClaimRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryGetClaimRequest.session_id": + value := x.SessionId + return protoreflect.ValueOfString(value) + case "poktroll.proof.QueryGetClaimRequest.supplier_address": + value := x.SupplierAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimRequest.session_id": + x.SessionId = value.Interface().(string) + case "poktroll.proof.QueryGetClaimRequest.supplier_address": + x.SupplierAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimRequest.session_id": + panic(fmt.Errorf("field session_id of message poktroll.proof.QueryGetClaimRequest is not mutable")) + case "poktroll.proof.QueryGetClaimRequest.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.QueryGetClaimRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetClaimRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimRequest.session_id": + return protoreflect.ValueOfString("") + case "poktroll.proof.QueryGetClaimRequest.supplier_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetClaimRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryGetClaimRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetClaimRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetClaimRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetClaimRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetClaimRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.SessionId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.SupplierAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetClaimRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.SupplierAddress) > 0 { + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.SessionId) > 0 { + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetClaimRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetClaimRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetClaimRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetClaimResponse protoreflect.MessageDescriptor + fd_QueryGetClaimResponse_claim protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryGetClaimResponse = File_poktroll_proof_query_proto.Messages().ByName("QueryGetClaimResponse") + fd_QueryGetClaimResponse_claim = md_QueryGetClaimResponse.Fields().ByName("claim") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetClaimResponse)(nil) + +type fastReflection_QueryGetClaimResponse QueryGetClaimResponse + +func (x *QueryGetClaimResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetClaimResponse)(x) +} + +func (x *QueryGetClaimResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetClaimResponse_messageType fastReflection_QueryGetClaimResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetClaimResponse_messageType{} + +type fastReflection_QueryGetClaimResponse_messageType struct{} + +func (x fastReflection_QueryGetClaimResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetClaimResponse)(nil) +} +func (x fastReflection_QueryGetClaimResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetClaimResponse) +} +func (x fastReflection_QueryGetClaimResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetClaimResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetClaimResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetClaimResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetClaimResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetClaimResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetClaimResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetClaimResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetClaimResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetClaimResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetClaimResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Claim != nil { + value := protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + if !f(fd_QueryGetClaimResponse_claim, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetClaimResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimResponse.claim": + return x.Claim != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimResponse.claim": + x.Claim = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetClaimResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryGetClaimResponse.claim": + value := x.Claim + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimResponse.claim": + x.Claim = value.Message().Interface().(*Claim) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimResponse.claim": + if x.Claim == nil { + x.Claim = new(Claim) + } + return protoreflect.ValueOfMessage(x.Claim.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetClaimResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetClaimResponse.claim": + m := new(Claim) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetClaimResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetClaimResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryGetClaimResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetClaimResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetClaimResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetClaimResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetClaimResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetClaimResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Claim != nil { + l = options.Size(x.Claim) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetClaimResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Claim != nil { + encoded, err := options.Marshal(x.Claim) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetClaimResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetClaimResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Claim == nil { + x.Claim = &Claim{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claim); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllClaimsRequest protoreflect.MessageDescriptor + fd_QueryAllClaimsRequest_pagination protoreflect.FieldDescriptor + fd_QueryAllClaimsRequest_supplier_address protoreflect.FieldDescriptor + fd_QueryAllClaimsRequest_session_id protoreflect.FieldDescriptor + fd_QueryAllClaimsRequest_session_end_height protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryAllClaimsRequest = File_poktroll_proof_query_proto.Messages().ByName("QueryAllClaimsRequest") + fd_QueryAllClaimsRequest_pagination = md_QueryAllClaimsRequest.Fields().ByName("pagination") + fd_QueryAllClaimsRequest_supplier_address = md_QueryAllClaimsRequest.Fields().ByName("supplier_address") + fd_QueryAllClaimsRequest_session_id = md_QueryAllClaimsRequest.Fields().ByName("session_id") + fd_QueryAllClaimsRequest_session_end_height = md_QueryAllClaimsRequest.Fields().ByName("session_end_height") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllClaimsRequest)(nil) + +type fastReflection_QueryAllClaimsRequest QueryAllClaimsRequest + +func (x *QueryAllClaimsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllClaimsRequest)(x) +} + +func (x *QueryAllClaimsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllClaimsRequest_messageType fastReflection_QueryAllClaimsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllClaimsRequest_messageType{} + +type fastReflection_QueryAllClaimsRequest_messageType struct{} + +func (x fastReflection_QueryAllClaimsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllClaimsRequest)(nil) +} +func (x fastReflection_QueryAllClaimsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllClaimsRequest) +} +func (x fastReflection_QueryAllClaimsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllClaimsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllClaimsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllClaimsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllClaimsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllClaimsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllClaimsRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllClaimsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllClaimsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllClaimsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllClaimsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllClaimsRequest_pagination, value) { + return + } + } + if x.Filter != nil { + switch o := x.Filter.(type) { + case *QueryAllClaimsRequest_SupplierAddress: + v := o.SupplierAddress + value := protoreflect.ValueOfString(v) + if !f(fd_QueryAllClaimsRequest_supplier_address, value) { + return + } + case *QueryAllClaimsRequest_SessionId: + v := o.SessionId + value := protoreflect.ValueOfString(v) + if !f(fd_QueryAllClaimsRequest_session_id, value) { + return + } + case *QueryAllClaimsRequest_SessionEndHeight: + v := o.SessionEndHeight + value := protoreflect.ValueOfUint64(v) + if !f(fd_QueryAllClaimsRequest_session_end_height, value) { + return + } + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllClaimsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.pagination": + return x.Pagination != nil + case "poktroll.proof.QueryAllClaimsRequest.supplier_address": + if x.Filter == nil { + return false + } else if _, ok := x.Filter.(*QueryAllClaimsRequest_SupplierAddress); ok { + return true + } else { + return false + } + case "poktroll.proof.QueryAllClaimsRequest.session_id": + if x.Filter == nil { + return false + } else if _, ok := x.Filter.(*QueryAllClaimsRequest_SessionId); ok { + return true + } else { + return false + } + case "poktroll.proof.QueryAllClaimsRequest.session_end_height": + if x.Filter == nil { + return false + } else if _, ok := x.Filter.(*QueryAllClaimsRequest_SessionEndHeight); ok { + return true + } else { + return false + } + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.pagination": + x.Pagination = nil + case "poktroll.proof.QueryAllClaimsRequest.supplier_address": + x.Filter = nil + case "poktroll.proof.QueryAllClaimsRequest.session_id": + x.Filter = nil + case "poktroll.proof.QueryAllClaimsRequest.session_end_height": + x.Filter = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllClaimsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.QueryAllClaimsRequest.supplier_address": + if x.Filter == nil { + return protoreflect.ValueOfString("") + } else if v, ok := x.Filter.(*QueryAllClaimsRequest_SupplierAddress); ok { + return protoreflect.ValueOfString(v.SupplierAddress) + } else { + return protoreflect.ValueOfString("") + } + case "poktroll.proof.QueryAllClaimsRequest.session_id": + if x.Filter == nil { + return protoreflect.ValueOfString("") + } else if v, ok := x.Filter.(*QueryAllClaimsRequest_SessionId); ok { + return protoreflect.ValueOfString(v.SessionId) + } else { + return protoreflect.ValueOfString("") + } + case "poktroll.proof.QueryAllClaimsRequest.session_end_height": + if x.Filter == nil { + return protoreflect.ValueOfUint64(uint64(0)) + } else if v, ok := x.Filter.(*QueryAllClaimsRequest_SessionEndHeight); ok { + return protoreflect.ValueOfUint64(v.SessionEndHeight) + } else { + return protoreflect.ValueOfUint64(uint64(0)) + } + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + case "poktroll.proof.QueryAllClaimsRequest.supplier_address": + cv := value.Interface().(string) + x.Filter = &QueryAllClaimsRequest_SupplierAddress{SupplierAddress: cv} + case "poktroll.proof.QueryAllClaimsRequest.session_id": + cv := value.Interface().(string) + x.Filter = &QueryAllClaimsRequest_SessionId{SessionId: cv} + case "poktroll.proof.QueryAllClaimsRequest.session_end_height": + cv := value.Uint() + x.Filter = &QueryAllClaimsRequest_SessionEndHeight{SessionEndHeight: cv} + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + case "poktroll.proof.QueryAllClaimsRequest.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.QueryAllClaimsRequest is not mutable")) + case "poktroll.proof.QueryAllClaimsRequest.session_id": + panic(fmt.Errorf("field session_id of message poktroll.proof.QueryAllClaimsRequest is not mutable")) + case "poktroll.proof.QueryAllClaimsRequest.session_end_height": + panic(fmt.Errorf("field session_end_height of message poktroll.proof.QueryAllClaimsRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllClaimsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.QueryAllClaimsRequest.supplier_address": + return protoreflect.ValueOfString("") + case "poktroll.proof.QueryAllClaimsRequest.session_id": + return protoreflect.ValueOfString("") + case "poktroll.proof.QueryAllClaimsRequest.session_end_height": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllClaimsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + case "poktroll.proof.QueryAllClaimsRequest.filter": + if x.Filter == nil { + return nil + } + switch x.Filter.(type) { + case *QueryAllClaimsRequest_SupplierAddress: + return x.Descriptor().Fields().ByName("supplier_address") + case *QueryAllClaimsRequest_SessionId: + return x.Descriptor().Fields().ByName("session_id") + case *QueryAllClaimsRequest_SessionEndHeight: + return x.Descriptor().Fields().ByName("session_end_height") + } + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryAllClaimsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllClaimsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllClaimsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllClaimsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllClaimsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + switch x := x.Filter.(type) { + case *QueryAllClaimsRequest_SupplierAddress: + if x == nil { + break + } + l = len(x.SupplierAddress) + n += 1 + l + runtime.Sov(uint64(l)) + case *QueryAllClaimsRequest_SessionId: + if x == nil { + break + } + l = len(x.SessionId) + n += 1 + l + runtime.Sov(uint64(l)) + case *QueryAllClaimsRequest_SessionEndHeight: + if x == nil { + break + } + n += 1 + runtime.Sov(uint64(x.SessionEndHeight)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllClaimsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + switch x := x.Filter.(type) { + case *QueryAllClaimsRequest_SupplierAddress: + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0x12 + case *QueryAllClaimsRequest_SessionId: + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0x1a + case *QueryAllClaimsRequest_SessionEndHeight: + i = runtime.EncodeVarint(dAtA, i, uint64(x.SessionEndHeight)) + i-- + dAtA[i] = 0x20 + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllClaimsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllClaimsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllClaimsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Filter = &QueryAllClaimsRequest_SupplierAddress{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Filter = &QueryAllClaimsRequest_SessionId{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionEndHeight", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Filter = &QueryAllClaimsRequest_SessionEndHeight{v} + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllClaimsResponse_1_list)(nil) + +type _QueryAllClaimsResponse_1_list struct { + list *[]*Claim +} + +func (x *_QueryAllClaimsResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllClaimsResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllClaimsResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Claim) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllClaimsResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Claim) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllClaimsResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Claim) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllClaimsResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllClaimsResponse_1_list) NewElement() protoreflect.Value { + v := new(Claim) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllClaimsResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllClaimsResponse protoreflect.MessageDescriptor + fd_QueryAllClaimsResponse_claims protoreflect.FieldDescriptor + fd_QueryAllClaimsResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryAllClaimsResponse = File_poktroll_proof_query_proto.Messages().ByName("QueryAllClaimsResponse") + fd_QueryAllClaimsResponse_claims = md_QueryAllClaimsResponse.Fields().ByName("claims") + fd_QueryAllClaimsResponse_pagination = md_QueryAllClaimsResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllClaimsResponse)(nil) + +type fastReflection_QueryAllClaimsResponse QueryAllClaimsResponse + +func (x *QueryAllClaimsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllClaimsResponse)(x) +} + +func (x *QueryAllClaimsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllClaimsResponse_messageType fastReflection_QueryAllClaimsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllClaimsResponse_messageType{} + +type fastReflection_QueryAllClaimsResponse_messageType struct{} + +func (x fastReflection_QueryAllClaimsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllClaimsResponse)(nil) +} +func (x fastReflection_QueryAllClaimsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllClaimsResponse) +} +func (x fastReflection_QueryAllClaimsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllClaimsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllClaimsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllClaimsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllClaimsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllClaimsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllClaimsResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllClaimsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllClaimsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllClaimsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllClaimsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Claims) != 0 { + value := protoreflect.ValueOfList(&_QueryAllClaimsResponse_1_list{list: &x.Claims}) + if !f(fd_QueryAllClaimsResponse_claims, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllClaimsResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllClaimsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsResponse.claims": + return len(x.Claims) != 0 + case "poktroll.proof.QueryAllClaimsResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsResponse.claims": + x.Claims = nil + case "poktroll.proof.QueryAllClaimsResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllClaimsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryAllClaimsResponse.claims": + if len(x.Claims) == 0 { + return protoreflect.ValueOfList(&_QueryAllClaimsResponse_1_list{}) + } + listValue := &_QueryAllClaimsResponse_1_list{list: &x.Claims} + return protoreflect.ValueOfList(listValue) + case "poktroll.proof.QueryAllClaimsResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsResponse.claims": + lv := value.List() + clv := lv.(*_QueryAllClaimsResponse_1_list) + x.Claims = *clv.list + case "poktroll.proof.QueryAllClaimsResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsResponse.claims": + if x.Claims == nil { + x.Claims = []*Claim{} + } + value := &_QueryAllClaimsResponse_1_list{list: &x.Claims} + return protoreflect.ValueOfList(value) + case "poktroll.proof.QueryAllClaimsResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllClaimsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllClaimsResponse.claims": + list := []*Claim{} + return protoreflect.ValueOfList(&_QueryAllClaimsResponse_1_list{list: &list}) + case "poktroll.proof.QueryAllClaimsResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllClaimsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllClaimsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllClaimsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryAllClaimsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllClaimsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllClaimsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllClaimsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllClaimsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllClaimsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Claims) > 0 { + for _, e := range x.Claims { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllClaimsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Claims) > 0 { + for iNdEx := len(x.Claims) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Claims[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllClaimsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllClaimsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllClaimsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Claims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Claims = append(x.Claims, &Claim{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Claims[len(x.Claims)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetProofRequest protoreflect.MessageDescriptor + fd_QueryGetProofRequest_session_id protoreflect.FieldDescriptor + fd_QueryGetProofRequest_supplier_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryGetProofRequest = File_poktroll_proof_query_proto.Messages().ByName("QueryGetProofRequest") + fd_QueryGetProofRequest_session_id = md_QueryGetProofRequest.Fields().ByName("session_id") + fd_QueryGetProofRequest_supplier_address = md_QueryGetProofRequest.Fields().ByName("supplier_address") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetProofRequest)(nil) + +type fastReflection_QueryGetProofRequest QueryGetProofRequest + +func (x *QueryGetProofRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetProofRequest)(x) +} + +func (x *QueryGetProofRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetProofRequest_messageType fastReflection_QueryGetProofRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetProofRequest_messageType{} + +type fastReflection_QueryGetProofRequest_messageType struct{} + +func (x fastReflection_QueryGetProofRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetProofRequest)(nil) +} +func (x fastReflection_QueryGetProofRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetProofRequest) +} +func (x fastReflection_QueryGetProofRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetProofRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetProofRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetProofRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetProofRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetProofRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetProofRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetProofRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetProofRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetProofRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetProofRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SessionId != "" { + value := protoreflect.ValueOfString(x.SessionId) + if !f(fd_QueryGetProofRequest_session_id, value) { + return + } + } + if x.SupplierAddress != "" { + value := protoreflect.ValueOfString(x.SupplierAddress) + if !f(fd_QueryGetProofRequest_supplier_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetProofRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofRequest.session_id": + return x.SessionId != "" + case "poktroll.proof.QueryGetProofRequest.supplier_address": + return x.SupplierAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofRequest.session_id": + x.SessionId = "" + case "poktroll.proof.QueryGetProofRequest.supplier_address": + x.SupplierAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetProofRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryGetProofRequest.session_id": + value := x.SessionId + return protoreflect.ValueOfString(value) + case "poktroll.proof.QueryGetProofRequest.supplier_address": + value := x.SupplierAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofRequest.session_id": + x.SessionId = value.Interface().(string) + case "poktroll.proof.QueryGetProofRequest.supplier_address": + x.SupplierAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofRequest.session_id": + panic(fmt.Errorf("field session_id of message poktroll.proof.QueryGetProofRequest is not mutable")) + case "poktroll.proof.QueryGetProofRequest.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.QueryGetProofRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetProofRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofRequest.session_id": + return protoreflect.ValueOfString("") + case "poktroll.proof.QueryGetProofRequest.supplier_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetProofRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryGetProofRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetProofRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetProofRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetProofRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetProofRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.SessionId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.SupplierAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetProofRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.SupplierAddress) > 0 { + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.SessionId) > 0 { + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetProofRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetProofRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetProofRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetProofResponse protoreflect.MessageDescriptor + fd_QueryGetProofResponse_proof protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryGetProofResponse = File_poktroll_proof_query_proto.Messages().ByName("QueryGetProofResponse") + fd_QueryGetProofResponse_proof = md_QueryGetProofResponse.Fields().ByName("proof") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetProofResponse)(nil) + +type fastReflection_QueryGetProofResponse QueryGetProofResponse + +func (x *QueryGetProofResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetProofResponse)(x) +} + +func (x *QueryGetProofResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetProofResponse_messageType fastReflection_QueryGetProofResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetProofResponse_messageType{} + +type fastReflection_QueryGetProofResponse_messageType struct{} + +func (x fastReflection_QueryGetProofResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetProofResponse)(nil) +} +func (x fastReflection_QueryGetProofResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetProofResponse) +} +func (x fastReflection_QueryGetProofResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetProofResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetProofResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetProofResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetProofResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetProofResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetProofResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetProofResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetProofResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetProofResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetProofResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Proof != nil { + value := protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + if !f(fd_QueryGetProofResponse_proof, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetProofResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofResponse.proof": + return x.Proof != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofResponse.proof": + x.Proof = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetProofResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryGetProofResponse.proof": + value := x.Proof + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofResponse.proof": + x.Proof = value.Message().Interface().(*Proof) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofResponse.proof": + if x.Proof == nil { + x.Proof = new(Proof) + } + return protoreflect.ValueOfMessage(x.Proof.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetProofResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryGetProofResponse.proof": + m := new(Proof) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryGetProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryGetProofResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetProofResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryGetProofResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetProofResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetProofResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetProofResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetProofResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetProofResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Proof != nil { + l = options.Size(x.Proof) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetProofResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Proof != nil { + encoded, err := options.Marshal(x.Proof) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetProofResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetProofResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetProofResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Proof == nil { + x.Proof = &Proof{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Proof); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllProofsRequest protoreflect.MessageDescriptor + fd_QueryAllProofsRequest_pagination protoreflect.FieldDescriptor + fd_QueryAllProofsRequest_supplier_address protoreflect.FieldDescriptor + fd_QueryAllProofsRequest_session_id protoreflect.FieldDescriptor + fd_QueryAllProofsRequest_session_end_height protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryAllProofsRequest = File_poktroll_proof_query_proto.Messages().ByName("QueryAllProofsRequest") + fd_QueryAllProofsRequest_pagination = md_QueryAllProofsRequest.Fields().ByName("pagination") + fd_QueryAllProofsRequest_supplier_address = md_QueryAllProofsRequest.Fields().ByName("supplier_address") + fd_QueryAllProofsRequest_session_id = md_QueryAllProofsRequest.Fields().ByName("session_id") + fd_QueryAllProofsRequest_session_end_height = md_QueryAllProofsRequest.Fields().ByName("session_end_height") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllProofsRequest)(nil) + +type fastReflection_QueryAllProofsRequest QueryAllProofsRequest + +func (x *QueryAllProofsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllProofsRequest)(x) +} + +func (x *QueryAllProofsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllProofsRequest_messageType fastReflection_QueryAllProofsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllProofsRequest_messageType{} + +type fastReflection_QueryAllProofsRequest_messageType struct{} + +func (x fastReflection_QueryAllProofsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllProofsRequest)(nil) +} +func (x fastReflection_QueryAllProofsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllProofsRequest) +} +func (x fastReflection_QueryAllProofsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllProofsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllProofsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllProofsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllProofsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllProofsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllProofsRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllProofsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllProofsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllProofsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllProofsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllProofsRequest_pagination, value) { + return + } + } + if x.Filter != nil { + switch o := x.Filter.(type) { + case *QueryAllProofsRequest_SupplierAddress: + v := o.SupplierAddress + value := protoreflect.ValueOfString(v) + if !f(fd_QueryAllProofsRequest_supplier_address, value) { + return + } + case *QueryAllProofsRequest_SessionId: + v := o.SessionId + value := protoreflect.ValueOfString(v) + if !f(fd_QueryAllProofsRequest_session_id, value) { + return + } + case *QueryAllProofsRequest_SessionEndHeight: + v := o.SessionEndHeight + value := protoreflect.ValueOfUint64(v) + if !f(fd_QueryAllProofsRequest_session_end_height, value) { + return + } + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllProofsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsRequest.pagination": + return x.Pagination != nil + case "poktroll.proof.QueryAllProofsRequest.supplier_address": + if x.Filter == nil { + return false + } else if _, ok := x.Filter.(*QueryAllProofsRequest_SupplierAddress); ok { + return true + } else { + return false + } + case "poktroll.proof.QueryAllProofsRequest.session_id": + if x.Filter == nil { + return false + } else if _, ok := x.Filter.(*QueryAllProofsRequest_SessionId); ok { + return true + } else { + return false + } + case "poktroll.proof.QueryAllProofsRequest.session_end_height": + if x.Filter == nil { + return false + } else if _, ok := x.Filter.(*QueryAllProofsRequest_SessionEndHeight); ok { + return true + } else { + return false + } + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsRequest.pagination": + x.Pagination = nil + case "poktroll.proof.QueryAllProofsRequest.supplier_address": + x.Filter = nil + case "poktroll.proof.QueryAllProofsRequest.session_id": + x.Filter = nil + case "poktroll.proof.QueryAllProofsRequest.session_end_height": + x.Filter = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllProofsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryAllProofsRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.QueryAllProofsRequest.supplier_address": + if x.Filter == nil { + return protoreflect.ValueOfString("") + } else if v, ok := x.Filter.(*QueryAllProofsRequest_SupplierAddress); ok { + return protoreflect.ValueOfString(v.SupplierAddress) + } else { + return protoreflect.ValueOfString("") + } + case "poktroll.proof.QueryAllProofsRequest.session_id": + if x.Filter == nil { + return protoreflect.ValueOfString("") + } else if v, ok := x.Filter.(*QueryAllProofsRequest_SessionId); ok { + return protoreflect.ValueOfString(v.SessionId) + } else { + return protoreflect.ValueOfString("") + } + case "poktroll.proof.QueryAllProofsRequest.session_end_height": + if x.Filter == nil { + return protoreflect.ValueOfUint64(uint64(0)) + } else if v, ok := x.Filter.(*QueryAllProofsRequest_SessionEndHeight); ok { + return protoreflect.ValueOfUint64(v.SessionEndHeight) + } else { + return protoreflect.ValueOfUint64(uint64(0)) + } + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + case "poktroll.proof.QueryAllProofsRequest.supplier_address": + cv := value.Interface().(string) + x.Filter = &QueryAllProofsRequest_SupplierAddress{SupplierAddress: cv} + case "poktroll.proof.QueryAllProofsRequest.session_id": + cv := value.Interface().(string) + x.Filter = &QueryAllProofsRequest_SessionId{SessionId: cv} + case "poktroll.proof.QueryAllProofsRequest.session_end_height": + cv := value.Uint() + x.Filter = &QueryAllProofsRequest_SessionEndHeight{SessionEndHeight: cv} + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + case "poktroll.proof.QueryAllProofsRequest.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.QueryAllProofsRequest is not mutable")) + case "poktroll.proof.QueryAllProofsRequest.session_id": + panic(fmt.Errorf("field session_id of message poktroll.proof.QueryAllProofsRequest is not mutable")) + case "poktroll.proof.QueryAllProofsRequest.session_end_height": + panic(fmt.Errorf("field session_end_height of message poktroll.proof.QueryAllProofsRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllProofsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.QueryAllProofsRequest.supplier_address": + return protoreflect.ValueOfString("") + case "poktroll.proof.QueryAllProofsRequest.session_id": + return protoreflect.ValueOfString("") + case "poktroll.proof.QueryAllProofsRequest.session_end_height": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsRequest")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllProofsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + case "poktroll.proof.QueryAllProofsRequest.filter": + if x.Filter == nil { + return nil + } + switch x.Filter.(type) { + case *QueryAllProofsRequest_SupplierAddress: + return x.Descriptor().Fields().ByName("supplier_address") + case *QueryAllProofsRequest_SessionId: + return x.Descriptor().Fields().ByName("session_id") + case *QueryAllProofsRequest_SessionEndHeight: + return x.Descriptor().Fields().ByName("session_end_height") + } + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryAllProofsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllProofsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllProofsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllProofsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllProofsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + switch x := x.Filter.(type) { + case *QueryAllProofsRequest_SupplierAddress: + if x == nil { + break + } + l = len(x.SupplierAddress) + n += 1 + l + runtime.Sov(uint64(l)) + case *QueryAllProofsRequest_SessionId: + if x == nil { + break + } + l = len(x.SessionId) + n += 1 + l + runtime.Sov(uint64(l)) + case *QueryAllProofsRequest_SessionEndHeight: + if x == nil { + break + } + n += 1 + runtime.Sov(uint64(x.SessionEndHeight)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllProofsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + switch x := x.Filter.(type) { + case *QueryAllProofsRequest_SupplierAddress: + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0x12 + case *QueryAllProofsRequest_SessionId: + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0x1a + case *QueryAllProofsRequest_SessionEndHeight: + i = runtime.EncodeVarint(dAtA, i, uint64(x.SessionEndHeight)) + i-- + dAtA[i] = 0x20 + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllProofsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllProofsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllProofsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Filter = &QueryAllProofsRequest_SupplierAddress{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Filter = &QueryAllProofsRequest_SessionId{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionEndHeight", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Filter = &QueryAllProofsRequest_SessionEndHeight{v} + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllProofsResponse_1_list)(nil) + +type _QueryAllProofsResponse_1_list struct { + list *[]*Proof +} + +func (x *_QueryAllProofsResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllProofsResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllProofsResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Proof) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllProofsResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Proof) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllProofsResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Proof) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllProofsResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllProofsResponse_1_list) NewElement() protoreflect.Value { + v := new(Proof) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllProofsResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllProofsResponse protoreflect.MessageDescriptor + fd_QueryAllProofsResponse_proofs protoreflect.FieldDescriptor + fd_QueryAllProofsResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_query_proto_init() + md_QueryAllProofsResponse = File_poktroll_proof_query_proto.Messages().ByName("QueryAllProofsResponse") + fd_QueryAllProofsResponse_proofs = md_QueryAllProofsResponse.Fields().ByName("proofs") + fd_QueryAllProofsResponse_pagination = md_QueryAllProofsResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllProofsResponse)(nil) + +type fastReflection_QueryAllProofsResponse QueryAllProofsResponse + +func (x *QueryAllProofsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllProofsResponse)(x) +} + +func (x *QueryAllProofsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_query_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllProofsResponse_messageType fastReflection_QueryAllProofsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllProofsResponse_messageType{} + +type fastReflection_QueryAllProofsResponse_messageType struct{} + +func (x fastReflection_QueryAllProofsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllProofsResponse)(nil) +} +func (x fastReflection_QueryAllProofsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllProofsResponse) +} +func (x fastReflection_QueryAllProofsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllProofsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllProofsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllProofsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllProofsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllProofsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllProofsResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllProofsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllProofsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllProofsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllProofsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Proofs) != 0 { + value := protoreflect.ValueOfList(&_QueryAllProofsResponse_1_list{list: &x.Proofs}) + if !f(fd_QueryAllProofsResponse_proofs, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllProofsResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllProofsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsResponse.proofs": + return len(x.Proofs) != 0 + case "poktroll.proof.QueryAllProofsResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsResponse.proofs": + x.Proofs = nil + case "poktroll.proof.QueryAllProofsResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllProofsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.QueryAllProofsResponse.proofs": + if len(x.Proofs) == 0 { + return protoreflect.ValueOfList(&_QueryAllProofsResponse_1_list{}) + } + listValue := &_QueryAllProofsResponse_1_list{list: &x.Proofs} + return protoreflect.ValueOfList(listValue) + case "poktroll.proof.QueryAllProofsResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsResponse.proofs": + lv := value.List() + clv := lv.(*_QueryAllProofsResponse_1_list) + x.Proofs = *clv.list + case "poktroll.proof.QueryAllProofsResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsResponse.proofs": + if x.Proofs == nil { + x.Proofs = []*Proof{} + } + value := &_QueryAllProofsResponse_1_list{list: &x.Proofs} + return protoreflect.ValueOfList(value) + case "poktroll.proof.QueryAllProofsResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllProofsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.QueryAllProofsResponse.proofs": + list := []*Proof{} + return protoreflect.ValueOfList(&_QueryAllProofsResponse_1_list{list: &list}) + case "poktroll.proof.QueryAllProofsResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.QueryAllProofsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.QueryAllProofsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllProofsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.QueryAllProofsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllProofsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllProofsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllProofsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllProofsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllProofsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Proofs) > 0 { + for _, e := range x.Proofs { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllProofsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Proofs) > 0 { + for iNdEx := len(x.Proofs) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Proofs[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllProofsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllProofsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllProofsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proofs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Proofs = append(x.Proofs, &Proof{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Proofs[len(x.Proofs)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetClaimRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + SupplierAddress string `protobuf:"bytes,2,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` +} + +func (x *QueryGetClaimRequest) Reset() { + *x = QueryGetClaimRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetClaimRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetClaimRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetClaimRequest.ProtoReflect.Descriptor instead. +func (*QueryGetClaimRequest) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetClaimRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *QueryGetClaimRequest) GetSupplierAddress() string { + if x != nil { + return x.SupplierAddress + } + return "" +} + +type QueryGetClaimResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Claim *Claim `protobuf:"bytes,1,opt,name=claim,proto3" json:"claim,omitempty"` +} + +func (x *QueryGetClaimResponse) Reset() { + *x = QueryGetClaimResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetClaimResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetClaimResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetClaimResponse.ProtoReflect.Descriptor instead. +func (*QueryGetClaimResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetClaimResponse) GetClaim() *Claim { + if x != nil { + return x.Claim + } + return nil +} + +type QueryAllClaimsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // Types that are assignable to Filter: + // + // *QueryAllClaimsRequest_SupplierAddress + // *QueryAllClaimsRequest_SessionId + // *QueryAllClaimsRequest_SessionEndHeight + Filter isQueryAllClaimsRequest_Filter `protobuf_oneof:"filter"` +} + +func (x *QueryAllClaimsRequest) Reset() { + *x = QueryAllClaimsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllClaimsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllClaimsRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllClaimsRequest.ProtoReflect.Descriptor instead. +func (*QueryAllClaimsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllClaimsRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +func (x *QueryAllClaimsRequest) GetFilter() isQueryAllClaimsRequest_Filter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *QueryAllClaimsRequest) GetSupplierAddress() string { + if x, ok := x.GetFilter().(*QueryAllClaimsRequest_SupplierAddress); ok { + return x.SupplierAddress + } + return "" +} + +func (x *QueryAllClaimsRequest) GetSessionId() string { + if x, ok := x.GetFilter().(*QueryAllClaimsRequest_SessionId); ok { + return x.SessionId + } + return "" +} + +func (x *QueryAllClaimsRequest) GetSessionEndHeight() uint64 { + if x, ok := x.GetFilter().(*QueryAllClaimsRequest_SessionEndHeight); ok { + return x.SessionEndHeight + } + return 0 +} + +type isQueryAllClaimsRequest_Filter interface { + isQueryAllClaimsRequest_Filter() +} + +type QueryAllClaimsRequest_SupplierAddress struct { + SupplierAddress string `protobuf:"bytes,2,opt,name=supplier_address,json=supplierAddress,proto3,oneof"` +} + +type QueryAllClaimsRequest_SessionId struct { + SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3,oneof"` +} + +type QueryAllClaimsRequest_SessionEndHeight struct { + SessionEndHeight uint64 `protobuf:"varint,4,opt,name=session_end_height,json=sessionEndHeight,proto3,oneof"` +} + +func (*QueryAllClaimsRequest_SupplierAddress) isQueryAllClaimsRequest_Filter() {} + +func (*QueryAllClaimsRequest_SessionId) isQueryAllClaimsRequest_Filter() {} + +func (*QueryAllClaimsRequest_SessionEndHeight) isQueryAllClaimsRequest_Filter() {} + +type QueryAllClaimsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Claims []*Claim `protobuf:"bytes,1,rep,name=claims,proto3" json:"claims,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllClaimsResponse) Reset() { + *x = QueryAllClaimsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllClaimsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllClaimsResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllClaimsResponse.ProtoReflect.Descriptor instead. +func (*QueryAllClaimsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllClaimsResponse) GetClaims() []*Claim { + if x != nil { + return x.Claims + } + return nil +} + +func (x *QueryAllClaimsResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryGetProofRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + SupplierAddress string `protobuf:"bytes,2,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` +} + +func (x *QueryGetProofRequest) Reset() { + *x = QueryGetProofRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetProofRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetProofRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetProofRequest.ProtoReflect.Descriptor instead. +func (*QueryGetProofRequest) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{6} +} + +func (x *QueryGetProofRequest) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *QueryGetProofRequest) GetSupplierAddress() string { + if x != nil { + return x.SupplierAddress + } + return "" +} + +type QueryGetProofResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Proof *Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (x *QueryGetProofResponse) Reset() { + *x = QueryGetProofResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetProofResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetProofResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetProofResponse.ProtoReflect.Descriptor instead. +func (*QueryGetProofResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{7} +} + +func (x *QueryGetProofResponse) GetProof() *Proof { + if x != nil { + return x.Proof + } + return nil +} + +type QueryAllProofsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // Types that are assignable to Filter: + // + // *QueryAllProofsRequest_SupplierAddress + // *QueryAllProofsRequest_SessionId + // *QueryAllProofsRequest_SessionEndHeight + Filter isQueryAllProofsRequest_Filter `protobuf_oneof:"filter"` +} + +func (x *QueryAllProofsRequest) Reset() { + *x = QueryAllProofsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllProofsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllProofsRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllProofsRequest.ProtoReflect.Descriptor instead. +func (*QueryAllProofsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{8} +} + +func (x *QueryAllProofsRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +func (x *QueryAllProofsRequest) GetFilter() isQueryAllProofsRequest_Filter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *QueryAllProofsRequest) GetSupplierAddress() string { + if x, ok := x.GetFilter().(*QueryAllProofsRequest_SupplierAddress); ok { + return x.SupplierAddress + } + return "" +} + +func (x *QueryAllProofsRequest) GetSessionId() string { + if x, ok := x.GetFilter().(*QueryAllProofsRequest_SessionId); ok { + return x.SessionId + } + return "" +} + +func (x *QueryAllProofsRequest) GetSessionEndHeight() uint64 { + if x, ok := x.GetFilter().(*QueryAllProofsRequest_SessionEndHeight); ok { + return x.SessionEndHeight + } + return 0 +} + +type isQueryAllProofsRequest_Filter interface { + isQueryAllProofsRequest_Filter() +} + +type QueryAllProofsRequest_SupplierAddress struct { + SupplierAddress string `protobuf:"bytes,2,opt,name=supplier_address,json=supplierAddress,proto3,oneof"` +} + +type QueryAllProofsRequest_SessionId struct { + SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3,oneof"` +} + +type QueryAllProofsRequest_SessionEndHeight struct { + SessionEndHeight uint64 `protobuf:"varint,4,opt,name=session_end_height,json=sessionEndHeight,proto3,oneof"` +} + +func (*QueryAllProofsRequest_SupplierAddress) isQueryAllProofsRequest_Filter() {} + +func (*QueryAllProofsRequest_SessionId) isQueryAllProofsRequest_Filter() {} + +func (*QueryAllProofsRequest_SessionEndHeight) isQueryAllProofsRequest_Filter() {} + +type QueryAllProofsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Proofs []*Proof `protobuf:"bytes,1,rep,name=proofs,proto3" json:"proofs,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllProofsResponse) Reset() { + *x = QueryAllProofsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_query_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllProofsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllProofsResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllProofsResponse.ProtoReflect.Descriptor instead. +func (*QueryAllProofsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_query_proto_rawDescGZIP(), []int{9} +} + +func (x *QueryAllProofsResponse) GetProofs() []*Proof { + if x != nil { + return x.Proofs + } + return nil +} + +func (x *QueryAllProofsResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_poktroll_proof_query_proto protoreflect.FileDescriptor + +var file_poktroll_proof_query_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x11, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x50, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x7a, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x43, + 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x22, 0x4a, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x43, + 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, + 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, + 0x69, 0x6d, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x22, + 0xe7, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x2b, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0f, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, + 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x2e, 0x0a, 0x12, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x68, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x10, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, + 0x08, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x96, 0x01, 0x0a, 0x16, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x06, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x7a, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x4a, + 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x22, 0xe7, 0x01, 0x0a, 0x15, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x10, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0a, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x10, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x45, 0x6e, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x08, 0x0a, 0x06, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x22, 0x96, 0x01, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, + 0x6c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x33, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x72, + 0x6f, 0x6f, 0x66, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xdf, 0x05, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x7e, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x25, 0x12, 0x23, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0xa0, 0x01, 0x0a, 0x05, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, + 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4a, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x44, 0x12, 0x42, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2f, 0x7b, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x7b, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x86, 0x01, 0x0a, 0x09, 0x41, + 0x6c, 0x6c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x6c, 0x6c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, + 0x22, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, + 0x61, 0x69, 0x6d, 0x12, 0xa0, 0x01, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x24, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4a, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x44, 0x12, 0x42, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x7b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x7d, 0x2f, 0x7b, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x86, 0x01, 0x0a, 0x09, 0x41, 0x6c, 0x6c, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, + 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, 0x1a, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_query_proto_rawDescOnce sync.Once + file_poktroll_proof_query_proto_rawDescData = file_poktroll_proof_query_proto_rawDesc +) + +func file_poktroll_proof_query_proto_rawDescGZIP() []byte { + file_poktroll_proof_query_proto_rawDescOnce.Do(func() { + file_poktroll_proof_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_query_proto_rawDescData) + }) + return file_poktroll_proof_query_proto_rawDescData +} + +var file_poktroll_proof_query_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_poktroll_proof_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.proof.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.proof.QueryParamsResponse + (*QueryGetClaimRequest)(nil), // 2: poktroll.proof.QueryGetClaimRequest + (*QueryGetClaimResponse)(nil), // 3: poktroll.proof.QueryGetClaimResponse + (*QueryAllClaimsRequest)(nil), // 4: poktroll.proof.QueryAllClaimsRequest + (*QueryAllClaimsResponse)(nil), // 5: poktroll.proof.QueryAllClaimsResponse + (*QueryGetProofRequest)(nil), // 6: poktroll.proof.QueryGetProofRequest + (*QueryGetProofResponse)(nil), // 7: poktroll.proof.QueryGetProofResponse + (*QueryAllProofsRequest)(nil), // 8: poktroll.proof.QueryAllProofsRequest + (*QueryAllProofsResponse)(nil), // 9: poktroll.proof.QueryAllProofsResponse + (*Params)(nil), // 10: poktroll.proof.Params + (*Claim)(nil), // 11: poktroll.proof.Claim + (*v1beta1.PageRequest)(nil), // 12: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 13: cosmos.base.query.v1beta1.PageResponse + (*Proof)(nil), // 14: poktroll.proof.Proof +} +var file_poktroll_proof_query_proto_depIdxs = []int32{ + 10, // 0: poktroll.proof.QueryParamsResponse.params:type_name -> poktroll.proof.Params + 11, // 1: poktroll.proof.QueryGetClaimResponse.claim:type_name -> poktroll.proof.Claim + 12, // 2: poktroll.proof.QueryAllClaimsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 11, // 3: poktroll.proof.QueryAllClaimsResponse.claims:type_name -> poktroll.proof.Claim + 13, // 4: poktroll.proof.QueryAllClaimsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 14, // 5: poktroll.proof.QueryGetProofResponse.proof:type_name -> poktroll.proof.Proof + 12, // 6: poktroll.proof.QueryAllProofsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 14, // 7: poktroll.proof.QueryAllProofsResponse.proofs:type_name -> poktroll.proof.Proof + 13, // 8: poktroll.proof.QueryAllProofsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 9: poktroll.proof.Query.Params:input_type -> poktroll.proof.QueryParamsRequest + 2, // 10: poktroll.proof.Query.Claim:input_type -> poktroll.proof.QueryGetClaimRequest + 4, // 11: poktroll.proof.Query.AllClaims:input_type -> poktroll.proof.QueryAllClaimsRequest + 6, // 12: poktroll.proof.Query.Proof:input_type -> poktroll.proof.QueryGetProofRequest + 8, // 13: poktroll.proof.Query.AllProofs:input_type -> poktroll.proof.QueryAllProofsRequest + 1, // 14: poktroll.proof.Query.Params:output_type -> poktroll.proof.QueryParamsResponse + 3, // 15: poktroll.proof.Query.Claim:output_type -> poktroll.proof.QueryGetClaimResponse + 5, // 16: poktroll.proof.Query.AllClaims:output_type -> poktroll.proof.QueryAllClaimsResponse + 7, // 17: poktroll.proof.Query.Proof:output_type -> poktroll.proof.QueryGetProofResponse + 9, // 18: poktroll.proof.Query.AllProofs:output_type -> poktroll.proof.QueryAllProofsResponse + 14, // [14:19] is the sub-list for method output_type + 9, // [9:14] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_query_proto_init() } +func file_poktroll_proof_query_proto_init() { + if File_poktroll_proof_query_proto != nil { + return + } + file_poktroll_proof_params_proto_init() + file_poktroll_proof_claim_proto_init() + file_poktroll_proof_proof_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetClaimRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetClaimResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllClaimsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllClaimsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetProofRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetProofResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllProofsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_query_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllProofsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_poktroll_proof_query_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*QueryAllClaimsRequest_SupplierAddress)(nil), + (*QueryAllClaimsRequest_SessionId)(nil), + (*QueryAllClaimsRequest_SessionEndHeight)(nil), + } + file_poktroll_proof_query_proto_msgTypes[8].OneofWrappers = []interface{}{ + (*QueryAllProofsRequest_SupplierAddress)(nil), + (*QueryAllProofsRequest_SessionId)(nil), + (*QueryAllProofsRequest_SessionEndHeight)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_proof_query_proto_goTypes, + DependencyIndexes: file_poktroll_proof_query_proto_depIdxs, + MessageInfos: file_poktroll_proof_query_proto_msgTypes, + }.Build() + File_poktroll_proof_query_proto = out.File + file_poktroll_proof_query_proto_rawDesc = nil + file_poktroll_proof_query_proto_goTypes = nil + file_poktroll_proof_query_proto_depIdxs = nil +} diff --git a/api/poktroll/proof/tx.pulsar.go b/api/poktroll/proof/tx.pulsar.go new file mode 100644 index 000000000..384f04713 --- /dev/null +++ b/api/poktroll/proof/tx.pulsar.go @@ -0,0 +1,3189 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package proof + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + session "github.com/pokt-network/poktroll/api/poktroll/session" + _ "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_tx_proto_init() + md_MsgUpdateParams = File_poktroll_proof_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.proof.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.proof.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.proof.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.proof.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.proof.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.proof.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.proof.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_proof_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_proof_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateClaim protoreflect.MessageDescriptor + fd_MsgCreateClaim_supplier_address protoreflect.FieldDescriptor + fd_MsgCreateClaim_session_header protoreflect.FieldDescriptor + fd_MsgCreateClaim_root_hash protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_tx_proto_init() + md_MsgCreateClaim = File_poktroll_proof_tx_proto.Messages().ByName("MsgCreateClaim") + fd_MsgCreateClaim_supplier_address = md_MsgCreateClaim.Fields().ByName("supplier_address") + fd_MsgCreateClaim_session_header = md_MsgCreateClaim.Fields().ByName("session_header") + fd_MsgCreateClaim_root_hash = md_MsgCreateClaim.Fields().ByName("root_hash") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateClaim)(nil) + +type fastReflection_MsgCreateClaim MsgCreateClaim + +func (x *MsgCreateClaim) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateClaim)(x) +} + +func (x *MsgCreateClaim) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateClaim_messageType fastReflection_MsgCreateClaim_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateClaim_messageType{} + +type fastReflection_MsgCreateClaim_messageType struct{} + +func (x fastReflection_MsgCreateClaim_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateClaim)(nil) +} +func (x fastReflection_MsgCreateClaim_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateClaim) +} +func (x fastReflection_MsgCreateClaim_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClaim +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateClaim) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClaim +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateClaim) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateClaim_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateClaim) New() protoreflect.Message { + return new(fastReflection_MsgCreateClaim) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateClaim) Interface() protoreflect.ProtoMessage { + return (*MsgCreateClaim)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateClaim) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SupplierAddress != "" { + value := protoreflect.ValueOfString(x.SupplierAddress) + if !f(fd_MsgCreateClaim_supplier_address, value) { + return + } + } + if x.SessionHeader != nil { + value := protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + if !f(fd_MsgCreateClaim_session_header, value) { + return + } + } + if len(x.RootHash) != 0 { + value := protoreflect.ValueOfBytes(x.RootHash) + if !f(fd_MsgCreateClaim_root_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateClaim) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.MsgCreateClaim.supplier_address": + return x.SupplierAddress != "" + case "poktroll.proof.MsgCreateClaim.session_header": + return x.SessionHeader != nil + case "poktroll.proof.MsgCreateClaim.root_hash": + return len(x.RootHash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaim")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaim does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaim) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.MsgCreateClaim.supplier_address": + x.SupplierAddress = "" + case "poktroll.proof.MsgCreateClaim.session_header": + x.SessionHeader = nil + case "poktroll.proof.MsgCreateClaim.root_hash": + x.RootHash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaim")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaim does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateClaim) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.MsgCreateClaim.supplier_address": + value := x.SupplierAddress + return protoreflect.ValueOfString(value) + case "poktroll.proof.MsgCreateClaim.session_header": + value := x.SessionHeader + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.MsgCreateClaim.root_hash": + value := x.RootHash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaim")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaim does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaim) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.MsgCreateClaim.supplier_address": + x.SupplierAddress = value.Interface().(string) + case "poktroll.proof.MsgCreateClaim.session_header": + x.SessionHeader = value.Message().Interface().(*session.SessionHeader) + case "poktroll.proof.MsgCreateClaim.root_hash": + x.RootHash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaim")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaim does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaim) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.MsgCreateClaim.session_header": + if x.SessionHeader == nil { + x.SessionHeader = new(session.SessionHeader) + } + return protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + case "poktroll.proof.MsgCreateClaim.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.MsgCreateClaim is not mutable")) + case "poktroll.proof.MsgCreateClaim.root_hash": + panic(fmt.Errorf("field root_hash of message poktroll.proof.MsgCreateClaim is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaim")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaim does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateClaim) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.MsgCreateClaim.supplier_address": + return protoreflect.ValueOfString("") + case "poktroll.proof.MsgCreateClaim.session_header": + m := new(session.SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.MsgCreateClaim.root_hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaim")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaim does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateClaim) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.MsgCreateClaim", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateClaim) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaim) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateClaim) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateClaim) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateClaim) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.SupplierAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionHeader != nil { + l = options.Size(x.SessionHeader) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.RootHash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateClaim) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.RootHash) > 0 { + i -= len(x.RootHash) + copy(dAtA[i:], x.RootHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RootHash))) + i-- + dAtA[i] = 0x1a + } + if x.SessionHeader != nil { + encoded, err := options.Marshal(x.SessionHeader) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.SupplierAddress) > 0 { + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateClaim) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.SessionHeader == nil { + x.SessionHeader = &session.SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SessionHeader); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RootHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.RootHash = append(x.RootHash[:0], dAtA[iNdEx:postIndex]...) + if x.RootHash == nil { + x.RootHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateClaimResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_proof_tx_proto_init() + md_MsgCreateClaimResponse = File_poktroll_proof_tx_proto.Messages().ByName("MsgCreateClaimResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateClaimResponse)(nil) + +type fastReflection_MsgCreateClaimResponse MsgCreateClaimResponse + +func (x *MsgCreateClaimResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateClaimResponse)(x) +} + +func (x *MsgCreateClaimResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateClaimResponse_messageType fastReflection_MsgCreateClaimResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateClaimResponse_messageType{} + +type fastReflection_MsgCreateClaimResponse_messageType struct{} + +func (x fastReflection_MsgCreateClaimResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateClaimResponse)(nil) +} +func (x fastReflection_MsgCreateClaimResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateClaimResponse) +} +func (x fastReflection_MsgCreateClaimResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClaimResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateClaimResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateClaimResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateClaimResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateClaimResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateClaimResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreateClaimResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateClaimResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreateClaimResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateClaimResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateClaimResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaimResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaimResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaimResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateClaimResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaimResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaimResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaimResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaimResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaimResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateClaimResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgCreateClaimResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgCreateClaimResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateClaimResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.MsgCreateClaimResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateClaimResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateClaimResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateClaimResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateClaimResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateClaimResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateClaimResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateClaimResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClaimResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSubmitProof protoreflect.MessageDescriptor + fd_MsgSubmitProof_supplier_address protoreflect.FieldDescriptor + fd_MsgSubmitProof_session_header protoreflect.FieldDescriptor + fd_MsgSubmitProof_proof protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_proof_tx_proto_init() + md_MsgSubmitProof = File_poktroll_proof_tx_proto.Messages().ByName("MsgSubmitProof") + fd_MsgSubmitProof_supplier_address = md_MsgSubmitProof.Fields().ByName("supplier_address") + fd_MsgSubmitProof_session_header = md_MsgSubmitProof.Fields().ByName("session_header") + fd_MsgSubmitProof_proof = md_MsgSubmitProof.Fields().ByName("proof") +} + +var _ protoreflect.Message = (*fastReflection_MsgSubmitProof)(nil) + +type fastReflection_MsgSubmitProof MsgSubmitProof + +func (x *MsgSubmitProof) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSubmitProof)(x) +} + +func (x *MsgSubmitProof) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSubmitProof_messageType fastReflection_MsgSubmitProof_messageType +var _ protoreflect.MessageType = fastReflection_MsgSubmitProof_messageType{} + +type fastReflection_MsgSubmitProof_messageType struct{} + +func (x fastReflection_MsgSubmitProof_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSubmitProof)(nil) +} +func (x fastReflection_MsgSubmitProof_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSubmitProof) +} +func (x fastReflection_MsgSubmitProof_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitProof +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSubmitProof) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitProof +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSubmitProof) Type() protoreflect.MessageType { + return _fastReflection_MsgSubmitProof_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSubmitProof) New() protoreflect.Message { + return new(fastReflection_MsgSubmitProof) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSubmitProof) Interface() protoreflect.ProtoMessage { + return (*MsgSubmitProof)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSubmitProof) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SupplierAddress != "" { + value := protoreflect.ValueOfString(x.SupplierAddress) + if !f(fd_MsgSubmitProof_supplier_address, value) { + return + } + } + if x.SessionHeader != nil { + value := protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + if !f(fd_MsgSubmitProof_session_header, value) { + return + } + } + if len(x.Proof) != 0 { + value := protoreflect.ValueOfBytes(x.Proof) + if !f(fd_MsgSubmitProof_proof, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSubmitProof) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.proof.MsgSubmitProof.supplier_address": + return x.SupplierAddress != "" + case "poktroll.proof.MsgSubmitProof.session_header": + return x.SessionHeader != nil + case "poktroll.proof.MsgSubmitProof.proof": + return len(x.Proof) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProof")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProof does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProof) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.proof.MsgSubmitProof.supplier_address": + x.SupplierAddress = "" + case "poktroll.proof.MsgSubmitProof.session_header": + x.SessionHeader = nil + case "poktroll.proof.MsgSubmitProof.proof": + x.Proof = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProof")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProof does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSubmitProof) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.proof.MsgSubmitProof.supplier_address": + value := x.SupplierAddress + return protoreflect.ValueOfString(value) + case "poktroll.proof.MsgSubmitProof.session_header": + value := x.SessionHeader + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.proof.MsgSubmitProof.proof": + value := x.Proof + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProof")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProof does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProof) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.proof.MsgSubmitProof.supplier_address": + x.SupplierAddress = value.Interface().(string) + case "poktroll.proof.MsgSubmitProof.session_header": + x.SessionHeader = value.Message().Interface().(*session.SessionHeader) + case "poktroll.proof.MsgSubmitProof.proof": + x.Proof = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProof")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProof does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProof) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.MsgSubmitProof.session_header": + if x.SessionHeader == nil { + x.SessionHeader = new(session.SessionHeader) + } + return protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + case "poktroll.proof.MsgSubmitProof.supplier_address": + panic(fmt.Errorf("field supplier_address of message poktroll.proof.MsgSubmitProof is not mutable")) + case "poktroll.proof.MsgSubmitProof.proof": + panic(fmt.Errorf("field proof of message poktroll.proof.MsgSubmitProof is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProof")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProof does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSubmitProof) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.proof.MsgSubmitProof.supplier_address": + return protoreflect.ValueOfString("") + case "poktroll.proof.MsgSubmitProof.session_header": + m := new(session.SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.proof.MsgSubmitProof.proof": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProof")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProof does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSubmitProof) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.MsgSubmitProof", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSubmitProof) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProof) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSubmitProof) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSubmitProof) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSubmitProof) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.SupplierAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionHeader != nil { + l = options.Size(x.SessionHeader) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Proof) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitProof) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Proof) > 0 { + i -= len(x.Proof) + copy(dAtA[i:], x.Proof) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Proof))) + i-- + dAtA[i] = 0x1a + } + if x.SessionHeader != nil { + encoded, err := options.Marshal(x.SessionHeader) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.SupplierAddress) > 0 { + i -= len(x.SupplierAddress) + copy(dAtA[i:], x.SupplierAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitProof) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.SessionHeader == nil { + x.SessionHeader = &session.SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SessionHeader); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Proof = append(x.Proof[:0], dAtA[iNdEx:postIndex]...) + if x.Proof == nil { + x.Proof = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSubmitProofResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_proof_tx_proto_init() + md_MsgSubmitProofResponse = File_poktroll_proof_tx_proto.Messages().ByName("MsgSubmitProofResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgSubmitProofResponse)(nil) + +type fastReflection_MsgSubmitProofResponse MsgSubmitProofResponse + +func (x *MsgSubmitProofResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSubmitProofResponse)(x) +} + +func (x *MsgSubmitProofResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_proof_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgSubmitProofResponse_messageType fastReflection_MsgSubmitProofResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgSubmitProofResponse_messageType{} + +type fastReflection_MsgSubmitProofResponse_messageType struct{} + +func (x fastReflection_MsgSubmitProofResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSubmitProofResponse)(nil) +} +func (x fastReflection_MsgSubmitProofResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSubmitProofResponse) +} +func (x fastReflection_MsgSubmitProofResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitProofResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSubmitProofResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitProofResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSubmitProofResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgSubmitProofResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSubmitProofResponse) New() protoreflect.Message { + return new(fastReflection_MsgSubmitProofResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSubmitProofResponse) Interface() protoreflect.ProtoMessage { + return (*MsgSubmitProofResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSubmitProofResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSubmitProofResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProofResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProofResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProofResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSubmitProofResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProofResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProofResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProofResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProofResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProofResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSubmitProofResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.proof.MsgSubmitProofResponse")) + } + panic(fmt.Errorf("message poktroll.proof.MsgSubmitProofResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSubmitProofResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.proof.MsgSubmitProofResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSubmitProofResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitProofResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSubmitProofResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSubmitProofResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSubmitProofResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitProofResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitProofResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitProofResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitProofResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/proof/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{1} +} + +type MsgCreateClaim struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SupplierAddress string `protobuf:"bytes,1,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` + SessionHeader *session.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` + // root returned from smt.SMST#Root() + RootHash []byte `protobuf:"bytes,3,opt,name=root_hash,json=rootHash,proto3" json:"root_hash,omitempty"` +} + +func (x *MsgCreateClaim) Reset() { + *x = MsgCreateClaim{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateClaim) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateClaim) ProtoMessage() {} + +// Deprecated: Use MsgCreateClaim.ProtoReflect.Descriptor instead. +func (*MsgCreateClaim) Descriptor() ([]byte, []int) { + return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgCreateClaim) GetSupplierAddress() string { + if x != nil { + return x.SupplierAddress + } + return "" +} + +func (x *MsgCreateClaim) GetSessionHeader() *session.SessionHeader { + if x != nil { + return x.SessionHeader + } + return nil +} + +func (x *MsgCreateClaim) GetRootHash() []byte { + if x != nil { + return x.RootHash + } + return nil +} + +type MsgCreateClaimResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCreateClaimResponse) Reset() { + *x = MsgCreateClaimResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateClaimResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateClaimResponse) ProtoMessage() {} + +// Deprecated: Use MsgCreateClaimResponse.ProtoReflect.Descriptor instead. +func (*MsgCreateClaimResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{3} +} + +type MsgSubmitProof struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SupplierAddress string `protobuf:"bytes,1,opt,name=supplier_address,json=supplierAddress,proto3" json:"supplier_address,omitempty"` + SessionHeader *session.SessionHeader `protobuf:"bytes,2,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` + // serialized version of *smt.SparseMerkleClosestProof + Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (x *MsgSubmitProof) Reset() { + *x = MsgSubmitProof{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSubmitProof) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSubmitProof) ProtoMessage() {} + +// Deprecated: Use MsgSubmitProof.ProtoReflect.Descriptor instead. +func (*MsgSubmitProof) Descriptor() ([]byte, []int) { + return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgSubmitProof) GetSupplierAddress() string { + if x != nil { + return x.SupplierAddress + } + return "" +} + +func (x *MsgSubmitProof) GetSessionHeader() *session.SessionHeader { + if x != nil { + return x.SessionHeader + } + return nil +} + +func (x *MsgSubmitProof) GetProof() []byte { + if x != nil { + return x.Proof + } + return nil +} + +type MsgSubmitProofResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgSubmitProofResponse) Reset() { + *x = MsgSubmitProofResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_proof_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSubmitProofResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSubmitProofResponse) ProtoMessage() {} + +// Deprecated: Use MsgSubmitProofResponse.ProtoReflect.Descriptor instead. +func (*MsgSubmitProofResponse) Descriptor() ([]byte, []int) { + return file_poktroll_proof_tx_proto_rawDescGZIP(), []int{5} +} + +var File_poktroll_proof_tx_proto protoreflect.FileDescriptor + +var file_poktroll_proof_tx_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xb9, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x39, + 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, + 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x33, 0x82, 0xe7, 0xb0, 0x2a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x20, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, + 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd1, 0x01, 0x0a, 0x0e, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x43, 0x0a, 0x10, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x0f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, + 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x6f, + 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, + 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xca, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x53, + 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x43, 0x0a, 0x10, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x3a, 0x15, 0x82, + 0xe7, 0xb0, 0x2a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x94, + 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x55, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x12, + 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x1a, + 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, + 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, + 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, + 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, + 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_proof_tx_proto_rawDescOnce sync.Once + file_poktroll_proof_tx_proto_rawDescData = file_poktroll_proof_tx_proto_rawDesc +) + +func file_poktroll_proof_tx_proto_rawDescGZIP() []byte { + file_poktroll_proof_tx_proto_rawDescOnce.Do(func() { + file_poktroll_proof_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_proof_tx_proto_rawDescData) + }) + return file_poktroll_proof_tx_proto_rawDescData +} + +var file_poktroll_proof_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_proof_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.proof.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.proof.MsgUpdateParamsResponse + (*MsgCreateClaim)(nil), // 2: poktroll.proof.MsgCreateClaim + (*MsgCreateClaimResponse)(nil), // 3: poktroll.proof.MsgCreateClaimResponse + (*MsgSubmitProof)(nil), // 4: poktroll.proof.MsgSubmitProof + (*MsgSubmitProofResponse)(nil), // 5: poktroll.proof.MsgSubmitProofResponse + (*Params)(nil), // 6: poktroll.proof.Params + (*session.SessionHeader)(nil), // 7: poktroll.session.SessionHeader +} +var file_poktroll_proof_tx_proto_depIdxs = []int32{ + 6, // 0: poktroll.proof.MsgUpdateParams.params:type_name -> poktroll.proof.Params + 7, // 1: poktroll.proof.MsgCreateClaim.session_header:type_name -> poktroll.session.SessionHeader + 7, // 2: poktroll.proof.MsgSubmitProof.session_header:type_name -> poktroll.session.SessionHeader + 0, // 3: poktroll.proof.Msg.UpdateParams:input_type -> poktroll.proof.MsgUpdateParams + 2, // 4: poktroll.proof.Msg.CreateClaim:input_type -> poktroll.proof.MsgCreateClaim + 4, // 5: poktroll.proof.Msg.SubmitProof:input_type -> poktroll.proof.MsgSubmitProof + 1, // 6: poktroll.proof.Msg.UpdateParams:output_type -> poktroll.proof.MsgUpdateParamsResponse + 3, // 7: poktroll.proof.Msg.CreateClaim:output_type -> poktroll.proof.MsgCreateClaimResponse + 5, // 8: poktroll.proof.Msg.SubmitProof:output_type -> poktroll.proof.MsgSubmitProofResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_poktroll_proof_tx_proto_init() } +func file_poktroll_proof_tx_proto_init() { + if File_poktroll_proof_tx_proto != nil { + return + } + file_poktroll_proof_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_proof_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateClaim); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateClaimResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSubmitProof); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_proof_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSubmitProofResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_proof_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_proof_tx_proto_goTypes, + DependencyIndexes: file_poktroll_proof_tx_proto_depIdxs, + MessageInfos: file_poktroll_proof_tx_proto_msgTypes, + }.Build() + File_poktroll_proof_tx_proto = out.File + file_poktroll_proof_tx_proto_rawDesc = nil + file_poktroll_proof_tx_proto_goTypes = nil + file_poktroll_proof_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/service/genesis.pulsar.go b/api/poktroll/service/genesis.pulsar.go new file mode 100644 index 000000000..576428f97 --- /dev/null +++ b/api/poktroll/service/genesis.pulsar.go @@ -0,0 +1,750 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*shared.Service +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(shared.Service) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(shared.Service) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_service_list protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_genesis_proto_init() + md_GenesisState = File_poktroll_service_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_service_list = md_GenesisState.Fields().ByName("service_list") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.ServiceList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.ServiceList}) + if !f(fd_GenesisState_service_list, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + return x.Params != nil + case "poktroll.service.GenesisState.service_list": + return len(x.ServiceList) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + x.Params = nil + case "poktroll.service.GenesisState.service_list": + x.ServiceList = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.GenesisState.service_list": + if len(x.ServiceList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.ServiceList} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "poktroll.service.GenesisState.service_list": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.ServiceList = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.service.GenesisState.service_list": + if x.ServiceList == nil { + x.ServiceList = []*shared.Service{} + } + value := &_GenesisState_2_list{list: &x.ServiceList} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.GenesisState.service_list": + list := []*shared.Service{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.GenesisState")) + } + panic(fmt.Errorf("message poktroll.service.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.ServiceList) > 0 { + for _, e := range x.ServiceList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.ServiceList) > 0 { + for iNdEx := len(x.ServiceList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ServiceList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ServiceList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ServiceList = append(x.ServiceList, &shared.Service{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ServiceList[len(x.ServiceList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the service module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + ServiceList []*shared.Service `protobuf:"bytes,2,rep,name=service_list,json=serviceList,proto3" json:"service_list,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_service_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetServiceList() []*shared.Service { + if x != nil { + return x.ServiceList + } + return nil +} + +var File_poktroll_service_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_service_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x0c, 0x47, 0x65, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_genesis_proto_rawDescOnce sync.Once + file_poktroll_service_genesis_proto_rawDescData = file_poktroll_service_genesis_proto_rawDesc +) + +func file_poktroll_service_genesis_proto_rawDescGZIP() []byte { + file_poktroll_service_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_service_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_genesis_proto_rawDescData) + }) + return file_poktroll_service_genesis_proto_rawDescData +} + +var file_poktroll_service_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.service.GenesisState + (*Params)(nil), // 1: poktroll.service.Params + (*shared.Service)(nil), // 2: poktroll.shared.Service +} +var file_poktroll_service_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.service.GenesisState.params:type_name -> poktroll.service.Params + 2, // 1: poktroll.service.GenesisState.service_list:type_name -> poktroll.shared.Service + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_service_genesis_proto_init() } +func file_poktroll_service_genesis_proto_init() { + if File_poktroll_service_genesis_proto != nil { + return + } + file_poktroll_service_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_service_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_service_genesis_proto_depIdxs, + MessageInfos: file_poktroll_service_genesis_proto_msgTypes, + }.Build() + File_poktroll_service_genesis_proto = out.File + file_poktroll_service_genesis_proto_rawDesc = nil + file_poktroll_service_genesis_proto_goTypes = nil + file_poktroll_service_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/service/module/module.pulsar.go b/api/poktroll/service/module/module.pulsar.go new file mode 100644 index 000000000..a7217c244 --- /dev/null +++ b/api/poktroll/service/module/module.pulsar.go @@ -0,0 +1,578 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_module_module_proto_init() + md_Module = File_poktroll_service_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.service.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.module.Module")) + } + panic(fmt.Errorf("message poktroll.service.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_service_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_service_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_service_module_module_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, + 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x5a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x32, 0xba, 0xc0, 0x96, 0xda, 0x01, + 0x2c, 0x0a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0xd2, 0x01, + 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x4d, 0xaa, 0x02, 0x17, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x17, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0xe2, 0x02, 0x23, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_module_module_proto_rawDescOnce sync.Once + file_poktroll_service_module_module_proto_rawDescData = file_poktroll_service_module_module_proto_rawDesc +) + +func file_poktroll_service_module_module_proto_rawDescGZIP() []byte { + file_poktroll_service_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_service_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_module_module_proto_rawDescData) + }) + return file_poktroll_service_module_module_proto_rawDescData +} + +var file_poktroll_service_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.service.module.Module +} +var file_poktroll_service_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_module_module_proto_init() } +func file_poktroll_service_module_module_proto_init() { + if File_poktroll_service_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_service_module_module_proto_depIdxs, + MessageInfos: file_poktroll_service_module_module_proto_msgTypes, + }.Build() + File_poktroll_service_module_module_proto = out.File + file_poktroll_service_module_module_proto_rawDesc = nil + file_poktroll_service_module_module_proto_goTypes = nil + file_poktroll_service_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/service/params.pulsar.go b/api/poktroll/service/params.pulsar.go new file mode 100644 index 000000000..d85bbf213 --- /dev/null +++ b/api/poktroll/service/params.pulsar.go @@ -0,0 +1,560 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor + fd_Params_add_service_fee protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_params_proto_init() + md_Params = File_poktroll_service_params_proto.Messages().ByName("Params") + fd_Params_add_service_fee = md_Params.Fields().ByName("add_service_fee") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.AddServiceFee != uint64(0) { + value := protoreflect.ValueOfUint64(x.AddServiceFee) + if !f(fd_Params_add_service_fee, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + return x.AddServiceFee != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + x.AddServiceFee = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.Params.add_service_fee": + value := x.AddServiceFee + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + x.AddServiceFee = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + panic(fmt.Errorf("field add_service_fee of message poktroll.service.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Params.add_service_fee": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Params")) + } + panic(fmt.Errorf("message poktroll.service.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.AddServiceFee != 0 { + n += 1 + runtime.Sov(uint64(x.AddServiceFee)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.AddServiceFee != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AddServiceFee)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AddServiceFee", wireType) + } + x.AddServiceFee = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AddServiceFee |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_service_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetAddServiceFee() uint64 { + if x != nil { + return x.AddServiceFee + } + return 0 +} + +var File_poktroll_service_params_proto protoreflect.FileDescriptor + +var file_poktroll_service_params_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x1a, 0xf2, + 0xde, 0x1f, 0x16, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x64, 0x64, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x22, 0x52, 0x0d, 0x61, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, + 0xb0, 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_params_proto_rawDescOnce sync.Once + file_poktroll_service_params_proto_rawDescData = file_poktroll_service_params_proto_rawDesc +) + +func file_poktroll_service_params_proto_rawDescGZIP() []byte { + file_poktroll_service_params_proto_rawDescOnce.Do(func() { + file_poktroll_service_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_params_proto_rawDescData) + }) + return file_poktroll_service_params_proto_rawDescData +} + +var file_poktroll_service_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.service.Params +} +var file_poktroll_service_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_params_proto_init() } +func file_poktroll_service_params_proto_init() { + if File_poktroll_service_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_params_proto_goTypes, + DependencyIndexes: file_poktroll_service_params_proto_depIdxs, + MessageInfos: file_poktroll_service_params_proto_msgTypes, + }.Build() + File_poktroll_service_params_proto = out.File + file_poktroll_service_params_proto_rawDesc = nil + file_poktroll_service_params_proto_goTypes = nil + file_poktroll_service_params_proto_depIdxs = nil +} diff --git a/api/poktroll/service/query.pulsar.go b/api/poktroll/service/query.pulsar.go new file mode 100644 index 000000000..1b1039159 --- /dev/null +++ b/api/poktroll/service/query.pulsar.go @@ -0,0 +1,3130 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryParamsRequest = File_poktroll_service_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryParamsResponse = File_poktroll_service_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetServiceRequest protoreflect.MessageDescriptor + fd_QueryGetServiceRequest_index protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryGetServiceRequest = File_poktroll_service_query_proto.Messages().ByName("QueryGetServiceRequest") + fd_QueryGetServiceRequest_index = md_QueryGetServiceRequest.Fields().ByName("index") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetServiceRequest)(nil) + +type fastReflection_QueryGetServiceRequest QueryGetServiceRequest + +func (x *QueryGetServiceRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetServiceRequest)(x) +} + +func (x *QueryGetServiceRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetServiceRequest_messageType fastReflection_QueryGetServiceRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetServiceRequest_messageType{} + +type fastReflection_QueryGetServiceRequest_messageType struct{} + +func (x fastReflection_QueryGetServiceRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetServiceRequest)(nil) +} +func (x fastReflection_QueryGetServiceRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceRequest) +} +func (x fastReflection_QueryGetServiceRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetServiceRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetServiceRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetServiceRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetServiceRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetServiceRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetServiceRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetServiceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Index != "" { + value := protoreflect.ValueOfString(x.Index) + if !f(fd_QueryGetServiceRequest_index, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetServiceRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.index": + return x.Index != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.index": + x.Index = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetServiceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryGetServiceRequest.index": + value := x.Index + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.index": + x.Index = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.index": + panic(fmt.Errorf("field index of message poktroll.service.QueryGetServiceRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetServiceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceRequest.index": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetServiceRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryGetServiceRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetServiceRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetServiceRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetServiceRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetServiceRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Index) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Index) > 0 { + i -= len(x.Index) + copy(dAtA[i:], x.Index) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetServiceResponse protoreflect.MessageDescriptor + fd_QueryGetServiceResponse_service protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryGetServiceResponse = File_poktroll_service_query_proto.Messages().ByName("QueryGetServiceResponse") + fd_QueryGetServiceResponse_service = md_QueryGetServiceResponse.Fields().ByName("service") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetServiceResponse)(nil) + +type fastReflection_QueryGetServiceResponse QueryGetServiceResponse + +func (x *QueryGetServiceResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetServiceResponse)(x) +} + +func (x *QueryGetServiceResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetServiceResponse_messageType fastReflection_QueryGetServiceResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetServiceResponse_messageType{} + +type fastReflection_QueryGetServiceResponse_messageType struct{} + +func (x fastReflection_QueryGetServiceResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetServiceResponse)(nil) +} +func (x fastReflection_QueryGetServiceResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceResponse) +} +func (x fastReflection_QueryGetServiceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetServiceResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetServiceResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetServiceResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetServiceResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetServiceResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetServiceResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetServiceResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetServiceResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_QueryGetServiceResponse_service, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + return x.Service != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + x.Service = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + x.Service = value.Message().Interface().(*shared.Service) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryGetServiceResponse.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryGetServiceResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetServiceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryGetServiceResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetServiceResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetServiceResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetServiceResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetServiceResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetServiceResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetServiceResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllServiceRequest protoreflect.MessageDescriptor + fd_QueryAllServiceRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryAllServiceRequest = File_poktroll_service_query_proto.Messages().ByName("QueryAllServiceRequest") + fd_QueryAllServiceRequest_pagination = md_QueryAllServiceRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllServiceRequest)(nil) + +type fastReflection_QueryAllServiceRequest QueryAllServiceRequest + +func (x *QueryAllServiceRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllServiceRequest)(x) +} + +func (x *QueryAllServiceRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllServiceRequest_messageType fastReflection_QueryAllServiceRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllServiceRequest_messageType{} + +type fastReflection_QueryAllServiceRequest_messageType struct{} + +func (x fastReflection_QueryAllServiceRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllServiceRequest)(nil) +} +func (x fastReflection_QueryAllServiceRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllServiceRequest) +} +func (x fastReflection_QueryAllServiceRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServiceRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllServiceRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServiceRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllServiceRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllServiceRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllServiceRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllServiceRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllServiceRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllServiceRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllServiceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllServiceRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllServiceRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllServiceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryAllServiceRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllServiceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllServiceRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServiceRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllServiceRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllServiceRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllServiceRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllServiceRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServiceRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServiceRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllServiceResponse_1_list)(nil) + +type _QueryAllServiceResponse_1_list struct { + list *[]*shared.Service +} + +func (x *_QueryAllServiceResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllServiceResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllServiceResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllServiceResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Service) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllServiceResponse_1_list) AppendMutable() protoreflect.Value { + v := new(shared.Service) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllServiceResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllServiceResponse_1_list) NewElement() protoreflect.Value { + v := new(shared.Service) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllServiceResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllServiceResponse protoreflect.MessageDescriptor + fd_QueryAllServiceResponse_service protoreflect.FieldDescriptor + fd_QueryAllServiceResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_query_proto_init() + md_QueryAllServiceResponse = File_poktroll_service_query_proto.Messages().ByName("QueryAllServiceResponse") + fd_QueryAllServiceResponse_service = md_QueryAllServiceResponse.Fields().ByName("service") + fd_QueryAllServiceResponse_pagination = md_QueryAllServiceResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllServiceResponse)(nil) + +type fastReflection_QueryAllServiceResponse QueryAllServiceResponse + +func (x *QueryAllServiceResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllServiceResponse)(x) +} + +func (x *QueryAllServiceResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_query_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllServiceResponse_messageType fastReflection_QueryAllServiceResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllServiceResponse_messageType{} + +type fastReflection_QueryAllServiceResponse_messageType struct{} + +func (x fastReflection_QueryAllServiceResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllServiceResponse)(nil) +} +func (x fastReflection_QueryAllServiceResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllServiceResponse) +} +func (x fastReflection_QueryAllServiceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServiceResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllServiceResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServiceResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllServiceResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllServiceResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllServiceResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllServiceResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllServiceResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllServiceResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Service) != 0 { + value := protoreflect.ValueOfList(&_QueryAllServiceResponse_1_list{list: &x.Service}) + if !f(fd_QueryAllServiceResponse_service, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllServiceResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceResponse.service": + return len(x.Service) != 0 + case "poktroll.service.QueryAllServiceResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceResponse.service": + x.Service = nil + case "poktroll.service.QueryAllServiceResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.QueryAllServiceResponse.service": + if len(x.Service) == 0 { + return protoreflect.ValueOfList(&_QueryAllServiceResponse_1_list{}) + } + listValue := &_QueryAllServiceResponse_1_list{list: &x.Service} + return protoreflect.ValueOfList(listValue) + case "poktroll.service.QueryAllServiceResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceResponse.service": + lv := value.List() + clv := lv.(*_QueryAllServiceResponse_1_list) + x.Service = *clv.list + case "poktroll.service.QueryAllServiceResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceResponse.service": + if x.Service == nil { + x.Service = []*shared.Service{} + } + value := &_QueryAllServiceResponse_1_list{list: &x.Service} + return protoreflect.ValueOfList(value) + case "poktroll.service.QueryAllServiceResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.QueryAllServiceResponse.service": + list := []*shared.Service{} + return protoreflect.ValueOfList(&_QueryAllServiceResponse_1_list{list: &list}) + case "poktroll.service.QueryAllServiceResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllServiceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServiceResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllServiceResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllServiceResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllServiceResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllServiceResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllServiceResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Service) > 0 { + for _, e := range x.Service { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServiceResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Service) > 0 { + for iNdEx := len(x.Service) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Service[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllServiceResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Service = append(x.Service, &shared.Service{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service[len(x.Service)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetServiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` +} + +func (x *QueryGetServiceRequest) Reset() { + *x = QueryGetServiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetServiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetServiceRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetServiceRequest.ProtoReflect.Descriptor instead. +func (*QueryGetServiceRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetServiceRequest) GetIndex() string { + if x != nil { + return x.Index + } + return "" +} + +type QueryGetServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service *shared.Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` +} + +func (x *QueryGetServiceResponse) Reset() { + *x = QueryGetServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetServiceResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetServiceResponse.ProtoReflect.Descriptor instead. +func (*QueryGetServiceResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetServiceResponse) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + +type QueryAllServiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllServiceRequest) Reset() { + *x = QueryAllServiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllServiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllServiceRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllServiceRequest.ProtoReflect.Descriptor instead. +func (*QueryAllServiceRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllServiceRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service []*shared.Service `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllServiceResponse) Reset() { + *x = QueryAllServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllServiceResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllServiceResponse.ProtoReflect.Descriptor instead. +func (*QueryAllServiceResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllServiceResponse) GetService() []*shared.Service { + if x != nil { + return x.Service + } + return nil +} + +func (x *QueryAllServiceResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_poktroll_service_query_proto protoreflect.FileDescriptor + +var file_poktroll_service_query_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, + 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x2e, 0x0a, 0x16, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x53, 0x0a, 0x17, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, + 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x32, 0xbb, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x96, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x28, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x0a, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, + 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_query_proto_rawDescOnce sync.Once + file_poktroll_service_query_proto_rawDescData = file_poktroll_service_query_proto_rawDesc +) + +func file_poktroll_service_query_proto_rawDescGZIP() []byte { + file_poktroll_service_query_proto_rawDescOnce.Do(func() { + file_poktroll_service_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_query_proto_rawDescData) + }) + return file_poktroll_service_query_proto_rawDescData +} + +var file_poktroll_service_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_service_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.service.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.service.QueryParamsResponse + (*QueryGetServiceRequest)(nil), // 2: poktroll.service.QueryGetServiceRequest + (*QueryGetServiceResponse)(nil), // 3: poktroll.service.QueryGetServiceResponse + (*QueryAllServiceRequest)(nil), // 4: poktroll.service.QueryAllServiceRequest + (*QueryAllServiceResponse)(nil), // 5: poktroll.service.QueryAllServiceResponse + (*Params)(nil), // 6: poktroll.service.Params + (*shared.Service)(nil), // 7: poktroll.shared.Service + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse +} +var file_poktroll_service_query_proto_depIdxs = []int32{ + 6, // 0: poktroll.service.QueryParamsResponse.params:type_name -> poktroll.service.Params + 7, // 1: poktroll.service.QueryGetServiceResponse.service:type_name -> poktroll.shared.Service + 8, // 2: poktroll.service.QueryAllServiceRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.service.QueryAllServiceResponse.service:type_name -> poktroll.shared.Service + 9, // 4: poktroll.service.QueryAllServiceResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.service.Query.Params:input_type -> poktroll.service.QueryParamsRequest + 2, // 6: poktroll.service.Query.Service:input_type -> poktroll.service.QueryGetServiceRequest + 4, // 7: poktroll.service.Query.ServiceAll:input_type -> poktroll.service.QueryAllServiceRequest + 1, // 8: poktroll.service.Query.Params:output_type -> poktroll.service.QueryParamsResponse + 3, // 9: poktroll.service.Query.Service:output_type -> poktroll.service.QueryGetServiceResponse + 5, // 10: poktroll.service.Query.ServiceAll:output_type -> poktroll.service.QueryAllServiceResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_poktroll_service_query_proto_init() } +func file_poktroll_service_query_proto_init() { + if File_poktroll_service_query_proto != nil { + return + } + file_poktroll_service_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_service_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetServiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllServiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_service_query_proto_goTypes, + DependencyIndexes: file_poktroll_service_query_proto_depIdxs, + MessageInfos: file_poktroll_service_query_proto_msgTypes, + }.Build() + File_poktroll_service_query_proto = out.File + file_poktroll_service_query_proto_rawDesc = nil + file_poktroll_service_query_proto_goTypes = nil + file_poktroll_service_query_proto_depIdxs = nil +} diff --git a/api/poktroll/service/service.pulsar.go b/api/poktroll/service/service.pulsar.go new file mode 100644 index 000000000..e47fdeda9 --- /dev/null +++ b/api/poktroll/service/service.pulsar.go @@ -0,0 +1,639 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Service protoreflect.MessageDescriptor + fd_Service_index protoreflect.FieldDescriptor + fd_Service_name protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_service_proto_init() + md_Service = File_poktroll_service_service_proto.Messages().ByName("Service") + fd_Service_index = md_Service.Fields().ByName("index") + fd_Service_name = md_Service.Fields().ByName("name") +} + +var _ protoreflect.Message = (*fastReflection_Service)(nil) + +type fastReflection_Service Service + +func (x *Service) ProtoReflect() protoreflect.Message { + return (*fastReflection_Service)(x) +} + +func (x *Service) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Service_messageType fastReflection_Service_messageType +var _ protoreflect.MessageType = fastReflection_Service_messageType{} + +type fastReflection_Service_messageType struct{} + +func (x fastReflection_Service_messageType) Zero() protoreflect.Message { + return (*fastReflection_Service)(nil) +} +func (x fastReflection_Service_messageType) New() protoreflect.Message { + return new(fastReflection_Service) +} +func (x fastReflection_Service_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Service) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Service) Type() protoreflect.MessageType { + return _fastReflection_Service_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Service) New() protoreflect.Message { + return new(fastReflection_Service) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Service) Interface() protoreflect.ProtoMessage { + return (*Service)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Service) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Index != "" { + value := protoreflect.ValueOfString(x.Index) + if !f(fd_Service_index, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_Service_name, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Service) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.Service.index": + return x.Index != "" + case "poktroll.service.Service.name": + return x.Name != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.Service.index": + x.Index = "" + case "poktroll.service.Service.name": + x.Name = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Service) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.Service.index": + value := x.Index + return protoreflect.ValueOfString(value) + case "poktroll.service.Service.name": + value := x.Name + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.Service.index": + x.Index = value.Interface().(string) + case "poktroll.service.Service.name": + x.Name = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Service.index": + panic(fmt.Errorf("field index of message poktroll.service.Service is not mutable")) + case "poktroll.service.Service.name": + panic(fmt.Errorf("field name of message poktroll.service.Service is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Service) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Service.index": + return protoreflect.ValueOfString("") + case "poktroll.service.Service.name": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Service")) + } + panic(fmt.Errorf("message poktroll.service.Service does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Service) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.Service", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Service) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Service) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Service) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Index) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Index) > 0 { + i -= len(x.Index) + copy(dAtA[i:], x.Index) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/service.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +// Deprecated: Use Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_poktroll_service_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Service) GetIndex() string { + if x != nil { + return x.Index + } + return "" +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_poktroll_service_service_proto protoreflect.FileDescriptor + +var file_poktroll_service_service_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x22, 0x33, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_service_proto_rawDescOnce sync.Once + file_poktroll_service_service_proto_rawDescData = file_poktroll_service_service_proto_rawDesc +) + +func file_poktroll_service_service_proto_rawDescGZIP() []byte { + file_poktroll_service_service_proto_rawDescOnce.Do(func() { + file_poktroll_service_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_service_proto_rawDescData) + }) + return file_poktroll_service_service_proto_rawDescData +} + +var file_poktroll_service_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_service_service_proto_goTypes = []interface{}{ + (*Service)(nil), // 0: poktroll.service.Service +} +var file_poktroll_service_service_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_service_service_proto_init() } +func file_poktroll_service_service_proto_init() { + if File_poktroll_service_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_service_proto_goTypes, + DependencyIndexes: file_poktroll_service_service_proto_depIdxs, + MessageInfos: file_poktroll_service_service_proto_msgTypes, + }.Build() + File_poktroll_service_service_proto = out.File + file_poktroll_service_service_proto_rawDesc = nil + file_poktroll_service_service_proto_goTypes = nil + file_poktroll_service_service_proto_depIdxs = nil +} diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go new file mode 100644 index 000000000..0cd43516f --- /dev/null +++ b/api/poktroll/service/tx.pulsar.go @@ -0,0 +1,2066 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParams = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.service.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.service.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.service.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.service.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.service.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgAddService protoreflect.MessageDescriptor + fd_MsgAddService_address protoreflect.FieldDescriptor + fd_MsgAddService_service protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgAddService = File_poktroll_service_tx_proto.Messages().ByName("MsgAddService") + fd_MsgAddService_address = md_MsgAddService.Fields().ByName("address") + fd_MsgAddService_service = md_MsgAddService.Fields().ByName("service") +} + +var _ protoreflect.Message = (*fastReflection_MsgAddService)(nil) + +type fastReflection_MsgAddService MsgAddService + +func (x *MsgAddService) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgAddService)(x) +} + +func (x *MsgAddService) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgAddService_messageType fastReflection_MsgAddService_messageType +var _ protoreflect.MessageType = fastReflection_MsgAddService_messageType{} + +type fastReflection_MsgAddService_messageType struct{} + +func (x fastReflection_MsgAddService_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgAddService)(nil) +} +func (x fastReflection_MsgAddService_messageType) New() protoreflect.Message { + return new(fastReflection_MsgAddService) +} +func (x fastReflection_MsgAddService_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddService +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgAddService) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddService +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgAddService) Type() protoreflect.MessageType { + return _fastReflection_MsgAddService_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgAddService) New() protoreflect.Message { + return new(fastReflection_MsgAddService) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgAddService) Interface() protoreflect.ProtoMessage { + return (*MsgAddService)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgAddService) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgAddService_address, value) { + return + } + } + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_MsgAddService_service, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgAddService) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + return x.Address != "" + case "poktroll.service.MsgAddService.service": + return x.Service != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + x.Address = "" + case "poktroll.service.MsgAddService.service": + x.Service = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgAddService) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.MsgAddService.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.service.MsgAddService.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + x.Address = value.Interface().(string) + case "poktroll.service.MsgAddService.service": + x.Service = value.Message().Interface().(*shared.Service) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgAddService.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + case "poktroll.service.MsgAddService.address": + panic(fmt.Errorf("field address of message poktroll.service.MsgAddService is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgAddService) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.MsgAddService.address": + return protoreflect.ValueOfString("") + case "poktroll.service.MsgAddService.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddService")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddService does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgAddService) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgAddService", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgAddService) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddService) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgAddService) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgAddService) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgAddService) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgAddService) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgAddService) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgAddServiceResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_service_tx_proto_init() + md_MsgAddServiceResponse = File_poktroll_service_tx_proto.Messages().ByName("MsgAddServiceResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgAddServiceResponse)(nil) + +type fastReflection_MsgAddServiceResponse MsgAddServiceResponse + +func (x *MsgAddServiceResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgAddServiceResponse)(x) +} + +func (x *MsgAddServiceResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgAddServiceResponse_messageType fastReflection_MsgAddServiceResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgAddServiceResponse_messageType{} + +type fastReflection_MsgAddServiceResponse_messageType struct{} + +func (x fastReflection_MsgAddServiceResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgAddServiceResponse)(nil) +} +func (x fastReflection_MsgAddServiceResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgAddServiceResponse) +} +func (x fastReflection_MsgAddServiceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddServiceResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgAddServiceResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddServiceResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgAddServiceResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgAddServiceResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgAddServiceResponse) New() protoreflect.Message { + return new(fastReflection_MsgAddServiceResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgAddServiceResponse) Interface() protoreflect.ProtoMessage { + return (*MsgAddServiceResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgAddServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgAddServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgAddServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgAddServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.MsgAddServiceResponse")) + } + panic(fmt.Errorf("message poktroll.service.MsgAddServiceResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgAddServiceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.MsgAddServiceResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgAddServiceResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddServiceResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgAddServiceResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgAddServiceResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgAddServiceResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgAddServiceResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgAddServiceResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgAddService defines a message for adding a new message to the network. +// Services can be added by any actor in the network making them truly +// permissionless. +// TODO_DOCUMENT(@h5law): This is a key function in making services +// permissionless, document it's usage and design - in docusaurus covering how +// the entire process works. +type MsgAddService struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the service supplier using cosmos' ScalarDescriptor + Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the supplier is adding to the network +} + +func (x *MsgAddService) Reset() { + *x = MsgAddService{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgAddService) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgAddService) ProtoMessage() {} + +// Deprecated: Use MsgAddService.ProtoReflect.Descriptor instead. +func (*MsgAddService) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgAddService) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgAddService) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + +type MsgAddServiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgAddServiceResponse) Reset() { + *x = MsgAddServiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgAddServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgAddServiceResponse) ProtoMessage() {} + +// Deprecated: Use MsgAddServiceResponse.ProtoReflect.Descriptor instead. +func (*MsgAddServiceResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_tx_proto_rawDescGZIP(), []int{3} +} + +var File_poktroll_service_tx_proto protoreflect.FileDescriptor + +var file_poktroll_service_tx_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc2, 0x01, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x56, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, + 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, + 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_tx_proto_rawDescOnce sync.Once + file_poktroll_service_tx_proto_rawDescData = file_poktroll_service_tx_proto_rawDesc +) + +func file_poktroll_service_tx_proto_rawDescGZIP() []byte { + file_poktroll_service_tx_proto_rawDescOnce.Do(func() { + file_poktroll_service_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_tx_proto_rawDescData) + }) + return file_poktroll_service_tx_proto_rawDescData +} + +var file_poktroll_service_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_service_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.service.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.service.MsgUpdateParamsResponse + (*MsgAddService)(nil), // 2: poktroll.service.MsgAddService + (*MsgAddServiceResponse)(nil), // 3: poktroll.service.MsgAddServiceResponse + (*Params)(nil), // 4: poktroll.service.Params + (*shared.Service)(nil), // 5: poktroll.shared.Service +} +var file_poktroll_service_tx_proto_depIdxs = []int32{ + 4, // 0: poktroll.service.MsgUpdateParams.params:type_name -> poktroll.service.Params + 5, // 1: poktroll.service.MsgAddService.service:type_name -> poktroll.shared.Service + 0, // 2: poktroll.service.Msg.UpdateParams:input_type -> poktroll.service.MsgUpdateParams + 2, // 3: poktroll.service.Msg.AddService:input_type -> poktroll.service.MsgAddService + 1, // 4: poktroll.service.Msg.UpdateParams:output_type -> poktroll.service.MsgUpdateParamsResponse + 3, // 5: poktroll.service.Msg.AddService:output_type -> poktroll.service.MsgAddServiceResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_service_tx_proto_init() } +func file_poktroll_service_tx_proto_init() { + if File_poktroll_service_tx_proto != nil { + return + } + file_poktroll_service_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_service_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgAddService); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgAddServiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_service_tx_proto_goTypes, + DependencyIndexes: file_poktroll_service_tx_proto_depIdxs, + MessageInfos: file_poktroll_service_tx_proto_msgTypes, + }.Build() + File_poktroll_service_tx_proto = out.File + file_poktroll_service_tx_proto_rawDesc = nil + file_poktroll_service_tx_proto_goTypes = nil + file_poktroll_service_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/session/genesis.pulsar.go b/api/poktroll/session/genesis.pulsar.go new file mode 100644 index 000000000..eb80c4693 --- /dev/null +++ b/api/poktroll/session/genesis.pulsar.go @@ -0,0 +1,595 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package session + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_genesis_proto_init() + md_GenesisState = File_poktroll_session_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.session.GenesisState.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.GenesisState")) + } + panic(fmt.Errorf("message poktroll.session.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.session.GenesisState.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.GenesisState")) + } + panic(fmt.Errorf("message poktroll.session.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.session.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.GenesisState")) + } + panic(fmt.Errorf("message poktroll.session.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.session.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.GenesisState")) + } + panic(fmt.Errorf("message poktroll.session.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.GenesisState")) + } + panic(fmt.Errorf("message poktroll.session.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.GenesisState")) + } + panic(fmt.Errorf("message poktroll.session.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/session/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the session module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_session_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_session_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_session_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x0c, 0x47, 0x65, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_session_genesis_proto_rawDescOnce sync.Once + file_poktroll_session_genesis_proto_rawDescData = file_poktroll_session_genesis_proto_rawDesc +) + +func file_poktroll_session_genesis_proto_rawDescGZIP() []byte { + file_poktroll_session_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_session_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_session_genesis_proto_rawDescData) + }) + return file_poktroll_session_genesis_proto_rawDescData +} + +var file_poktroll_session_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_session_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.session.GenesisState + (*Params)(nil), // 1: poktroll.session.Params +} +var file_poktroll_session_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.session.GenesisState.params:type_name -> poktroll.session.Params + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_session_genesis_proto_init() } +func file_poktroll_session_genesis_proto_init() { + if File_poktroll_session_genesis_proto != nil { + return + } + file_poktroll_session_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_session_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_session_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_session_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_session_genesis_proto_depIdxs, + MessageInfos: file_poktroll_session_genesis_proto_msgTypes, + }.Build() + File_poktroll_session_genesis_proto = out.File + file_poktroll_session_genesis_proto_rawDesc = nil + file_poktroll_session_genesis_proto_goTypes = nil + file_poktroll_session_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/session/module/module.pulsar.go b/api/poktroll/session/module/module.pulsar.go new file mode 100644 index 000000000..66f2ee183 --- /dev/null +++ b/api/poktroll/session/module/module.pulsar.go @@ -0,0 +1,578 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_module_module_proto_init() + md_Module = File_poktroll_session_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.session.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.module.Module")) + } + panic(fmt.Errorf("message poktroll.session.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.session.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.module.Module")) + } + panic(fmt.Errorf("message poktroll.session.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.session.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.module.Module")) + } + panic(fmt.Errorf("message poktroll.session.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.session.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.module.Module")) + } + panic(fmt.Errorf("message poktroll.session.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.session.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.module.Module")) + } + panic(fmt.Errorf("message poktroll.session.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.module.Module")) + } + panic(fmt.Errorf("message poktroll.session.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/session/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_session_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_session_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_session_module_module_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, + 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x5a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x32, 0xba, 0xc0, 0x96, 0xda, 0x01, + 0x2c, 0x0a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0xd2, 0x01, + 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x4d, 0xaa, 0x02, 0x17, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x17, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0xe2, 0x02, 0x23, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_session_module_module_proto_rawDescOnce sync.Once + file_poktroll_session_module_module_proto_rawDescData = file_poktroll_session_module_module_proto_rawDesc +) + +func file_poktroll_session_module_module_proto_rawDescGZIP() []byte { + file_poktroll_session_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_session_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_session_module_module_proto_rawDescData) + }) + return file_poktroll_session_module_module_proto_rawDescData +} + +var file_poktroll_session_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_session_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.session.module.Module +} +var file_poktroll_session_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_session_module_module_proto_init() } +func file_poktroll_session_module_module_proto_init() { + if File_poktroll_session_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_session_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_session_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_session_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_session_module_module_proto_depIdxs, + MessageInfos: file_poktroll_session_module_module_proto_msgTypes, + }.Build() + File_poktroll_session_module_module_proto = out.File + file_poktroll_session_module_module_proto_rawDesc = nil + file_poktroll_session_module_module_proto_goTypes = nil + file_poktroll_session_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/session/params.pulsar.go b/api/poktroll/session/params.pulsar.go new file mode 100644 index 000000000..c9ea81482 --- /dev/null +++ b/api/poktroll/session/params.pulsar.go @@ -0,0 +1,499 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package session + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_session_params_proto_init() + md_Params = File_poktroll_session_params_proto.Messages().ByName("Params") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Params")) + } + panic(fmt.Errorf("message poktroll.session.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Params")) + } + panic(fmt.Errorf("message poktroll.session.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Params")) + } + panic(fmt.Errorf("message poktroll.session.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Params")) + } + panic(fmt.Errorf("message poktroll.session.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Params")) + } + panic(fmt.Errorf("message poktroll.session.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Params")) + } + panic(fmt.Errorf("message poktroll.session.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/session/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_session_params_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_session_params_proto protoreflect.FileDescriptor + +var file_poktroll_session_params_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_session_params_proto_rawDescOnce sync.Once + file_poktroll_session_params_proto_rawDescData = file_poktroll_session_params_proto_rawDesc +) + +func file_poktroll_session_params_proto_rawDescGZIP() []byte { + file_poktroll_session_params_proto_rawDescOnce.Do(func() { + file_poktroll_session_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_session_params_proto_rawDescData) + }) + return file_poktroll_session_params_proto_rawDescData +} + +var file_poktroll_session_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_session_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.session.Params +} +var file_poktroll_session_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_session_params_proto_init() } +func file_poktroll_session_params_proto_init() { + if File_poktroll_session_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_session_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_session_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_session_params_proto_goTypes, + DependencyIndexes: file_poktroll_session_params_proto_depIdxs, + MessageInfos: file_poktroll_session_params_proto_msgTypes, + }.Build() + File_poktroll_session_params_proto = out.File + file_poktroll_session_params_proto_rawDesc = nil + file_poktroll_session_params_proto_goTypes = nil + file_poktroll_session_params_proto_depIdxs = nil +} diff --git a/api/poktroll/session/query.pulsar.go b/api/poktroll/session/query.pulsar.go new file mode 100644 index 000000000..95fe25015 --- /dev/null +++ b/api/poktroll/session/query.pulsar.go @@ -0,0 +1,2142 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package session + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_session_query_proto_init() + md_QueryParamsRequest = File_poktroll_session_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_query_proto_init() + md_QueryParamsResponse = File_poktroll_session_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetSessionRequest protoreflect.MessageDescriptor + fd_QueryGetSessionRequest_application_address protoreflect.FieldDescriptor + fd_QueryGetSessionRequest_service protoreflect.FieldDescriptor + fd_QueryGetSessionRequest_block_height protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_query_proto_init() + md_QueryGetSessionRequest = File_poktroll_session_query_proto.Messages().ByName("QueryGetSessionRequest") + fd_QueryGetSessionRequest_application_address = md_QueryGetSessionRequest.Fields().ByName("application_address") + fd_QueryGetSessionRequest_service = md_QueryGetSessionRequest.Fields().ByName("service") + fd_QueryGetSessionRequest_block_height = md_QueryGetSessionRequest.Fields().ByName("block_height") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetSessionRequest)(nil) + +type fastReflection_QueryGetSessionRequest QueryGetSessionRequest + +func (x *QueryGetSessionRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetSessionRequest)(x) +} + +func (x *QueryGetSessionRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetSessionRequest_messageType fastReflection_QueryGetSessionRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetSessionRequest_messageType{} + +type fastReflection_QueryGetSessionRequest_messageType struct{} + +func (x fastReflection_QueryGetSessionRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetSessionRequest)(nil) +} +func (x fastReflection_QueryGetSessionRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetSessionRequest) +} +func (x fastReflection_QueryGetSessionRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSessionRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetSessionRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSessionRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetSessionRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetSessionRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetSessionRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetSessionRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetSessionRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetSessionRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetSessionRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ApplicationAddress != "" { + value := protoreflect.ValueOfString(x.ApplicationAddress) + if !f(fd_QueryGetSessionRequest_application_address, value) { + return + } + } + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_QueryGetSessionRequest_service, value) { + return + } + } + if x.BlockHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockHeight) + if !f(fd_QueryGetSessionRequest_block_height, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetSessionRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryGetSessionRequest.application_address": + return x.ApplicationAddress != "" + case "poktroll.QueryGetSessionRequest.service": + return x.Service != nil + case "poktroll.QueryGetSessionRequest.block_height": + return x.BlockHeight != int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryGetSessionRequest.application_address": + x.ApplicationAddress = "" + case "poktroll.QueryGetSessionRequest.service": + x.Service = nil + case "poktroll.QueryGetSessionRequest.block_height": + x.BlockHeight = int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetSessionRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryGetSessionRequest.application_address": + value := x.ApplicationAddress + return protoreflect.ValueOfString(value) + case "poktroll.QueryGetSessionRequest.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.QueryGetSessionRequest.block_height": + value := x.BlockHeight + return protoreflect.ValueOfInt64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryGetSessionRequest.application_address": + x.ApplicationAddress = value.Interface().(string) + case "poktroll.QueryGetSessionRequest.service": + x.Service = value.Message().Interface().(*shared.Service) + case "poktroll.QueryGetSessionRequest.block_height": + x.BlockHeight = value.Int() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetSessionRequest.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + case "poktroll.QueryGetSessionRequest.application_address": + panic(fmt.Errorf("field application_address of message poktroll.QueryGetSessionRequest is not mutable")) + case "poktroll.QueryGetSessionRequest.block_height": + panic(fmt.Errorf("field block_height of message poktroll.QueryGetSessionRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetSessionRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetSessionRequest.application_address": + return protoreflect.ValueOfString("") + case "poktroll.QueryGetSessionRequest.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.QueryGetSessionRequest.block_height": + return protoreflect.ValueOfInt64(int64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionRequest")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetSessionRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryGetSessionRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetSessionRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetSessionRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetSessionRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetSessionRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ApplicationAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.BlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.BlockHeight)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSessionRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.BlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockHeight)) + i-- + dAtA[i] = 0x18 + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.ApplicationAddress) > 0 { + i -= len(x.ApplicationAddress) + copy(dAtA[i:], x.ApplicationAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ApplicationAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSessionRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSessionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSessionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ApplicationAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ApplicationAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + x.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.BlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetSessionResponse protoreflect.MessageDescriptor + fd_QueryGetSessionResponse_session protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_query_proto_init() + md_QueryGetSessionResponse = File_poktroll_session_query_proto.Messages().ByName("QueryGetSessionResponse") + fd_QueryGetSessionResponse_session = md_QueryGetSessionResponse.Fields().ByName("session") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetSessionResponse)(nil) + +type fastReflection_QueryGetSessionResponse QueryGetSessionResponse + +func (x *QueryGetSessionResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetSessionResponse)(x) +} + +func (x *QueryGetSessionResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetSessionResponse_messageType fastReflection_QueryGetSessionResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetSessionResponse_messageType{} + +type fastReflection_QueryGetSessionResponse_messageType struct{} + +func (x fastReflection_QueryGetSessionResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetSessionResponse)(nil) +} +func (x fastReflection_QueryGetSessionResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetSessionResponse) +} +func (x fastReflection_QueryGetSessionResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSessionResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetSessionResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSessionResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetSessionResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetSessionResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetSessionResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetSessionResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetSessionResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetSessionResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetSessionResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Session != nil { + value := protoreflect.ValueOfMessage(x.Session.ProtoReflect()) + if !f(fd_QueryGetSessionResponse_session, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetSessionResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.QueryGetSessionResponse.session": + return x.Session != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.QueryGetSessionResponse.session": + x.Session = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetSessionResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.QueryGetSessionResponse.session": + value := x.Session + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.QueryGetSessionResponse.session": + x.Session = value.Message().Interface().(*Session) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetSessionResponse.session": + if x.Session == nil { + x.Session = new(Session) + } + return protoreflect.ValueOfMessage(x.Session.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetSessionResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.QueryGetSessionResponse.session": + m := new(Session) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryGetSessionResponse")) + } + panic(fmt.Errorf("message poktroll.QueryGetSessionResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetSessionResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryGetSessionResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetSessionResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSessionResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetSessionResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetSessionResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetSessionResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Session != nil { + l = options.Size(x.Session) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSessionResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Session != nil { + encoded, err := options.Marshal(x.Session) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSessionResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSessionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSessionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Session", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Session == nil { + x.Session = &Session{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Session); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/session/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_session_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_session_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetSessionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ApplicationAddress string `protobuf:"bytes,1,opt,name=application_address,json=applicationAddress,proto3" json:"application_address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The service id to query the session for + BlockHeight int64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // The block height to query the session for +} + +func (x *QueryGetSessionRequest) Reset() { + *x = QueryGetSessionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetSessionRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetSessionRequest.ProtoReflect.Descriptor instead. +func (*QueryGetSessionRequest) Descriptor() ([]byte, []int) { + return file_poktroll_session_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetSessionRequest) GetApplicationAddress() string { + if x != nil { + return x.ApplicationAddress + } + return "" +} + +func (x *QueryGetSessionRequest) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + +func (x *QueryGetSessionRequest) GetBlockHeight() int64 { + if x != nil { + return x.BlockHeight + } + return 0 +} + +type QueryGetSessionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` +} + +func (x *QueryGetSessionResponse) Reset() { + *x = QueryGetSessionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetSessionResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetSessionResponse.ProtoReflect.Descriptor instead. +func (*QueryGetSessionResponse) Descriptor() ([]byte, []int) { + return file_poktroll_session_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetSessionResponse) GetSession() *Session { + if x != nil { + return x.Session + } + return nil +} + +var File_poktroll_session_query_proto protoreflect.FileDescriptor + +var file_poktroll_session_query_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xba, 0x01, 0x0a, 0x16, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x13, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x32, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x4e, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x33, 0x0a, 0x07, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xa6, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2c, 0x12, 0x2a, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x65, 0x74, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, + 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_poktroll_session_query_proto_rawDescOnce sync.Once + file_poktroll_session_query_proto_rawDescData = file_poktroll_session_query_proto_rawDesc +) + +func file_poktroll_session_query_proto_rawDescGZIP() []byte { + file_poktroll_session_query_proto_rawDescOnce.Do(func() { + file_poktroll_session_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_session_query_proto_rawDescData) + }) + return file_poktroll_session_query_proto_rawDescData +} + +var file_poktroll_session_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_poktroll_session_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.QueryParamsResponse + (*QueryGetSessionRequest)(nil), // 2: poktroll.QueryGetSessionRequest + (*QueryGetSessionResponse)(nil), // 3: poktroll.QueryGetSessionResponse + (*Params)(nil), // 4: poktroll.Params + (*shared.Service)(nil), // 5: poktroll.shared.Service + (*Session)(nil), // 6: poktroll.Session +} +var file_poktroll_session_query_proto_depIdxs = []int32{ + 4, // 0: poktroll.QueryParamsResponse.params:type_name -> poktroll.Params + 5, // 1: poktroll.QueryGetSessionRequest.service:type_name -> poktroll.shared.Service + 6, // 2: poktroll.QueryGetSessionResponse.session:type_name -> poktroll.Session + 0, // 3: poktroll.Query.Params:input_type -> poktroll.QueryParamsRequest + 2, // 4: poktroll.Query.GetSession:input_type -> poktroll.QueryGetSessionRequest + 1, // 5: poktroll.Query.Params:output_type -> poktroll.QueryParamsResponse + 3, // 6: poktroll.Query.GetSession:output_type -> poktroll.QueryGetSessionResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_poktroll_session_query_proto_init() } +func file_poktroll_session_query_proto_init() { + if File_poktroll_session_query_proto != nil { + return + } + file_poktroll_session_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_session_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_session_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_session_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetSessionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_session_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetSessionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_session_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_session_query_proto_goTypes, + DependencyIndexes: file_poktroll_session_query_proto_depIdxs, + MessageInfos: file_poktroll_session_query_proto_msgTypes, + }.Build() + File_poktroll_session_query_proto = out.File + file_poktroll_session_query_proto_rawDesc = nil + file_poktroll_session_query_proto_goTypes = nil + file_poktroll_session_query_proto_depIdxs = nil +} diff --git a/api/poktroll/session/session.pulsar.go b/api/poktroll/session/session.pulsar.go new file mode 100644 index 000000000..c0a424878 --- /dev/null +++ b/api/poktroll/session/session.pulsar.go @@ -0,0 +1,1796 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package session + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + application "github.com/pokt-network/poktroll/api/poktroll/application" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_SessionHeader protoreflect.MessageDescriptor + fd_SessionHeader_application_address protoreflect.FieldDescriptor + fd_SessionHeader_service protoreflect.FieldDescriptor + fd_SessionHeader_session_start_block_height protoreflect.FieldDescriptor + fd_SessionHeader_session_id protoreflect.FieldDescriptor + fd_SessionHeader_session_end_block_height protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_session_proto_init() + md_SessionHeader = File_poktroll_session_session_proto.Messages().ByName("SessionHeader") + fd_SessionHeader_application_address = md_SessionHeader.Fields().ByName("application_address") + fd_SessionHeader_service = md_SessionHeader.Fields().ByName("service") + fd_SessionHeader_session_start_block_height = md_SessionHeader.Fields().ByName("session_start_block_height") + fd_SessionHeader_session_id = md_SessionHeader.Fields().ByName("session_id") + fd_SessionHeader_session_end_block_height = md_SessionHeader.Fields().ByName("session_end_block_height") +} + +var _ protoreflect.Message = (*fastReflection_SessionHeader)(nil) + +type fastReflection_SessionHeader SessionHeader + +func (x *SessionHeader) ProtoReflect() protoreflect.Message { + return (*fastReflection_SessionHeader)(x) +} + +func (x *SessionHeader) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_session_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_SessionHeader_messageType fastReflection_SessionHeader_messageType +var _ protoreflect.MessageType = fastReflection_SessionHeader_messageType{} + +type fastReflection_SessionHeader_messageType struct{} + +func (x fastReflection_SessionHeader_messageType) Zero() protoreflect.Message { + return (*fastReflection_SessionHeader)(nil) +} +func (x fastReflection_SessionHeader_messageType) New() protoreflect.Message { + return new(fastReflection_SessionHeader) +} +func (x fastReflection_SessionHeader_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_SessionHeader +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_SessionHeader) Descriptor() protoreflect.MessageDescriptor { + return md_SessionHeader +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_SessionHeader) Type() protoreflect.MessageType { + return _fastReflection_SessionHeader_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_SessionHeader) New() protoreflect.Message { + return new(fastReflection_SessionHeader) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_SessionHeader) Interface() protoreflect.ProtoMessage { + return (*SessionHeader)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_SessionHeader) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ApplicationAddress != "" { + value := protoreflect.ValueOfString(x.ApplicationAddress) + if !f(fd_SessionHeader_application_address, value) { + return + } + } + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_SessionHeader_service, value) { + return + } + } + if x.SessionStartBlockHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.SessionStartBlockHeight) + if !f(fd_SessionHeader_session_start_block_height, value) { + return + } + } + if x.SessionId != "" { + value := protoreflect.ValueOfString(x.SessionId) + if !f(fd_SessionHeader_session_id, value) { + return + } + } + if x.SessionEndBlockHeight != int64(0) { + value := protoreflect.ValueOfInt64(x.SessionEndBlockHeight) + if !f(fd_SessionHeader_session_end_block_height, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_SessionHeader) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.session.SessionHeader.application_address": + return x.ApplicationAddress != "" + case "poktroll.session.SessionHeader.service": + return x.Service != nil + case "poktroll.session.SessionHeader.session_start_block_height": + return x.SessionStartBlockHeight != int64(0) + case "poktroll.session.SessionHeader.session_id": + return x.SessionId != "" + case "poktroll.session.SessionHeader.session_end_block_height": + return x.SessionEndBlockHeight != int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.SessionHeader")) + } + panic(fmt.Errorf("message poktroll.session.SessionHeader does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SessionHeader) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.session.SessionHeader.application_address": + x.ApplicationAddress = "" + case "poktroll.session.SessionHeader.service": + x.Service = nil + case "poktroll.session.SessionHeader.session_start_block_height": + x.SessionStartBlockHeight = int64(0) + case "poktroll.session.SessionHeader.session_id": + x.SessionId = "" + case "poktroll.session.SessionHeader.session_end_block_height": + x.SessionEndBlockHeight = int64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.SessionHeader")) + } + panic(fmt.Errorf("message poktroll.session.SessionHeader does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_SessionHeader) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.session.SessionHeader.application_address": + value := x.ApplicationAddress + return protoreflect.ValueOfString(value) + case "poktroll.session.SessionHeader.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.session.SessionHeader.session_start_block_height": + value := x.SessionStartBlockHeight + return protoreflect.ValueOfInt64(value) + case "poktroll.session.SessionHeader.session_id": + value := x.SessionId + return protoreflect.ValueOfString(value) + case "poktroll.session.SessionHeader.session_end_block_height": + value := x.SessionEndBlockHeight + return protoreflect.ValueOfInt64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.SessionHeader")) + } + panic(fmt.Errorf("message poktroll.session.SessionHeader does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SessionHeader) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.session.SessionHeader.application_address": + x.ApplicationAddress = value.Interface().(string) + case "poktroll.session.SessionHeader.service": + x.Service = value.Message().Interface().(*shared.Service) + case "poktroll.session.SessionHeader.session_start_block_height": + x.SessionStartBlockHeight = value.Int() + case "poktroll.session.SessionHeader.session_id": + x.SessionId = value.Interface().(string) + case "poktroll.session.SessionHeader.session_end_block_height": + x.SessionEndBlockHeight = value.Int() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.SessionHeader")) + } + panic(fmt.Errorf("message poktroll.session.SessionHeader does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SessionHeader) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.SessionHeader.service": + if x.Service == nil { + x.Service = new(shared.Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + case "poktroll.session.SessionHeader.application_address": + panic(fmt.Errorf("field application_address of message poktroll.session.SessionHeader is not mutable")) + case "poktroll.session.SessionHeader.session_start_block_height": + panic(fmt.Errorf("field session_start_block_height of message poktroll.session.SessionHeader is not mutable")) + case "poktroll.session.SessionHeader.session_id": + panic(fmt.Errorf("field session_id of message poktroll.session.SessionHeader is not mutable")) + case "poktroll.session.SessionHeader.session_end_block_height": + panic(fmt.Errorf("field session_end_block_height of message poktroll.session.SessionHeader is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.SessionHeader")) + } + panic(fmt.Errorf("message poktroll.session.SessionHeader does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_SessionHeader) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.SessionHeader.application_address": + return protoreflect.ValueOfString("") + case "poktroll.session.SessionHeader.service": + m := new(shared.Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.session.SessionHeader.session_start_block_height": + return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.session.SessionHeader.session_id": + return protoreflect.ValueOfString("") + case "poktroll.session.SessionHeader.session_end_block_height": + return protoreflect.ValueOfInt64(int64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.SessionHeader")) + } + panic(fmt.Errorf("message poktroll.session.SessionHeader does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_SessionHeader) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.SessionHeader", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_SessionHeader) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SessionHeader) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_SessionHeader) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_SessionHeader) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*SessionHeader) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.ApplicationAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionStartBlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.SessionStartBlockHeight)) + } + l = len(x.SessionId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionEndBlockHeight != 0 { + n += 1 + runtime.Sov(uint64(x.SessionEndBlockHeight)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*SessionHeader) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.SessionEndBlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.SessionEndBlockHeight)) + i-- + dAtA[i] = 0x28 + } + if len(x.SessionId) > 0 { + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0x22 + } + if x.SessionStartBlockHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.SessionStartBlockHeight)) + i-- + dAtA[i] = 0x18 + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.ApplicationAddress) > 0 { + i -= len(x.ApplicationAddress) + copy(dAtA[i:], x.ApplicationAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ApplicationAddress))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*SessionHeader) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SessionHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SessionHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ApplicationAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ApplicationAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &shared.Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionStartBlockHeight", wireType) + } + x.SessionStartBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.SessionStartBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionEndBlockHeight", wireType) + } + x.SessionEndBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.SessionEndBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_Session_6_list)(nil) + +type _Session_6_list struct { + list *[]*shared.Supplier +} + +func (x *_Session_6_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Session_6_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Session_6_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) + (*x.list)[i] = concreteValue +} + +func (x *_Session_6_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Session_6_list) AppendMutable() protoreflect.Value { + v := new(shared.Supplier) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Session_6_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Session_6_list) NewElement() protoreflect.Value { + v := new(shared.Supplier) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Session_6_list) IsValid() bool { + return x.list != nil +} + +var ( + md_Session protoreflect.MessageDescriptor + fd_Session_header protoreflect.FieldDescriptor + fd_Session_session_id protoreflect.FieldDescriptor + fd_Session_session_number protoreflect.FieldDescriptor + fd_Session_num_blocks_per_session protoreflect.FieldDescriptor + fd_Session_application protoreflect.FieldDescriptor + fd_Session_suppliers protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_session_proto_init() + md_Session = File_poktroll_session_session_proto.Messages().ByName("Session") + fd_Session_header = md_Session.Fields().ByName("header") + fd_Session_session_id = md_Session.Fields().ByName("session_id") + fd_Session_session_number = md_Session.Fields().ByName("session_number") + fd_Session_num_blocks_per_session = md_Session.Fields().ByName("num_blocks_per_session") + fd_Session_application = md_Session.Fields().ByName("application") + fd_Session_suppliers = md_Session.Fields().ByName("suppliers") +} + +var _ protoreflect.Message = (*fastReflection_Session)(nil) + +type fastReflection_Session Session + +func (x *Session) ProtoReflect() protoreflect.Message { + return (*fastReflection_Session)(x) +} + +func (x *Session) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_session_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Session_messageType fastReflection_Session_messageType +var _ protoreflect.MessageType = fastReflection_Session_messageType{} + +type fastReflection_Session_messageType struct{} + +func (x fastReflection_Session_messageType) Zero() protoreflect.Message { + return (*fastReflection_Session)(nil) +} +func (x fastReflection_Session_messageType) New() protoreflect.Message { + return new(fastReflection_Session) +} +func (x fastReflection_Session_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Session +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Session) Descriptor() protoreflect.MessageDescriptor { + return md_Session +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Session) Type() protoreflect.MessageType { + return _fastReflection_Session_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Session) New() protoreflect.Message { + return new(fastReflection_Session) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Session) Interface() protoreflect.ProtoMessage { + return (*Session)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Session) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Header != nil { + value := protoreflect.ValueOfMessage(x.Header.ProtoReflect()) + if !f(fd_Session_header, value) { + return + } + } + if x.SessionId != "" { + value := protoreflect.ValueOfString(x.SessionId) + if !f(fd_Session_session_id, value) { + return + } + } + if x.SessionNumber != int64(0) { + value := protoreflect.ValueOfInt64(x.SessionNumber) + if !f(fd_Session_session_number, value) { + return + } + } + if x.NumBlocksPerSession != int64(0) { + value := protoreflect.ValueOfInt64(x.NumBlocksPerSession) + if !f(fd_Session_num_blocks_per_session, value) { + return + } + } + if x.Application != nil { + value := protoreflect.ValueOfMessage(x.Application.ProtoReflect()) + if !f(fd_Session_application, value) { + return + } + } + if len(x.Suppliers) != 0 { + value := protoreflect.ValueOfList(&_Session_6_list{list: &x.Suppliers}) + if !f(fd_Session_suppliers, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Session) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.session.Session.header": + return x.Header != nil + case "poktroll.session.Session.session_id": + return x.SessionId != "" + case "poktroll.session.Session.session_number": + return x.SessionNumber != int64(0) + case "poktroll.session.Session.num_blocks_per_session": + return x.NumBlocksPerSession != int64(0) + case "poktroll.session.Session.application": + return x.Application != nil + case "poktroll.session.Session.suppliers": + return len(x.Suppliers) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Session")) + } + panic(fmt.Errorf("message poktroll.session.Session does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Session) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.session.Session.header": + x.Header = nil + case "poktroll.session.Session.session_id": + x.SessionId = "" + case "poktroll.session.Session.session_number": + x.SessionNumber = int64(0) + case "poktroll.session.Session.num_blocks_per_session": + x.NumBlocksPerSession = int64(0) + case "poktroll.session.Session.application": + x.Application = nil + case "poktroll.session.Session.suppliers": + x.Suppliers = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Session")) + } + panic(fmt.Errorf("message poktroll.session.Session does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Session) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.session.Session.header": + value := x.Header + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.session.Session.session_id": + value := x.SessionId + return protoreflect.ValueOfString(value) + case "poktroll.session.Session.session_number": + value := x.SessionNumber + return protoreflect.ValueOfInt64(value) + case "poktroll.session.Session.num_blocks_per_session": + value := x.NumBlocksPerSession + return protoreflect.ValueOfInt64(value) + case "poktroll.session.Session.application": + value := x.Application + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.session.Session.suppliers": + if len(x.Suppliers) == 0 { + return protoreflect.ValueOfList(&_Session_6_list{}) + } + listValue := &_Session_6_list{list: &x.Suppliers} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Session")) + } + panic(fmt.Errorf("message poktroll.session.Session does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Session) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.session.Session.header": + x.Header = value.Message().Interface().(*SessionHeader) + case "poktroll.session.Session.session_id": + x.SessionId = value.Interface().(string) + case "poktroll.session.Session.session_number": + x.SessionNumber = value.Int() + case "poktroll.session.Session.num_blocks_per_session": + x.NumBlocksPerSession = value.Int() + case "poktroll.session.Session.application": + x.Application = value.Message().Interface().(*application.Application) + case "poktroll.session.Session.suppliers": + lv := value.List() + clv := lv.(*_Session_6_list) + x.Suppliers = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Session")) + } + panic(fmt.Errorf("message poktroll.session.Session does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Session) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.Session.header": + if x.Header == nil { + x.Header = new(SessionHeader) + } + return protoreflect.ValueOfMessage(x.Header.ProtoReflect()) + case "poktroll.session.Session.application": + if x.Application == nil { + x.Application = new(application.Application) + } + return protoreflect.ValueOfMessage(x.Application.ProtoReflect()) + case "poktroll.session.Session.suppliers": + if x.Suppliers == nil { + x.Suppliers = []*shared.Supplier{} + } + value := &_Session_6_list{list: &x.Suppliers} + return protoreflect.ValueOfList(value) + case "poktroll.session.Session.session_id": + panic(fmt.Errorf("field session_id of message poktroll.session.Session is not mutable")) + case "poktroll.session.Session.session_number": + panic(fmt.Errorf("field session_number of message poktroll.session.Session is not mutable")) + case "poktroll.session.Session.num_blocks_per_session": + panic(fmt.Errorf("field num_blocks_per_session of message poktroll.session.Session is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Session")) + } + panic(fmt.Errorf("message poktroll.session.Session does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Session) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.Session.header": + m := new(SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.session.Session.session_id": + return protoreflect.ValueOfString("") + case "poktroll.session.Session.session_number": + return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.session.Session.num_blocks_per_session": + return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.session.Session.application": + m := new(application.Application) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.session.Session.suppliers": + list := []*shared.Supplier{} + return protoreflect.ValueOfList(&_Session_6_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.Session")) + } + panic(fmt.Errorf("message poktroll.session.Session does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Session) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.Session", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Session) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Session) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Session) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Session) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Session) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Header != nil { + l = options.Size(x.Header) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.SessionId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SessionNumber != 0 { + n += 1 + runtime.Sov(uint64(x.SessionNumber)) + } + if x.NumBlocksPerSession != 0 { + n += 1 + runtime.Sov(uint64(x.NumBlocksPerSession)) + } + if x.Application != nil { + l = options.Size(x.Application) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Suppliers) > 0 { + for _, e := range x.Suppliers { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Session) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Suppliers) > 0 { + for iNdEx := len(x.Suppliers) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Suppliers[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + } + if x.Application != nil { + encoded, err := options.Marshal(x.Application) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } + if x.NumBlocksPerSession != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.NumBlocksPerSession)) + i-- + dAtA[i] = 0x20 + } + if x.SessionNumber != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.SessionNumber)) + i-- + dAtA[i] = 0x18 + } + if len(x.SessionId) > 0 { + i -= len(x.SessionId) + copy(dAtA[i:], x.SessionId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SessionId))) + i-- + dAtA[i] = 0x12 + } + if x.Header != nil { + encoded, err := options.Marshal(x.Header) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Session) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Session: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Session: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Header == nil { + x.Header = &SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Header); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionNumber", wireType) + } + x.SessionNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.SessionNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NumBlocksPerSession", wireType) + } + x.NumBlocksPerSession = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.NumBlocksPerSession |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Application", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Application == nil { + x.Application = &application.Application{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Application); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Suppliers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Suppliers = append(x.Suppliers, &shared.Supplier{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Suppliers[len(x.Suppliers)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/session/session.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// SessionHeader is a lightweight header for a session that can be passed around. +// It is the minimal amount of data required to hydrate & retrieve all data relevant to the session. +type SessionHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ApplicationAddress string `protobuf:"bytes,1,opt,name=application_address,json=applicationAddress,proto3" json:"application_address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The service this session is for + SessionStartBlockHeight int64 `protobuf:"varint,3,opt,name=session_start_block_height,json=sessionStartBlockHeight,proto3" json:"session_start_block_height,omitempty"` // The height at which this session started + // NOTE: session_id can be derived from the above values using on-chain but is included in the header for convenience + SessionId string `protobuf:"bytes,4,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // A unique pseudoranom ID for this session + SessionEndBlockHeight int64 `protobuf:"varint,5,opt,name=session_end_block_height,json=sessionEndBlockHeight,proto3" json:"session_end_block_height,omitempty"` // The height at which this session ended, this is the last block of the session +} + +func (x *SessionHeader) Reset() { + *x = SessionHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_session_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionHeader) ProtoMessage() {} + +// Deprecated: Use SessionHeader.ProtoReflect.Descriptor instead. +func (*SessionHeader) Descriptor() ([]byte, []int) { + return file_poktroll_session_session_proto_rawDescGZIP(), []int{0} +} + +func (x *SessionHeader) GetApplicationAddress() string { + if x != nil { + return x.ApplicationAddress + } + return "" +} + +func (x *SessionHeader) GetService() *shared.Service { + if x != nil { + return x.Service + } + return nil +} + +func (x *SessionHeader) GetSessionStartBlockHeight() int64 { + if x != nil { + return x.SessionStartBlockHeight + } + return 0 +} + +func (x *SessionHeader) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *SessionHeader) GetSessionEndBlockHeight() int64 { + if x != nil { + return x.SessionEndBlockHeight + } + return 0 +} + +// Session is a fully hydrated session object that contains all the information for the Session +// and its parcipants. +type Session struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *SessionHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // The header of the session containing lightweight data + SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // A unique pseudoranom ID for this session + SessionNumber int64 `protobuf:"varint,3,opt,name=session_number,json=sessionNumber,proto3" json:"session_number,omitempty"` // The session number since genesis + NumBlocksPerSession int64 `protobuf:"varint,4,opt,name=num_blocks_per_session,json=numBlocksPerSession,proto3" json:"num_blocks_per_session,omitempty"` // The number of blocks per session when this session started + Application *application.Application `protobuf:"bytes,5,opt,name=application,proto3" json:"application,omitempty"` // A fully hydrated application object this session is for + Suppliers []*shared.Supplier `protobuf:"bytes,6,rep,name=suppliers,proto3" json:"suppliers,omitempty"` // A fully hydrated set of servicers that are serving the application +} + +func (x *Session) Reset() { + *x = Session{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_session_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Session) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Session) ProtoMessage() {} + +// Deprecated: Use Session.ProtoReflect.Descriptor instead. +func (*Session) Descriptor() ([]byte, []int) { + return file_poktroll_session_session_proto_rawDescGZIP(), []int{1} +} + +func (x *Session) GetHeader() *SessionHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *Session) GetSessionId() string { + if x != nil { + return x.SessionId + } + return "" +} + +func (x *Session) GetSessionNumber() int64 { + if x != nil { + return x.SessionNumber + } + return 0 +} + +func (x *Session) GetNumBlocksPerSession() int64 { + if x != nil { + return x.NumBlocksPerSession + } + return 0 +} + +func (x *Session) GetApplication() *application.Application { + if x != nil { + return x.Application + } + return nil +} + +func (x *Session) GetSuppliers() []*shared.Supplier { + if x != nil { + return x.Suppliers + } + return nil +} + +var File_poktroll_session_session_proto protoreflect.FileDescriptor + +var file_poktroll_session_session_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x13, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x32, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x1a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x37, 0x0a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x64, + 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x15, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0xbb, 0x02, 0x0a, 0x07, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, + 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x6e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, + 0x50, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x37, 0x0a, 0x09, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x09, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x42, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x10, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_session_session_proto_rawDescOnce sync.Once + file_poktroll_session_session_proto_rawDescData = file_poktroll_session_session_proto_rawDesc +) + +func file_poktroll_session_session_proto_rawDescGZIP() []byte { + file_poktroll_session_session_proto_rawDescOnce.Do(func() { + file_poktroll_session_session_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_session_session_proto_rawDescData) + }) + return file_poktroll_session_session_proto_rawDescData +} + +var file_poktroll_session_session_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_session_session_proto_goTypes = []interface{}{ + (*SessionHeader)(nil), // 0: poktroll.session.SessionHeader + (*Session)(nil), // 1: poktroll.session.Session + (*shared.Service)(nil), // 2: poktroll.shared.Service + (*application.Application)(nil), // 3: poktroll.application.Application + (*shared.Supplier)(nil), // 4: poktroll.shared.Supplier +} +var file_poktroll_session_session_proto_depIdxs = []int32{ + 2, // 0: poktroll.session.SessionHeader.service:type_name -> poktroll.shared.Service + 0, // 1: poktroll.session.Session.header:type_name -> poktroll.session.SessionHeader + 3, // 2: poktroll.session.Session.application:type_name -> poktroll.application.Application + 4, // 3: poktroll.session.Session.suppliers:type_name -> poktroll.shared.Supplier + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_poktroll_session_session_proto_init() } +func file_poktroll_session_session_proto_init() { + if File_poktroll_session_session_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_session_session_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_session_session_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Session); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_session_session_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_session_session_proto_goTypes, + DependencyIndexes: file_poktroll_session_session_proto_depIdxs, + MessageInfos: file_poktroll_session_session_proto_msgTypes, + }.Build() + File_poktroll_session_session_proto = out.File + file_poktroll_session_session_proto_rawDesc = nil + file_poktroll_session_session_proto_goTypes = nil + file_poktroll_session_session_proto_depIdxs = nil +} diff --git a/api/poktroll/session/tx.pulsar.go b/api/poktroll/session/tx.pulsar.go new file mode 100644 index 000000000..20ba9d62e --- /dev/null +++ b/api/poktroll/session/tx.pulsar.go @@ -0,0 +1,1089 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package session + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_session_tx_proto_init() + md_MsgUpdateParams = File_poktroll_session_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.session.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.session.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.session.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.session.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.session.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.session.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.session.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.session.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.session.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.session.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.session.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.session.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_session_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_session_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_session_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.session.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.session.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.session.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/session/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_session_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_session_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_session_tx_proto_rawDescGZIP(), []int{1} +} + +var File_poktroll_session_tx_proto protoreflect.FileDescriptor + +var file_poktroll_session_tx_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x78, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x6a, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, + 0x42, 0xa3, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_session_tx_proto_rawDescOnce sync.Once + file_poktroll_session_tx_proto_rawDescData = file_poktroll_session_tx_proto_rawDesc +) + +func file_poktroll_session_tx_proto_rawDescGZIP() []byte { + file_poktroll_session_tx_proto_rawDescOnce.Do(func() { + file_poktroll_session_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_session_tx_proto_rawDescData) + }) + return file_poktroll_session_tx_proto_rawDescData +} + +var file_poktroll_session_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_session_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.session.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.session.MsgUpdateParamsResponse + (*Params)(nil), // 2: poktroll.session.Params +} +var file_poktroll_session_tx_proto_depIdxs = []int32{ + 2, // 0: poktroll.session.MsgUpdateParams.params:type_name -> poktroll.session.Params + 0, // 1: poktroll.session.Msg.UpdateParams:input_type -> poktroll.session.MsgUpdateParams + 1, // 2: poktroll.session.Msg.UpdateParams:output_type -> poktroll.session.MsgUpdateParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_session_tx_proto_init() } +func file_poktroll_session_tx_proto_init() { + if File_poktroll_session_tx_proto != nil { + return + } + file_poktroll_session_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_session_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_session_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_session_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_session_tx_proto_goTypes, + DependencyIndexes: file_poktroll_session_tx_proto_depIdxs, + MessageInfos: file_poktroll_session_tx_proto_msgTypes, + }.Build() + File_poktroll_session_tx_proto = out.File + file_poktroll_session_tx_proto_rawDesc = nil + file_poktroll_session_tx_proto_goTypes = nil + file_poktroll_session_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/shared/service.pulsar.go b/api/poktroll/shared/service.pulsar.go new file mode 100644 index 000000000..6af7bca5b --- /dev/null +++ b/api/poktroll/shared/service.pulsar.go @@ -0,0 +1,3105 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package shared + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Service protoreflect.MessageDescriptor + fd_Service_id protoreflect.FieldDescriptor + fd_Service_name protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_Service = File_poktroll_shared_service_proto.Messages().ByName("Service") + fd_Service_id = md_Service.Fields().ByName("id") + fd_Service_name = md_Service.Fields().ByName("name") +} + +var _ protoreflect.Message = (*fastReflection_Service)(nil) + +type fastReflection_Service Service + +func (x *Service) ProtoReflect() protoreflect.Message { + return (*fastReflection_Service)(x) +} + +func (x *Service) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Service_messageType fastReflection_Service_messageType +var _ protoreflect.MessageType = fastReflection_Service_messageType{} + +type fastReflection_Service_messageType struct{} + +func (x fastReflection_Service_messageType) Zero() protoreflect.Message { + return (*fastReflection_Service)(nil) +} +func (x fastReflection_Service_messageType) New() protoreflect.Message { + return new(fastReflection_Service) +} +func (x fastReflection_Service_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Service) Descriptor() protoreflect.MessageDescriptor { + return md_Service +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Service) Type() protoreflect.MessageType { + return _fastReflection_Service_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Service) New() protoreflect.Message { + return new(fastReflection_Service) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Service) Interface() protoreflect.ProtoMessage { + return (*Service)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Service) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_Service_id, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_Service_name, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Service) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.Service.id": + return x.Id != "" + case "poktroll.shared.Service.name": + return x.Name != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.Service.id": + x.Id = "" + case "poktroll.shared.Service.name": + x.Name = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Service) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.Service.id": + value := x.Id + return protoreflect.ValueOfString(value) + case "poktroll.shared.Service.name": + value := x.Name + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.Service.id": + x.Id = value.Interface().(string) + case "poktroll.shared.Service.name": + x.Name = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Service.id": + panic(fmt.Errorf("field id of message poktroll.shared.Service is not mutable")) + case "poktroll.shared.Service.name": + panic(fmt.Errorf("field name of message poktroll.shared.Service is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Service) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Service.id": + return protoreflect.ValueOfString("") + case "poktroll.shared.Service.name": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Service")) + } + panic(fmt.Errorf("message poktroll.shared.Service does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Service) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.Service", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Service) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Service) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Service) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Service) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Service) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_ApplicationServiceConfig protoreflect.MessageDescriptor + fd_ApplicationServiceConfig_service protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_ApplicationServiceConfig = File_poktroll_shared_service_proto.Messages().ByName("ApplicationServiceConfig") + fd_ApplicationServiceConfig_service = md_ApplicationServiceConfig.Fields().ByName("service") +} + +var _ protoreflect.Message = (*fastReflection_ApplicationServiceConfig)(nil) + +type fastReflection_ApplicationServiceConfig ApplicationServiceConfig + +func (x *ApplicationServiceConfig) ProtoReflect() protoreflect.Message { + return (*fastReflection_ApplicationServiceConfig)(x) +} + +func (x *ApplicationServiceConfig) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_ApplicationServiceConfig_messageType fastReflection_ApplicationServiceConfig_messageType +var _ protoreflect.MessageType = fastReflection_ApplicationServiceConfig_messageType{} + +type fastReflection_ApplicationServiceConfig_messageType struct{} + +func (x fastReflection_ApplicationServiceConfig_messageType) Zero() protoreflect.Message { + return (*fastReflection_ApplicationServiceConfig)(nil) +} +func (x fastReflection_ApplicationServiceConfig_messageType) New() protoreflect.Message { + return new(fastReflection_ApplicationServiceConfig) +} +func (x fastReflection_ApplicationServiceConfig_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ApplicationServiceConfig +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_ApplicationServiceConfig) Descriptor() protoreflect.MessageDescriptor { + return md_ApplicationServiceConfig +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_ApplicationServiceConfig) Type() protoreflect.MessageType { + return _fastReflection_ApplicationServiceConfig_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_ApplicationServiceConfig) New() protoreflect.Message { + return new(fastReflection_ApplicationServiceConfig) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_ApplicationServiceConfig) Interface() protoreflect.ProtoMessage { + return (*ApplicationServiceConfig)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_ApplicationServiceConfig) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_ApplicationServiceConfig_service, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_ApplicationServiceConfig) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.ApplicationServiceConfig.service": + return x.Service != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ApplicationServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.ApplicationServiceConfig does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ApplicationServiceConfig) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.ApplicationServiceConfig.service": + x.Service = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ApplicationServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.ApplicationServiceConfig does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_ApplicationServiceConfig) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.ApplicationServiceConfig.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ApplicationServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.ApplicationServiceConfig does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ApplicationServiceConfig) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.ApplicationServiceConfig.service": + x.Service = value.Message().Interface().(*Service) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ApplicationServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.ApplicationServiceConfig does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ApplicationServiceConfig) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.ApplicationServiceConfig.service": + if x.Service == nil { + x.Service = new(Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ApplicationServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.ApplicationServiceConfig does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_ApplicationServiceConfig) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.ApplicationServiceConfig.service": + m := new(Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ApplicationServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.ApplicationServiceConfig does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_ApplicationServiceConfig) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.ApplicationServiceConfig", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_ApplicationServiceConfig) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ApplicationServiceConfig) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_ApplicationServiceConfig) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_ApplicationServiceConfig) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*ApplicationServiceConfig) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*ApplicationServiceConfig) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*ApplicationServiceConfig) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ApplicationServiceConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ApplicationServiceConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_SupplierServiceConfig_2_list)(nil) + +type _SupplierServiceConfig_2_list struct { + list *[]*SupplierEndpoint +} + +func (x *_SupplierServiceConfig_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_SupplierServiceConfig_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_SupplierServiceConfig_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierEndpoint) + (*x.list)[i] = concreteValue +} + +func (x *_SupplierServiceConfig_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierEndpoint) + *x.list = append(*x.list, concreteValue) +} + +func (x *_SupplierServiceConfig_2_list) AppendMutable() protoreflect.Value { + v := new(SupplierEndpoint) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierServiceConfig_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_SupplierServiceConfig_2_list) NewElement() protoreflect.Value { + v := new(SupplierEndpoint) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierServiceConfig_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_SupplierServiceConfig protoreflect.MessageDescriptor + fd_SupplierServiceConfig_service protoreflect.FieldDescriptor + fd_SupplierServiceConfig_endpoints protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_SupplierServiceConfig = File_poktroll_shared_service_proto.Messages().ByName("SupplierServiceConfig") + fd_SupplierServiceConfig_service = md_SupplierServiceConfig.Fields().ByName("service") + fd_SupplierServiceConfig_endpoints = md_SupplierServiceConfig.Fields().ByName("endpoints") +} + +var _ protoreflect.Message = (*fastReflection_SupplierServiceConfig)(nil) + +type fastReflection_SupplierServiceConfig SupplierServiceConfig + +func (x *SupplierServiceConfig) ProtoReflect() protoreflect.Message { + return (*fastReflection_SupplierServiceConfig)(x) +} + +func (x *SupplierServiceConfig) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_SupplierServiceConfig_messageType fastReflection_SupplierServiceConfig_messageType +var _ protoreflect.MessageType = fastReflection_SupplierServiceConfig_messageType{} + +type fastReflection_SupplierServiceConfig_messageType struct{} + +func (x fastReflection_SupplierServiceConfig_messageType) Zero() protoreflect.Message { + return (*fastReflection_SupplierServiceConfig)(nil) +} +func (x fastReflection_SupplierServiceConfig_messageType) New() protoreflect.Message { + return new(fastReflection_SupplierServiceConfig) +} +func (x fastReflection_SupplierServiceConfig_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierServiceConfig +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_SupplierServiceConfig) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierServiceConfig +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_SupplierServiceConfig) Type() protoreflect.MessageType { + return _fastReflection_SupplierServiceConfig_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_SupplierServiceConfig) New() protoreflect.Message { + return new(fastReflection_SupplierServiceConfig) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_SupplierServiceConfig) Interface() protoreflect.ProtoMessage { + return (*SupplierServiceConfig)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_SupplierServiceConfig) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Service != nil { + value := protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + if !f(fd_SupplierServiceConfig_service, value) { + return + } + } + if len(x.Endpoints) != 0 { + value := protoreflect.ValueOfList(&_SupplierServiceConfig_2_list{list: &x.Endpoints}) + if !f(fd_SupplierServiceConfig_endpoints, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_SupplierServiceConfig) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + return x.Service != nil + case "poktroll.shared.SupplierServiceConfig.endpoints": + return len(x.Endpoints) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierServiceConfig) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + x.Service = nil + case "poktroll.shared.SupplierServiceConfig.endpoints": + x.Endpoints = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_SupplierServiceConfig) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + value := x.Service + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.shared.SupplierServiceConfig.endpoints": + if len(x.Endpoints) == 0 { + return protoreflect.ValueOfList(&_SupplierServiceConfig_2_list{}) + } + listValue := &_SupplierServiceConfig_2_list{list: &x.Endpoints} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierServiceConfig) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + x.Service = value.Message().Interface().(*Service) + case "poktroll.shared.SupplierServiceConfig.endpoints": + lv := value.List() + clv := lv.(*_SupplierServiceConfig_2_list) + x.Endpoints = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierServiceConfig) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + if x.Service == nil { + x.Service = new(Service) + } + return protoreflect.ValueOfMessage(x.Service.ProtoReflect()) + case "poktroll.shared.SupplierServiceConfig.endpoints": + if x.Endpoints == nil { + x.Endpoints = []*SupplierEndpoint{} + } + value := &_SupplierServiceConfig_2_list{list: &x.Endpoints} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_SupplierServiceConfig) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierServiceConfig.service": + m := new(Service) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.shared.SupplierServiceConfig.endpoints": + list := []*SupplierEndpoint{} + return protoreflect.ValueOfList(&_SupplierServiceConfig_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierServiceConfig")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierServiceConfig does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_SupplierServiceConfig) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.SupplierServiceConfig", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_SupplierServiceConfig) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierServiceConfig) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_SupplierServiceConfig) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_SupplierServiceConfig) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*SupplierServiceConfig) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Service != nil { + l = options.Size(x.Service) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Endpoints) > 0 { + for _, e := range x.Endpoints { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*SupplierServiceConfig) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Endpoints) > 0 { + for iNdEx := len(x.Endpoints) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Endpoints[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Service != nil { + encoded, err := options.Marshal(x.Service) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*SupplierServiceConfig) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SupplierServiceConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SupplierServiceConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Service == nil { + x.Service = &Service{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Service); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Endpoints = append(x.Endpoints, &SupplierEndpoint{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Endpoints[len(x.Endpoints)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_SupplierEndpoint_3_list)(nil) + +type _SupplierEndpoint_3_list struct { + list *[]*ConfigOption +} + +func (x *_SupplierEndpoint_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_SupplierEndpoint_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_SupplierEndpoint_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*ConfigOption) + (*x.list)[i] = concreteValue +} + +func (x *_SupplierEndpoint_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*ConfigOption) + *x.list = append(*x.list, concreteValue) +} + +func (x *_SupplierEndpoint_3_list) AppendMutable() protoreflect.Value { + v := new(ConfigOption) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierEndpoint_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_SupplierEndpoint_3_list) NewElement() protoreflect.Value { + v := new(ConfigOption) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_SupplierEndpoint_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_SupplierEndpoint protoreflect.MessageDescriptor + fd_SupplierEndpoint_url protoreflect.FieldDescriptor + fd_SupplierEndpoint_rpc_type protoreflect.FieldDescriptor + fd_SupplierEndpoint_configs protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_SupplierEndpoint = File_poktroll_shared_service_proto.Messages().ByName("SupplierEndpoint") + fd_SupplierEndpoint_url = md_SupplierEndpoint.Fields().ByName("url") + fd_SupplierEndpoint_rpc_type = md_SupplierEndpoint.Fields().ByName("rpc_type") + fd_SupplierEndpoint_configs = md_SupplierEndpoint.Fields().ByName("configs") +} + +var _ protoreflect.Message = (*fastReflection_SupplierEndpoint)(nil) + +type fastReflection_SupplierEndpoint SupplierEndpoint + +func (x *SupplierEndpoint) ProtoReflect() protoreflect.Message { + return (*fastReflection_SupplierEndpoint)(x) +} + +func (x *SupplierEndpoint) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_SupplierEndpoint_messageType fastReflection_SupplierEndpoint_messageType +var _ protoreflect.MessageType = fastReflection_SupplierEndpoint_messageType{} + +type fastReflection_SupplierEndpoint_messageType struct{} + +func (x fastReflection_SupplierEndpoint_messageType) Zero() protoreflect.Message { + return (*fastReflection_SupplierEndpoint)(nil) +} +func (x fastReflection_SupplierEndpoint_messageType) New() protoreflect.Message { + return new(fastReflection_SupplierEndpoint) +} +func (x fastReflection_SupplierEndpoint_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierEndpoint +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_SupplierEndpoint) Descriptor() protoreflect.MessageDescriptor { + return md_SupplierEndpoint +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_SupplierEndpoint) Type() protoreflect.MessageType { + return _fastReflection_SupplierEndpoint_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_SupplierEndpoint) New() protoreflect.Message { + return new(fastReflection_SupplierEndpoint) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_SupplierEndpoint) Interface() protoreflect.ProtoMessage { + return (*SupplierEndpoint)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_SupplierEndpoint) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Url != "" { + value := protoreflect.ValueOfString(x.Url) + if !f(fd_SupplierEndpoint_url, value) { + return + } + } + if x.RpcType != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.RpcType)) + if !f(fd_SupplierEndpoint_rpc_type, value) { + return + } + } + if len(x.Configs) != 0 { + value := protoreflect.ValueOfList(&_SupplierEndpoint_3_list{list: &x.Configs}) + if !f(fd_SupplierEndpoint_configs, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_SupplierEndpoint) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + return x.Url != "" + case "poktroll.shared.SupplierEndpoint.rpc_type": + return x.RpcType != 0 + case "poktroll.shared.SupplierEndpoint.configs": + return len(x.Configs) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierEndpoint) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + x.Url = "" + case "poktroll.shared.SupplierEndpoint.rpc_type": + x.RpcType = 0 + case "poktroll.shared.SupplierEndpoint.configs": + x.Configs = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_SupplierEndpoint) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + value := x.Url + return protoreflect.ValueOfString(value) + case "poktroll.shared.SupplierEndpoint.rpc_type": + value := x.RpcType + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "poktroll.shared.SupplierEndpoint.configs": + if len(x.Configs) == 0 { + return protoreflect.ValueOfList(&_SupplierEndpoint_3_list{}) + } + listValue := &_SupplierEndpoint_3_list{list: &x.Configs} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierEndpoint) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + x.Url = value.Interface().(string) + case "poktroll.shared.SupplierEndpoint.rpc_type": + x.RpcType = (RPCType)(value.Enum()) + case "poktroll.shared.SupplierEndpoint.configs": + lv := value.List() + clv := lv.(*_SupplierEndpoint_3_list) + x.Configs = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierEndpoint) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.configs": + if x.Configs == nil { + x.Configs = []*ConfigOption{} + } + value := &_SupplierEndpoint_3_list{list: &x.Configs} + return protoreflect.ValueOfList(value) + case "poktroll.shared.SupplierEndpoint.url": + panic(fmt.Errorf("field url of message poktroll.shared.SupplierEndpoint is not mutable")) + case "poktroll.shared.SupplierEndpoint.rpc_type": + panic(fmt.Errorf("field rpc_type of message poktroll.shared.SupplierEndpoint is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_SupplierEndpoint) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.SupplierEndpoint.url": + return protoreflect.ValueOfString("") + case "poktroll.shared.SupplierEndpoint.rpc_type": + return protoreflect.ValueOfEnum(0) + case "poktroll.shared.SupplierEndpoint.configs": + list := []*ConfigOption{} + return protoreflect.ValueOfList(&_SupplierEndpoint_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.SupplierEndpoint")) + } + panic(fmt.Errorf("message poktroll.shared.SupplierEndpoint does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_SupplierEndpoint) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.SupplierEndpoint", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_SupplierEndpoint) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_SupplierEndpoint) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_SupplierEndpoint) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_SupplierEndpoint) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*SupplierEndpoint) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Url) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.RpcType != 0 { + n += 1 + runtime.Sov(uint64(x.RpcType)) + } + if len(x.Configs) > 0 { + for _, e := range x.Configs { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*SupplierEndpoint) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Configs) > 0 { + for iNdEx := len(x.Configs) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Configs[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if x.RpcType != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RpcType)) + i-- + dAtA[i] = 0x10 + } + if len(x.Url) > 0 { + i -= len(x.Url) + copy(dAtA[i:], x.Url) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Url))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*SupplierEndpoint) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SupplierEndpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: SupplierEndpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Url = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RpcType", wireType) + } + x.RpcType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RpcType |= RPCType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Configs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Configs = append(x.Configs, &ConfigOption{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Configs[len(x.Configs)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_ConfigOption protoreflect.MessageDescriptor + fd_ConfigOption_key protoreflect.FieldDescriptor + fd_ConfigOption_value protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_service_proto_init() + md_ConfigOption = File_poktroll_shared_service_proto.Messages().ByName("ConfigOption") + fd_ConfigOption_key = md_ConfigOption.Fields().ByName("key") + fd_ConfigOption_value = md_ConfigOption.Fields().ByName("value") +} + +var _ protoreflect.Message = (*fastReflection_ConfigOption)(nil) + +type fastReflection_ConfigOption ConfigOption + +func (x *ConfigOption) ProtoReflect() protoreflect.Message { + return (*fastReflection_ConfigOption)(x) +} + +func (x *ConfigOption) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_ConfigOption_messageType fastReflection_ConfigOption_messageType +var _ protoreflect.MessageType = fastReflection_ConfigOption_messageType{} + +type fastReflection_ConfigOption_messageType struct{} + +func (x fastReflection_ConfigOption_messageType) Zero() protoreflect.Message { + return (*fastReflection_ConfigOption)(nil) +} +func (x fastReflection_ConfigOption_messageType) New() protoreflect.Message { + return new(fastReflection_ConfigOption) +} +func (x fastReflection_ConfigOption_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ConfigOption +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_ConfigOption) Descriptor() protoreflect.MessageDescriptor { + return md_ConfigOption +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_ConfigOption) Type() protoreflect.MessageType { + return _fastReflection_ConfigOption_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_ConfigOption) New() protoreflect.Message { + return new(fastReflection_ConfigOption) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_ConfigOption) Interface() protoreflect.ProtoMessage { + return (*ConfigOption)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_ConfigOption) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Key != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Key)) + if !f(fd_ConfigOption_key, value) { + return + } + } + if x.Value != "" { + value := protoreflect.ValueOfString(x.Value) + if !f(fd_ConfigOption_value, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_ConfigOption) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + return x.Key != 0 + case "poktroll.shared.ConfigOption.value": + return x.Value != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ConfigOption) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + x.Key = 0 + case "poktroll.shared.ConfigOption.value": + x.Value = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_ConfigOption) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.ConfigOption.key": + value := x.Key + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "poktroll.shared.ConfigOption.value": + value := x.Value + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ConfigOption) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + x.Key = (ConfigOptions)(value.Enum()) + case "poktroll.shared.ConfigOption.value": + x.Value = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ConfigOption) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + panic(fmt.Errorf("field key of message poktroll.shared.ConfigOption is not mutable")) + case "poktroll.shared.ConfigOption.value": + panic(fmt.Errorf("field value of message poktroll.shared.ConfigOption is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_ConfigOption) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.ConfigOption.key": + return protoreflect.ValueOfEnum(0) + case "poktroll.shared.ConfigOption.value": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.ConfigOption")) + } + panic(fmt.Errorf("message poktroll.shared.ConfigOption does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_ConfigOption) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.ConfigOption", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_ConfigOption) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_ConfigOption) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_ConfigOption) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_ConfigOption) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*ConfigOption) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Key != 0 { + n += 1 + runtime.Sov(uint64(x.Key)) + } + l = len(x.Value) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*ConfigOption) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Value) > 0 { + i -= len(x.Value) + copy(dAtA[i:], x.Value) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Value))) + i-- + dAtA[i] = 0x12 + } + if x.Key != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Key)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*ConfigOption) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ConfigOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + x.Key = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Key |= ConfigOptions(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/shared/service.proto + +// NOTE that the `shared` package is not a Cosmos module, +// but rather a manually created package to resolve circular dependencies. + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Enum to define RPC types +type RPCType int32 + +const ( + RPCType_UNKNOWN_RPC RPCType = 0 // Undefined RPC type + RPCType_GRPC RPCType = 1 // gRPC + RPCType_WEBSOCKET RPCType = 2 // WebSocket + RPCType_JSON_RPC RPCType = 3 // JSON-RPC + RPCType_REST RPCType = 4 // REST +) + +// Enum value maps for RPCType. +var ( + RPCType_name = map[int32]string{ + 0: "UNKNOWN_RPC", + 1: "GRPC", + 2: "WEBSOCKET", + 3: "JSON_RPC", + 4: "REST", + } + RPCType_value = map[string]int32{ + "UNKNOWN_RPC": 0, + "GRPC": 1, + "WEBSOCKET": 2, + "JSON_RPC": 3, + "REST": 4, + } +) + +func (x RPCType) Enum() *RPCType { + p := new(RPCType) + *p = x + return p +} + +func (x RPCType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RPCType) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_shared_service_proto_enumTypes[0].Descriptor() +} + +func (RPCType) Type() protoreflect.EnumType { + return &file_poktroll_shared_service_proto_enumTypes[0] +} + +func (x RPCType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RPCType.Descriptor instead. +func (RPCType) EnumDescriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{0} +} + +// Enum to define configuration options +// TODO_RESEARCH: Should these be configs, SLAs or something else? There will be more discussion once we get closer to implementing on-chain QoS. +type ConfigOptions int32 + +const ( + ConfigOptions_UNKNOWN_CONFIG ConfigOptions = 0 // Undefined config option + ConfigOptions_TIMEOUT ConfigOptions = 1 // Timeout setting +) + +// Enum value maps for ConfigOptions. +var ( + ConfigOptions_name = map[int32]string{ + 0: "UNKNOWN_CONFIG", + 1: "TIMEOUT", + } + ConfigOptions_value = map[string]int32{ + "UNKNOWN_CONFIG": 0, + "TIMEOUT": 1, + } +) + +func (x ConfigOptions) Enum() *ConfigOptions { + p := new(ConfigOptions) + *p = x + return p +} + +func (x ConfigOptions) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfigOptions) Descriptor() protoreflect.EnumDescriptor { + return file_poktroll_shared_service_proto_enumTypes[1].Descriptor() +} + +func (ConfigOptions) Type() protoreflect.EnumType { + return &file_poktroll_shared_service_proto_enumTypes[1] +} + +func (x ConfigOptions) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfigOptions.Descriptor instead. +func (ConfigOptions) EnumDescriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{1} +} + +// Service message to encapsulate unique and semantic identifiers for a service on the network +type Service struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // For example, what if we want to request a session for a certain service but with some additional configs that identify it? + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the service + // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // (Optional) Semantic human readable name for the service +} + +func (x *Service) Reset() { + *x = Service{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Service) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Service) ProtoMessage() {} + +// Deprecated: Use Service.ProtoReflect.Descriptor instead. +func (*Service) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Service) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Service) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// ApplicationServiceConfig holds the service configuration the application stakes for +type ApplicationServiceConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the application is configured +} + +func (x *ApplicationServiceConfig) Reset() { + *x = ApplicationServiceConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApplicationServiceConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApplicationServiceConfig) ProtoMessage() {} + +// Deprecated: Use ApplicationServiceConfig.ProtoReflect.Descriptor instead. +func (*ApplicationServiceConfig) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ApplicationServiceConfig) GetService() *Service { + if x != nil { + return x.Service + } + return nil +} + +// SupplierServiceConfig holds the service configuration the supplier stakes for +type SupplierServiceConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // The Service for which the supplier is configured + Endpoints []*SupplierEndpoint `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"` // List of endpoints for the service +} + +func (x *SupplierServiceConfig) Reset() { + *x = SupplierServiceConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupplierServiceConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupplierServiceConfig) ProtoMessage() {} + +// Deprecated: Use SupplierServiceConfig.ProtoReflect.Descriptor instead. +func (*SupplierServiceConfig) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{2} +} + +func (x *SupplierServiceConfig) GetService() *Service { + if x != nil { + return x.Service + } + return nil +} + +func (x *SupplierServiceConfig) GetEndpoints() []*SupplierEndpoint { + if x != nil { + return x.Endpoints + } + return nil +} + +// SupplierEndpoint message to hold service configuration details +type SupplierEndpoint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // URL of the endpoint + RpcType RPCType `protobuf:"varint,2,opt,name=rpc_type,json=rpcType,proto3,enum=poktroll.shared.RPCType" json:"rpc_type,omitempty"` // Type of RPC exposed on the url above + Configs []*ConfigOption `protobuf:"bytes,3,rep,name=configs,proto3" json:"configs,omitempty"` // Additional configuration options for the endpoint +} + +func (x *SupplierEndpoint) Reset() { + *x = SupplierEndpoint{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupplierEndpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupplierEndpoint) ProtoMessage() {} + +// Deprecated: Use SupplierEndpoint.ProtoReflect.Descriptor instead. +func (*SupplierEndpoint) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{3} +} + +func (x *SupplierEndpoint) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *SupplierEndpoint) GetRpcType() RPCType { + if x != nil { + return x.RpcType + } + return RPCType_UNKNOWN_RPC +} + +func (x *SupplierEndpoint) GetConfigs() []*ConfigOption { + if x != nil { + return x.Configs + } + return nil +} + +// Key-value wrapper for config options, as proto maps can't be keyed by enums +type ConfigOption struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key ConfigOptions `protobuf:"varint,1,opt,name=key,proto3,enum=poktroll.shared.ConfigOptions" json:"key,omitempty"` // Config option key + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // Config option value +} + +func (x *ConfigOption) Reset() { + *x = ConfigOption{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigOption) ProtoMessage() {} + +// Deprecated: Use ConfigOption.ProtoReflect.Descriptor instead. +func (*ConfigOption) Descriptor() ([]byte, []int) { + return file_poktroll_shared_service_proto_rawDescGZIP(), []int{4} +} + +func (x *ConfigOption) GetKey() ConfigOptions { + if x != nil { + return x.Key + } + return ConfigOptions_UNKNOWN_CONFIG +} + +func (x *ConfigOption) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +var File_poktroll_shared_service_proto protoreflect.FileDescriptor + +var file_poktroll_shared_service_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x22, 0x2d, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x4e, 0x0a, 0x18, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x32, 0x0a, 0x07, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, + 0x8c, 0x01, 0x0a, 0x15, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x32, 0x0a, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, + 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x92, + 0x01, 0x0a, 0x10, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x33, 0x0a, 0x08, 0x72, 0x70, 0x63, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x52, 0x50, 0x43, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x07, 0x72, 0x70, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x22, 0x56, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x4b, 0x0a, 0x07, 0x52, + 0x50, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x5f, 0x52, 0x50, 0x43, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x10, + 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x02, + 0x12, 0x0c, 0x0a, 0x08, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x52, 0x50, 0x43, 0x10, 0x03, 0x12, 0x08, + 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x10, 0x04, 0x2a, 0x30, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x01, 0x42, 0xa2, 0x01, 0x0a, 0x13, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, + 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_shared_service_proto_rawDescOnce sync.Once + file_poktroll_shared_service_proto_rawDescData = file_poktroll_shared_service_proto_rawDesc +) + +func file_poktroll_shared_service_proto_rawDescGZIP() []byte { + file_poktroll_shared_service_proto_rawDescOnce.Do(func() { + file_poktroll_shared_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_shared_service_proto_rawDescData) + }) + return file_poktroll_shared_service_proto_rawDescData +} + +var file_poktroll_shared_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_poktroll_shared_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_poktroll_shared_service_proto_goTypes = []interface{}{ + (RPCType)(0), // 0: poktroll.shared.RPCType + (ConfigOptions)(0), // 1: poktroll.shared.ConfigOptions + (*Service)(nil), // 2: poktroll.shared.Service + (*ApplicationServiceConfig)(nil), // 3: poktroll.shared.ApplicationServiceConfig + (*SupplierServiceConfig)(nil), // 4: poktroll.shared.SupplierServiceConfig + (*SupplierEndpoint)(nil), // 5: poktroll.shared.SupplierEndpoint + (*ConfigOption)(nil), // 6: poktroll.shared.ConfigOption +} +var file_poktroll_shared_service_proto_depIdxs = []int32{ + 2, // 0: poktroll.shared.ApplicationServiceConfig.service:type_name -> poktroll.shared.Service + 2, // 1: poktroll.shared.SupplierServiceConfig.service:type_name -> poktroll.shared.Service + 5, // 2: poktroll.shared.SupplierServiceConfig.endpoints:type_name -> poktroll.shared.SupplierEndpoint + 0, // 3: poktroll.shared.SupplierEndpoint.rpc_type:type_name -> poktroll.shared.RPCType + 6, // 4: poktroll.shared.SupplierEndpoint.configs:type_name -> poktroll.shared.ConfigOption + 1, // 5: poktroll.shared.ConfigOption.key:type_name -> poktroll.shared.ConfigOptions + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_poktroll_shared_service_proto_init() } +func file_poktroll_shared_service_proto_init() { + if File_poktroll_shared_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_shared_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Service); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApplicationServiceConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupplierServiceConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupplierEndpoint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigOption); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_shared_service_proto_rawDesc, + NumEnums: 2, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_shared_service_proto_goTypes, + DependencyIndexes: file_poktroll_shared_service_proto_depIdxs, + EnumInfos: file_poktroll_shared_service_proto_enumTypes, + MessageInfos: file_poktroll_shared_service_proto_msgTypes, + }.Build() + File_poktroll_shared_service_proto = out.File + file_poktroll_shared_service_proto_rawDesc = nil + file_poktroll_shared_service_proto_goTypes = nil + file_poktroll_shared_service_proto_depIdxs = nil +} diff --git a/api/poktroll/shared/supplier.pulsar.go b/api/poktroll/shared/supplier.pulsar.go new file mode 100644 index 000000000..a0e0c637e --- /dev/null +++ b/api/poktroll/shared/supplier.pulsar.go @@ -0,0 +1,824 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package shared + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_Supplier_3_list)(nil) + +type _Supplier_3_list struct { + list *[]*SupplierServiceConfig +} + +func (x *_Supplier_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Supplier_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Supplier_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierServiceConfig) + (*x.list)[i] = concreteValue +} + +func (x *_Supplier_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*SupplierServiceConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Supplier_3_list) AppendMutable() protoreflect.Value { + v := new(SupplierServiceConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Supplier_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Supplier_3_list) NewElement() protoreflect.Value { + v := new(SupplierServiceConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Supplier_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_Supplier protoreflect.MessageDescriptor + fd_Supplier_address protoreflect.FieldDescriptor + fd_Supplier_stake protoreflect.FieldDescriptor + fd_Supplier_services protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_supplier_proto_init() + md_Supplier = File_poktroll_shared_supplier_proto.Messages().ByName("Supplier") + fd_Supplier_address = md_Supplier.Fields().ByName("address") + fd_Supplier_stake = md_Supplier.Fields().ByName("stake") + fd_Supplier_services = md_Supplier.Fields().ByName("services") +} + +var _ protoreflect.Message = (*fastReflection_Supplier)(nil) + +type fastReflection_Supplier Supplier + +func (x *Supplier) ProtoReflect() protoreflect.Message { + return (*fastReflection_Supplier)(x) +} + +func (x *Supplier) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_supplier_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Supplier_messageType fastReflection_Supplier_messageType +var _ protoreflect.MessageType = fastReflection_Supplier_messageType{} + +type fastReflection_Supplier_messageType struct{} + +func (x fastReflection_Supplier_messageType) Zero() protoreflect.Message { + return (*fastReflection_Supplier)(nil) +} +func (x fastReflection_Supplier_messageType) New() protoreflect.Message { + return new(fastReflection_Supplier) +} +func (x fastReflection_Supplier_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Supplier +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Supplier) Descriptor() protoreflect.MessageDescriptor { + return md_Supplier +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Supplier) Type() protoreflect.MessageType { + return _fastReflection_Supplier_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Supplier) New() protoreflect.Message { + return new(fastReflection_Supplier) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Supplier) Interface() protoreflect.ProtoMessage { + return (*Supplier)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Supplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_Supplier_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_Supplier_stake, value) { + return + } + } + if len(x.Services) != 0 { + value := protoreflect.ValueOfList(&_Supplier_3_list{list: &x.Services}) + if !f(fd_Supplier_services, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Supplier) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.Supplier.address": + return x.Address != "" + case "poktroll.shared.Supplier.stake": + return x.Stake != nil + case "poktroll.shared.Supplier.services": + return len(x.Services) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) + } + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Supplier) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.Supplier.address": + x.Address = "" + case "poktroll.shared.Supplier.stake": + x.Stake = nil + case "poktroll.shared.Supplier.services": + x.Services = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) + } + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Supplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.Supplier.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.shared.Supplier.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.shared.Supplier.services": + if len(x.Services) == 0 { + return protoreflect.ValueOfList(&_Supplier_3_list{}) + } + listValue := &_Supplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) + } + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Supplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.Supplier.address": + x.Address = value.Interface().(string) + case "poktroll.shared.Supplier.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.shared.Supplier.services": + lv := value.List() + clv := lv.(*_Supplier_3_list) + x.Services = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) + } + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Supplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Supplier.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.shared.Supplier.services": + if x.Services == nil { + x.Services = []*SupplierServiceConfig{} + } + value := &_Supplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(value) + case "poktroll.shared.Supplier.address": + panic(fmt.Errorf("field address of message poktroll.shared.Supplier is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) + } + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Supplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.Supplier.address": + return protoreflect.ValueOfString("") + case "poktroll.shared.Supplier.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.shared.Supplier.services": + list := []*SupplierServiceConfig{} + return protoreflect.ValueOfList(&_Supplier_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.Supplier")) + } + panic(fmt.Errorf("message poktroll.shared.Supplier does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Supplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.Supplier", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Supplier) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Supplier) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Supplier) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Supplier) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Supplier) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Services) > 0 { + for _, e := range x.Services { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Supplier) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Services) > 0 { + for iNdEx := len(x.Services) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Services[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Supplier) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Supplier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Supplier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Services = append(x.Services, &SupplierServiceConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Services[len(x.Services)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/shared/supplier.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Supplier is the type defining the actor in Pocket Network that provides RPC services. +type Supplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic encoding + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the supplier has staked + Services []*SupplierServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The service configs this supplier can support +} + +func (x *Supplier) Reset() { + *x = Supplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_supplier_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Supplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Supplier) ProtoMessage() {} + +// Deprecated: Use Supplier.ProtoReflect.Descriptor instead. +func (*Supplier) Descriptor() ([]byte, []int) { + return file_poktroll_shared_supplier_proto_rawDescGZIP(), []int{0} +} + +func (x *Supplier) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Supplier) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *Supplier) GetServices() []*SupplierServiceConfig { + if x != nil { + return x.Services + } + return nil +} + +var File_poktroll_shared_supplier_proto protoreflect.FileDescriptor + +var file_poktroll_shared_supplier_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x32, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, + 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_shared_supplier_proto_rawDescOnce sync.Once + file_poktroll_shared_supplier_proto_rawDescData = file_poktroll_shared_supplier_proto_rawDesc +) + +func file_poktroll_shared_supplier_proto_rawDescGZIP() []byte { + file_poktroll_shared_supplier_proto_rawDescOnce.Do(func() { + file_poktroll_shared_supplier_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_shared_supplier_proto_rawDescData) + }) + return file_poktroll_shared_supplier_proto_rawDescData +} + +var file_poktroll_shared_supplier_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_shared_supplier_proto_goTypes = []interface{}{ + (*Supplier)(nil), // 0: poktroll.shared.Supplier + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin + (*SupplierServiceConfig)(nil), // 2: poktroll.shared.SupplierServiceConfig +} +var file_poktroll_shared_supplier_proto_depIdxs = []int32{ + 1, // 0: poktroll.shared.Supplier.stake:type_name -> cosmos.base.v1beta1.Coin + 2, // 1: poktroll.shared.Supplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_shared_supplier_proto_init() } +func file_poktroll_shared_supplier_proto_init() { + if File_poktroll_shared_supplier_proto != nil { + return + } + file_poktroll_shared_service_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_shared_supplier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Supplier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_shared_supplier_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_shared_supplier_proto_goTypes, + DependencyIndexes: file_poktroll_shared_supplier_proto_depIdxs, + MessageInfos: file_poktroll_shared_supplier_proto_msgTypes, + }.Build() + File_poktroll_shared_supplier_proto = out.File + file_poktroll_shared_supplier_proto_rawDesc = nil + file_poktroll_shared_supplier_proto_goTypes = nil + file_poktroll_shared_supplier_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/genesis.pulsar.go b/api/poktroll/supplier/genesis.pulsar.go new file mode 100644 index 000000000..86a864a41 --- /dev/null +++ b/api/poktroll/supplier/genesis.pulsar.go @@ -0,0 +1,751 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*shared.Supplier +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(shared.Supplier) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(shared.Supplier) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_supplierList protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_genesis_proto_init() + md_GenesisState = File_poktroll_supplier_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_supplierList = md_GenesisState.Fields().ByName("supplierList") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } + if len(x.SupplierList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.SupplierList}) + if !f(fd_GenesisState_supplierList, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.GenesisState.params": + return x.Params != nil + case "poktroll.supplier.GenesisState.supplierList": + return len(x.SupplierList) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.GenesisState.params": + x.Params = nil + case "poktroll.supplier.GenesisState.supplierList": + x.SupplierList = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.supplier.GenesisState.supplierList": + if len(x.SupplierList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.SupplierList} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + case "poktroll.supplier.GenesisState.supplierList": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.SupplierList = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.supplier.GenesisState.supplierList": + if x.SupplierList == nil { + x.SupplierList = []*shared.Supplier{} + } + value := &_GenesisState_2_list{list: &x.SupplierList} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.supplier.GenesisState.supplierList": + list := []*shared.Supplier{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.GenesisState")) + } + panic(fmt.Errorf("message poktroll.supplier.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.SupplierList) > 0 { + for _, e := range x.SupplierList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.SupplierList) > 0 { + for iNdEx := len(x.SupplierList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.SupplierList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierList = append(x.SupplierList, &shared.Supplier{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SupplierList[len(x.SupplierList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the supplier module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + SupplierList []*shared.Supplier `protobuf:"bytes,2,rep,name=supplierList,proto3" json:"supplierList,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *GenesisState) GetSupplierList() []*shared.Supplier { + if x != nil { + return x.SupplierList + } + return nil +} + +var File_poktroll_supplier_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x01, + 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3c, + 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x43, 0x0a, 0x0c, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, + 0x74, 0x42, 0xae, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0c, 0x47, 0x65, 0x6e, + 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, + 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_genesis_proto_rawDescOnce sync.Once + file_poktroll_supplier_genesis_proto_rawDescData = file_poktroll_supplier_genesis_proto_rawDesc +) + +func file_poktroll_supplier_genesis_proto_rawDescGZIP() []byte { + file_poktroll_supplier_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_genesis_proto_rawDescData) + }) + return file_poktroll_supplier_genesis_proto_rawDescData +} + +var file_poktroll_supplier_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.supplier.GenesisState + (*Params)(nil), // 1: poktroll.supplier.Params + (*shared.Supplier)(nil), // 2: poktroll.shared.Supplier +} +var file_poktroll_supplier_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.supplier.GenesisState.params:type_name -> poktroll.supplier.Params + 2, // 1: poktroll.supplier.GenesisState.supplierList:type_name -> poktroll.shared.Supplier + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_genesis_proto_init() } +func file_poktroll_supplier_genesis_proto_init() { + if File_poktroll_supplier_genesis_proto != nil { + return + } + file_poktroll_supplier_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_supplier_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_genesis_proto_depIdxs, + MessageInfos: file_poktroll_supplier_genesis_proto_msgTypes, + }.Build() + File_poktroll_supplier_genesis_proto = out.File + file_poktroll_supplier_genesis_proto_rawDesc = nil + file_poktroll_supplier_genesis_proto_goTypes = nil + file_poktroll_supplier_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/module/module.pulsar.go b/api/poktroll/supplier/module/module.pulsar.go new file mode 100644 index 000000000..4da01a712 --- /dev/null +++ b/api/poktroll/supplier/module/module.pulsar.go @@ -0,0 +1,579 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_module_module_proto_init() + md_Module = File_poktroll_supplier_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.supplier.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.module.Module")) + } + panic(fmt.Errorf("message poktroll.supplier.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_supplier_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_module_module_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x5b, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x33, 0xba, 0xc0, 0x96, + 0xda, 0x01, 0x2d, 0x0a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x42, 0xd8, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x29, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x4d, 0xaa, 0x02, 0x18, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x18, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x24, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_module_module_proto_rawDescOnce sync.Once + file_poktroll_supplier_module_module_proto_rawDescData = file_poktroll_supplier_module_module_proto_rawDesc +) + +func file_poktroll_supplier_module_module_proto_rawDescGZIP() []byte { + file_poktroll_supplier_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_module_module_proto_rawDescData) + }) + return file_poktroll_supplier_module_module_proto_rawDescData +} + +var file_poktroll_supplier_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.supplier.module.Module +} +var file_poktroll_supplier_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_module_module_proto_init() } +func file_poktroll_supplier_module_module_proto_init() { + if File_poktroll_supplier_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_supplier_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_module_module_proto_depIdxs, + MessageInfos: file_poktroll_supplier_module_module_proto_msgTypes, + }.Build() + File_poktroll_supplier_module_module_proto = out.File + file_poktroll_supplier_module_module_proto_rawDesc = nil + file_poktroll_supplier_module_module_proto_goTypes = nil + file_poktroll_supplier_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/params.pulsar.go b/api/poktroll/supplier/params.pulsar.go new file mode 100644 index 000000000..7108db140 --- /dev/null +++ b/api/poktroll/supplier/params.pulsar.go @@ -0,0 +1,500 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_params_proto_init() + md_Params = File_poktroll_supplier_params_proto.Messages().ByName("Params") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) + } + panic(fmt.Errorf("message poktroll.supplier.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_params_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_supplier_params_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_params_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x23, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, + 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xad, 0x01, 0x0a, 0x15, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_params_proto_rawDescOnce sync.Once + file_poktroll_supplier_params_proto_rawDescData = file_poktroll_supplier_params_proto_rawDesc +) + +func file_poktroll_supplier_params_proto_rawDescGZIP() []byte { + file_poktroll_supplier_params_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_params_proto_rawDescData) + }) + return file_poktroll_supplier_params_proto_rawDescData +} + +var file_poktroll_supplier_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_supplier_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.supplier.Params +} +var file_poktroll_supplier_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_params_proto_init() } +func file_poktroll_supplier_params_proto_init() { + if File_poktroll_supplier_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_supplier_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_supplier_params_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_params_proto_depIdxs, + MessageInfos: file_poktroll_supplier_params_proto_msgTypes, + }.Build() + File_poktroll_supplier_params_proto = out.File + file_poktroll_supplier_params_proto_rawDesc = nil + file_poktroll_supplier_params_proto_goTypes = nil + file_poktroll_supplier_params_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/query.pulsar.go b/api/poktroll/supplier/query.pulsar.go new file mode 100644 index 000000000..827e8bc66 --- /dev/null +++ b/api/poktroll/supplier/query.pulsar.go @@ -0,0 +1,3141 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryParamsRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryParamsResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetSupplierRequest protoreflect.MessageDescriptor + fd_QueryGetSupplierRequest_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryGetSupplierRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryGetSupplierRequest") + fd_QueryGetSupplierRequest_address = md_QueryGetSupplierRequest.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetSupplierRequest)(nil) + +type fastReflection_QueryGetSupplierRequest QueryGetSupplierRequest + +func (x *QueryGetSupplierRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetSupplierRequest)(x) +} + +func (x *QueryGetSupplierRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetSupplierRequest_messageType fastReflection_QueryGetSupplierRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetSupplierRequest_messageType{} + +type fastReflection_QueryGetSupplierRequest_messageType struct{} + +func (x fastReflection_QueryGetSupplierRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetSupplierRequest)(nil) +} +func (x fastReflection_QueryGetSupplierRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierRequest) +} +func (x fastReflection_QueryGetSupplierRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetSupplierRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetSupplierRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetSupplierRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetSupplierRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetSupplierRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetSupplierRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetSupplierRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryGetSupplierRequest_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetSupplierRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetSupplierRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.address": + panic(fmt.Errorf("field address of message poktroll.supplier.QueryGetSupplierRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetSupplierRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierRequest.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetSupplierRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryGetSupplierRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetSupplierRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetSupplierRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetSupplierRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetSupplierRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSupplierRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSupplierRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSupplierRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSupplierRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryGetSupplierResponse protoreflect.MessageDescriptor + fd_QueryGetSupplierResponse_supplier protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryGetSupplierResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryGetSupplierResponse") + fd_QueryGetSupplierResponse_supplier = md_QueryGetSupplierResponse.Fields().ByName("supplier") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetSupplierResponse)(nil) + +type fastReflection_QueryGetSupplierResponse QueryGetSupplierResponse + +func (x *QueryGetSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetSupplierResponse)(x) +} + +func (x *QueryGetSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetSupplierResponse_messageType fastReflection_QueryGetSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetSupplierResponse_messageType{} + +type fastReflection_QueryGetSupplierResponse_messageType struct{} + +func (x fastReflection_QueryGetSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetSupplierResponse)(nil) +} +func (x fastReflection_QueryGetSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierResponse) +} +func (x fastReflection_QueryGetSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetSupplierResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetSupplierResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetSupplierResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetSupplierResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Supplier != nil { + value := protoreflect.ValueOfMessage(x.Supplier.ProtoReflect()) + if !f(fd_QueryGetSupplierResponse_supplier, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + return x.Supplier != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + x.Supplier = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + value := x.Supplier + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + x.Supplier = value.Message().Interface().(*shared.Supplier) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + if x.Supplier == nil { + x.Supplier = new(shared.Supplier) + } + return protoreflect.ValueOfMessage(x.Supplier.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryGetSupplierResponse.supplier": + m := new(shared.Supplier) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryGetSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryGetSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryGetSupplierResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetSupplierResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetSupplierResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetSupplierResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetSupplierResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Supplier != nil { + l = options.Size(x.Supplier) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSupplierResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Supplier != nil { + encoded, err := options.Marshal(x.Supplier) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetSupplierResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetSupplierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Supplier", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Supplier == nil { + x.Supplier = &shared.Supplier{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Supplier); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllSuppliersRequest protoreflect.MessageDescriptor + fd_QueryAllSuppliersRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryAllSuppliersRequest = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSuppliersRequest") + fd_QueryAllSuppliersRequest_pagination = md_QueryAllSuppliersRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllSuppliersRequest)(nil) + +type fastReflection_QueryAllSuppliersRequest QueryAllSuppliersRequest + +func (x *QueryAllSuppliersRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersRequest)(x) +} + +func (x *QueryAllSuppliersRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_query_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllSuppliersRequest_messageType fastReflection_QueryAllSuppliersRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllSuppliersRequest_messageType{} + +type fastReflection_QueryAllSuppliersRequest_messageType struct{} + +func (x fastReflection_QueryAllSuppliersRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersRequest)(nil) +} +func (x fastReflection_QueryAllSuppliersRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersRequest) +} +func (x fastReflection_QueryAllSuppliersRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllSuppliersRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllSuppliersRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllSuppliersRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllSuppliersRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllSuppliersRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllSuppliersRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllSuppliersRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllSuppliersRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllSuppliersRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllSuppliersRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllSuppliersRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersRequest")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllSuppliersRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSuppliersRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllSuppliersRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllSuppliersRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllSuppliersRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllSuppliersRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllSuppliersRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllSuppliersRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllSuppliersResponse_1_list)(nil) + +type _QueryAllSuppliersResponse_1_list struct { + list *[]*shared.Supplier +} + +func (x *_QueryAllSuppliersResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllSuppliersResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllSuppliersResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllSuppliersResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.Supplier) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllSuppliersResponse_1_list) AppendMutable() protoreflect.Value { + v := new(shared.Supplier) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllSuppliersResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllSuppliersResponse_1_list) NewElement() protoreflect.Value { + v := new(shared.Supplier) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllSuppliersResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllSuppliersResponse protoreflect.MessageDescriptor + fd_QueryAllSuppliersResponse_supplier protoreflect.FieldDescriptor + fd_QueryAllSuppliersResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_query_proto_init() + md_QueryAllSuppliersResponse = File_poktroll_supplier_query_proto.Messages().ByName("QueryAllSuppliersResponse") + fd_QueryAllSuppliersResponse_supplier = md_QueryAllSuppliersResponse.Fields().ByName("supplier") + fd_QueryAllSuppliersResponse_pagination = md_QueryAllSuppliersResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllSuppliersResponse)(nil) + +type fastReflection_QueryAllSuppliersResponse QueryAllSuppliersResponse + +func (x *QueryAllSuppliersResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersResponse)(x) +} + +func (x *QueryAllSuppliersResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_query_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryAllSuppliersResponse_messageType fastReflection_QueryAllSuppliersResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllSuppliersResponse_messageType{} + +type fastReflection_QueryAllSuppliersResponse_messageType struct{} + +func (x fastReflection_QueryAllSuppliersResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllSuppliersResponse)(nil) +} +func (x fastReflection_QueryAllSuppliersResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersResponse) +} +func (x fastReflection_QueryAllSuppliersResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllSuppliersResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllSuppliersResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryAllSuppliersResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllSuppliersResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllSuppliersResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllSuppliersResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllSuppliersResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllSuppliersResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryAllSuppliersResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Supplier) != 0 { + value := protoreflect.ValueOfList(&_QueryAllSuppliersResponse_1_list{list: &x.Supplier}) + if !f(fd_QueryAllSuppliersResponse_supplier, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllSuppliersResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryAllSuppliersResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": + return len(x.Supplier) != 0 + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": + x.Supplier = nil + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryAllSuppliersResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": + if len(x.Supplier) == 0 { + return protoreflect.ValueOfList(&_QueryAllSuppliersResponse_1_list{}) + } + listValue := &_QueryAllSuppliersResponse_1_list{list: &x.Supplier} + return protoreflect.ValueOfList(listValue) + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": + lv := value.List() + clv := lv.(*_QueryAllSuppliersResponse_1_list) + x.Supplier = *clv.list + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": + if x.Supplier == nil { + x.Supplier = []*shared.Supplier{} + } + value := &_QueryAllSuppliersResponse_1_list{list: &x.Supplier} + return protoreflect.ValueOfList(value) + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryAllSuppliersResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.QueryAllSuppliersResponse.supplier": + list := []*shared.Supplier{} + return protoreflect.ValueOfList(&_QueryAllSuppliersResponse_1_list{list: &list}) + case "poktroll.supplier.QueryAllSuppliersResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.QueryAllSuppliersResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.QueryAllSuppliersResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryAllSuppliersResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.QueryAllSuppliersResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryAllSuppliersResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryAllSuppliersResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryAllSuppliersResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryAllSuppliersResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllSuppliersResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Supplier) > 0 { + for _, e := range x.Supplier { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryAllSuppliersResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Supplier) > 0 { + for iNdEx := len(x.Supplier) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Supplier[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllSuppliersResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllSuppliersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Supplier", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Supplier = append(x.Supplier, &shared.Supplier{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Supplier[len(x.Supplier)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +type QueryGetSupplierRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *QueryGetSupplierRequest) Reset() { + *x = QueryGetSupplierRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetSupplierRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetSupplierRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetSupplierRequest.ProtoReflect.Descriptor instead. +func (*QueryGetSupplierRequest) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetSupplierRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type QueryGetSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Supplier *shared.Supplier `protobuf:"bytes,1,opt,name=supplier,proto3" json:"supplier,omitempty"` +} + +func (x *QueryGetSupplierResponse) Reset() { + *x = QueryGetSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetSupplierResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetSupplierResponse.ProtoReflect.Descriptor instead. +func (*QueryGetSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetSupplierResponse) GetSupplier() *shared.Supplier { + if x != nil { + return x.Supplier + } + return nil +} + +type QueryAllSuppliersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllSuppliersRequest) Reset() { + *x = QueryAllSuppliersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllSuppliersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllSuppliersRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllSuppliersRequest.ProtoReflect.Descriptor instead. +func (*QueryAllSuppliersRequest) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllSuppliersRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllSuppliersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Supplier []*shared.Supplier `protobuf:"bytes,1,rep,name=supplier,proto3" json:"supplier,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllSuppliersResponse) Reset() { + *x = QueryAllSuppliersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllSuppliersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllSuppliersResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllSuppliersResponse.ProtoReflect.Descriptor instead. +func (*QueryAllSuppliersResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllSuppliersResponse) GetSupplier() []*shared.Supplier { + if x != nil { + return x.Supplier + } + return nil +} + +func (x *QueryAllSuppliersResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_poktroll_supplier_query_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_query_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, + 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x53, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x4d, 0x0a, 0x17, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x57, 0x0a, 0x18, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x22, 0x62, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa1, 0x01, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, + 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xd1, 0x03, 0x0a, 0x05, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x87, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x9f, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x12, 0x32, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x7d, 0x12, 0x9b, 0x01, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x73, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, + 0xac, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_query_proto_rawDescOnce sync.Once + file_poktroll_supplier_query_proto_rawDescData = file_poktroll_supplier_query_proto_rawDesc +) + +func file_poktroll_supplier_query_proto_rawDescGZIP() []byte { + file_poktroll_supplier_query_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_query_proto_rawDescData) + }) + return file_poktroll_supplier_query_proto_rawDescData +} + +var file_poktroll_supplier_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_supplier_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.supplier.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.supplier.QueryParamsResponse + (*QueryGetSupplierRequest)(nil), // 2: poktroll.supplier.QueryGetSupplierRequest + (*QueryGetSupplierResponse)(nil), // 3: poktroll.supplier.QueryGetSupplierResponse + (*QueryAllSuppliersRequest)(nil), // 4: poktroll.supplier.QueryAllSuppliersRequest + (*QueryAllSuppliersResponse)(nil), // 5: poktroll.supplier.QueryAllSuppliersResponse + (*Params)(nil), // 6: poktroll.supplier.Params + (*shared.Supplier)(nil), // 7: poktroll.shared.Supplier + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse +} +var file_poktroll_supplier_query_proto_depIdxs = []int32{ + 6, // 0: poktroll.supplier.QueryParamsResponse.params:type_name -> poktroll.supplier.Params + 7, // 1: poktroll.supplier.QueryGetSupplierResponse.supplier:type_name -> poktroll.shared.Supplier + 8, // 2: poktroll.supplier.QueryAllSuppliersRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.supplier.QueryAllSuppliersResponse.supplier:type_name -> poktroll.shared.Supplier + 9, // 4: poktroll.supplier.QueryAllSuppliersResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.supplier.Query.Params:input_type -> poktroll.supplier.QueryParamsRequest + 2, // 6: poktroll.supplier.Query.Supplier:input_type -> poktroll.supplier.QueryGetSupplierRequest + 4, // 7: poktroll.supplier.Query.AllSuppliers:input_type -> poktroll.supplier.QueryAllSuppliersRequest + 1, // 8: poktroll.supplier.Query.Params:output_type -> poktroll.supplier.QueryParamsResponse + 3, // 9: poktroll.supplier.Query.Supplier:output_type -> poktroll.supplier.QueryGetSupplierResponse + 5, // 10: poktroll.supplier.Query.AllSuppliers:output_type -> poktroll.supplier.QueryAllSuppliersResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_query_proto_init() } +func file_poktroll_supplier_query_proto_init() { + if File_poktroll_supplier_query_proto != nil { + return + } + file_poktroll_supplier_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetSupplierRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetSupplierResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllSuppliersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllSuppliersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_supplier_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_supplier_query_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_query_proto_depIdxs, + MessageInfos: file_poktroll_supplier_query_proto_msgTypes, + }.Build() + File_poktroll_supplier_query_proto = out.File + file_poktroll_supplier_query_proto_rawDesc = nil + file_poktroll_supplier_query_proto_goTypes = nil + file_poktroll_supplier_query_proto_depIdxs = nil +} diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go new file mode 100644 index 000000000..362a13a3b --- /dev/null +++ b/api/poktroll/supplier/tx.pulsar.go @@ -0,0 +1,3096 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package supplier + +import ( + _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUpdateParams = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.supplier.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.supplier.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.supplier.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.supplier.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_MsgStakeSupplier_3_list)(nil) + +type _MsgStakeSupplier_3_list struct { + list *[]*shared.SupplierServiceConfig +} + +func (x *_MsgStakeSupplier_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgStakeSupplier_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgStakeSupplier_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.SupplierServiceConfig) + (*x.list)[i] = concreteValue +} + +func (x *_MsgStakeSupplier_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*shared.SupplierServiceConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgStakeSupplier_3_list) AppendMutable() protoreflect.Value { + v := new(shared.SupplierServiceConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgStakeSupplier_3_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgStakeSupplier_3_list) NewElement() protoreflect.Value { + v := new(shared.SupplierServiceConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgStakeSupplier_3_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgStakeSupplier protoreflect.MessageDescriptor + fd_MsgStakeSupplier_address protoreflect.FieldDescriptor + fd_MsgStakeSupplier_stake protoreflect.FieldDescriptor + fd_MsgStakeSupplier_services protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgStakeSupplier = File_poktroll_supplier_tx_proto.Messages().ByName("MsgStakeSupplier") + fd_MsgStakeSupplier_address = md_MsgStakeSupplier.Fields().ByName("address") + fd_MsgStakeSupplier_stake = md_MsgStakeSupplier.Fields().ByName("stake") + fd_MsgStakeSupplier_services = md_MsgStakeSupplier.Fields().ByName("services") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeSupplier)(nil) + +type fastReflection_MsgStakeSupplier MsgStakeSupplier + +func (x *MsgStakeSupplier) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeSupplier)(x) +} + +func (x *MsgStakeSupplier) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeSupplier_messageType fastReflection_MsgStakeSupplier_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeSupplier_messageType{} + +type fastReflection_MsgStakeSupplier_messageType struct{} + +func (x fastReflection_MsgStakeSupplier_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeSupplier)(nil) +} +func (x fastReflection_MsgStakeSupplier_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplier) +} +func (x fastReflection_MsgStakeSupplier_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplier +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeSupplier) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplier +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgStakeSupplier) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeSupplier_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeSupplier) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplier) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeSupplier) Interface() protoreflect.ProtoMessage { + return (*MsgStakeSupplier)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgStakeSupplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgStakeSupplier_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_MsgStakeSupplier_stake, value) { + return + } + } + if len(x.Services) != 0 { + value := protoreflect.ValueOfList(&_MsgStakeSupplier_3_list{list: &x.Services}) + if !f(fd_MsgStakeSupplier_services, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeSupplier) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + return x.Address != "" + case "poktroll.supplier.MsgStakeSupplier.stake": + return x.Stake != nil + case "poktroll.supplier.MsgStakeSupplier.services": + return len(x.Services) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplier) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + x.Address = "" + case "poktroll.supplier.MsgStakeSupplier.stake": + x.Stake = nil + case "poktroll.supplier.MsgStakeSupplier.services": + x.Services = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgStakeSupplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgStakeSupplier.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.services": + if len(x.Services) == 0 { + return protoreflect.ValueOfList(&_MsgStakeSupplier_3_list{}) + } + listValue := &_MsgStakeSupplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + x.Address = value.Interface().(string) + case "poktroll.supplier.MsgStakeSupplier.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + case "poktroll.supplier.MsgStakeSupplier.services": + lv := value.List() + clv := lv.(*_MsgStakeSupplier_3_list) + x.Services = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.services": + if x.Services == nil { + x.Services = []*shared.SupplierServiceConfig{} + } + value := &_MsgStakeSupplier_3_list{list: &x.Services} + return protoreflect.ValueOfList(value) + case "poktroll.supplier.MsgStakeSupplier.address": + panic(fmt.Errorf("field address of message poktroll.supplier.MsgStakeSupplier is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgStakeSupplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgStakeSupplier.address": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgStakeSupplier.stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.supplier.MsgStakeSupplier.services": + list := []*shared.SupplierServiceConfig{} + return protoreflect.ValueOfList(&_MsgStakeSupplier_3_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplier does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgStakeSupplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgStakeSupplier", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgStakeSupplier) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplier) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgStakeSupplier) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgStakeSupplier) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeSupplier) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Services) > 0 { + for _, e := range x.Services { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeSupplier) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Services) > 0 { + for iNdEx := len(x.Services) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Services[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeSupplier) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeSupplier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeSupplier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Services = append(x.Services, &shared.SupplierServiceConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Services[len(x.Services)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgStakeSupplierResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgStakeSupplierResponse = File_poktroll_supplier_tx_proto.Messages().ByName("MsgStakeSupplierResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeSupplierResponse)(nil) + +type fastReflection_MsgStakeSupplierResponse MsgStakeSupplierResponse + +func (x *MsgStakeSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeSupplierResponse)(x) +} + +func (x *MsgStakeSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeSupplierResponse_messageType fastReflection_MsgStakeSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeSupplierResponse_messageType{} + +type fastReflection_MsgStakeSupplierResponse_messageType struct{} + +func (x fastReflection_MsgStakeSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeSupplierResponse)(nil) +} +func (x fastReflection_MsgStakeSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplierResponse) +} +func (x fastReflection_MsgStakeSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeSupplierResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgStakeSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeSupplierResponse) New() protoreflect.Message { + return new(fastReflection_MsgStakeSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*MsgStakeSupplierResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgStakeSupplierResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgStakeSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgStakeSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgStakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgStakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgStakeSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgStakeSupplierResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgStakeSupplierResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgStakeSupplierResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgStakeSupplierResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgStakeSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeSupplierResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeSupplierResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeSupplierResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeSupplierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUnstakeSupplier protoreflect.MessageDescriptor + fd_MsgUnstakeSupplier_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUnstakeSupplier = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUnstakeSupplier") + fd_MsgUnstakeSupplier_address = md_MsgUnstakeSupplier.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeSupplier)(nil) + +type fastReflection_MsgUnstakeSupplier MsgUnstakeSupplier + +func (x *MsgUnstakeSupplier) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplier)(x) +} + +func (x *MsgUnstakeSupplier) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUnstakeSupplier_messageType fastReflection_MsgUnstakeSupplier_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeSupplier_messageType{} + +type fastReflection_MsgUnstakeSupplier_messageType struct{} + +func (x fastReflection_MsgUnstakeSupplier_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplier)(nil) +} +func (x fastReflection_MsgUnstakeSupplier_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplier) +} +func (x fastReflection_MsgUnstakeSupplier_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplier +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeSupplier) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplier +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUnstakeSupplier) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeSupplier_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeSupplier) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplier) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeSupplier) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeSupplier)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUnstakeSupplier) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgUnstakeSupplier_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeSupplier) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplier) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUnstakeSupplier) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplier) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplier) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + panic(fmt.Errorf("field address of message poktroll.supplier.MsgUnstakeSupplier is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUnstakeSupplier) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.supplier.MsgUnstakeSupplier.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplier")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplier does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUnstakeSupplier) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUnstakeSupplier", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUnstakeSupplier) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplier) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUnstakeSupplier) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUnstakeSupplier) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeSupplier) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeSupplier) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeSupplier) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeSupplier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeSupplier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUnstakeSupplierResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUnstakeSupplierResponse = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUnstakeSupplierResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeSupplierResponse)(nil) + +type fastReflection_MsgUnstakeSupplierResponse MsgUnstakeSupplierResponse + +func (x *MsgUnstakeSupplierResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplierResponse)(x) +} + +func (x *MsgUnstakeSupplierResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUnstakeSupplierResponse_messageType fastReflection_MsgUnstakeSupplierResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeSupplierResponse_messageType{} + +type fastReflection_MsgUnstakeSupplierResponse_messageType struct{} + +func (x fastReflection_MsgUnstakeSupplierResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeSupplierResponse)(nil) +} +func (x fastReflection_MsgUnstakeSupplierResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplierResponse) +} +func (x fastReflection_MsgUnstakeSupplierResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplierResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeSupplierResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeSupplierResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUnstakeSupplierResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeSupplierResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeSupplierResponse) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeSupplierResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeSupplierResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeSupplierResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUnstakeSupplierResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeSupplierResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplierResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUnstakeSupplierResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplierResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplierResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUnstakeSupplierResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUnstakeSupplierResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUnstakeSupplierResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUnstakeSupplierResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUnstakeSupplierResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUnstakeSupplierResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUnstakeSupplierResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUnstakeSupplierResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUnstakeSupplierResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeSupplierResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeSupplierResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeSupplierResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeSupplierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeSupplierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{1} +} + +type MsgStakeSupplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + Services []*shared.SupplierServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The list of services this supplier is staked to provide service for +} + +func (x *MsgStakeSupplier) Reset() { + *x = MsgStakeSupplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeSupplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeSupplier) ProtoMessage() {} + +// Deprecated: Use MsgStakeSupplier.ProtoReflect.Descriptor instead. +func (*MsgStakeSupplier) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeSupplier) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgStakeSupplier) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *MsgStakeSupplier) GetServices() []*shared.SupplierServiceConfig { + if x != nil { + return x.Services + } + return nil +} + +type MsgStakeSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeSupplierResponse) Reset() { + *x = MsgStakeSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeSupplierResponse) ProtoMessage() {} + +// Deprecated: Use MsgStakeSupplierResponse.ProtoReflect.Descriptor instead. +func (*MsgStakeSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{3} +} + +type MsgUnstakeSupplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding +} + +func (x *MsgUnstakeSupplier) Reset() { + *x = MsgUnstakeSupplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeSupplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeSupplier) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeSupplier.ProtoReflect.Descriptor instead. +func (*MsgUnstakeSupplier) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgUnstakeSupplier) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type MsgUnstakeSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUnstakeSupplierResponse) Reset() { + *x = MsgUnstakeSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeSupplierResponse) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeSupplierResponse.ProtoReflect.Descriptor instead. +func (*MsgUnstakeSupplierResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{5} +} + +var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor + +var file_poktroll_supplier_tx_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, + 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, + 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, 0x0f, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, + 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc9, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, + 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x32, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x56, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, + 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, + 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, + 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, + 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, + 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_supplier_tx_proto_rawDescOnce sync.Once + file_poktroll_supplier_tx_proto_rawDescData = file_poktroll_supplier_tx_proto_rawDesc +) + +func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { + file_poktroll_supplier_tx_proto_rawDescOnce.Do(func() { + file_poktroll_supplier_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_supplier_tx_proto_rawDescData) + }) + return file_poktroll_supplier_tx_proto_rawDescData +} + +var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse + (*MsgStakeSupplier)(nil), // 2: poktroll.supplier.MsgStakeSupplier + (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse + (*MsgUnstakeSupplier)(nil), // 4: poktroll.supplier.MsgUnstakeSupplier + (*MsgUnstakeSupplierResponse)(nil), // 5: poktroll.supplier.MsgUnstakeSupplierResponse + (*Params)(nil), // 6: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*shared.SupplierServiceConfig)(nil), // 8: poktroll.shared.SupplierServiceConfig +} +var file_poktroll_supplier_tx_proto_depIdxs = []int32{ + 6, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params + 7, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin + 8, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier + 4, // 5: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier + 1, // 6: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 7: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 5, // 8: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_poktroll_supplier_tx_proto_init() } +func file_poktroll_supplier_tx_proto_init() { + if File_poktroll_supplier_tx_proto != nil { + return + } + file_poktroll_supplier_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_supplier_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeSupplier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeSupplierResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeSupplier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_supplier_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeSupplierResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_supplier_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_supplier_tx_proto_goTypes, + DependencyIndexes: file_poktroll_supplier_tx_proto_depIdxs, + MessageInfos: file_poktroll_supplier_tx_proto_msgTypes, + }.Build() + File_poktroll_supplier_tx_proto = out.File + file_poktroll_supplier_tx_proto_rawDesc = nil + file_poktroll_supplier_tx_proto_goTypes = nil + file_poktroll_supplier_tx_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/genesis.pulsar.go b/api/poktroll/tokenomics/genesis.pulsar.go new file mode 100644 index 000000000..be0862e09 --- /dev/null +++ b/api/poktroll/tokenomics/genesis.pulsar.go @@ -0,0 +1,597 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package tokenomics + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_genesis_proto_init() + md_GenesisState = File_poktroll_tokenomics_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.GenesisState.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) + } + panic(fmt.Errorf("message poktroll.tokenomics.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.GenesisState.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) + } + panic(fmt.Errorf("message poktroll.tokenomics.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) + } + panic(fmt.Errorf("message poktroll.tokenomics.GenesisState does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) + } + panic(fmt.Errorf("message poktroll.tokenomics.GenesisState does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) + } + panic(fmt.Errorf("message poktroll.tokenomics.GenesisState does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.GenesisState")) + } + panic(fmt.Errorf("message poktroll.tokenomics.GenesisState does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.GenesisState", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_GenesisState) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/tokenomics/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the tokenomics module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_tokenomics_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_tokenomics_genesis_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, + 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, + 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x4e, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0xba, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, + 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_tokenomics_genesis_proto_rawDescOnce sync.Once + file_poktroll_tokenomics_genesis_proto_rawDescData = file_poktroll_tokenomics_genesis_proto_rawDesc +) + +func file_poktroll_tokenomics_genesis_proto_rawDescGZIP() []byte { + file_poktroll_tokenomics_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_tokenomics_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_tokenomics_genesis_proto_rawDescData) + }) + return file_poktroll_tokenomics_genesis_proto_rawDescData +} + +var file_poktroll_tokenomics_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_tokenomics_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.tokenomics.GenesisState + (*Params)(nil), // 1: poktroll.tokenomics.Params +} +var file_poktroll_tokenomics_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.tokenomics.GenesisState.params:type_name -> poktroll.tokenomics.Params + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_tokenomics_genesis_proto_init() } +func file_poktroll_tokenomics_genesis_proto_init() { + if File_poktroll_tokenomics_genesis_proto != nil { + return + } + file_poktroll_tokenomics_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_tokenomics_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_tokenomics_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_tokenomics_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_tokenomics_genesis_proto_depIdxs, + MessageInfos: file_poktroll_tokenomics_genesis_proto_msgTypes, + }.Build() + File_poktroll_tokenomics_genesis_proto = out.File + file_poktroll_tokenomics_genesis_proto_rawDesc = nil + file_poktroll_tokenomics_genesis_proto_goTypes = nil + file_poktroll_tokenomics_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/module/module.pulsar.go b/api/poktroll/tokenomics/module/module.pulsar.go new file mode 100644 index 000000000..cbfd9f6fd --- /dev/null +++ b/api/poktroll/tokenomics/module/module.pulsar.go @@ -0,0 +1,580 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_module_module_proto_init() + md_Module = File_poktroll_tokenomics_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.module.Module")) + } + panic(fmt.Errorf("message poktroll.tokenomics.module.Module does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.module.Module")) + } + panic(fmt.Errorf("message poktroll.tokenomics.module.Module does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.module.Module")) + } + panic(fmt.Errorf("message poktroll.tokenomics.module.Module does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.module.Module")) + } + panic(fmt.Errorf("message poktroll.tokenomics.module.Module does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.tokenomics.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.module.Module")) + } + panic(fmt.Errorf("message poktroll.tokenomics.module.Module does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.module.Module")) + } + panic(fmt.Errorf("message poktroll.tokenomics.module.Module does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.module.Module", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Module) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Module) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/tokenomics/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_tokenomics_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_tokenomics_module_module_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, + 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5d, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, + 0x35, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x2f, 0x0a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0xe4, 0x01, 0x0a, 0x1e, 0x63, 0x6f, 0x6d, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x4d, 0xaa, 0x02, 0x1a, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x26, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_tokenomics_module_module_proto_rawDescOnce sync.Once + file_poktroll_tokenomics_module_module_proto_rawDescData = file_poktroll_tokenomics_module_module_proto_rawDesc +) + +func file_poktroll_tokenomics_module_module_proto_rawDescGZIP() []byte { + file_poktroll_tokenomics_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_tokenomics_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_tokenomics_module_module_proto_rawDescData) + }) + return file_poktroll_tokenomics_module_module_proto_rawDescData +} + +var file_poktroll_tokenomics_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_tokenomics_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.tokenomics.module.Module +} +var file_poktroll_tokenomics_module_module_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_tokenomics_module_module_proto_init() } +func file_poktroll_tokenomics_module_module_proto_init() { + if File_poktroll_tokenomics_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_tokenomics_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_tokenomics_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_tokenomics_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_tokenomics_module_module_proto_depIdxs, + MessageInfos: file_poktroll_tokenomics_module_module_proto_msgTypes, + }.Build() + File_poktroll_tokenomics_module_module_proto = out.File + file_poktroll_tokenomics_module_module_proto_rawDesc = nil + file_poktroll_tokenomics_module_module_proto_goTypes = nil + file_poktroll_tokenomics_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/params.pulsar.go b/api/poktroll/tokenomics/params.pulsar.go new file mode 100644 index 000000000..2d6e71ad8 --- /dev/null +++ b/api/poktroll/tokenomics/params.pulsar.go @@ -0,0 +1,569 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package tokenomics + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor + fd_Params_compute_units_to_tokens_multiplier protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_params_proto_init() + md_Params = File_poktroll_tokenomics_params_proto.Messages().ByName("Params") + fd_Params_compute_units_to_tokens_multiplier = md_Params.Fields().ByName("compute_units_to_tokens_multiplier") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ComputeUnitsToTokensMultiplier != uint64(0) { + value := protoreflect.ValueOfUint64(x.ComputeUnitsToTokensMultiplier) + if !f(fd_Params_compute_units_to_tokens_multiplier, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.Params.compute_units_to_tokens_multiplier": + return x.ComputeUnitsToTokensMultiplier != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.Params")) + } + panic(fmt.Errorf("message poktroll.tokenomics.Params does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.Params.compute_units_to_tokens_multiplier": + x.ComputeUnitsToTokensMultiplier = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.Params")) + } + panic(fmt.Errorf("message poktroll.tokenomics.Params does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.Params.compute_units_to_tokens_multiplier": + value := x.ComputeUnitsToTokensMultiplier + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.Params")) + } + panic(fmt.Errorf("message poktroll.tokenomics.Params does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.Params.compute_units_to_tokens_multiplier": + x.ComputeUnitsToTokensMultiplier = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.Params")) + } + panic(fmt.Errorf("message poktroll.tokenomics.Params does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.Params.compute_units_to_tokens_multiplier": + panic(fmt.Errorf("field compute_units_to_tokens_multiplier of message poktroll.tokenomics.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.Params")) + } + panic(fmt.Errorf("message poktroll.tokenomics.Params does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.Params.compute_units_to_tokens_multiplier": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.Params")) + } + panic(fmt.Errorf("message poktroll.tokenomics.Params does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.Params", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Params) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.ComputeUnitsToTokensMultiplier != 0 { + n += 1 + runtime.Sov(uint64(x.ComputeUnitsToTokensMultiplier)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.ComputeUnitsToTokensMultiplier != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ComputeUnitsToTokensMultiplier)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ComputeUnitsToTokensMultiplier", wireType) + } + x.ComputeUnitsToTokensMultiplier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.ComputeUnitsToTokensMultiplier |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/tokenomics/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. +// Params defines the parameters for the tokenomics module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The amount of upokt that a compute unit should translate to when settling a session. + // TODO_DOCUMENT(@Olshansk): Make sure to document the units of this parameter (or the map) once finalized. + ComputeUnitsToTokensMultiplier uint64 `protobuf:"varint,1,opt,name=compute_units_to_tokens_multiplier,json=computeUnitsToTokensMultiplier,proto3" json:"compute_units_to_tokens_multiplier,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_params_proto_rawDescGZIP(), []int{0} +} + +func (x *Params) GetComputeUnitsToTokensMultiplier() uint64 { + if x != nil { + return x.ComputeUnitsToTokensMultiplier + } + return 0 +} + +var File_poktroll_tokenomics_params_proto protoreflect.FileDescriptor + +var file_poktroll_tokenomics_params_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x13, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xaa, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x79, 0x0a, 0x22, 0x63, + 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x5f, 0x74, 0x6f, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x2d, 0xf2, 0xde, 0x1f, 0x29, 0x79, 0x61, 0x6d, + 0x6c, 0x3a, 0x22, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x73, + 0x5f, 0x74, 0x6f, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x22, 0x52, 0x1e, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x55, + 0x6e, 0x69, 0x74, 0x73, 0x54, 0x6f, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x3a, 0x25, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, + 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb9, 0x01, + 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, + 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_poktroll_tokenomics_params_proto_rawDescOnce sync.Once + file_poktroll_tokenomics_params_proto_rawDescData = file_poktroll_tokenomics_params_proto_rawDesc +) + +func file_poktroll_tokenomics_params_proto_rawDescGZIP() []byte { + file_poktroll_tokenomics_params_proto_rawDescOnce.Do(func() { + file_poktroll_tokenomics_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_tokenomics_params_proto_rawDescData) + }) + return file_poktroll_tokenomics_params_proto_rawDescData +} + +var file_poktroll_tokenomics_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_tokenomics_params_proto_goTypes = []interface{}{ + (*Params)(nil), // 0: poktroll.tokenomics.Params +} +var file_poktroll_tokenomics_params_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_poktroll_tokenomics_params_proto_init() } +func file_poktroll_tokenomics_params_proto_init() { + if File_poktroll_tokenomics_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_tokenomics_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_tokenomics_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_tokenomics_params_proto_goTypes, + DependencyIndexes: file_poktroll_tokenomics_params_proto_depIdxs, + MessageInfos: file_poktroll_tokenomics_params_proto_msgTypes, + }.Build() + File_poktroll_tokenomics_params_proto = out.File + file_poktroll_tokenomics_params_proto_rawDesc = nil + file_poktroll_tokenomics_params_proto_goTypes = nil + file_poktroll_tokenomics_params_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/query.pulsar.go b/api/poktroll/tokenomics/query.pulsar.go new file mode 100644 index 000000000..cdb9d88ac --- /dev/null +++ b/api/poktroll/tokenomics/query.pulsar.go @@ -0,0 +1,1013 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package tokenomics + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_tokenomics_query_proto_init() + md_QueryParamsRequest = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryParamsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_query_proto_init() + md_QueryParamsResponse = File_poktroll_tokenomics_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.QueryParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.QueryParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/tokenomics/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_tokenomics_query_proto protoreflect.FileDescriptor + +var file_poktroll_tokenomics_query_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x13, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x97, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, + 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_tokenomics_query_proto_rawDescOnce sync.Once + file_poktroll_tokenomics_query_proto_rawDescData = file_poktroll_tokenomics_query_proto_rawDesc +) + +func file_poktroll_tokenomics_query_proto_rawDescGZIP() []byte { + file_poktroll_tokenomics_query_proto_rawDescOnce.Do(func() { + file_poktroll_tokenomics_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_tokenomics_query_proto_rawDescData) + }) + return file_poktroll_tokenomics_query_proto_rawDescData +} + +var file_poktroll_tokenomics_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_tokenomics_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.tokenomics.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.tokenomics.QueryParamsResponse + (*Params)(nil), // 2: poktroll.tokenomics.Params +} +var file_poktroll_tokenomics_query_proto_depIdxs = []int32{ + 2, // 0: poktroll.tokenomics.QueryParamsResponse.params:type_name -> poktroll.tokenomics.Params + 0, // 1: poktroll.tokenomics.Query.Params:input_type -> poktroll.tokenomics.QueryParamsRequest + 1, // 2: poktroll.tokenomics.Query.Params:output_type -> poktroll.tokenomics.QueryParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_tokenomics_query_proto_init() } +func file_poktroll_tokenomics_query_proto_init() { + if File_poktroll_tokenomics_query_proto != nil { + return + } + file_poktroll_tokenomics_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_tokenomics_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_tokenomics_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_tokenomics_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_tokenomics_query_proto_goTypes, + DependencyIndexes: file_poktroll_tokenomics_query_proto_depIdxs, + MessageInfos: file_poktroll_tokenomics_query_proto_msgTypes, + }.Build() + File_poktroll_tokenomics_query_proto = out.File + file_poktroll_tokenomics_query_proto_rawDesc = nil + file_poktroll_tokenomics_query_proto_goTypes = nil + file_poktroll_tokenomics_query_proto_depIdxs = nil +} diff --git a/api/poktroll/tokenomics/tx.pulsar.go b/api/poktroll/tokenomics/tx.pulsar.go new file mode 100644 index 000000000..4b40d6a09 --- /dev/null +++ b/api/poktroll/tokenomics/tx.pulsar.go @@ -0,0 +1,1090 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package tokenomics + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_tokenomics_tx_proto_init() + md_MsgUpdateParams = File_poktroll_tokenomics_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_params, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.tokenomics.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.tokenomics.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.tokenomics.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.tokenomics.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.tokenomics.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.tokenomics.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParams does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.tokenomics.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.tokenomics.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.tokenomics.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.tokenomics.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.tokenomics.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.tokenomics.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParams does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.MsgUpdateParams", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParams) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_tokenomics_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_tokenomics_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_tokenomics_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.tokenomics.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.tokenomics.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.tokenomics.MsgUpdateParamsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/tokenomics/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/tokenomics parameters to update. + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_tokenomics_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_tokenomics_tx_proto_rawDescGZIP(), []int{1} +} + +var File_poktroll_tokenomics_tx_proto protoreflect.FileDescriptor + +var file_poktroll_tokenomics_tx_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, + 0x69, 0x63, 0x73, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, + 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3e, + 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, + 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x38, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, + 0xb0, 0x2a, 0x25, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0x70, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x62, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, + 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xb5, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, + 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, + 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_tokenomics_tx_proto_rawDescOnce sync.Once + file_poktroll_tokenomics_tx_proto_rawDescData = file_poktroll_tokenomics_tx_proto_rawDesc +) + +func file_poktroll_tokenomics_tx_proto_rawDescGZIP() []byte { + file_poktroll_tokenomics_tx_proto_rawDescOnce.Do(func() { + file_poktroll_tokenomics_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_tokenomics_tx_proto_rawDescData) + }) + return file_poktroll_tokenomics_tx_proto_rawDescData +} + +var file_poktroll_tokenomics_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_tokenomics_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.tokenomics.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.tokenomics.MsgUpdateParamsResponse + (*Params)(nil), // 2: poktroll.tokenomics.Params +} +var file_poktroll_tokenomics_tx_proto_depIdxs = []int32{ + 2, // 0: poktroll.tokenomics.MsgUpdateParams.params:type_name -> poktroll.tokenomics.Params + 0, // 1: poktroll.tokenomics.Msg.UpdateParams:input_type -> poktroll.tokenomics.MsgUpdateParams + 1, // 2: poktroll.tokenomics.Msg.UpdateParams:output_type -> poktroll.tokenomics.MsgUpdateParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_tokenomics_tx_proto_init() } +func file_poktroll_tokenomics_tx_proto_init() { + if File_poktroll_tokenomics_tx_proto != nil { + return + } + file_poktroll_tokenomics_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_tokenomics_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_tokenomics_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_tokenomics_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_tokenomics_tx_proto_goTypes, + DependencyIndexes: file_poktroll_tokenomics_tx_proto_depIdxs, + MessageInfos: file_poktroll_tokenomics_tx_proto_msgTypes, + }.Build() + File_poktroll_tokenomics_tx_proto = out.File + file_poktroll_tokenomics_tx_proto_rawDesc = nil + file_poktroll_tokenomics_tx_proto_goTypes = nil + file_poktroll_tokenomics_tx_proto_depIdxs = nil +} diff --git a/app/app.go b/app/app.go index 8f157015a..66fe5ec05 100644 --- a/app/app.go +++ b/app/app.go @@ -53,6 +53,14 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + applicationmodulekeeper "github.com/pokt-network/poktroll/x/application/keeper" + gatewaymodulekeeper "github.com/pokt-network/poktroll/x/gateway/keeper" + proofmodulekeeper "github.com/pokt-network/poktroll/x/proof/keeper" + servicemodulekeeper "github.com/pokt-network/poktroll/x/service/keeper" + sessionmodulekeeper "github.com/pokt-network/poktroll/x/session/keeper" + suppliermodulekeeper "github.com/pokt-network/poktroll/x/supplier/keeper" + tokenomicsmodulekeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper" + // this line is used by starport scaffolding # stargate/app/moduleImport "github.com/pokt-network/poktroll/docs" @@ -60,7 +68,7 @@ import ( const ( AccountAddressPrefix = "pokt" - Name = "pocket" + Name = "poktroll" // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase DenomuPOKT = "upokt" ) @@ -117,6 +125,13 @@ type App struct { ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + ServiceKeeper servicemodulekeeper.Keeper + GatewayKeeper gatewaymodulekeeper.Keeper + ApplicationKeeper applicationmodulekeeper.Keeper + SupplierKeeper suppliermodulekeeper.Keeper + SessionKeeper sessionmodulekeeper.Keeper + ProofKeeper proofmodulekeeper.Keeper + TokenomicsKeeper tokenomicsmodulekeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration // simulation manager @@ -176,6 +191,7 @@ func New( appBuilder *runtime.AppBuilder // merge the AppConfig and other configuration in one config + // TODO_BLOCKER(@Olshansk): Revisit the advanced configuration and understand if/where it fits in Shannon appConfig = depinject.Configs( AppConfig(), depinject.Supply( @@ -254,6 +270,13 @@ func New( &app.GroupKeeper, &app.ConsensusParamsKeeper, &app.CircuitBreakerKeeper, + &app.ServiceKeeper, + &app.GatewayKeeper, + &app.ApplicationKeeper, + &app.SupplierKeeper, + &app.SessionKeeper, + &app.ProofKeeper, + &app.TokenomicsKeeper, // this line is used by starport scaffolding # stargate/app/keeperDefinition ); err != nil { panic(err) diff --git a/app/app_config.go b/app/app_config.go index 29f20c962..fb5e1e833 100644 --- a/app/app_config.go +++ b/app/app_config.go @@ -69,6 +69,27 @@ import ( ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + applicationmodulev1 "github.com/pokt-network/poktroll/api/poktroll/application/module" + gatewaymodulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway/module" + proofmodulev1 "github.com/pokt-network/poktroll/api/poktroll/proof/module" + servicemodulev1 "github.com/pokt-network/poktroll/api/poktroll/service/module" + sessionmodulev1 "github.com/pokt-network/poktroll/api/poktroll/session/module" + suppliermodulev1 "github.com/pokt-network/poktroll/api/poktroll/supplier/module" + tokenomicsmodulev1 "github.com/pokt-network/poktroll/api/poktroll/tokenomics/module" + _ "github.com/pokt-network/poktroll/x/application/module" // import for side-effects + applicationmoduletypes "github.com/pokt-network/poktroll/x/application/types" + _ "github.com/pokt-network/poktroll/x/gateway/module" // import for side-effects + gatewaymoduletypes "github.com/pokt-network/poktroll/x/gateway/types" + _ "github.com/pokt-network/poktroll/x/proof/module" // import for side-effects + proofmoduletypes "github.com/pokt-network/poktroll/x/proof/types" + _ "github.com/pokt-network/poktroll/x/service/module" // import for side-effects + servicemoduletypes "github.com/pokt-network/poktroll/x/service/types" + _ "github.com/pokt-network/poktroll/x/session/module" // import for side-effects + sessionmoduletypes "github.com/pokt-network/poktroll/x/session/types" + _ "github.com/pokt-network/poktroll/x/supplier/module" // import for side-effects + suppliermoduletypes "github.com/pokt-network/poktroll/x/supplier/types" + _ "github.com/pokt-network/poktroll/x/tokenomics/module" // import for side-effects + tokenomicsmoduletypes "github.com/pokt-network/poktroll/x/tokenomics/types" "google.golang.org/protobuf/types/known/durationpb" // this line is used by starport scaffolding # stargate/app/moduleImport ) @@ -107,6 +128,13 @@ var ( consensusparamtypes.ModuleName, circuittypes.ModuleName, // chain modules + servicemoduletypes.ModuleName, + gatewaymoduletypes.ModuleName, + applicationmoduletypes.ModuleName, + suppliermoduletypes.ModuleName, + sessionmoduletypes.ModuleName, + proofmoduletypes.ModuleName, + tokenomicsmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis } @@ -131,6 +159,13 @@ var ( icatypes.ModuleName, ibcfeetypes.ModuleName, // chain modules + servicemoduletypes.ModuleName, + gatewaymoduletypes.ModuleName, + applicationmoduletypes.ModuleName, + suppliermoduletypes.ModuleName, + sessionmoduletypes.ModuleName, + proofmoduletypes.ModuleName, + tokenomicsmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers } @@ -149,6 +184,13 @@ var ( icatypes.ModuleName, ibcfeetypes.ModuleName, // chain modules + servicemoduletypes.ModuleName, + gatewaymoduletypes.ModuleName, + applicationmoduletypes.ModuleName, + suppliermoduletypes.ModuleName, + sessionmoduletypes.ModuleName, + proofmoduletypes.ModuleName, + tokenomicsmoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers } @@ -168,7 +210,13 @@ var ( {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, {Account: ibcfeetypes.ModuleName}, {Account: icatypes.ModuleName}, - // this line is used by starport scaffolding # stargate/app/maccPerms + {Account: servicemoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + {Account: gatewaymoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + {Account: applicationmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + {Account: suppliermoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + {Account: sessionmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + {Account: tokenomicsmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, + // this line is used by starport scaffolding # stargate/app/maccPerms } } // blocked account addresses @@ -298,6 +346,34 @@ var ( Name: circuittypes.ModuleName, Config: appconfig.WrapAny(&circuitmodulev1.Module{}), }, + { + Name: servicemoduletypes.ModuleName, + Config: appconfig.WrapAny(&servicemodulev1.Module{}), + }, + { + Name: gatewaymoduletypes.ModuleName, + Config: appconfig.WrapAny(&gatewaymodulev1.Module{}), + }, + { + Name: applicationmoduletypes.ModuleName, + Config: appconfig.WrapAny(&applicationmodulev1.Module{}), + }, + { + Name: suppliermoduletypes.ModuleName, + Config: appconfig.WrapAny(&suppliermodulev1.Module{}), + }, + { + Name: sessionmoduletypes.ModuleName, + Config: appconfig.WrapAny(&sessionmodulev1.Module{}), + }, + { + Name: proofmoduletypes.ModuleName, + Config: appconfig.WrapAny(&proofmodulev1.Module{}), + }, + { + Name: tokenomicsmoduletypes.ModuleName, + Config: appconfig.WrapAny(&tokenomicsmodulev1.Module{}), + }, // this line is used by starport scaffolding # stargate/app/moduleConfig }, }) diff --git a/cmd/poktrolld/cmd/root.go b/cmd/poktrolld/cmd/root.go index 64ac47d0e..1bfbfd135 100644 --- a/cmd/poktrolld/cmd/root.go +++ b/cmd/poktrolld/cmd/root.go @@ -29,7 +29,7 @@ import ( // NewRootCmd creates a new root command for poktrolld. It is called once in the main function. func NewRootCmd() *cobra.Command { - initSDKConfig() + InitSDKConfig() var ( txConfigOpts tx.ConfigOptions diff --git a/config.yml b/config.yml index 7ba4164c1..0165a4ea0 100644 --- a/config.yml +++ b/config.yml @@ -91,8 +91,8 @@ genesis: maxDelegatedGateways: 7 applicationList: - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 - delegatee_gateway_addresses: [] - service_configs: + delegateeGatewayAddresses: [] + serviceConfigs: - service: id: anvil name: "" diff --git a/go.mod b/go.mod index 4dcf1553b..cf765b06f 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,9 @@ require ( cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/core v0.11.0 cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 + cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.1 cosmossdk.io/tools/confix v0.1.1 cosmossdk.io/x/circuit v0.1.0 @@ -31,17 +33,25 @@ require ( github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/gogo/status v1.1.0 + github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 + github.com/pokt-network/smt v0.9.2 + github.com/rs/zerolog v1.31.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.8.4 + golang.org/x/crypto v0.18.0 golang.org/x/tools v0.17.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac + google.golang.org/grpc v1.60.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 google.golang.org/protobuf v1.32.0 + gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -54,8 +64,6 @@ require ( connectrpc.com/connect v1.14.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/errors v1.0.0 // indirect - cosmossdk.io/math v1.2.0 // indirect cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -142,7 +150,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/cel-go v0.19.0 // indirect @@ -274,7 +281,6 @@ require ( github.com/rollkit/go-da v0.2.0 // indirect github.com/rollkit/rollkit v0.11.19 // indirect github.com/rs/cors v1.10.1 // indirect - github.com/rs/zerolog v1.31.0 // 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 @@ -285,6 +291,7 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -310,7 +317,6 @@ require ( go.uber.org/fx v1.20.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.20.0 // indirect @@ -324,11 +330,8 @@ require ( google.golang.org/api v0.153.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect - google.golang.org/grpc v1.60.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/go.sum b/go.sum index bda8d18ab..35808c136 100644 --- a/go.sum +++ b/go.sum @@ -753,6 +753,7 @@ github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14j github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= +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= @@ -764,6 +765,8 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= @@ -1698,6 +1701,8 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pokt-network/smt v0.9.2 h1:h/GnFm1F6mNBbF1hopr+9+y7nr173SU55NX7NxTVU0Y= +github.com/pokt-network/smt v0.9.2/go.mod h1:S4Ho4OPkK2v2vUCHNtA49XDjqUC/OFYpBbynRVYmxvA= github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= @@ -2734,6 +2739,7 @@ google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 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-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -2862,6 +2868,7 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= diff --git a/pkg/polylog/LICENSE b/pkg/polylog/LICENSE new file mode 100644 index 000000000..3914913fc --- /dev/null +++ b/pkg/polylog/LICENSE @@ -0,0 +1,32 @@ +The `Logger` and `Event` interfaces follow the `zerolog` package's API 1:1 +(possibly partially) to make zerolog implementation/integration become the +thinnest wrapper possible. + +This is the API intended for all off-chain (i.e. under `/pkg`) logging. + +The following is the MIT LICENSE from `zerolog` package at the time of writing: +(see: https://github.com/rs/zerolog) + +--- + +MIT License + +Copyright (c) 2017 Olivier Poitrey + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/pkg/polylog/context.go b/pkg/polylog/context.go new file mode 100644 index 000000000..0e6904b64 --- /dev/null +++ b/pkg/polylog/context.go @@ -0,0 +1,39 @@ +package polylog + +import "context" + +// CtxKey is the key used to store the polylog.Logger in a context.Context. This +// is **independant** of any logger-implementation-specific context key that may +// be used internal to any of the logger implementations. Polylog attempts to +// provide a ubiquitous interface for storing and retrieving loggers from the +// context but also to integrate with the underlying logger implementations as +// seamlessly as possible. +const CtxKey = "polylog/context" + +// DefaultContextLogger is the default logger implementation used when no logger +// is associated with a context. It is assigned in the implementation package's +// init() function to avoid potentially creating import cycles. +// The default logger implementation is zerolog (i.e. pkg/polylog/polyzero). +// +// IMPORTANT: In order for the default to be populated, the polyzero package MUST +// be part of the build. Otherwise, the polyzero package's init function will +// neither be included in the build nor executed. If no such import exists, the +// polyzero package can be imported for side effects only, e.g.: +// +// import _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +var DefaultContextLogger Logger + +// Ctx returns the Logger associated with the ctx. If no logger is associated, +// DefaultContextLogger is returned, unless DefaultContextLogger is nil, in which +// case a disabled logger is returned. +// +// To get a context which is associated a given logger, call the respective logger's +// #WithContext() method. Then this function can be used to retrieve it from that +// (or a context derived from that) context, later and elsewhere. +func Ctx(ctx context.Context) Logger { + logger, ok := ctx.Value(CtxKey).(Logger) + if !ok { + return DefaultContextLogger + } + return logger +} diff --git a/pkg/polylog/context_example_test.go b/pkg/polylog/context_example_test.go new file mode 100644 index 000000000..11f979ae4 --- /dev/null +++ b/pkg/polylog/context_example_test.go @@ -0,0 +1,43 @@ +package polylog_test + +import ( + "context" + "os" + + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +) + +func ExampleCtx() { + // Use whichever zerolog level you need. + level := zerolog.InfoLevel + + // Specify the lowest level to log. I.e.: calls to level methods "lower" + // than this will be ignored. + levelOpt := polyzero.WithLevel(level) + + // Construct a context, this is typically received as an argument. + ctx := context.Background() + + // Construct expectedLogger. + // NB: adding WithOutput is optional; defaults to os.Stderr. It is needed + // here to print to stdout for testable example purposes. + expectedLogger := polyzero.NewLogger(levelOpt, polyzero.WithOutput(os.Stdout)) + + // Add fields to the expectedLogger's context so that we can identify it in the output. + expectedLogger = expectedLogger.With("label", "my_test_logger") + + // Associate the expectedLogger with the context and update the context reference. + ctx = expectedLogger.WithContext(ctx) + + // Retrieve the logger from the context. + retrievedLogger := polylog.Ctx(ctx) + + // Log and check that the output matches our expectations. + retrievedLogger.Info().Msg("info message") + + // Output: + // {"level":"info","label":"my_test_logger","message":"info message"} +} diff --git a/pkg/polylog/context_test.go b/pkg/polylog/context_test.go new file mode 100644 index 000000000..d37201249 --- /dev/null +++ b/pkg/polylog/context_test.go @@ -0,0 +1,43 @@ +package polylog_test + +import ( + "context" + "testing" + + "github.com/rs/zerolog" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +) + +func TestWithContext_Ctx(t *testing.T) { + var ( + expectedLogger = polyzero.NewLogger() + ctx = context.Background() + ) + + // Ensure that no logger is associated with the context. + existingLogger, ok := ctx.Value(polylog.CtxKey).(polylog.Logger) + require.False(t, ok) + require.Nil(t, existingLogger) + + // Retrieve the default logger from the context using polylog and assert + // that it matches the default context logger. + defaultLogger := polylog.Ctx(ctx) + require.Equal(t, polylog.DefaultContextLogger, defaultLogger) + + // Associate a logger with a context. + ctx = expectedLogger.WithContext(ctx) + + // Retrieve the associated logger from the context using polylog and assert + // that it matches the one constructed at the beginning of the test. + actualLogger := polylog.Ctx(ctx) + require.Equal(t, expectedLogger, actualLogger) + + // Retrieve the associated logger from the context using zerolog and assert + // that it matches the one constructed at the beginning of the test. + actualZerologLogger := zerolog.Ctx(ctx) + expectedZerologLogger := polyzero.GetZerologLogger(expectedLogger) + require.Equal(t, expectedZerologLogger, actualZerologLogger) +} diff --git a/pkg/polylog/godoc.go b/pkg/polylog/godoc.go new file mode 100644 index 000000000..e3f759007 --- /dev/null +++ b/pkg/polylog/godoc.go @@ -0,0 +1,17 @@ +// Package polylog provides a ubiquitous logging interface which is derived from +// github.com/rs/zerolog, and as a result, also highly compatibly with other +// common, industry-standard logging libraries. This API mirrors that of zerolog +// but exists as a distinct layer of abstraction, and an extremely thin wrapper +// around the underlying logging library; especially in the case of the zerolog +// implementation. This distinction is intended to allow for evolution of the needs +// of this packages consumers as well as any future ambitions to (and implications +// thereof) adding support for adapting to additional logging libraries. +// +// It is intended to initially support the go std `log`, `github.com/rs/zerolog` and `go.uber.org/zap` logging libraries: +// +// - https://pkg.go.dev/log@go1.21.4 +// +// - https://github.com/rs/zerolog +// +// - https://github.com/uber-go/zap +package polylog diff --git a/pkg/polylog/interface.go b/pkg/polylog/interface.go new file mode 100644 index 000000000..b4ef28457 --- /dev/null +++ b/pkg/polylog/interface.go @@ -0,0 +1,193 @@ +package polylog + +import ( + "context" + "time" +) + +// TODO_CONSIDERATION: this may be a good candidate package for extraction to +// its own module. + +// TODO_INVESTIGATE: check whether the pkg dependency tree includes all logging +// libraries. + +// Level is the minimal interface required to express and convert between log levels +// of the underlying logging libraries. +type Level interface { + // String returns the string representation of the underlying Level. + String() string + // Int returns the int representation of the underlying Level. Level types are + // typically defined as enums of a concrete type that implement #String(). + Int() int +} + +// Logger is an interface that exposes methods for each supported log level, each +// of which returns an Event. +type Logger interface { + // Debug starts a new log message (event) with debug level. + // + // You must call Msg on the returned event in order to send the event. + Debug() Event + + // Info starts a new log message (event) with info level. + // + // You must call Msg on the returned event in order to send the event. + Info() Event + + // Warn starts a new log message (event) with warn level. + // + // You must call Msg on the returned event in order to send the event. + Warn() Event + + // Error starts a new log message (event) with error level. + // + // You must call Msg on the returned event in order to send the event. + Error() Event + + // With creates a child logger with the fields constructed from keyVals added + // to its context. + With(keyVals ...any) Logger + + // WithContext returns a copy of ctx with the receiver attached. The Logger + // attached to the provided Context (if any) will not be effected. If the + // receiver's log level is Disabled it will only be attached to the returned + // Context if the provided Context has a previously attached Logger. If the + // provided Context has no attached Logger, a Disabled Logger will not be + // attached. + // + // TODO_IMPROVE/TODO_COMMUNITY: support #UpdateContext() and update this + // godoc to include #UpdateContext() usage example. + // See: https://pkg.go.dev/github.com/rs/zerolog#Logger.UpdateContext. + WithContext(ctx context.Context) context.Context + + // WithLevel starts a new message (event) with level. + // + // You must call Msg on the returned event in order to send the event. + WithLevel(level Level) Event + + // Write implements the io.Writer interface. This is useful to set as a writer + // for the standard library log. + Write(p []byte) (n int, err error) +} + +// Event represents a log event. It is instanced by one of the level methods of +// Logger and finalized by the Msg, Msgf, or Send methods. It exposes methods for +// adding fields to the event which will be rendered in an encoding-appropriate +// way in the log output. +// +// TODO_IMPROVE/TODO_COMMUNITY: support #Dict(), #Stack(), #Any() type methods. +// See: https://pkg.go.dev/github.com/rs/zerolog#Event +// +// TODO_IMPROVE/TODO_COMMUNITY: support #Ctx() and #GetCtx() methods. +// See: https://pkg.go.dev/github.com/rs/zerolog#Event.Ctx and +// https://pkg.go.dev/github.com/rs/zerolog#Event.Ctx. +type Event interface { + // Str adds the field key with value as a string to the Event context. + Str(key, value string) Event + + // Bool adds the field key with value as a bool to the Event context. + Bool(key string, value bool) Event + + // Int adds the field key with value as an int to the Event context. + Int(key string, value int) Event + + // Int8 adds the field key with value as an int8 to the Event context. + Int8(key string, value int8) Event + + // Int16 adds the field key with value as an int16 to the Event context. + Int16(key string, value int16) Event + + // Int32 adds the field key with value as an int32 to the Event context. + Int32(key string, value int32) Event + + // Int64 adds the field key with value as an int64 to the Event context. + Int64(key string, value int64) Event + + // Uint adds the field key with value as a uint to the Event context. + Uint(key string, value uint) Event + + // Uint8 adds the field key with value as a uint8 to the Event context. + Uint8(key string, value uint8) Event + + // Uint16 adds the field key with value as a uint16 to the Event context. + Uint16(key string, value uint16) Event + + // Uint32 adds the field key with value as a uint32 to the Event context. + Uint32(key string, value uint32) Event + + // Uint64 adds the field key with value as a uint64 to the Event context. + Uint64(key string, value uint64) Event + + // Float32 adds the field key with value as a float32 to the Event context. + Float32(key string, value float32) Event + + // Float64 adds the field key with value as a float64 to the Event context. + Float64(key string, value float64) Event + + // Err adds the field "error" with serialized err to the Event context. + // If err is nil, no field is added. + // + // TODO_TEST: ensure implementation tests cover this: do not add a field + // if err is nil. + // + // To customize the key name, use the appropriate option from the respective + // package when constructing a logger. + // + // TODO_UPNEXT(@bryanchriswhite): ensure implementations' godoc examples cover + // options. + Err(err error) Event + + // Timestamp adds the current local time as UNIX timestamp to the Event context + // with the "time" key. To customize the key name, use the appropriate option + // from the respective package when constructing a Logger. + // + // TODO_UPNEXT(@bryanchriswhite): ensure implementations' godoc examples cover + // options. + // + // NOTE: It won't dedupe the "time" key if the Event (or *Context) has one + // already. + Timestamp() Event + + // Time adds the field key with value formatted as string using a configurable, + // implementation-specific format. + // + // To customize the time format, use the appropriate option from the respective + // package when constructing a Logger. + Time(key string, value time.Time) Event + + // Dur adds the field key with duration with a configurable, + // implementation-specific value format. + Dur(key string, value time.Duration) Event + + // Fields is a helper function to use a map or slice to set fields using type assertion. + // Only map[string]interface{} and []interface{} are accepted. []interface{} must + // alternate string keys and arbitrary values, and extraneous ones are ignored. + Fields(fields any) Event + + // Func allows an anonymous func to run only if the event is enabled. + Func(func(Event)) Event + + // Enabled return false if the Event is going to be filtered out by + // log level or sampling. + Enabled() bool + + // Discard disables the event so Msg(f)/Send won't print it. + Discard() Event + + // Msg sends the Event with msg added as the message field if not empty. + // + // NOTICE: once this method is called, the Event should be disposed. + // Calling Msg twice can have unexpected result. + Msg(message string) + + // Msgf sends the event with formatted msg added as the message field if not empty. + // + // NOTICE: once this method is called, the Event should be disposed. + // Calling Msgf twice can have unexpected result. + Msgf(format string, keyVals ...interface{}) + + // Send is equivalent to calling Msg(""). + // + // NOTICE: once this method is called, the Event should be disposed. + Send() +} diff --git a/pkg/polylog/polyzero/default.go b/pkg/polylog/polyzero/default.go new file mode 100644 index 000000000..905cf7c2c --- /dev/null +++ b/pkg/polylog/polyzero/default.go @@ -0,0 +1,15 @@ +package polyzero + +import "github.com/pokt-network/poktroll/pkg/polylog" + +func init() { + // Set the default logger to a polyzero logger. This is the logger which will + // be returned when calling polylog.Ctx() with a context which has no logger + // associated. + // + // This is assigned here to avoid an import cycle. Note that dependency init + // functions are called before dependents. It is therefore safe to override + // this default logger assignment in polylog consumer code, including in + // consumer package init functions. + polylog.DefaultContextLogger = NewLogger() +} diff --git a/pkg/polylog/polyzero/event.go b/pkg/polylog/polyzero/event.go new file mode 100644 index 000000000..58a78df8a --- /dev/null +++ b/pkg/polylog/polyzero/event.go @@ -0,0 +1,205 @@ +package polyzero + +import ( + "time" + + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +var _ polylog.Event = (*zerologEvent)(nil) + +// zerologEvent is a thin wrapper around a zerolog event. +type zerologEvent struct { + event *zerolog.Event +} + +// Str adds the field key with value as a string to the Event context. +func (zle *zerologEvent) Str(key, value string) polylog.Event { + zle.event.Str(key, value) + return zle +} + +// Bool adds the field key with value as a bool to the Event context. +func (zle *zerologEvent) Bool(key string, value bool) polylog.Event { + zle.event.Bool(key, value) + return zle +} + +// Int adds the field key with value as an int to the Event context. +func (zle *zerologEvent) Int(key string, value int) polylog.Event { + zle.event.Int(key, value) + return zle +} + +// Int8 adds the field key with value as an int8 to the Event context. +func (zle *zerologEvent) Int8(key string, value int8) polylog.Event { + zle.event.Int8(key, value) + return zle +} + +// Int16 adds the field key with value as an int16 to the Event context. +func (zle *zerologEvent) Int16(key string, value int16) polylog.Event { + zle.event.Int16(key, value) + return zle +} + +// Int32 adds the field key with value as an int32 to the Event context. +func (zle *zerologEvent) Int32(key string, value int32) polylog.Event { + zle.event.Int32(key, value) + return zle +} + +// Int64 adds the field key with value as an int64 to the Event context. +func (zle *zerologEvent) Int64(key string, value int64) polylog.Event { + zle.event.Int64(key, value) + return zle +} + +// Uint adds the field key with value as an uint to the Event context. +func (zle *zerologEvent) Uint(key string, value uint) polylog.Event { + zle.event.Uint(key, value) + return zle +} + +// Uint8 adds the field key with value as an uint8 to the Event context. +func (zle *zerologEvent) Uint8(key string, value uint8) polylog.Event { + zle.event.Uint8(key, value) + return zle +} + +// Uint16 adds the field key with value as an uint16 to the Event context. +func (zle *zerologEvent) Uint16(key string, value uint16) polylog.Event { + zle.event.Uint16(key, value) + return zle +} + +// Uint32 adds the field key with value as an uint32 to the Event context. +func (zle *zerologEvent) Uint32(key string, value uint32) polylog.Event { + zle.event.Uint32(key, value) + return zle +} + +// Uint64 adds the field key with value as an uint64 to the Event context. +func (zle *zerologEvent) Uint64(key string, value uint64) polylog.Event { + zle.event.Uint64(key, value) + return zle +} + +// Float32 adds the field key with value as a float32 to the Event context. +func (zle *zerologEvent) Float32(key string, value float32) polylog.Event { + zle.event.Float32(key, value) + return zle +} + +// Float64 adds the field key with value as a float64 to the Event context. +func (zle *zerologEvent) Float64(key string, value float64) polylog.Event { + zle.event.Float64(key, value) + return zle +} + +// Err adds the field "error" with serialized err to the Event context. +// If err is nil, no field is added. +// +// To customize the key name, change zerolog.ErrorFieldName. This can be done +// directly or by using the WithErrKey() option when constructing the logger. +// +// If Stack() has been called before and zerolog.ErrorStackMarshaler is defined, +// the err is passed to ErrorStackMarshaler and the result is appended to the +// zerolog.ErrorStackFieldName. +func (zle *zerologEvent) Err(err error) polylog.Event { + zle.event.Err(err) + return zle +} + +// Timestamp adds the current local time as UNIX timestamp to the Event context +// with the "time" key. +// To customize the key name, change zerolog.TimestampFieldName. This can be done directly or via +// the WithTimestampKey() option when constructing the logger. +// +// NOTE: It won't dedupe the "time" key if the Event (or *Context) has one +// already. +func (zle *zerologEvent) Timestamp() polylog.Event { + zle.event.Timestamp() + return zle +} + +// Time adds the field key with value formatted as string using zerolog.TimeFieldFormat. +func (zle *zerologEvent) Time(key string, value time.Time) polylog.Event { + zle.event.Time(key, value) + return zle +} + +// Dur adds the field key with duration value stored as zerolog.DurationFieldUnit. +// If zerolog.DurationFieldInteger is true, durations are rendered as integer +// instead of float. +func (zle *zerologEvent) Dur(key string, value time.Duration) polylog.Event { + zle.event.Dur(key, value) + return zle +} + +// Func allows an anonymous func to run only if the event is enabled. +func (zle *zerologEvent) Func(fn func(polylog.Event)) polylog.Event { + // NB: no need to call #Enabled() here because the underlying zerolog.Event + // will do that for us. + if zle.Enabled() { + zle.event.Func( + func(event *zerolog.Event) { + fn(newEvent(event)) + }, + ) + } + return zle +} + +// Fields is a helper function to use a map or slice to set fields using type +// assertion. Only map[string]any and []any are accepted. any must alternate +// string keys and arbitrary values, and extraneous ones are ignored. +func (zle *zerologEvent) Fields(fields any) polylog.Event { + zle.event.Fields(fields) + return zle +} + +// Enabled return false if the Event is going to be filtered out by +// log level or sampling. +func (zle *zerologEvent) Enabled() bool { + return zle.event.Enabled() +} + +// Discard disables the event so Msg(f)/Send won't print it. +func (zle *zerologEvent) Discard() polylog.Event { + zle.event.Discard() + return zle +} + +// Msg sends the Event with msg added as the message field if not empty. +// +// NOTICE: once this method is called, the Event should be disposed. +// Calling Msg twice can have unexpected result. +func (zle *zerologEvent) Msg(msg string) { + zle.event.Msg(msg) +} + +// Msgf sends the event with formatted msg added as the message field if not empty. +// +// NOTICE: once this method is called, the Event should be disposed. +// Calling Msgf twice can have unexpected result. +func (zle *zerologEvent) Msgf(format string, args ...any) { + zle.event.Msgf(format, args...) +} + +// Send is equivalent to calling Msg(""). It can be thought of as a Flush. +// +// NOTICE: once this method is called, the Event should be disposed. +func (zle *zerologEvent) Send() { + zle.event.Send() +} + +// newEvent takes a zerolog event pointer and wraps it in a polylog.zerologEvent +// struct. +func newEvent(event *zerolog.Event) polylog.Event { + return &zerologEvent{ + event: event, + } +} diff --git a/pkg/polylog/polyzero/godoc.go b/pkg/polylog/polyzero/godoc.go new file mode 100644 index 000000000..4410dd8e9 --- /dev/null +++ b/pkg/polylog/polyzero/godoc.go @@ -0,0 +1,9 @@ +// Package polyzero provides a polylog.Logger implementation backed by zerolog. +// As the polylogger interface mirrors that of zerolog, this package is a thin +// wrapper around the zerolog package. However, it is only a partial mapping of +// the full zerolog API, and has already begun to deviate a bit to be more +// accommodating to other supported logging libraries. +// +// Use polyzero if you don't have a preference for a particular logging library +// or are already using zerolog. +package polyzero diff --git a/pkg/polylog/polyzero/levels.go b/pkg/polylog/polyzero/levels.go new file mode 100644 index 000000000..e2880711c --- /dev/null +++ b/pkg/polylog/polyzero/levels.go @@ -0,0 +1,47 @@ +package polyzero + +import ( + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// TODO_TECHDEBT: support a Disabled level. +const ( + // DebugLevel logs are typically voluminous, and are usually disabled in + // production. + DebugLevel = Level(iota) + // InfoLevel is the default logging priority. + InfoLevel + // WarnLevel logs are more important than Info, but don't need individual + // human review. + WarnLevel + // ErrorLevel logs are high-priority. If an application is running smoothly, + // it shouldn't generate any error-level logs. + ErrorLevel +) + +var _ polylog.Level = Level(0) + +// Level implements the polylog.Level interface for zerolog levels. +type Level int + +// Levels is a convenience function to return all supported levels. +func Levels() []Level { + return []Level{ + DebugLevel, + InfoLevel, + WarnLevel, + ErrorLevel, + } +} + +// String implements polylog.Level#String(). +func (lvl Level) String() string { + return zerolog.Level(lvl).String() +} + +// Int implements polylog.Level#Int(). +func (lvl Level) Int() int { + return int(lvl) +} diff --git a/pkg/polylog/polyzero/logger.go b/pkg/polylog/polyzero/logger.go new file mode 100644 index 000000000..8c908fd0f --- /dev/null +++ b/pkg/polylog/polyzero/logger.go @@ -0,0 +1,109 @@ +package polyzero + +import ( + "context" + "os" + + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// zerologLogger is a thin wrapper around a zerolog logger which implements +// the polylog.Logger interface. +type zerologLogger struct { + // NB: Default (0) is Debug. + level zerolog.Level + zerolog.Logger +} + +// NewLogger constructs a new zerolog-backed logger which conforms to the +// polylog.Logger interface. By default, the logger is configured to write to +// os.Stderr and log at the Debug level. +// +// TODO_IMPROVE/TODO_COMMUNITY: Add `NewProductionLogger`, `NewDevelopmentLogger`, +// and `NewExampleLogger` functions with reasonable defaults the their respective +// environments; conceptually similar to the respective analogues in zap. +// See: https://pkg.go.dev/github.com/uber-go/zap#hdr-Configuring_Zap. +func NewLogger( + opts ...polylog.LoggerOption, +) polylog.Logger { + ze := &zerologLogger{ + level: zerolog.DebugLevel, + Logger: zerolog.New(os.Stderr), + } + + for _, opt := range opts { + opt(ze) + } + + return ze +} + +// Debug starts a new message with debug level. +// +// You must call Msg on the returned event in order to send the event. +func (ze *zerologLogger) Debug() polylog.Event { + return newEvent(ze.Logger.Debug()) +} + +// Info starts a new message with info level. +// +// You must call Msg, Msgf, or Send on the returned event in order to send the event. +func (ze *zerologLogger) Info() polylog.Event { + return newEvent(ze.Logger.Info()) +} + +// Warn starts a new message with warn level. +// +// You must call Msg, Msgf, or Send on the returned event in order to send the event. +func (ze *zerologLogger) Warn() polylog.Event { + return newEvent(ze.Logger.Warn()) +} + +// Error starts a new message with error level. +// +// You must call Msg, Msgf, or Send on the returned event in order to send the event. +func (ze *zerologLogger) Error() polylog.Event { + return newEvent(ze.Logger.Error()) +} + +// With creates a child logger with the fields constructed from keyVals added +// to its context. +func (ze *zerologLogger) With(keyVals ...any) polylog.Logger { + return &zerologLogger{ + level: ze.level, + Logger: ze.Logger.With().Fields(keyVals).Logger(), + } +} + +// WithLevel starts a new message with level. +// +// You must call Msg, Msgf, or Send on the returned event in order to send the event. +func (ze *zerologLogger) WithLevel(level polylog.Level) polylog.Event { + return newEvent(ze.Logger.WithLevel(zerolog.Level(level.Int()))) +} + +// WithContext returns a copy of ctx with the receiver logger attached. +// - The Logger attached to the provided Context (if any) will not be effected. +// - If the receiver's log level is Disabled, it will only be attached to the returned +// Context if the provided Context has a previously attached Logger. +// - If the provided Context has no attached Logger, a Disabled Logger +// will not be attached. +// +// TODO_TEST/TODO_COMMUNITY: add support for #UpdateContext() and update this +// godoc to inlude example usage. +// See: https://pkg.go.dev/github.com/rs/zerolog#Logger.WithContext. +// +// TODO_TEST/TODO_COMMUNITY: add coverage for `polyzero.Logger#WithContext()`. +func (ze *zerologLogger) WithContext(ctx context.Context) context.Context { + ctx = context.WithValue(ctx, polylog.CtxKey, ze) + ctx = ze.Logger.WithContext(ctx) + return ctx +} + +// Write implements io.Writer. This is useful to set as a writer for the +// standard library log. +func (ze *zerologLogger) Write(p []byte) (n int, err error) { + return ze.Logger.Write(p) +} diff --git a/pkg/polylog/polyzero/logger_example_test.go b/pkg/polylog/polyzero/logger_example_test.go new file mode 100644 index 000000000..7534026d6 --- /dev/null +++ b/pkg/polylog/polyzero/logger_example_test.go @@ -0,0 +1,37 @@ +package polyzero_test + +import ( + "os" + + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +) + +func ExampleNewLogger() { + // Use whichever zerolog level you need. + level := zerolog.InfoLevel + // Specify the lowest level to log. I.e.: calls to level methods "lower" + // than this will be ignored. + levelOpt := polyzero.WithLevel(level) + + // Construct logger. + // NB: adding WithOutput is optional; defaults to os.Stderr. It is needed + // here to print to stdout for testable example purposes. + logger := polyzero.NewLogger(levelOpt, polyzero.WithOutput(os.Stdout)) + + // All level methods are always available, but will only log if the level + // is enabled. + logger.Debug().Msg("debug message - should not see me") + logger.Info().Msgf("info message with %s", "formatting") + logger.Warn().Str("warn", "message").Send() + // NB: arg type MUST be either map[string]any OR []any. + logger.Error().Fields(map[string]any{ + "error": "message", + }).Send() + + // Output: + // {"level":"info","message":"info message with formatting"} + // {"level":"warn","warn":"message"} + // {"level":"error","error":"message"} +} diff --git a/pkg/polylog/polyzero/logger_test.go b/pkg/polylog/polyzero/logger_test.go new file mode 100644 index 000000000..c55668d41 --- /dev/null +++ b/pkg/polylog/polyzero/logger_test.go @@ -0,0 +1,392 @@ +package polyzero_test + +import ( + "bytes" + "fmt" + "testing" + "time" + + "github.com/rs/zerolog" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/testutil/testpolylog" +) + +const polyzeroEventTypeName = "*polyzero.zerologEvent" + +var ( + expectedErr = fmt.Errorf("%d", 42) + expectedTime = time.Now() + // expectedTimestampDayPrecisionLayout is a "layout" which is described using + // the "reference time", as per the time package usage convention. + // See: https://golang.org/pkg/time/#pkg-constants for more details on "layouts" and the "reference time". + // + // NB: #Timestamp() uses time.Now() internally. If the test is run around the + // rollover of a second, minute, or hour, the expected timestamp time may not + // match the actual time precisely enough. While this is still a possibility + // near the rollover of a day, this window occurs less frequently and is many + // multiples of the time it takes CI to run. + // + // TODO_CONSIDERATION: redesign the test helper to support regular expressions + // for the output expectation. + expectedTimestampDayPrecisionLayout = "2006-01-02T" + expectedTimeLayout = "2006-01-02T15:04:05-07:00" + expectedTimestampEventContains = fmt.Sprintf(`"time":"%s`, expectedTime.Format(expectedTimestampDayPrecisionLayout)) + expectedTimeEventContains = fmt.Sprintf(`"Time":"%s`, expectedTime.Format(expectedTimeLayout)) + expectedDuration = time.Millisecond + (250 * time.Nanosecond) // 1000250 + expectedDurationString = expectedDuration.String()[:len(expectedDuration.String())-2] // 1.00025 + expectedDurationEventContains = fmt.Sprintf(`"Dur":%s`, expectedDurationString) +) + +func TestZerologLogger_AllLevels_AllEventTypeMethods(t *testing.T) { + tests := []testpolylog.EventMethodTestCase{ + { + // Explicitly left empty; no event method should be called. + EventMethodName: "", + Msg: "Msg", + ExpectedOutputContains: "Msg", + }, + { + // Explicitly left empty; no event method should be called. + EventMethodName: "", + MsgFmt: "%s", + MsgFmtArgs: []any{"Msgf"}, + ExpectedOutputContains: "Msgf", + }, + { + Key: "Str", + Value: "str_value", + EventMethodName: "Str", + ExpectedOutputContains: `"Str":"str_value"`, + }, + { + Key: "Bool", + Value: true, + EventMethodName: "Bool", + ExpectedOutputContains: `"Bool":true`, + }, + { + EventMethodName: "Int", + Key: "Int", + Value: int(42), + ExpectedOutputContains: `"Int":42`, + }, + { + EventMethodName: "Int8", + Key: "Int8", + Value: int8(42), + ExpectedOutputContains: `"Int8":42`, + }, + { + EventMethodName: "Int16", + Key: "Int16", + Value: int16(42), + ExpectedOutputContains: `"Int16":42`, + }, + { + EventMethodName: "Int32", + Key: "Int32", + Value: int32(42), + ExpectedOutputContains: `"Int32":42`, + }, + { + EventMethodName: "Int64", + Key: "Int64", + Value: int64(42), + ExpectedOutputContains: `"Int64":42`, + }, + { + EventMethodName: "Uint", + Key: "Uint", + Value: uint(42), + ExpectedOutputContains: `"Uint":42`, + }, + { + EventMethodName: "Uint8", + Key: "Uint8", + Value: uint8(42), + ExpectedOutputContains: `"Uint8":42`, + }, + { + Key: "Uint16", + ExpectedOutputContains: `"Uint16":42`, + Value: uint16(42), + EventMethodName: "Uint16", + }, + { + EventMethodName: "Uint32", + Key: "Uint32", + Value: uint32(42), + ExpectedOutputContains: `"Uint32":42`, + }, + { + EventMethodName: "Uint64", + Key: "Uint64", + Value: uint64(42), + ExpectedOutputContains: `"Uint64":42`, + }, + { + EventMethodName: "Float32", + Key: "Float32", + Value: float32(420.69), + ExpectedOutputContains: `"Float32":420.69`, + }, + { + EventMethodName: "Float64", + Key: "Float64", + Value: float64(420.69), + ExpectedOutputContains: `"Float64":420.69`, + }, + { + EventMethodName: "Err", + Value: expectedErr, + ExpectedOutputContains: `"error":"42"`, + }, + { + EventMethodName: "Timestamp", + ExpectedOutputContains: expectedTimestampEventContains, + }, + // TODO_TECHDEBT: figure out why this fails in CI but not locally, + // (even with `make itest 500 10 ./pkg/polylog/... -- -run=ZeroLogger_AllLevels_AllEventTypeMethods`). + // + //{ + // EventMethodName: "Time", + // Key: "Time", + // Value: expectedTime, + // ExpectedOutputContains: expectedTimeEventContains, + //}, + { + EventMethodName: "Dur", + Key: "Dur", + Value: expectedDuration, + ExpectedOutputContains: expectedDurationEventContains, + }, + { + EventMethodName: "Fields", + Value: map[string]any{ + "key1": "value1", + "key2": 42, + }, + ExpectedOutputContains: `"key1":"value1","key2":42`, + }, + { + EventMethodName: "Fields", + Value: []any{"key1", "value1", "key2", 42}, + ExpectedOutputContains: `"key1":"value1","key2":42`, + }, + } + + for _, level := range polyzero.Levels() { + testpolylog.RunEventMethodTests( + t, + level, + tests, + newTestLogger, + newTestEventWithLevel, + getExpectedLevelOutputContains, + ) + } +} + +func TestZerologLogger_Levels_Discard(t *testing.T) { + // Construct a logger with each level. With each logger, log an event at each + // level and assert that the event is logged if and only if the event level + // is GTE the logger level. + for _, loggerLevel := range polyzero.Levels() { + testDesc := fmt.Sprintf("%s level logger", loggerLevel.String()) + t.Run(testDesc, func(t *testing.T) { + logger, logOutput := newTestLogger(t, loggerLevel) + + // Log an event for each level. + for _, eventLevel := range polyzero.Levels() { + event := newTestEventWithLevel(t, logger, eventLevel) + // Log the event level string. + event.Msg(eventLevel.String()) + + // If the event level is GTE the logger level, then the event should + // be logged. + if eventLevel.Int() >= loggerLevel.Int() { + require.Truef(t, event.Enabled(), "expected event to be enabled") + require.Contains(t, logOutput.String(), eventLevel.String()) + } else { + require.Falsef(t, event.Enabled(), "expected event to be discarded") + require.NotContains(t, logOutput.String(), eventLevel.String()) + } + } + + // Print log output for manual inspection. + t.Log(logOutput.String()) + }) + } +} + +func TestZerologLogger_Func_Discard_Enabled(t *testing.T) { + for _, loggerLevel := range polyzero.Levels() { + testDesc := fmt.Sprintf("%s loggerLevel logger", loggerLevel.String()) + t.Run(testDesc, func(t *testing.T) { + var ( + notExpectedOutput = "if you're reading this, the test failed" + // Construct a spy which implements a #Fn() method which we can use to + // assert that the function passed to polylog.Event#Func() is called with + // the expected arg(s). + logger, logOutput = newTestLogger(t, loggerLevel) + ) + + for _, eventLevel := range polyzero.Levels() { + funcSpy := testpolylog.EventFuncSpy{} + funcSpy.On("Fn", mock.AnythingOfType(polyzeroEventTypeName)).Return() + + event := newTestEventWithLevel(t, logger, eventLevel) + expectedEventLevelEnabled := eventLevel.Int() >= loggerLevel.Int() + + require.Equalf(t, expectedEventLevelEnabled, event.Enabled(), "expected event to be initially enabled") + + // If the event level is GTE the logger level, then make additional + // assertions about #Func(), #Discard(), and #Enabled() behavior. + if expectedEventLevelEnabled { + // Assert that #Func() calls `funcSpy#Fn()` method 1 time with + // an event whose type name matches funcMethodEventTypeName. + event.Func(funcSpy.Fn) + funcSpy.AssertCalled(t, "Fn", mock.AnythingOfType(polyzeroEventTypeName)) + funcSpy.AssertNumberOfCalls(t, "Fn", 1) + + event.Discard() + require.Falsef(t, event.Enabled(), "expected event to be disabled after Discard()") + + // Assert that #Func() **does not** call `funcSpy#Fn()` method again. + event.Func(funcSpy.Fn) + funcSpy.AssertNumberOfCalls(t, "Fn", 1) + + event.Msg(notExpectedOutput) + require.NotContains(t, logOutput.String(), notExpectedOutput) + } + + // NB: this test doesn't produce any log output as all cases + // exercise discarding. + } + }) + } +} + +func TestZerologLogger_With(t *testing.T) { + logger, logOutput := newTestLogger(t, polyzero.DebugLevel) + + logger.Debug().Msg("before") + require.Contains(t, logOutput.String(), "before") + + logger = logger.With("key", "value") + + logger.Debug().Msg("after") + require.Contains(t, logOutput.String(), "after") + require.Contains(t, logOutput.String(), `"key":"value"`) +} + +func TestZerologLogger_WithLevel(t *testing.T) { + logger, logOutput := newTestLogger(t, polyzero.DebugLevel) + logger.WithLevel(polyzero.DebugLevel).Msg("WithLevel()") + + require.Contains(t, logOutput.String(), "WithLevel()") +} + +func TestZerologLogger_Write(t *testing.T) { + testOutput := "Write()" + logger, logOutput := newTestLogger(t, polyzero.DebugLevel) + + n, err := logger.Write([]byte(testOutput)) + require.NoError(t, err) + require.Lenf(t, testOutput, n, "expected %d bytes to be written", len(testOutput)) + + require.Contains(t, logOutput.String(), testOutput) +} + +func TestWithTimestampKey(t *testing.T) { + expectedTimestampKey := "custom-timestamp-key" + + timestampKeyOpt := polyzero.WithTimestampKey(expectedTimestampKey) + // Reset zerolog timestamp key to default value after test. + t.Cleanup(func() { + zerolog.TimestampFieldName = "time" + }) + logger, logOutput := newTestLogger(t, polyzero.DebugLevel, timestampKeyOpt) + + logger.Debug().Timestamp().Send() + + expectedCustomTimestampEventContains := fmt.Sprintf( + `"%s":"%s`, + expectedTimestampKey, + expectedTime.Format(expectedTimestampDayPrecisionLayout), + ) + require.Contains(t, logOutput.String(), expectedCustomTimestampEventContains) + + // Print log output for manual inspection. + t.Log(logOutput) +} + +func TestWithErrorKey(t *testing.T) { + expectedErrKey := "custom-error-key" + + errorKeyOpt := polyzero.WithErrKey(expectedErrKey) + // Reset zerolog error key to default value after test. + t.Cleanup(func() { + zerolog.ErrorFieldName = "error" + }) + logger, logOutput := newTestLogger(t, polyzero.DebugLevel, errorKeyOpt) + + logger.Debug().Err(expectedErr).Send() + + require.Contains(t, logOutput.String(), expectedErr.Error()) + require.Contains(t, logOutput.String(), expectedErrKey) + + // Print log output for manual inspection. + t.Log(logOutput) +} + +func newTestLogger( + t *testing.T, + level polylog.Level, + opts ...polylog.LoggerOption, +) (polylog.Logger, *bytes.Buffer) { + t.Helper() + + // Redirect standard log output to logOutput buffer. + logOutput := new(bytes.Buffer) + opts = append( + opts, + polyzero.WithOutput(logOutput), + // NB: typically consumers would pass zerolog.Level directly instead. + polyzero.WithLevel(zerolog.Level(level.Int())), + ) + + logger := polyzero.NewLogger(opts...) + + return logger, logOutput +} + +func newTestEventWithLevel( + t *testing.T, + logger polylog.Logger, + level polylog.Level, +) polylog.Event { + t.Helper() + + // Match on level string to determine which level method to call. + switch level.String() { + case zerolog.DebugLevel.String(): + return logger.Debug() + case zerolog.InfoLevel.String(): + return logger.Info() + case zerolog.WarnLevel.String(): + return logger.Warn() + case zerolog.ErrorLevel.String(): + return logger.Error() + default: + panic(fmt.Errorf("level not yet supported: %s", level.String())) + } +} + +func getExpectedLevelOutputContains(level polylog.Level) string { + return fmt.Sprintf(`"level":%q`, level.String()) +} diff --git a/pkg/polylog/polyzero/options.go b/pkg/polylog/polyzero/options.go new file mode 100644 index 000000000..4fbe18d83 --- /dev/null +++ b/pkg/polylog/polyzero/options.go @@ -0,0 +1,51 @@ +package polyzero + +import ( + "io" + + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// WithOutput returns an option function that configures the output writer for zerolog. +func WithOutput(output io.Writer) polylog.LoggerOption { + return func(logger polylog.Logger) { + zl := logger.(*zerologLogger).Logger + logger.(*zerologLogger).Logger = zl.Output(output) + } +} + +// WithLevel returns an option function that configures the logger level for zerolog. +func WithLevel(level zerolog.Level) polylog.LoggerOption { + return func(logger polylog.Logger) { + zl := logger.(*zerologLogger).Logger + logger.(*zerologLogger).Logger = zl.Level(level) + } +} + +// WithTimestampKey returns an option function which configures the logger to +// use the given key when `polylog.Event#Timestamp()` is called. +func WithTimestampKey(key string) polylog.LoggerOption { + return func(_ polylog.Logger) { + zerolog.TimestampFieldName = key + } +} + +// WithErrKey returns an option function which configures the logger to use the +// given key when `polylog.Event#Err()` is called. +func WithErrKey(key string) polylog.LoggerOption { + return func(_ polylog.Logger) { + zerolog.ErrorFieldName = key + } +} + +// WithSetupFn takes function which receives the underlying zerolog logger pointer +// and returns an options function that calls it, passing the zerolog logger. +// +// TODO_TEST/TODO_COMMUNITY: add test coverage and example usage around this method. +func WithSetupFn(fn func(logger *zerolog.Logger)) polylog.LoggerOption { + return func(logger polylog.Logger) { + fn(&logger.(*zerologLogger).Logger) + } +} diff --git a/pkg/polylog/polyzero/test_logger.go b/pkg/polylog/polyzero/test_logger.go new file mode 100644 index 000000000..f0c35c89c --- /dev/null +++ b/pkg/polylog/polyzero/test_logger.go @@ -0,0 +1,18 @@ +//go:build test + +package polyzero + +import ( + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// GetZerologLogger is a helper function which provides direct access to the +// underlying zerolog logger for testing purposes; e.g. use in assertions. To use +// this helper, ensure that the build tag/constraint "test" is set (e.g. `go build -tags=test`). +// It MUST be defined in this package (as opposed to somewhere in testutils), as +// by definition, it references unexported members of this package. +func GetZerologLogger(polylogger polylog.Logger) *zerolog.Logger { + return &polylogger.(*zerologLogger).Logger +} diff --git a/pkg/polylog/types.go b/pkg/polylog/types.go new file mode 100644 index 000000000..3ac2ce4a0 --- /dev/null +++ b/pkg/polylog/types.go @@ -0,0 +1,3 @@ +package polylog + +type LoggerOption func(logger Logger) diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml index 89a67f2b2..3f46e1774 100644 --- a/proto/buf.gen.pulsar.yaml +++ b/proto/buf.gen.pulsar.yaml @@ -16,7 +16,7 @@ managed: plugins: - name: go-pulsar out: ./api - opt: paths=source_relative,Mpoktroll/shared/service.proto=github.com/pokt-network/poktroll/api/poktroll/shared + opt: paths=source_relative,Mpoktroll/shared/service.proto=github.com/pokt-network/poktroll/api/poktroll/shared,Mpoktroll/shared/supplier.proto=github.com/pokt-network/poktroll/api/poktroll/shared,Mpoktroll/application/application.proto=github.com/pokt-network/poktroll/api/poktroll/application,Mpoktroll/supplier/supplier.proto=github.com/pokt-network/poktroll/api/poktroll/supplier,Mpoktroll/session/session.proto=github.com/pokt-network/poktroll/api/poktroll/session - name: go-grpc out: ./api opt: paths=source_relative diff --git a/proto/poktroll/application/application.proto b/proto/poktroll/application/application.proto new file mode 100644 index 000000000..4a3cb74e8 --- /dev/null +++ b/proto/poktroll/application/application.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package poktroll.application; + +option go_package = "github.com/pokt-network/poktroll/x/application/types"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; + +import "poktroll/shared/service.proto"; + +// Application defines the type used to store an on-chain definition and state for an application +message Application { + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked + repeated poktroll.shared.ApplicationServiceConfig service_configs = 3; // The list of services this appliccation is configured to request service for + repeated string delegatee_gateway_addresses = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.nullable) = false]; // The Bech32 encoded addresses for all delegatee Gateways, in a non-nullable slice +} diff --git a/proto/poktroll/application/event.proto b/proto/poktroll/application/event.proto new file mode 100644 index 000000000..86502955e --- /dev/null +++ b/proto/poktroll/application/event.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.application; + +option go_package = "github.com/pokt-network/poktroll/x/application/types"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; + +// EventRedelegation is an event emitted whenever an application changes its +// delegatee gateways on chain. This is in response to both a DelegateToGateway +// and UndelegateFromGateway message. +message EventRedelegation { + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "app_address"]; // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding + string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "gateway_address"]; // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding +} \ No newline at end of file diff --git a/proto/poktroll/application/genesis.proto b/proto/poktroll/application/genesis.proto new file mode 100644 index 000000000..e9cb2d6c1 --- /dev/null +++ b/proto/poktroll/application/genesis.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package poktroll.application; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/application/params.proto"; +import "poktroll/application/application.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + +// GenesisState defines the application module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Application application_list = 2 [(gogoproto.nullable) = false] ; +} + diff --git a/proto/poktroll/application/module/module.proto b/proto/poktroll/application/module/module.proto new file mode 100644 index 000000000..29bc985e2 --- /dev/null +++ b/proto/poktroll/application/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.application.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/application" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/application/params.proto b/proto/poktroll/application/params.proto new file mode 100644 index 000000000..a1ecf959b --- /dev/null +++ b/proto/poktroll/application/params.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.application; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/application/Params"; + option (gogoproto.equal) = true; + uint64 max_delegated_gateways = 1 [(gogoproto.moretags) = "yaml:\"max_delegated_gateways\""]; +} \ No newline at end of file diff --git a/proto/poktroll/application/query.proto b/proto/poktroll/application/query.proto new file mode 100644 index 000000000..bf38d13dd --- /dev/null +++ b/proto/poktroll/application/query.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package poktroll.application; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/application/params.proto"; +import "poktroll/application/application.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/application/params"; + + } + + // Queries a list of Application items. + rpc Application (QueryGetApplicationRequest) returns (QueryGetApplicationResponse) { + option (google.api.http).get = "/pokt-network/poktroll/application/application/{address}"; + + } + rpc ApplicationAll (QueryAllApplicationRequest) returns (QueryAllApplicationResponse) { + option (google.api.http).get = "/pokt-network/poktroll/application/application"; + + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetApplicationRequest { + string address = 1; +} + +message QueryGetApplicationResponse { + Application application = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllApplicationRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllApplicationResponse { + repeated Application application = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto new file mode 100644 index 000000000..886bc43a7 --- /dev/null +++ b/proto/poktroll/application/tx.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; + +package poktroll.application; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/application/params.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc StakeApplication (MsgStakeApplication ) returns (MsgStakeApplicationResponse ); + rpc UnstakeApplication (MsgUnstakeApplication ) returns (MsgUnstakeApplicationResponse ); + rpc DelegateToGateway (MsgDelegateToGateway ) returns (MsgDelegateToGatewayResponse ); + rpc UndelegateFromGateway (MsgUndelegateFromGateway) returns (MsgUndelegateFromGatewayResponse); +} +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/application/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +message MsgStakeApplication { + option (cosmos.msg.v1.signer) = "address"; + + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) + repeated poktroll.shared.ApplicationServiceConfig services = 3; // The list of services this application is staked to request service for +} + +message MsgStakeApplicationResponse {} + +message MsgUnstakeApplication { + option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string address = 1; +} + +message MsgUnstakeApplicationResponse {} + +message MsgDelegateToGateway { + option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to delegate to using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + +} + +message MsgDelegateToGatewayResponse {} + +message MsgUndelegateFromGateway { + option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to undelegate from using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding +} + +message MsgUndelegateFromGatewayResponse {} + diff --git a/proto/poktroll/gateway/gateway.proto b/proto/poktroll/gateway/gateway.proto new file mode 100644 index 000000000..ff6798ba7 --- /dev/null +++ b/proto/poktroll/gateway/gateway.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package poktroll.gateway; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +message Gateway { + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway has staked +} + diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto new file mode 100644 index 000000000..d8b01b7c4 --- /dev/null +++ b/proto/poktroll/gateway/genesis.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package poktroll.gateway; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/gateway/params.proto"; +import "poktroll/gateway/gateway.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// GenesisState defines the gateway module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Gateway gateway_list = 2 [(gogoproto.nullable) = false] ; +} + diff --git a/proto/poktroll/gateway/module/module.proto b/proto/poktroll/gateway/module/module.proto new file mode 100644 index 000000000..a60bd4c46 --- /dev/null +++ b/proto/poktroll/gateway/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.gateway.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/gateway" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto new file mode 100644 index 000000000..bb7a65110 --- /dev/null +++ b/proto/poktroll/gateway/params.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.gateway; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/gateway/Params"; + option (gogoproto.equal) = true; + +} \ No newline at end of file diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto new file mode 100644 index 000000000..6e000cf4f --- /dev/null +++ b/proto/poktroll/gateway/query.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package poktroll.gateway; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/gateway/params.proto"; +import "poktroll/gateway/gateway.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/gateway/params"; + + } + + // Queries a list of Gateway items. + rpc Gateway (QueryGetGatewayRequest) returns (QueryGetGatewayResponse) { + option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway/{address}"; + + } + rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { + option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway"; + + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetGatewayRequest { + string address = 1; +} + +message QueryGetGatewayResponse { + Gateway gateway = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllGatewayRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllGatewayResponse { + repeated Gateway gateway = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto new file mode 100644 index 000000000..0d7312952 --- /dev/null +++ b/proto/poktroll/gateway/tx.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; + +package poktroll.gateway; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/gateway/params.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc StakeGateway (MsgStakeGateway ) returns (MsgStakeGatewayResponse ); + rpc UnstakeGateway (MsgUnstakeGateway) returns (MsgUnstakeGatewayResponse); +} +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/gateway/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +message MsgStakeGateway { + option (cosmos.msg.v1.signer) = "address"; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) +} + +message MsgStakeGatewayResponse {} + +message MsgUnstakeGateway { + option (cosmos.msg.v1.signer) = "address"; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway +} + +message MsgUnstakeGatewayResponse {} + diff --git a/proto/poktroll/proof/claim.proto b/proto/poktroll/proof/claim.proto new file mode 100644 index 000000000..508f88b68 --- /dev/null +++ b/proto/poktroll/proof/claim.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package poktroll.proof; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +import "cosmos_proto/cosmos.proto"; +import "poktroll/session/session.proto"; + +// Claim is the serialized object stored on-chain for claims pending to be proven +message Claim { + string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the address of the supplier that submitted this claim + // The session header of the session that this claim is for. + poktroll.session.SessionHeader session_header = 2; + // Root hash returned from smt.SMST#Root(). + bytes root_hash = 3; +} diff --git a/proto/poktroll/proof/genesis.proto b/proto/poktroll/proof/genesis.proto new file mode 100644 index 000000000..e3741aab6 --- /dev/null +++ b/proto/poktroll/proof/genesis.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package poktroll.proof; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/proof/params.proto"; +import "poktroll/proof/claim.proto"; +import "poktroll/proof/proof.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +// GenesisState defines the proof module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Claim claimList = 2 [(gogoproto.nullable) = false] ; + repeated Proof proofList = 3 [(gogoproto.nullable) = false] ; +} + diff --git a/proto/poktroll/proof/module/module.proto b/proto/poktroll/proof/module/module.proto new file mode 100644 index 000000000..dea1c09c0 --- /dev/null +++ b/proto/poktroll/proof/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.proof.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/proof" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto new file mode 100644 index 000000000..2e5ba59e3 --- /dev/null +++ b/proto/poktroll/proof/params.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package poktroll.proof; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/proof/Params"; + option (gogoproto.equal) = true; + + +} \ No newline at end of file diff --git a/proto/poktroll/proof/proof.proto b/proto/poktroll/proof/proof.proto new file mode 100644 index 000000000..0f4a33c6d --- /dev/null +++ b/proto/poktroll/proof/proof.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package poktroll.proof; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +import "cosmos_proto/cosmos.proto"; +import "poktroll/session/session.proto"; + +message Proof { + string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // The session header of the session that this claim is for. + poktroll.session.SessionHeader session_header = 2; + // The serialized SMST proof from the `#ClosestProof()` method. + bytes closest_merkle_proof = 3; +} + diff --git a/proto/poktroll/proof/query.proto b/proto/poktroll/proof/query.proto new file mode 100644 index 000000000..c3c9724e5 --- /dev/null +++ b/proto/poktroll/proof/query.proto @@ -0,0 +1,101 @@ +syntax = "proto3"; + +package poktroll.proof; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/proof/params.proto"; +import "poktroll/proof/claim.proto"; +import "poktroll/proof/proof.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/proof/params"; + + } + + // Queries a list of Claim items. + rpc Claim (QueryGetClaimRequest ) returns (QueryGetClaimResponse ) { + option (google.api.http).get = "/pokt-network/poktroll/proof/claim/{session_id}/{supplier_address}"; + + } + rpc AllClaims (QueryAllClaimsRequest) returns (QueryAllClaimsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/proof/claim"; + + } + + // Queries a list of Proof items. + rpc Proof (QueryGetProofRequest) returns (QueryGetProofResponse) { + option (google.api.http).get = "/pokt-network/poktroll/proof/proof/{session_id}/{supplier_address}"; + + } + rpc AllProofs (QueryAllProofsRequest) returns (QueryAllProofsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/proof/proof"; + + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetClaimRequest { + string session_id = 1; + string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message QueryGetClaimResponse { + Claim claim = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllClaimsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; + + oneof filter { + string supplier_address = 2; + string session_id = 3; + uint64 session_end_height = 4; + } +} + +message QueryAllClaimsResponse { + repeated Claim claims = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetProofRequest { + string session_id = 1; + string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message QueryGetProofResponse { + Proof proof = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllProofsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; + oneof filter { + string supplier_address = 2; + string session_id = 3; + uint64 session_end_height = 4; + } +} + +message QueryAllProofsResponse { + repeated Proof proofs = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/proof/tx.proto b/proto/poktroll/proof/tx.proto new file mode 100644 index 000000000..dbc034c5a --- /dev/null +++ b/proto/poktroll/proof/tx.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; + +package poktroll.proof; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/proof/params.proto"; +import "poktroll/session/session.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc CreateClaim (MsgCreateClaim ) returns (MsgCreateClaimResponse ); + rpc SubmitProof (MsgSubmitProof ) returns (MsgSubmitProofResponse ); +} +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/proof/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +message MsgCreateClaim { + option (cosmos.msg.v1.signer) = "supplier_address"; + string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + poktroll.session.SessionHeader session_header = 2; + + // root returned from smt.SMST#Root() + bytes root_hash = 3; +} + +message MsgCreateClaimResponse {} + +message MsgSubmitProof { + option (cosmos.msg.v1.signer) = "supplier_address"; + + string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + poktroll.session.SessionHeader session_header = 2; + // serialized version of *smt.SparseMerkleClosestProof + bytes proof = 3; +} + +message MsgSubmitProofResponse {} + diff --git a/proto/poktroll/service/genesis.proto b/proto/poktroll/service/genesis.proto new file mode 100644 index 000000000..c563bf3a7 --- /dev/null +++ b/proto/poktroll/service/genesis.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package poktroll.service; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/service/params.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +// GenesisState defines the service module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated poktroll.shared.Service service_list = 2 [(gogoproto.nullable) = false] ; +} + diff --git a/proto/poktroll/service/module/module.proto b/proto/poktroll/service/module/module.proto new file mode 100644 index 000000000..d057936f7 --- /dev/null +++ b/proto/poktroll/service/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.service.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/service" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/service/params.proto b/proto/poktroll/service/params.proto new file mode 100644 index 000000000..ab19273e8 --- /dev/null +++ b/proto/poktroll/service/params.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package poktroll.service; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/service/Params"; + option (gogoproto.equal) = true; + + + uint64 add_service_fee = 1 [(gogoproto.moretags) = "yaml:\"add_service_fee\""]; +} \ No newline at end of file diff --git a/proto/poktroll/service/query.proto b/proto/poktroll/service/query.proto new file mode 100644 index 000000000..ca2dacb7c --- /dev/null +++ b/proto/poktroll/service/query.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package poktroll.service; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/service/params.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/params"; + + } + + // Queries a list of Service items. + rpc Service (QueryGetServiceRequest) returns (QueryGetServiceResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/service/{index}"; + + } + rpc ServiceAll (QueryAllServiceRequest) returns (QueryAllServiceResponse) { + option (google.api.http).get = "/pokt-network/poktroll/service/service"; + + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetServiceRequest { + string index = 1; +} + +message QueryGetServiceResponse { + poktroll.shared.Service service = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllServiceRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllServiceResponse { + repeated poktroll.shared.Service service = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto new file mode 100644 index 000000000..26b4b3400 --- /dev/null +++ b/proto/poktroll/service/tx.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package poktroll.service; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/service/params.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc AddService (MsgAddService ) returns (MsgAddServiceResponse ); +} +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/service/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +// MsgAddService defines a message for adding a new message to the network. +// Services can be added by any actor in the network making them truly +// permissionless. +// TODO_DOCUMENT(@h5law): This is a key function in making services +// permissionless, document it's usage and design - in docusaurus covering how +// the entire process works. +message MsgAddService { + option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the service supplier using cosmos' ScalarDescriptor + poktroll.shared.Service service = 2 [(gogoproto.nullable) = false]; // The Service for which the supplier is adding to the network +} + +message MsgAddServiceResponse {} + diff --git a/proto/poktroll/session/genesis.proto b/proto/poktroll/session/genesis.proto new file mode 100644 index 000000000..bd2f42a8e --- /dev/null +++ b/proto/poktroll/session/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package poktroll.session; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/session/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + +// GenesisState defines the session module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/poktroll/session/module/module.proto b/proto/poktroll/session/module/module.proto new file mode 100644 index 000000000..b3c5e4339 --- /dev/null +++ b/proto/poktroll/session/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.session.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/session" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/session/params.proto b/proto/poktroll/session/params.proto new file mode 100644 index 000000000..9616a05d7 --- /dev/null +++ b/proto/poktroll/session/params.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package poktroll.session; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/session/Params"; + option (gogoproto.equal) = true; +} \ No newline at end of file diff --git a/proto/poktroll/session/query.proto b/proto/poktroll/session/query.proto new file mode 100644 index 000000000..89fbb144e --- /dev/null +++ b/proto/poktroll/session/query.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package poktroll.session; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; + + +import "poktroll/session/params.proto"; +import "poktroll/session/session.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/session/params"; + } + + // Queries a list of GetSession items. + rpc GetSession (QueryGetSessionRequest) returns (QueryGetSessionResponse) { + option (google.api.http).get = "/pokt-network/poktroll/session/get_session"; + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetSessionRequest { + string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + poktroll.shared.Service service = 2; // The service id to query the session for + int64 block_height = 3; // The block height to query the session for +} + +message QueryGetSessionResponse { + Session session = 1; +} + diff --git a/proto/poktroll/session/session.proto b/proto/poktroll/session/session.proto new file mode 100644 index 000000000..2c03af313 --- /dev/null +++ b/proto/poktroll/session/session.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package poktroll.session; + +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + +import "cosmos_proto/cosmos.proto"; +import "poktroll/shared/service.proto"; +import "poktroll/application/application.proto"; +import "poktroll/shared/supplier.proto"; + +// NOTE: Using signed integers for consistency with the cosmos SDK + +// SessionHeader is a lightweight header for a session that can be passed around. +// It is the minimal amount of data required to hydrate & retrieve all data relevant to the session. +message SessionHeader { + string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding + poktroll.shared.Service service = 2; // The service this session is for + int64 session_start_block_height = 3; // The height at which this session started + // NOTE: session_id can be derived from the above values using on-chain but is included in the header for convenience + string session_id = 4; // A unique pseudoranom ID for this session + int64 session_end_block_height = 5; // The height at which this session ended, this is the last block of the session +} + +// Session is a fully hydrated session object that contains all the information for the Session +// and its parcipants. +message Session { + SessionHeader header = 1; // The header of the session containing lightweight data + string session_id = 2; // A unique pseudoranom ID for this session + int64 session_number = 3; // The session number since genesis + int64 num_blocks_per_session = 4; // The number of blocks per session when this session started + poktroll.application.Application application = 5; // A fully hydrated application object this session is for + repeated poktroll.shared.Supplier suppliers = 6; // A fully hydrated set of servicers that are serving the application +} \ No newline at end of file diff --git a/proto/poktroll/session/tx.proto b/proto/poktroll/session/tx.proto new file mode 100644 index 000000000..37e78c39a --- /dev/null +++ b/proto/poktroll/session/tx.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package poktroll.session; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/session/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/session/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/poktroll/shared/service.proto b/proto/poktroll/shared/service.proto new file mode 100644 index 000000000..15c434d5f --- /dev/null +++ b/proto/poktroll/shared/service.proto @@ -0,0 +1,66 @@ +syntax = "proto3"; + +// NOTE that the `shared` package is not a Cosmos module, +// but rather a manually created package to resolve circular dependencies. +package poktroll.shared; + +option go_package = "github.com/pokt-network/poktroll/x/shared/types"; + +// TODO_CLEANUP(@Olshansk): Add native optional identifiers once its supported; https://github.com/ignite/cli/issues/3698 + +// Service message to encapsulate unique and semantic identifiers for a service on the network +message Service { + // For example, what if we want to request a session for a certain service but with some additional configs that identify it? + string id = 1; // Unique identifier for the service + + // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary + string name = 2; // (Optional) Semantic human readable name for the service +} + +// ApplicationServiceConfig holds the service configuration the application stakes for +message ApplicationServiceConfig { + Service service = 1; // The Service for which the application is configured + + // TODO_RESEARCH: There is an opportunity for applications to advertise the max + // they're willing to pay for a certain configuration/price, but this is outside of scope. + // RPCConfig rpc_configs = 2; // List of endpoints for the service +} + +// SupplierServiceConfig holds the service configuration the supplier stakes for +message SupplierServiceConfig { + Service service = 1; // The Service for which the supplier is configured + repeated SupplierEndpoint endpoints = 2; // List of endpoints for the service + // TODO_RESEARCH: There is an opportunity for supplier to advertise the min + // they're willing to earn for a certain configuration/price, but this is outside of scope. +} + +// SupplierEndpoint message to hold service configuration details +message SupplierEndpoint { + string url = 1; // URL of the endpoint + RPCType rpc_type = 2; // Type of RPC exposed on the url above + repeated ConfigOption configs = 3; // Additional configuration options for the endpoint +} + +// Enum to define RPC types +enum RPCType { + UNKNOWN_RPC = 0; // Undefined RPC type + GRPC = 1; // gRPC + WEBSOCKET = 2; // WebSocket + JSON_RPC = 3; // JSON-RPC + REST = 4; // REST + // Add new RPC types here as needed +} + +// Enum to define configuration options +// TODO_RESEARCH: Should these be configs, SLAs or something else? There will be more discussion once we get closer to implementing on-chain QoS. +enum ConfigOptions { + UNKNOWN_CONFIG = 0; // Undefined config option + TIMEOUT = 1; // Timeout setting + // Add new config options here as needed +} + +// Key-value wrapper for config options, as proto maps can't be keyed by enums +message ConfigOption { + ConfigOptions key = 1; // Config option key + string value = 2; // Config option value +} diff --git a/proto/poktroll/shared/supplier.proto b/proto/poktroll/shared/supplier.proto new file mode 100644 index 000000000..42c65eb67 --- /dev/null +++ b/proto/poktroll/shared/supplier.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package poktroll.shared; + +option go_package = "github.com/pokt-network/poktroll/x/shared/types"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "poktroll/shared/service.proto"; + +// Supplier is the type defining the actor in Pocket Network that provides RPC services. +message Supplier { + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked + repeated SupplierServiceConfig services = 3; // The service configs this supplier can support +} + diff --git a/proto/poktroll/supplier/genesis.proto b/proto/poktroll/supplier/genesis.proto new file mode 100644 index 000000000..5970cc005 --- /dev/null +++ b/proto/poktroll/supplier/genesis.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package poktroll.supplier; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/supplier/params.proto"; +import "poktroll/shared/supplier.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + +// GenesisState defines the supplier module's genesis state. +message GenesisState { + + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated poktroll.shared.Supplier supplierList = 2 [(gogoproto.nullable) = false] ; +} + diff --git a/proto/poktroll/supplier/module/module.proto b/proto/poktroll/supplier/module/module.proto new file mode 100644 index 000000000..b0b5704db --- /dev/null +++ b/proto/poktroll/supplier/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.supplier.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/supplier" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/supplier/params.proto b/proto/poktroll/supplier/params.proto new file mode 100644 index 000000000..031afe85a --- /dev/null +++ b/proto/poktroll/supplier/params.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package poktroll.supplier; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/supplier/Params"; + option (gogoproto.equal) = true; + + +} \ No newline at end of file diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto new file mode 100644 index 000000000..8d3ad532d --- /dev/null +++ b/proto/poktroll/supplier/query.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package poktroll.supplier; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "poktroll/supplier/params.proto"; +import "poktroll/shared/supplier.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + +// Query defines the gRPC querier service. +service Query { + + // Parameters queries the parameters of the module. + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/supplier/params"; + + } + + // Queries a list of Supplier items. + rpc Supplier (QueryGetSupplierRequest) returns (QueryGetSupplierResponse) { + option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier/{address}"; + + } + rpc AllSuppliers (QueryAllSuppliersRequest) returns (QueryAllSuppliersResponse) { + option (google.api.http).get = "/pokt-network/poktroll/supplier/supplier"; + + } +} +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + + // params holds all the parameters of this module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetSupplierRequest { + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message QueryGetSupplierResponse { + poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllSuppliersRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllSuppliersResponse { + repeated poktroll.shared.Supplier supplier = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto new file mode 100644 index 000000000..79ed6f5c3 --- /dev/null +++ b/proto/poktroll/supplier/tx.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package poktroll.supplier; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "poktroll/supplier/params.proto"; +import "poktroll/shared/service.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); + rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); +} +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the module parameters to update. + + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} + +message MsgStakeSupplier { + option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + repeated poktroll.shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for +} + +message MsgStakeSupplierResponse {} + +message MsgUnstakeSupplier { + option (cosmos.msg.v1.signer) = "address"; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding +} + +message MsgUnstakeSupplierResponse {} + diff --git a/proto/poktroll/tokenomics/genesis.proto b/proto/poktroll/tokenomics/genesis.proto new file mode 100644 index 000000000..00410f82a --- /dev/null +++ b/proto/poktroll/tokenomics/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package poktroll.tokenomics; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/tokenomics/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + +// GenesisState defines the tokenomics module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/poktroll/tokenomics/module/module.proto b/proto/poktroll/tokenomics/module/module.proto new file mode 100644 index 000000000..8dfd4debc --- /dev/null +++ b/proto/poktroll/tokenomics/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.tokenomics.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/tokenomics" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/tokenomics/params.proto b/proto/poktroll/tokenomics/params.proto new file mode 100644 index 000000000..a5e09eaf7 --- /dev/null +++ b/proto/poktroll/tokenomics/params.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package poktroll.tokenomics; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + +// TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. +// Params defines the parameters for the tokenomics module. +message Params { + option (amino.name) = "poktroll/x/tokenomics/Params"; + option (gogoproto.equal) = true; + + // The amount of upokt that a compute unit should translate to when settling a session. + // TODO_DOCUMENT(@Olshansk): Make sure to document the units of this parameter (or the map) once finalized. + uint64 compute_units_to_tokens_multiplier = 1 [(gogoproto.moretags) = "yaml:\"compute_units_to_tokens_multiplier\""]; + + // TODO: Some parameters we should consider adding next: + // - Service.computeUnitsToTokensMultiplierMap + // - Application.MaxuPOKTPerRelay + // - Application.MinuPOKTPerRelay + // - Suppler.MaxuPOKTPerRelay + // - Suppler.MinuPOKTPerRelay + // - RevDistr.PercentageToSupploer + // - RevDistr.PercentageToDAO + // - RevDistr.PercentageToPNF + // - RevDistr.PercentageToDelegators +} \ No newline at end of file diff --git a/proto/poktroll/tokenomics/query.proto b/proto/poktroll/tokenomics/query.proto new file mode 100644 index 000000000..8109ab945 --- /dev/null +++ b/proto/poktroll/tokenomics/query.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package poktroll.tokenomics; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/tokenomics/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/tokenomics/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} \ No newline at end of file diff --git a/proto/poktroll/tokenomics/tx.proto b/proto/poktroll/tokenomics/tx.proto new file mode 100644 index 000000000..8874cde46 --- /dev/null +++ b/proto/poktroll/tokenomics/tx.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package poktroll.tokenomics; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/tokenomics/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/tokenomics/MsgUpdateParams"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + + // params defines the x/tokenomics parameters to update. + // NOTE: All parameters must be supplied. + Params params = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/testutil/application/mocks/mocks.go b/testutil/application/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/application/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/gateway/mocks/mocks.go b/testutil/gateway/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/gateway/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go new file mode 100644 index 000000000..8d07cb131 --- /dev/null +++ b/testutil/keeper/application.go @@ -0,0 +1,102 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + mocks "github.com/pokt-network/poktroll/testutil/application/mocks" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" +) + +// stakedGatewayMap is used to mock whether a gateway is staked or not for use +// in the application's mocked gateway keeper. This enables the tester to +// control whether a gateway is "staked" or not and whether it can be delegated to +// WARNING: Using this map may cause issues if running multiple tests in parallel +var stakedGatewayMap = make(map[string]struct{}) + +func ApplicationKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + ctrl := gomock.NewController(t) + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + + mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) + mockAccountKeeper.EXPECT().GetAccount(gomock.Any(), gomock.Any()).AnyTimes() + + mockGatewayKeeper := mocks.NewMockGatewayKeeper(ctrl) + mockGatewayKeeper.EXPECT().GetGateway(gomock.Any(), gomock.Any()).DoAndReturn( + func(_ sdk.Context, addr string) (gatewaytypes.Gateway, bool) { + if _, ok := stakedGatewayMap[addr]; !ok { + return gatewaytypes.Gateway{}, false + } + stake := sdk.NewCoin("upokt", sdkmath.NewInt(10000)) + return gatewaytypes.Gateway{ + Address: addr, + Stake: &stake, + }, true + }, + ).AnyTimes() + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockBankKeeper, + mockAccountKeeper, + mockGatewayKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} + +// AddGatewayToStakedGatewayMap adds the given gateway address to the staked +// gateway map for use in the application's mocked gateway keeper and ensures +// that it is removed from the map when the test is complete +func AddGatewayToStakedGatewayMap(t *testing.T, gatewayAddr string) { + t.Helper() + stakedGatewayMap[gatewayAddr] = struct{}{} + t.Cleanup(func() { + delete(stakedGatewayMap, gatewayAddr) + }) +} + +// RemoveGatewayFromStakedGatewayMap removes the given gateway address from the +// staked gateway map for use in the application's mocked gateway keeper +func RemoveGatewayFromStakedGatewayMap(t *testing.T, gatewayAddr string) { + t.Helper() + delete(stakedGatewayMap, gatewayAddr) +} diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go new file mode 100644 index 000000000..906a742dd --- /dev/null +++ b/testutil/keeper/gateway.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + mocks "github.com/pokt-network/poktroll/testutil/gateway/mocks" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + ctrl := gomock.NewController(t) + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockBankKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/testutil/keeper/proof.go b/testutil/keeper/proof.go new file mode 100644 index 000000000..ed5c9d152 --- /dev/null +++ b/testutil/keeper/proof.go @@ -0,0 +1,87 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/proof" + "github.com/pokt-network/poktroll/testutil/proof/mocks" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +func ProofKeeper(t testing.TB, sessionByAppAddr proof.SessionsByAppAddress) (keeper.Keeper, sdk.Context) { + t.Helper() + + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + ctrl := gomock.NewController(t) + mockSessionKeeper := mocks.NewMockSessionKeeper(ctrl) + mockSessionKeeper.EXPECT(). + GetSession(gomock.AssignableToTypeOf(sdk.Context{}), gomock.Any()). + DoAndReturn( + func( + ctx sdk.Context, + req *sessiontypes.QueryGetSessionRequest, + ) (*sessiontypes.QueryGetSessionResponse, error) { + session, ok := sessionByAppAddr[req.GetApplicationAddress()] + require.Truef(t, ok, "application address not provided during mock construction: %q", req.ApplicationAddress) + + return &sessiontypes.QueryGetSessionResponse{ + Session: &sessiontypes.Session{ + Header: &sessiontypes.SessionHeader{ + ApplicationAddress: session.GetApplication().GetAddress(), + Service: req.GetService(), + SessionStartBlockHeight: 1, + SessionId: session.GetSessionId(), + SessionEndBlockHeight: 5, + }, + SessionId: session.GetSessionId(), + SessionNumber: 1, + NumBlocksPerSession: session.GetNumBlocksPerSession(), + Application: session.GetApplication(), + Suppliers: session.GetSuppliers(), + }, + }, nil + }, + ).AnyTimes() + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockSessionKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/testutil/keeper/service.go b/testutil/keeper/service.go new file mode 100644 index 000000000..d6bf955d5 --- /dev/null +++ b/testutil/keeper/service.go @@ -0,0 +1,106 @@ +package keeper + +import ( + "sync" + "testing" + + "cosmossdk.io/log" + "cosmossdk.io/math" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/service/mocks" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +var ( + // mapAccAddrCoins is used by the mock BankModule to determine who has what + // coins, if they are sufficient to pay the fee for adding a service. + mapAccAddrCoins = make(map[string]sdk.Coins) + mapMu = sync.RWMutex{} +) + +func ServiceKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + ctrl := gomock.NewController(t) + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + mockBankKeeper.EXPECT(). + SpendableCoins(gomock.Any(), gomock.Any()). + DoAndReturn(func(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { + mapMu.RLock() + defer mapMu.RUnlock() + if coins, ok := mapAccAddrCoins[addr.String()]; ok { + return coins + } + return sdk.Coins{} + }). + AnyTimes() + mockBankKeeper.EXPECT(). + SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()). + DoAndReturn(func(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { + mapMu.Lock() + defer mapMu.Unlock() + coins := mapAccAddrCoins[senderAddr.String()] + if coins.AmountOf("upokt").GT(amt.AmountOf("upokt")) { + mapAccAddrCoins[senderAddr.String()] = coins.Sub(amt...) + return nil + } + return types.ErrServiceNotEnoughFunds + }). + AnyTimes() + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockBankKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} + +// AddAccToAccMapCoins adds to the mapAccAddrCoins map the coins specified as +// parameters, to the function under the address specified. When it cleans up +// it deletes the entry in the map for the provided address. +func AddAccToAccMapCoins(t *testing.T, addr, denom string, amount uint64) { + t.Helper() + t.Cleanup(func() { + mapMu.Lock() + delete(mapAccAddrCoins, addr) + mapMu.Unlock() + }) + addrBech32, err := sdk.AccAddressFromBech32(addr) + require.NoError(t, err) + coins := sdk.NewCoins(sdk.Coin{Denom: denom, Amount: math.NewIntFromUint64(amount)}) + mapMu.Lock() + defer mapMu.Unlock() + mapAccAddrCoins[addrBech32.String()] = coins +} diff --git a/testutil/keeper/session.go b/testutil/keeper/session.go new file mode 100644 index 000000000..0687016c8 --- /dev/null +++ b/testutil/keeper/session.go @@ -0,0 +1,227 @@ +package keeper + +import ( + "context" + "encoding/hex" + "testing" + + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/testutil/session/mocks" + apptypes "github.com/pokt-network/poktroll/x/application/types" + "github.com/pokt-network/poktroll/x/session/keeper" + "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +var ( + TestServiceId1 = "svc1" // staked for by app1 & supplier1 + TestServiceId11 = "svc11" // staked for by app1 + + TestServiceId2 = "svc2" // staked for by app2 & supplier1 + TestServiceId22 = "svc22" // staked for by app2 + + TestServiceId12 = "svc12" // staked for by app1, app2 & supplier1 + + TestApp1Address = "pokt1mdccn4u38eyjdxkk4h0jaddw4n3c72u82m5m9e" // Generated via sample.AccAddress() + TestApp1 = apptypes.Application{ + Address: TestApp1Address, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: TestServiceId1}, + }, + { + Service: &sharedtypes.Service{Id: TestServiceId11}, + }, + { + Service: &sharedtypes.Service{Id: TestServiceId12}, + }, + }, + } + + TestApp2Address = "pokt133amv5suh75zwkxxcq896azvmmwszg99grvk9f" // Generated via sample.AccAddress() + TestApp2 = apptypes.Application{ + Address: TestApp1Address, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: TestServiceId2}, + }, + { + Service: &sharedtypes.Service{Id: TestServiceId22}, + }, + { + Service: &sharedtypes.Service{Id: TestServiceId12}, + }, + }, + } + + TestSupplierUrl = "http://olshansky.info" + TestSupplierAddress = sample.AccAddress() + TestSupplier = sharedtypes.Supplier{ + Address: TestSupplierAddress, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: TestServiceId1}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: TestSupplierUrl, + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + { + Service: &sharedtypes.Service{Id: TestServiceId2}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: TestSupplierUrl, + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + { + Service: &sharedtypes.Service{Id: TestServiceId12}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: TestSupplierUrl, + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } +) + +func SessionKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + ctrl := gomock.NewController(t) + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + + mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) + mockAccountKeeper.EXPECT().GetAccount(gomock.Any(), gomock.Any()).AnyTimes() + + mockAppKeeper := defaultAppKeeperMock(t) + mockSupplierKeeper := defaultSupplierKeeperMock(t) + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockAccountKeeper, + mockBankKeeper, + mockAppKeeper, + mockSupplierKeeper, + ) + + // TODO_TECHDEBT: See the comment at the bottom of this file explaining + // why we don't support options yet. + // for _, opt := range opts { + // opt(k) + // } + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + // In prod, the hashes of all block heights are stored in the hash store while + // the block hashes below are hardcoded to match the hardcoded session IDs used + // in the `session_hydrator_test.go`. + // TODO_IMPROVE: Use fixtures populated by block hashes and their corresponding + // session IDs for each block height in the [0, N] interval, instead of using + // in-place hardcoded values. + // Store block hashes to be used in tests + blockHash := map[int64]string{ + 0: "", + 4: "261594ddc3c8afc5b4c63f59ee58e89d3a115bcd164c83fd79349de0b1ffd21d", + 8: "251665c7cf286a30fbd98acd983c63e9a34efc16496511373405e24eb02a8fb9", + } + + storeAdapter := runtime.KVStoreAdapter(runtime.NewKVStoreService(storeKey).OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.BlockHashKeyPrefix)) + for height, hash := range blockHash { + hashBz, err := hex.DecodeString(hash) + require.NoError(t, err) + store.Set(types.BlockHashKey(height), hashBz) + } + + return k, ctx +} + +func defaultAppKeeperMock(t testing.TB) types.ApplicationKeeper { + t.Helper() + ctrl := gomock.NewController(t) + + getAppFn := func(_ context.Context, appAddr string) (apptypes.Application, bool) { + switch appAddr { + case TestApp1Address: + return TestApp1, true + case TestApp2Address: + return TestApp2, true + default: + return apptypes.Application{}, false + } + } + + mockAppKeeper := mocks.NewMockApplicationKeeper(ctrl) + mockAppKeeper.EXPECT().GetApplication(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(getAppFn) + mockAppKeeper.EXPECT().GetApplication(gomock.Any(), TestApp1Address).AnyTimes().Return(TestApp1, true) + + return mockAppKeeper +} + +func defaultSupplierKeeperMock(t testing.TB) types.SupplierKeeper { + t.Helper() + ctrl := gomock.NewController(t) + + allSuppliers := []sharedtypes.Supplier{TestSupplier} + + mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) + mockSupplierKeeper.EXPECT().GetAllSupplier(gomock.Any()).AnyTimes().Return(allSuppliers) + + return mockSupplierKeeper +} + +// TODO_TECHDEBT: Figure out how to vary the supplierKeep on a per test basis with exposing `SupplierKeeper publically` + +// type option[V any] func(k *keeper.Keeper) + +// WithPublisher returns an option function which sets the given publishCh of the +// resulting observable when passed to NewObservable(). +// func WithSupplierKeeperMock(supplierKeeper types.SupplierKeeper) option[any] { +// return func(k *keeper.Keeper) { +// k.supplierKeeper = supplierKeeper +// } +// } diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go new file mode 100644 index 000000000..ba9cb9b46 --- /dev/null +++ b/testutil/keeper/supplier.go @@ -0,0 +1,59 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/supplier/mocks" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func SupplierKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + t.Helper() + + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + ctrl := gomock.NewController(t) + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockBankKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go new file mode 100644 index 000000000..c7e68ee64 --- /dev/null +++ b/testutil/keeper/tokenomics.go @@ -0,0 +1,126 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + math "cosmossdk.io/math" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/testutil/tokenomics/mocks" + apptypes "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// TODO_TECHDEBT: Replace `AnyTimes` w/ `Times/MinTimes/MaxTimes` as the tests +// mature to be explicit about the number of expected tests. + +func TokenomicsKeeper(t testing.TB) ( + k keeper.Keeper, s sdk.Context, + appAddr, supplierAddr string, +) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + // Initialize the in-memory database + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + // Initialize the codec and other necessary components + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + ctrl := gomock.NewController(t) + + // The on-chain governance address + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + // Prepare the test application + application := apptypes.Application{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100000)}, + } + + // Prepare the test supplier + supplier := sharedtypes.Supplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100000)}, + } + + // Mock the application keeper + mockApplicationKeeper := mocks.NewMockApplicationKeeper(ctrl) + mockApplicationKeeper.EXPECT(). + GetApplication(gomock.Any(), gomock.Eq(application.Address)). + Return(application, true). + AnyTimes() + mockApplicationKeeper.EXPECT(). + GetApplication(gomock.Any(), gomock.Not(application.Address)). + Return(apptypes.Application{}, false). + AnyTimes() + mockApplicationKeeper.EXPECT(). + SetApplication(gomock.Any(), gomock.Any()). + AnyTimes() + + // Mock the supplier keeper + mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) + mockSupplierKeeper.EXPECT(). + GetSupplier(gomock.Any(), supplier.Address). + Return(supplier, true). + AnyTimes() + + // Mock the bank keeper + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + mockBankKeeper.EXPECT(). + MintCoins(gomock.Any(), gomock.Any(), gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + BurnCoins(gomock.Any(), gomock.Any(), gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(gomock.Any(), suppliertypes.ModuleName, gomock.Any(), gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), apptypes.ModuleName, gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + UndelegateCoinsFromModuleToAccount(gomock.Any(), apptypes.ModuleName, gomock.Any(), gomock.Any()). + AnyTimes() + + // Mock the account keeper + mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) + mockAccountKeeper.EXPECT().GetAccount(gomock.Any(), gomock.Any()).AnyTimes() + + tokenomicsKeeper := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + mockBankKeeper, + mockAccountKeeper, + mockApplicationKeeper, + mockSupplierKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + tokenomicsKeeper.SetParams(ctx, types.DefaultParams()) + + return tokenomicsKeeper, ctx, application.Address, supplier.Address +} diff --git a/testutil/network/network.go b/testutil/network/network.go index 103480318..5a7ce763c 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -1,13 +1,26 @@ package network import ( + "encoding/json" "fmt" "testing" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/sample" + apptypes "github.com/pokt-network/poktroll/x/application/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" + tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) type ( @@ -15,6 +28,12 @@ type ( Config = network.Config ) +var addrCodec = addresscodec.NewBech32Codec(app.AccountAddressPrefix) + +func init() { + cmd.InitSDKConfig() +} + // New creates instance with fully configured cosmos network. // Accepts optional config, that will be used in place of the DefaultConfig() if provided. func New(t *testing.T, configs ...Config) *Network { @@ -59,6 +78,191 @@ func DefaultConfig() network.Config { return cfg } +// TODO_CLEANUP: Refactor the genesis state helpers below to consolidate usage +// and reduce the code footprint. + +// ApplicationModuleGenesisStateWithAccount generates a GenesisState object with +// a single application for each of the given addresses. +func ApplicationModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *apptypes.GenesisState { + t.Helper() + state := apptypes.DefaultGenesis() + for _, addr := range addresses { + application := apptypes.Application{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(10000)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + state.ApplicationList = append(state.ApplicationList, application) + } + + return state +} + +// DefaultApplicationModuleGenesisState generates a GenesisState object with a given number of applications. +// It returns the populated GenesisState object. +func DefaultApplicationModuleGenesisState(t *testing.T, n int) *apptypes.GenesisState { + t.Helper() + state := apptypes.DefaultGenesis() + for i := 0; i < n; i++ { + stake := sdk.NewCoin("upokt", math.NewInt(int64(i+1))) + application := apptypes.Application{ + Address: sample.AccAddress(), + Stake: &stake, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, + }, + { + Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d%d", i, i)}, + }, + }, + } + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // nullify.Fill(&application) + state.ApplicationList = append(state.ApplicationList, application) + } + return state +} + +// DefaultSupplierModuleGenesisState generates a GenesisState object with a given number of suppliers. +// It returns the populated GenesisState object. +func DefaultSupplierModuleGenesisState(t *testing.T, n int) *suppliertypes.GenesisState { + t.Helper() + state := suppliertypes.DefaultGenesis() + for i := 0; i < n; i++ { + stake := sdk.NewCoin("upokt", math.NewInt(int64(i))) + supplier := sharedtypes.Supplier{ + Address: sample.AccAddress(), + Stake: &stake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: fmt.Sprintf("http://localhost:%d", i), + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + }, + }, + } + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // nullify.Fill(&supplier) + state.SupplierList = append(state.SupplierList, supplier) + } + return state +} + +// SupplierModuleGenesisStateWithAddresses generates a GenesisState object with +// a single supplier for each of the given addresses. +func SupplierModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *suppliertypes.GenesisState { + t.Helper() + state := suppliertypes.DefaultGenesis() + for _, addr := range addresses { + supplier := sharedtypes.Supplier{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(10000)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:1", + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + }, + }, + } + state.SupplierList = append(state.SupplierList, supplier) + } + return state +} + +func DefaultTokenomicsModuleGenesisState(t *testing.T) *tokenomicstypes.GenesisState { + t.Helper() + state := tokenomicstypes.DefaultGenesis() + return state +} + +// DefaultGatewayModuleGenesisState generates a GenesisState object with a given +// number of gateways. It returns the populated GenesisState object. +func DefaultGatewayModuleGenesisState(t *testing.T, n int) *gatewaytypes.GenesisState { + t.Helper() + state := gatewaytypes.DefaultGenesis() + for i := 0; i < n; i++ { + stake := sdk.NewCoin("upokt", math.NewInt(int64(i))) + gateway := gatewaytypes.Gateway{ + Address: sample.AccAddress(), + Stake: &stake, + } + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // nullify.Fill(&gateway) + state.GatewayList = append(state.GatewayList, gateway) + } + return state +} + +// TODO_CLEANUP: Consolidate all of the helpers below to use shared business +// logic and move into its own helpers file. + +// InitAccount initializes an Account by sending it some funds from the validator +// in the network to the address provided +func InitAccount(t *testing.T, net *Network, addr sdk.AccAddress) { + t.Helper() + val := net.Validators[0] + ctx := val.ClientCtx + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), + } + amount := sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(200))) + addrCodec := addresscodec.NewBech32Codec(app.AccountAddressPrefix) + responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, addrCodec, args...) + require.NoError(t, err) + var responseJSON map[string]interface{} + err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) + require.NoError(t, err) + require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) +} + +// InitAccountWithSequence initializes an Account by sending it some funds from +// the validator in the network to the address provided +func InitAccountWithSequence( + t *testing.T, + net *Network, + addr sdk.AccAddress, + signatureSequencerNumber int, +) { + t.Helper() + val := net.Validators[0] + signerAccountNumber := 0 + ctx := val.ClientCtx + args := []string{ + fmt.Sprintf("--%s=true", flags.FlagOffline), + fmt.Sprintf("--%s=%d", flags.FlagAccountNumber, signerAccountNumber), + fmt.Sprintf("--%s=%d", flags.FlagSequence, signatureSequencerNumber), + + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), + } + amount := sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(200))) + responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, addrCodec, args...) + require.NoError(t, err) + var responseJSON map[string]interface{} + err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) + require.NoError(t, err) + require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) +} + // freePorts return the available ports based on the number of requested ports. func freePorts(n int) ([]string, error) { closeFns := make([]func() error, n) @@ -78,3 +282,10 @@ func freePorts(n int) ([]string, error) { } return ports, nil } + +// TODO_TECHDEBT: Reuse this helper in all test helpers where appropriate. +func NewBondDenomCoins(t *testing.T, net *network.Network, numCoins int64) sdk.Coins { + t.Helper() + + return sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(numCoins))) +} diff --git a/testutil/proof/fixtures.go b/testutil/proof/fixtures.go new file mode 100644 index 000000000..ee80568f1 --- /dev/null +++ b/testutil/proof/fixtures.go @@ -0,0 +1,113 @@ +package proof + +import ( + "testing" + + sdktypes "github.com/cosmos/cosmos-sdk/types" + + apptypes "github.com/pokt-network/poktroll/x/application/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +const ( + testSessionNumber = 1 + testBlockHeight = 1 + testBlocksPerSession = 4 + testSessionId = "mock_session_id" +) + +// SessionsByAppAddress is a map of session fixtures where the key is the +// application address and the value is the session fixture. +type SessionsByAppAddress map[string]sessiontypes.Session + +// AppSupplierPair is a pairing of an application and a supplier address. +type AppSupplierPair struct { + AppAddr string + SupplierAddr string +} + +// NewSessionFixturesWithPairings creates a map of session fixtures where the key +// is the application address and the value is the session fixture. App/supplier +// addresses are expected to be provided in alternating order (as pairs). The same +// app and/or supplier may be given more than once but only distinct pairs will +// be added to the session fixtures map. +func NewSessionFixturesWithPairings( + t *testing.T, + service *sharedtypes.Service, + appSupplierPairs ...AppSupplierPair, +) SessionsByAppAddress { + t.Helper() + + // Initialize the session fixtures map. + sessionFixturesByAppAddr := make(SessionsByAppAddress) + + // Iterate over the app and supplier address pairs (two indices at a time), + // and create a session fixture for each app address. + for _, appSupplierPair := range appSupplierPairs { + application := newApplication(t, appSupplierPair.AppAddr, service) + supplier := newSupplier(t, appSupplierPair.SupplierAddr, service) + + if session, ok := sessionFixturesByAppAddr[appSupplierPair.AppAddr]; ok { + session.Suppliers = append(session.Suppliers, supplier) + continue + } + + sessionFixturesByAppAddr[appSupplierPair.AppAddr] = sessiontypes.Session{ + Header: &sessiontypes.SessionHeader{ + ApplicationAddress: appSupplierPair.AppAddr, + Service: service, + SessionStartBlockHeight: testBlockHeight, + SessionId: testSessionId, + SessionEndBlockHeight: testBlockHeight + testBlocksPerSession, + }, + SessionId: testSessionId, + SessionNumber: testSessionNumber, + NumBlocksPerSession: testBlocksPerSession, + Application: application, + Suppliers: []*sharedtypes.Supplier{ + newSupplier(t, appSupplierPair.SupplierAddr, service), + }, + } + } + + return sessionFixturesByAppAddr +} + +// newSuppliers configures a supplier for the services provided and nil endpoints. +func newSupplier(t *testing.T, addr string, services ...*sharedtypes.Service) *sharedtypes.Supplier { + t.Helper() + + serviceConfigs := make([]*sharedtypes.SupplierServiceConfig, len(services)) + for i, service := range services { + serviceConfigs[i] = &sharedtypes.SupplierServiceConfig{ + Service: service, + Endpoints: nil, + } + } + + return &sharedtypes.Supplier{ + Address: addr, + Stake: &sdktypes.Coin{}, + Services: serviceConfigs, + } +} + +// newApplication configures an application for the services provided. +func newApplication(t *testing.T, addr string, services ...*sharedtypes.Service) *apptypes.Application { + t.Helper() + + serviceConfigs := make([]*sharedtypes.ApplicationServiceConfig, len(services)) + for i, service := range services { + serviceConfigs[i] = &sharedtypes.ApplicationServiceConfig{ + Service: service, + } + } + + return &apptypes.Application{ + Address: addr, + Stake: &sdktypes.Coin{}, + ServiceConfigs: serviceConfigs, + DelegateeGatewayAddresses: nil, + } +} diff --git a/testutil/proof/mocks/mocks.go b/testutil/proof/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/proof/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/service/mocks/mocks.go b/testutil/service/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/service/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/session/mocks/mocks.go b/testutil/session/mocks/mocks.go new file mode 100644 index 000000000..423f63d3e --- /dev/null +++ b/testutil/session/mocks/mocks.go @@ -0,0 +1,10 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which requires `.go` files to compile. diff --git a/testutil/supplier/mocks/mocks.go b/testutil/supplier/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/supplier/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/testkeyring/accounts.go b/testutil/testkeyring/accounts.go new file mode 100644 index 000000000..f71fe665d --- /dev/null +++ b/testutil/testkeyring/accounts.go @@ -0,0 +1,118 @@ +package testkeyring + +import ( + "encoding/base64" + "encoding/json" + "sync/atomic" + + sdktypes "github.com/cosmos/cosmos-sdk/types" +) + +// PreGeneratedAccount holds the address and mnemonic of an account which was +// pre-generated by the `gen_accounts` package. It is intended to be used ONLY +// in tests. It is useful for scenarios where it is necessary to know the address +// of a specific key in a separate context from that of keyring and/or module +// genesis state construction. +type PreGeneratedAccount struct { + Address sdktypes.AccAddress `json:"address"` + Mnemonic string `json:"mnemonic"` +} + +// PreGeneratedAccountIterator is an iterator over the pre-generated accounts. +// A new iterator populated with existing pre-generated accounts can be created +// with the PreGeneratedAccounts function. Alternatively, a new iterator can be +// created with the NewPreGeneratedAccountIterator function, to which a list of +// pre-generated accounts to be iterated over must be provided. +type PreGeneratedAccountIterator struct { + accounts []*PreGeneratedAccount + nextIndex uint32 +} + +// PreGeneratedAccountAtIndex returns the pre-generated account at the given index. +// It returns nil and false if the index is out of range. +func PreGeneratedAccountAtIndex(index uint32) (_ *PreGeneratedAccount, ok bool) { + if preGeneratedAccounts.nextIndex >= uint32(len(preGeneratedAccounts.accounts)) { + return nil, false + } + + return preGeneratedAccounts.accounts[index], true +} + +// MustPreGeneratedAccountAtIndex returns the pre-generated account at the given index. +// It panics on error; i.e. if the index is out of range. +func MustPreGeneratedAccountAtIndex(index uint32) *PreGeneratedAccount { + account, ok := PreGeneratedAccountAtIndex(index) + if !ok { + panic("index out of range of pre-generated accounts list") + } + return account +} + +// PreGeneratedAccounts returns a new PreGeneratedAccountIterator with the +// accounts which were pre-generated by the `gen_accounts` package (i.e. accounts_table.go). +func PreGeneratedAccounts() *PreGeneratedAccountIterator { + return preGeneratedAccounts.Clone() +} + +// NewPreGeneratedAccountIterator returns a new PreGeneratedAccountIterator with +// the given accounts. It is primarily used by the generated code to initially +// construct the preGeneratedAccounts variable. +func NewPreGeneratedAccountIterator(accounts ...*PreGeneratedAccount) *PreGeneratedAccountIterator { + return &PreGeneratedAccountIterator{ + accounts: accounts, + nextIndex: 0, + } +} + +// Next returns the next account in the iterator. It is safe to call +// concurrently and is guaranteed to return a unique account on each call. +// If the iterator index goes out of range, it returns nil and false. +func (iter *PreGeneratedAccountIterator) Next() (_ *PreGeneratedAccount, ok bool) { + // NB: instead of loading and incrementing in separate steps, just increment + // and use nextIndex-1 for the current index. + nextIndex := atomic.AddUint32(&iter.nextIndex, 1) + currentIndex := nextIndex - 1 + + if currentIndex > uint32(len(iter.accounts)) { + return nil, false + } + + return iter.accounts[currentIndex], true +} + +// Clone returns a new PreGeneratedAccountIterator with the same accounts as the +// receiver but with its nextIndex reset to 0. +func (iter *PreGeneratedAccountIterator) Clone() *PreGeneratedAccountIterator { + return NewPreGeneratedAccountIterator(iter.accounts...) +} + +// Marshal returns the base64 and JSON encoded account string. +func (pga *PreGeneratedAccount) Marshal() (string, error) { + accountJson, err := json.Marshal(pga) + if err != nil { + return "", err + } + + accountStr := base64.StdEncoding.EncodeToString(accountJson) + return accountStr, nil +} + +// UnmarshalString parses the given base64 and JSON encoded account string into +// the PreGeneratedAccount receiver. +func (pga *PreGeneratedAccount) UnmarshalString(encodedAccountStr string) error { + accountJson, err := base64.StdEncoding.DecodeString(encodedAccountStr) + if err != nil { + return err + } + return json.Unmarshal(accountJson, pga) +} + +// mustParsePreGeneratedAccount parses the given base64 and JSON encoded account +// string into a PreGeneratedAccount. It panics on error. +func mustParsePreGeneratedAccount(accountStr string) *PreGeneratedAccount { + account := new(PreGeneratedAccount) + if err := account.UnmarshalString(accountStr); err != nil { + panic(err) + } + return account +} diff --git a/testutil/testkeyring/accounts_table.go b/testutil/testkeyring/accounts_table.go new file mode 100644 index 000000000..711a25018 --- /dev/null +++ b/testutil/testkeyring/accounts_table.go @@ -0,0 +1,111 @@ +// DO NOT EDIT. This Code is generated by gen_accounts/gen.go, +// changes will be overwritten upon regeneration. +// +// To regenerate this file, use make go_testgen_accounts or go generate ./testutil/network/keyring.go. + +package testkeyring + +var ( + preGeneratedAccounts = NewPreGeneratedAccountIterator( + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRwZzN5YWU5OWc4bHJ3Nzl3dzBrZzJ6YTg0MzY2ZDZ0NjNrdTdkIiwiTW5lbW9uaWMiOiJsaWtlIGhpcCBzd2FtcCBmb3VuZCBjcnlzdGFsIGZsYW1lIGRlY3JlYXNlIGNydXNoIGNvaW4gY29uZHVjdCBhZmZhaXIgdmlsbGFnZSBjcnVlbCBtb250aCBob3N0IGdsb2JlIHJlZnVzZSByaWdpZCBmZWJydWFyeSBvdmVuIGNvcmUgY3JvcCBpbnB1dCBndWlsdCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczYzI2dG05enp2MnVnbGNhdmFkMGd3dG02azd0cTN0MmtzN2s4IiwiTW5lbW9uaWMiOiJyb2JvdCBzdW5ueSBoaWxsIHNvY2NlciB0b2JhY2NvIHBhbmVsIGluY2x1ZGUgdGFibGUgaW52aXRlIHNoeSB3b3JsZCBwZXJzb24gZG9vciBwdW5jaCBzdGluZyBkZWNvcmF0ZSB3aW5rIHNjaXNzb3JzIG94eWdlbiB0aG91Z2h0IGxpZnQgZGVjbGluZSBtb29uIGxvYW4ifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBzbTVlcDUzaGt5a2RnM3p0NHNwZ214amZ0YXJ6czh1ZjBkZXdqIiwiTW5lbW9uaWMiOiJzdG9uZSBwcmVzZW50IGdvbGQgYmFyZ2FpbiBsZWFmIHJlY2VpdmUgYmFyZ2FpbiByYXcgc2luY2Ugc2hvdmUgYWRqdXN0IGRlcHV0eSByb2NrZXQgZm9sbG93IGxhd3N1aXQgbWFuZ28gc3RhZ2UgcnVud2F5IGRvZyBiZWF1dHkgZ2FzIHNlbnNlIGRpYWdyYW0gdGFzayJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR1bHp3Z3RnN2xkeDJ6dGgzbXNtbXB1d3phN2tsZDUyOTJkenh1IiwiTW5lbW9uaWMiOiJkb25hdGUgYWxpZW4gcGxhbmV0IGRlZXIgbWFuc2lvbiBiZWdpbiBub3RoaW5nIGd1aWx0IGdvb3NlIGNpdmlsIGdhdGUgcHJvZHVjZSBvbGQgZXJyb3IgYmVoYXZlIG1ha2UgZmx1c2ggYmFubmVyIGNyaWNrZXQgbGFrZSBoaXN0b3J5IGxhbXAgdmljdG9yeSB0dW1ibGUifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTRmODRqbGc3ZHFrNHlmNXY3bDg5cHh2a2FyczZtM2czbGRyYXM0IiwiTW5lbW9uaWMiOiJlbGRlciBncmllZiBmYXRhbCBzaXggY291c2luIHByb2JsZW0gdGlnZXIgdmFsdmUgaGVhdnkgY2hyb25pYyBkZXB0aCBnYXRoZXIgZmljdGlvbiBjaGltbmV5IGNyaXNwIGVjb2xvZ3kgbWFuc2lvbiBleGN1c2UgbGV0dGVyIGZhbGwgZXZva2UgY3Jhd2wgaWdub3JlIG9wZXJhIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWNwY25oanU0MDR6NDQ3Z2x4ZzlxdTNsN3c1ZHdzcGQ1emQ0NWhyIiwiTW5lbW9uaWMiOiJ3aGF0IGVtZXJnZSBob3NwaXRhbCBrZXkgZHV0Y2ggZXhhbXBsZSB1cG9uIGdvb2Qgbm9vZGxlIHNldHRsZSB3aXNlIGNvbm5lY3QgdGlwIGFsbCByb29mIGNvbWJpbmUgZXhwbGFpbiBjaGVzdCBsYWJlbCBsb2dpYyB3YWxrIGZvbGQgdHJheSByYWNjb29uIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNrcm11ZGpldDNrY2xjZGVtMG5qaGdodzloMnBsZnFncmNqdnRlIiwiTW5lbW9uaWMiOiJraXdpIG9wcG9zZSBxdWVzdGlvbiBtb250aCByYW5kb20gZXh0cmEgZW1wb3dlciBiYW5hbmEgd29ydGggYXBhcnQgcmlzayBiZXR3ZWVuIGluc2FuZSByaXZhbCBkdWNrIGxlZyB0cmF2ZWwgcmVuZXcgc29jY2VyIGFkanVzdCBnb2RkZXNzIGNyb3VjaCBkaXNhZ3JlZSB0b3BpYyJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXozZ3NrdjdlNjR5MzZ2eDN6Y3M3ZDYzbnJ1bWRhZnRzNjZ1MjluIiwiTW5lbW9uaWMiOiJtb3ZlIGZsaWdodCBjb21pYyB5b3V0aCBkcmFmdCB0cnV0aCB0cmFzaCBiYXNpYyBsYXdzdWl0IHdpbGQgcHJpZGUgdGlzc3VlIGFwYXJ0IGluaGFsZSB6ZWJyYSBmdWVsIHRyZWF0IGhvdXIgcGhvdG8gdG9zcyB2aXNpdCB0b3AgYWxsZXkgc3R1bWJsZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTh1eHV2djA0MmUzbjd5d3FzMmZmODNzaDM2YzdkOXhuOGx1NmsyIiwiTW5lbW9uaWMiOiJ3b3J0aCBjaGlja2VuIGFybW9yIGNhbG0gaGVuIHRvaWxldCBldm9rZSByb3V0ZSBwYXRjaCBmYW1lIHBvcnRpb24gaG9iYnkgZXhjZXNzIG1hbmRhdGUgd29ybGQgdW5oYXBweSBoYXJkIG1vbSBvbHltcGljIGNyeXN0YWwgb2ZmaWNlIHJlbGllZiBmYXNoaW9uIHN1Y2gifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWtqcGRneG0waHN5YWhxcTQ5NHVocGt3d2w4cXZ5N3JudG12OGxoIiwiTW5lbW9uaWMiOiJva2F5IHBvZW0gYm9vc3QgYmxlYWsgc3F1ZWV6ZSBwaXBlIHRvb2wgZmlsdGVyIHRpbWJlciBzbGFiIGdhaW4gcGVvcGxlIG5ldCBhcnJlc3Qgc2VjdXJpdHkgZGVjYWRlIGNyYWZ0IGFwcGVhciBzbW9rZSBib2R5IGFzc2F1bHQgYmVhY2ggZXhvdGljIGFsdGVyIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXVudXJnd3Zna2s1NmwzM2d3bjA3MjM3NTkwODluOGU0ajRweXJmIiwiTW5lbW9uaWMiOiJ1cmJhbiBicm9jY29saSBncml0IG1lcnJ5IHJvbWFuY2UgbXl0aCBqb2IgZm9jdXMgY2xpY2sgc2h5IHByaW9yaXR5IGFzc2V0IGJyaXNrIHJlY29yZCByZW5ldyB0aW1iZXIgc3RlYWsgZmF0IGd1YXJkIG1vdGhlciBoYW5kIG5vdmVsIGN1cnZlIGxhdmEifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTY1ejRqc3Nncjl5dXNuZXNwdjd2YXk1bjcyNmNoMnYwdHF6dTU1IiwiTW5lbW9uaWMiOiJ0dW5uZWwgaHVtb3IgbWltaWMgZ2F0ZSBwaWxsIGJyZWFkIHRpbnkgc21vb3RoIHRvcGljIHdpc2UgdHdpY2Ugc3VnZ2VzdCBzb3VsIGxpbWl0IGluY3JlYXNlIGFyZWEgb3JhbmdlIHNoZXJpZmYgcHVyc2UgaW5jb21lIGphZ3VhciB3aWZlIG9yZGluYXJ5IHZpb2xpbiJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW12cHl1OTV6bndscnprdDV0ZTdhZXMyeXN5eGhmZHptN3hlbWVsIiwiTW5lbW9uaWMiOiJsYXJnZSBiYW5hbmEgZ3JhcGUgbW9ua2V5IHVwcGVyIGdpYW50IGFjdGlvbiBtdXR1YWwgdGhlb3J5IGJlbmVmaXQgaW5kaWNhdGUgdGF0dG9vIHVwZ3JhZGUgb3BlcmEgY2hhb3MgcGFyYWRlIHNvbWVvbmUgZWR1Y2F0ZSBoYW5kIG5vYmxlIGpva2UgcmViZWwgcmFjY29vbiBhcm0ifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTcwbmFrYTVnd2swOG5xdzVqYXZtZ3A3c3VnMzUwMHMyM242ZzZmIiwiTW5lbW9uaWMiOiJlbGRlciByYXRlIGJ1c2luZXNzIGdvYXQgdGFuayBtYXR0ZXIgdXBncmFkZSByaW5nIHNob3ZlIGVjb25vbXkgYXJ0aXN0IGJhY2hlbG9yIGZsYXZvciBicmlzayBmYW1pbHkgdGVuIGJ1ZGR5IHJvYm90IHJlcXVpcmUgYWRhcHQgc3VjaCBzYWQgc2libGluZyBwaXN0b2wifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTlxcW5yNWE1M2R2azBodGgyNGRobjVhYXMwdm53bHpwbnZyNm1oIiwiTW5lbW9uaWMiOiJrYW5nYXJvbyBsaWNlbnNlIGdvb2Qgb3ZlciBxdWVzdGlvbiBzY3JhcCBhY3Jvc3MgZGVjb3JhdGUgZnJlc2ggaGFtbWVyIG1lcmdlIGNvbmZpcm0gZm9sZCB1bmFibGUgY3JhbSBzcXVlZXplIHN1cHBseSBiaXJ0aCBob3JzZSBkZXRhaWwgd2F2ZSBsaW1pdCBpbmNsdWRlIGhhaXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnN2Z6OWV2YWE4OGd2Nm1nNHA3dmM3Y2hzaGh3Nmg1NmRyM25lIiwiTW5lbW9uaWMiOiJ3aWRlIGJhdHRsZSBsZW9wYXJkIGxlbmQgcmFpbCBkaXZlcnQgZm9nIG9ycGhhbiBvY2VhbiBlbmZvcmNlIHRydWUgY29tcGFueSBkcmF3IGVuam95IHRoYXQgY29yYWwgYmxvdXNlIGZyb250IHNwb25zb3IgY29udHJvbCBjb2xvciB0b3JuYWRvIHBpbmsgYWRhcHQifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZ3cXgwNHJqdmEzdjh4NWYzdnZtbXlwOW1mOHkzajJ1bDk3NmZhIiwiTW5lbW9uaWMiOiJncmllZiBhY3R1YWwgaW5wdXQgYmVsdCBicmFpbiB3aW5nIGp1bmsgeW91bmcgZ2VuaXVzIHBhcmsgY2lnYXIgaHVyZGxlIGxlYWRlciBkZWNlbWJlciB0d2VsdmUgbWl4dHVyZSBjb252aW5jZSB1bmZhaXIgZmxhZyBzY3JpcHQgY2hhb3Mgc3dvcmQgbWlkZGxlIGplbGx5In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWFjMm52eHZ4aHhkaDlrc3U1M2VxdzQzMzg3emM0ajNjNHhrdW52IiwiTW5lbW9uaWMiOiJhbWF6aW5nIGh1bmdyeSBkdXN0IGVycm9yIHNjcnViIG1vcmFsIHdhdGVyIG9idGFpbiBib251cyBwdW5jaCBjbGVyayBicm9jY29saSBwcm91ZCBqdXN0IGNydWlzZSB0dXJrZXkgaWRsZSB0dW5uZWwgc2FsYWQgd2luZG93IHJlbnQgc3RvdmUgc2hhbGxvdyBydWcifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN2eXQ4OGtrYXNkM213ZnhmcWFnbnk0c21oeHA5a2g0Y2FncjAwIiwiTW5lbW9uaWMiOiJyZWFkeSBsaXF1aWQgbW9ua2V5IGluZG9vciBjYWJiYWdlIHRyb3BoeSBidXJkZW4gcGxheSBhbmdsZSByZXZpZXcgdW5sb2NrIGhhaXIgcGFyZW50IGhhcmQgaGFsZiBuZWdhdGl2ZSBwZXJtaXQgcmVndWxhciB0cmFkZSBmcm9zdCBsYWR5IGZ1cnkgcmVndWxhciBzcXVhcmUifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXZocWNobTlkNnBybWU1enFsdHlzODYwZ3I3YWNka2RodGtnNnJhIiwiTW5lbW9uaWMiOiJpbnF1aXJ5IGxpYXIgaW1pdGF0ZSBzY2FuIHByZXBhcmUgc3RhdGUgZmluZSBjdXJyZW50IHZpcnVzIHBheW1lbnQgc2hvdmUgbm9ybWFsIGRvdWJsZSB2YXVsdCB0cmF5IGhlYWx0aCByZXNwb25zZSB3YXZlIHJlbmRlciByaXZlciBmbGF0IHNraXJ0IGxlY3R1cmUgdGVuYW50In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxkcTVrbHhjNmw1cjl5Mnc2NXJ2OGdrbmV4YXNkbjBmZzJwemxtIiwiTW5lbW9uaWMiOiJhZGQgaG9ja2V5IGJvb3N0IGNoYXQgc2lsZW50IGVyb2RlIGZsYW1lIGJhdHRsZSBwdXp6bGUgcm91Z2ggc2VjdGlvbiBiZWVmIGxpZ2h0IGZpbmQgcm91dGUgcmFiYml0IHZvaWQgYXJtZWQgbW9yYWwgcmlvdCBjaGFtcGlvbiBkcmlsbCBoYXphcmQgYm9vc3QifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR0ZTA4aHNueWowcmt6em1mcnk4ZXplYWFkcGVkeHQ3eTg1N3c2IiwiTW5lbW9uaWMiOiJoaWRkZW4gc3BhcmUgbW90aW9uIG5pZ2h0IGZhdCB0ZW4gb2J2aW91cyBwdXp6bGUgYWRkcmVzcyBtZWxvZHkgamFja2V0IGVsc2UgaW5mbGljdCBhYmlsaXR5IGtleSB2YWxsZXkgZHJlc3MgcG93ZXIgbXVzaWMgYXdmdWwgc29vbiB1bmRlciBzb3VsIGFybW9yIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTM4dnIwY3hqcHhsbGs1YXVhdWM0Z3V3eGxseWd0MzczOG1jcTBwIiwiTW5lbW9uaWMiOiJ0cmFwIGNvdXNpbiBzaGFsbG93IGZpcnN0IHJveWFsIHRvZ2V0aGVyIHZpYWJsZSBiYW1ib28gYm9tYiBvY3RvYmVyIHZhY2FudCBjYW1wIGZyYW1lIGRpc2FncmVlIGN1cCBjaHVja2xlIHN5bWJvbCBtYXRlcmlhbCBhdWd1c3QgYmVzdCBtYW5hZ2Ugcm9vZiBmbGF2b3IgaW5zaWRlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXIwcDB4eTA3dXhmNngzcDNrZ25yeGN3bjdjNjczY3hlZzJtc240IiwiTW5lbW9uaWMiOiJpZ25vcmUgdG9hc3QgcmluZyBob21lIGFoZWFkIGRlY2VtYmVyIGJpY3ljbGUgbW91c2UgZ2VudGxlIGZsb2F0IG5hbWUgZW1iYXJrIGxhcmdlIGNodXJuIGVtYnJhY2Ugc3dhbXAgZnVybmFjZSBjcmFkbGUgcHVwcHkgYW5jaWVudCBub3NlIGRlc3Ryb3kgb3JkZXIgdmVoaWNsZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW13MjlueXVndWFsNjd5d3E5c2N1NGMzNXZuaHdtcG1zampwNW5hIiwiTW5lbW9uaWMiOiJkYW5nZXIgd2ViIGxlbmQgZXJhc2UgaWdub3JlIHRyYWZmaWMgZGV2b3RlIGtuaWZlIGRvY3VtZW50IHNsZWVwIGludm9sdmUgdHJpcCB3aW5lIHNvbmcgZmVhdHVyZSBtYXJpbmUgbWlzZXJ5IGFyZWEgY2FuZHkgcmFkYXIgYm9tYiBkZXN0cm95IHJlbWVtYmVyIHNpdHVhdGUifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWs3dzNkbWdrdG1oc3kwa2xoeTlhazBqcjQ1ajdoMzNra3B5anZ4IiwiTW5lbW9uaWMiOiJtZW50aW9uIGp1bXAgaWRlbnRpZnkgY2FwaXRhbCBtZW51IGNvcm4gY2FuY2VsIHJvYWQgZXF1aXAgZW5kb3JzZSB3aW4gYnVyZGVuIGZvc3RlciBsb3ZlIGNsZXJrIHByb2R1Y2UgZ3JlYXQgdGhlcmUgZ2FsYXh5IGRvbmtleSBzZW50ZW5jZSB0cnVjayBqb3VybmV5IHJvdXRlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWQ2cWpqZTlzc3c0cTN6dzkzM3g5OXhkZTZrMzQ4bmx6cHcybThoIiwiTW5lbW9uaWMiOiJjeWNsZSBzdHVtYmxlIGRheSByZXNpc3QgYnVpbGQgY290dG9uIHZlcmIgcG93ZGVyIGFjY291bnQgdml0YWwgdmlicmFudCBzaW1pbGFyIGZhbWlseSBhZmZvcmQgc2FtZSBtdXR1YWwgcGVsaWNhbiBiYW5hbmEgYnJvdGhlciByb3VnaCBiYXJlbHkgaXNsYW5kIGF3ZXNvbWUgbHVuYXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5xcWZmd2xnZ3YyZzR3dWFzenU1M3QycWZjd3E5cHZlNHBtdTRjIiwiTW5lbW9uaWMiOiJwYXRpZW50IHNtYWxsIG11dHVhbCBhcmVuYSBmZXcgYm91bmNlIHRvbmUgYXV0aG9yIGJyb29tIGx5cmljcyBiZWdpbiByZXBhaXIgbWV0aG9kIGJyb256ZSBob3RlbCBwbGF0ZSB3aW50ZXIgZHdhcmYgaGFyYm9yIGNhZ2Ugc3Rvb2wgc25pZmYgc29hcCBleGNsdWRlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWprMHVyaGRsYWF0enJwZjJzY3l3MmhjeHN5eGVyeHAyazV5ODlnIiwiTW5lbW9uaWMiOiJtaW5kIG1hbmRhdGUgYXNzYXVsdCB0ZXJtIGdsb29tIGJsYWRlIGNodXJuIHZlcmlmeSBicmlkZ2UgZ3JhbnQgYWhlYWQgZGljZSBqZWFucyBib3kgcGljdHVyZSBiaXJ0aCBleHBlY3QgaHVycnkgc2NhbGUgb2JzZXJ2ZSB0aHJlZSBhbG9uZSBtaXggdmVsdmV0In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXd5d3Y5OTh5emxqcXZmNzNkMGVncm5qejVzdTZubGh1enFrM3plIiwiTW5lbW9uaWMiOiJ0dXJuIGVuZm9yY2UgZmFjZSBtdWNoIHV0aWxpdHkgcGF0aWVudCBhcnQgYnJvd24gYm94IHVwc2V0IGxhYm9yIGVuZG9yc2UgdGFnIGVhcnRoIG9mZmljZSBsb3VuZ2UgZGl2b3JjZSBiYXNlIGdsYXJlIGx1bWJlciB0b2UgdG93biBwaXRjaCBzaXN0ZXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBoeXhnaGN4NGZ5bnZydDR5NG52eW5kenhoMGRyOWZ4N3NrNXA3IiwiTW5lbW9uaWMiOiJyaXZhbCB0d28gbWFyZ2luIGh1bnQgYnVkZ2V0IHdhaXQgdHJpYmUgc3VubnkgcGlnZW9uIHB1bHAgc2hvb3QgdHJlYXQga2V5IGRpc2FncmVlIHVtYnJlbGxhIG9yaWVudCBuYXR1cmUgdG9tb3Jyb3cgbGVjdHVyZSBsb2dpYyByYW5jaCBzaGFmdCBmb3NzaWwgY2FuY2VsIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5kejRsNHN1OWRjcWVxcjd1eDR3enJzY3c0dmVoZ2hxNXo4cnBoIiwiTW5lbW9uaWMiOiJ0aW1iZXIgdGVuYW50IHNpbmcgbHVuY2ggc2VlZCBiZWx0IGxldHRlciBydWxlIHNjYXR0ZXIgZmFsc2Ugcm90YXRlIGl0ZW0gY2xldmVyIHNsaWdodCBmaWx0ZXIgZmVlIHRyeSBibG9zc29tIGZsb2NrIGdyZWVuIHVudXN1YWwgbmV0IHNuYXAgYXdmdWwifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWd5dGt5aDJoZHk0YzNqNzJxZGRrMjNjNmNsenV4emszMHRlY3ByIiwiTW5lbW9uaWMiOiJoYXZlIGxhbmd1YWdlIGhvcGUgY2hvaWNlIGZlZGVyYWwgYmljeWNsZSBxdWl0IGFsbGV5IHBhcmsgcGxlZGdlIHJlcG9ydCBhbm51YWwgc2hydWcgaG9yc2UgYWNjZXNzIGZvcnVtIGJsdWUgc29mdCBtaWRuaWdodCBsYXRpbiB3aWZlIGh1cnJ5IGVyb3Npb24gc2VnbWVudCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVxeXdzOGx2eWRrandsN2VtM2c2ODVjcXZzMGU4amE5NmNjdXRkIiwiTW5lbW9uaWMiOiJub3RhYmxlIGlsbCBkcmFtYSBsdW5jaCBmb3JjZSBib21iIG1hcmdpbiBpZGxlIGZpbmUgdGFzdGUgZGlzaCBub3RhYmxlIHB1c2ggZXhpdCBhaXJwb3J0IGNhc2lubyBzY2hvb2wgY2FnZSBzdHVtYmxlIHRvd24ga2lkIHN1cHJlbWUgYWxhcm0gdGhleSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWN0NDV6a3RnNDd2a3I3a3lyNmVlNG54eWdndzU1c3R4c3ZkN2E5IiwiTW5lbW9uaWMiOiJldmlkZW5jZSBqb2luIHJhdGUgdW5rbm93biBzcG90IHNob2Ugd2hpc3BlciBzZWVkIGNpdmlsIG1haWQgbmVydmUgZG9ub3IgYmFsY29ueSBjcm91Y2ggc29jY2VyIG9rYXkgb2ZmZXIgamVsbHkgYWdlbnQgY3Jhd2wgY2FudmFzIGVsZGVyIHNhbmQgZGF1Z2h0ZXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXh5bGEzbjNtY2RnOGdmbHJ4dmR3cG1ycDlhYWQ1eGZmcTY4eDY3IiwiTW5lbW9uaWMiOiJzb29uIGdvc3BlbCBmcmFnaWxlIHNhbG1vbiBnb29kIGVjaG8gcGFycm90IGRpbGVtbWEgc3BhcmUgZmF0aWd1ZSB0d2luIGVzY2FwZSBwYW50aGVyIHRyaXAgZXh0ZW5kIGVuYWN0IGJlYW4gbGVnYWwgYmlydGggY29uZmlybSBlbXBsb3kgY29sbGVjdCBtZWRhbCB2aXRhbCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXNrN2N1YWhxemd2aGRqdWE5djZhcW43eHBkc2c5azVqcWw2ZGx2IiwiTW5lbW9uaWMiOiJwcmlzb24gY2VudHVyeSBwdWRkaW5nIGZyaW5nZSBwcm9maXQgYWxwaGEgZGV2aWNlIGxvY2sgZW1wdHkgYWJvdXQgY3J5IG96b25lIGZlYXR1cmUgdmlvbGluIHlvdXRoIGRlY2lkZSByYXZlbiBkaXNwbGF5IHRhbGVudCB1c2FnZSBsb25lbHkgaGludCBoYWlyIHZpbnRhZ2UifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw4dXYydXRkZXJmNDczYW14Zno3bGw1djBlNWpnbWtqaGc5MHJyIiwiTW5lbW9uaWMiOiJ2b2lkIHNpYmxpbmcgd2FybSBmZWJydWFyeSBiaWN5Y2xlIGJlaGF2ZSBydXJhbCBjaHJvbmljIGNoZXJyeSBmYW1lIGRpc29yZGVyIHN3aXRjaCBicm93biBzYW1lIGNsaWVudCBnb29zZSBkcmlmdCB0b3NzIGFyZWEgcGVybWl0IGRlY3JlYXNlIHJpdHVhbCBpbmhhbGUgYmlydGgifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhncXduZzM4MGdka25xdHcza2ZyOXRweXE4em5ldHVrcWdrbTBoIiwiTW5lbW9uaWMiOiJ2aWN0b3J5IHdvcnRoIHllYXIgcmVkdWNlIGxlYWRlciBleGl0IHJhcGlkIHRydWNrIHNjYW4gbWl4ZWQgbGltaXQgbWFyaW5lIGluc3BpcmUgdGVzdCB3b3J0aCByZXBhaXIgY29tbW9uIHNpbWlsYXIgZ2hvc3QgY29uZ3Jlc3Mgc2NhcmUgZmluZ2VyIGFyY3RpYyBkb3NlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNkcW05M2poZDI5anJqdjl6eWFxOGtteTk2d3RqcXgycDh5ZnltIiwiTW5lbW9uaWMiOiJzaG92ZSBwcm92aWRlIG1lYXN1cmUgbGVhZiBkb25vciBnb3Zlcm4gcmViZWwgcmV0aXJlIGNvcHkgb25jZSBuYXN0eSBzdWJqZWN0IHNldHRsZSBjcnkgZmF2b3JpdGUgd2VhciBkaXNtaXNzIGFzdGhtYSBrZWVwIGZpbmFsIG1vZGVsIHRyaWdnZXIgbGF0ZXIgYmFycmVsIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBjN2x3am5rejlrZnNsdmZyOHJrOTk0amh6dmowMDIyeXpoazU1IiwiTW5lbW9uaWMiOiJzbGlnaHQgbGFiIGNyZXcgZGVmZW5zZSBjb2FjaCB1cG9uIGZhY3VsdHkgYXJlYSB3b2xmIGV4cGxhaW4gbWFudWFsIGdvcmlsbGEgbW9uc3RlciBmbGlwIGV4YWN0IGR1c3QgYmxvb2QgdG95IHBsYXRlIHNhbG1vbiBkaXJlY3QgYWdlIGJ1bGIgdG9uZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWY5c3IyN3Frajk4ZTJ5bXB2MHhjZDJ1Zmsyd2VqbGRsZnpmNHc3IiwiTW5lbW9uaWMiOiJjYW1wIGdhdGUgZ2lhbnQgbWFjaGluZSBwdW1wa2luIHNpYmxpbmcgaHViIHVuaWZvcm0gbGljZW5zZSB1bmRlciBjdXJ2ZSBsYW5ndWFnZSBkZXBhcnQgYXNzdW1lIGFtYXRldXIgZ3JvdyBkaWFsIG11dHVhbCByaWIgdm95YWdlIGdvZGRlc3MgY3JlZWsgYXNrIGNhc2gifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXkwOWM0cmhndDJybWxjenhld2c3eTQ4cmp4aG1qZXM2NTc3dmRzIiwiTW5lbW9uaWMiOiJweXJhbWlkIHJlbmV3IGlsbCBzdG9jayBtYXJibGUgbnV0IGdvcmlsbGEgZGlydCBleGhhdXN0IHNoYWRvdyBjb3JuIGdvc3BlbCBpbnNpZGUgbnVyc2UgZWFydGggZm9vZCBwYXRoIGJ1eWVyIHNhdG9zaGkgY3JhZGxlIHBpZ2VvbiBsZWFmIHNlYXNvbiBzY3J1YiJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTk0ZHZmN2F4ZjB4MnB1cG01ZXh0ejIyd242dWtmNGZrNWozZGhnIiwiTW5lbW9uaWMiOiJ0b3VyaXN0IHVuaWZvcm0gc2tpIHN1cnZleSBpbm5vY2VudCBvYmxpZ2UgZm9yY2UgYmVjb21lIGFjcXVpcmUgcmVtYWluIG11c2hyb29tIGJhbGNvbnkgY2hhcmdlIG1hc3RlciBjaGVlc2UgZW1wbG95IHJpZGUgYmFyIHJvYnVzdCB0aW1iZXIgc29jayB0b3VyaXN0IHVwcGVyIHJlc2lzdCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTQ1dTV3bnZnNXlzd3hqcmx1bXhsbmpjaDJxZndyMjUyem1yZGVqIiwiTW5lbW9uaWMiOiJiZXR3ZWVuIHRyYW5zZmVyIGxpZmUgcm91Z2ggc3RvY2sgaW5oZXJpdCBvdXRlciBza2F0ZSBhbmNpZW50IHRoZXkgYmluZCBjdWJlIG92ZXIgbXlzZWxmIHJlY3ljbGUgc2Vzc2lvbiB2ZW50dXJlIGJvaWwgZW1wdHkgbG9jayBicmVhZCBleHBsYWluIGFyZ3VlIG1hZCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw1bHE1dTh6emc0Z2dyc2Y5ZmdxbDJsODBscjhxYWRmY3F5MGFuIiwiTW5lbW9uaWMiOiJweXJhbWlkIGd1biB2YXBvciBkZXBlbmQgcHVtcGtpbiBwZW4gY3JlZWsga2V0Y2h1cCBjYWxsIGJvb3N0IGNhcGFibGUgbmFwa2luIGF1ZGl0IGFtdXNlZCBzb2x1dGlvbiBsaXR0bGUgbWFwbGUgb2NlYW4gaGlsbCBsb29wIGxpbmsgZ2FsbGVyeSBib3ggc3RlcCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWFkbXdkMjQzbmo0Zmo1MGZsOHcyY2hqdnZucjZqbmduMno5NHkwIiwiTW5lbW9uaWMiOiJsZWdhbCBoZWFydCBva2F5IGFpcnBvcnQgYWdlIGhlZGdlaG9nIHNsZWVwIHJlcGVhdCBhY2N1c2Ugc3ltcHRvbSBmb3N0ZXIgYmluZCBkcmlsbCBjcnVtYmxlIGVmZm9ydCBmbG9jayBtYXJibGUgY3Jvd2QgZ3J1bnQgZ3JhYiBvcmlnaW5hbCBlc3RhdGUgYWRkcmVzcyBwdXNoIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTh5eGo2M3kwdXhtM2U5dzl4ZGE0cGxodzAyZnU4MDA1M2FtenU5IiwiTW5lbW9uaWMiOiJtZW50aW9uIHBsYXkgYmF0dGxlIGxveWFsIHVuZm9sZCBmb3VuZCBjZW50dXJ5IGVuZCBjb21lIGNsdXRjaCB3YWxsIHdvb2QgZW5yaWNoIGVxdWlwIGFybW9yIGJvbnVzIGhlbiB2aWRlbyBtb3JhbCBkb2xsIGFuZ2VyIHNraXJ0IHNvZGEgc2F2ZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczZHQydTdnOW1udWU4amZnamN3ZzZucXA2NjJsdTRjNm0zcHlsIiwiTW5lbW9uaWMiOiJjb25kdWN0IGludGFjdCBhaXNsZSBjaGFvcyBxdWFsaXR5IHRoZW9yeSBjaHVuayBqdWljZSBjcnVpc2UgZmVlIHJpcHBsZSBsaW1pdCBnYXVnZSBmb3Jlc3QgY2hhbmdlIHNhdXNhZ2UgZXh0cmEgYWxwaGEgdXNhZ2UgZXhvdGljIGRyaWZ0IGJyYXNzIGdvcmlsbGEgdGFzdGUifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXBsenR3Z3Qzc2c1dmszbHNtbGtsOTV1cmw1ZDR0bGd4Y3RkZGU5IiwiTW5lbW9uaWMiOiJvYmplY3QgYmFyIGNhbG0gbXl0aCBmZWUgdG9vbCBmaW5nZXIganVuZ2xlIHNpbXBsZSBiYWcgem9uZSBjaGFzZSBzY2hvb2wgYmVuY2ggYmVsdCB0aW1lIHdlYXRoZXIgZXhwcmVzcyBhZmZhaXIgc2NpZW5jZSB2ZXJiIHJlY29yZCBpbnRhY3QgZGFyaW5nIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhsZDhrYTBxaDY3ZjJuNWV4bXplY3RlNjRhd3VkNTNkMGY3bnhhIiwiTW5lbW9uaWMiOiJob2xpZGF5IGxpdHRsZSBwb2xhciBzdWRkZW4gY29uZmlybSBzb25nIGRpYW1vbmQgcHJpZGUganVzdCBkb3ZlIG5vYmxlIGZhdm9yaXRlIGNlbnR1cnkgcnVyYWwgZmFpbnQgYWxpZW4gYWN0dWFsIGhvbGUgZHJpZnQgcG9vbCBhcnJhbmdlIGFscGhhIGJvdHRvbSBlbnRyeSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXc2YzBleW56Zm5zd2RhNXpnOHRta3hrem1sbjNkZHY3cGd5enZ0IiwiTW5lbW9uaWMiOiJ0b25pZ2h0IGZpbGUgZGVmZW5zZSByZW5ldyBjb2lsIHVuY2xlIHBpZyBub2lzZSBibHVyIGVsc2UgZ2xvdmUgcmVtYWluIHJ1ZyBjdXJ0YWluIGNvbmZpcm0gb3JkaW5hcnkgYnVpbGQgY3J1c2ggY2FyZCBsZWF2ZSBmbGF0IGp1bmlvciBkZWJhdGUgd2F0ZXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxybTB1dXM5Mzdxeng4Y3hnNXNmNWo5Z2VnanFmd3B6dHAydWd6IiwiTW5lbW9uaWMiOiJzdGF0ZSBvcmNoYXJkIGZ1biBlY29ub215IGxhZGRlciBvY2VhbiBmb3ggYm95IGN1cmlvdXMgYWxidW0gdGVzdCBzdGFpcnMgcG9ldCBlaWdodCBiZXN0IHN0cmVldCBhdXRob3Igc3Bpa2UgdGlueSBmYW4gc2F1c2FnZSBub3RhYmxlIGNydW5jaCBzaG9ydCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNobDdteGN0Y3QyZ2w2cDlnZTc2c2VjZDBtNG14dmp4ZGZmdWQ4IiwiTW5lbW9uaWMiOiJidWxsZXQgZ2lybCBtYXNrIHNhdXNhZ2UgdHJvdWJsZSBhZmZhaXIgcHJlc2VudCBvdmVuIGRpZXNlbCBlcm9zaW9uIHByb2dyYW0gY2hpbW5leSBsYXB0b3AgcGhvbmUgc291cmNlIGh5YnJpZCBidWJibGUgc2hpbmUgaGludCBzdXJ2ZXkgdG9ydG9pc2UgdmF1bHQgcGlhbm8gdGVuYW50In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTI2M2ZkbjQ0dnQwcjBzeWN0MGh1NXMzeTZmeTVsYzIycWN6ZHNyIiwiTW5lbW9uaWMiOiJwYXRjaCBhbmltYWwgZGVicmlzIGltbXVuZSBhcmVhIGRvY3RvciB1dGlsaXR5IHJpYmJvbiByZXZpZXcga2l0dGVuIHByb2dyYW0gY2l0aXplbiBtb3RoZXIgYWxtb3N0IGRlZmluZSB3aGVlbCBhYm92ZSB5ZWxsb3cgdHVpdGlvbiBpZGxlIG1vcmFsIG91dGRvb3Igc3B5IHdpbGwifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTQ4a2NhamY1dzZnZW04dmE5dmhncDl5Nmxxa3JmdXN2Z3Zqc2R6IiwiTW5lbW9uaWMiOiJtYXRyaXggYnVkZ2V0IGNsYWltIHJldGlyZSBnb2xkIGluc3RhbGwgdHJhdmVsIHN0dW1ibGUgbGF0ZXIgcmVzb3VyY2UgY3Jpc3AgY2xhcmlmeSBza2F0ZSB0b3Agc3BvcnQgZ2VucmUgbWFuYWdlIHNvYXAgZnVuIHRyaWdnZXIgZmluZ2VyIGJvcmRlciByZWFkeSBmb3JjZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRlY3M1bHY3OHV0a2V5aHUzc2h6N3cyaGd2MDhmOXk1dm03M2V4IiwiTW5lbW9uaWMiOiJwb29sIHNtYXJ0IGNpZ2FyIG1ldGhvZCBkaXp6eSB0YWxrIG1hbmdvIGJpbmQgd29vbCBicmFja2V0IGZpeCBlYXJseSBwZWFyIGVudmVsb3BlIGFlcm9iaWMgZXZva2UgdHJpZ2dlciBpbmNvbWUgbXlzZWxmIGhlbiBiaXJkIHBvc2l0aW9uIGhvbmV5IGFtb25nIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJ2cXR0dmo5eDAwZW1kYXJxODk2eXJmMmFwYXN4Z3prZnJqOHJmIiwiTW5lbW9uaWMiOiJhZG1pdCB1c2FnZSBjb21wYW55IHJlY2VpdmUgcGF0dGVybiBjcnVlbCBzdW5ueSBuZWVkIGltcHJvdmUgbWlub3IgZGFuY2UgZXNzZW5jZSBzaGFsbG93IGVhcnRoIGlucXVpcnkgbm9vZGxlIGtuZWUgcmVzaXN0IGNvbWJpbmUgdm9pY2Ugc25ha2UgZGl6enkgbWFuIHBpYW5vIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWdkczR5NzRka3owY2pwdWRuZHM2MDY1Zzl4Mng4NHpxbmo2OWNjIiwiTW5lbW9uaWMiOiJ0b2RheSBxdWFydGVyIGludGFjdCBoZWFydCBtb3VzZSBncm91cCBleGN1c2UgbmVhciBmaWxtIHNob2Uga25vdyBjb21pYyB0cm9waHkgcmFpc2UgZm9zdGVyIHN1Z2dlc3QgbWF4aW11bSBvY3RvYmVyIGRpcnQgYXJteSBjdXJ0YWluIGVydXB0IGF0dGVuZCBmb2cifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVmdHZyNWV0dXRocHN0aHJyOWN0M3I0NWFwZ3dqN2tncmM4eGRkIiwiTW5lbW9uaWMiOiJ0aGFuayBmbHkgZGl2b3JjZSBzaHJpbXAgbGFrZSBzaWxrIGd1YXJkIHN5c3RlbSBjYXJ0IGVtYnJhY2UgZWRpdCBwYXBlciB0aWx0IHJpc2sgYmV0dGVyIG1vdG9yIHRvcnRvaXNlIGFjcXVpcmUgZWNobyBmb29kIG9yZGVyIG1hbW1hbCB0d2VsdmUgdm9pY2UifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW4wMDhycGt5aHlyZHA5c2Z2ZDYyd3p0cHhseXU0eGc5YTVnanR2IiwiTW5lbW9uaWMiOiJjYXNlIGxlc3NvbiBzdXJmYWNlIHNjaXNzb3JzIGNpdmlsIHNvcnJ5IG5lc3QgZXRoaWNzIG1lc3NhZ2UgaG9ybiBhZmZhaXIgZGVtaXNlIGJsb3Nzb20gbXVmZmluIGRyaWZ0IGZhbWUgYmluZCBzaGFyZSBtaWRkbGUgc3BvbnNvciBkZW55IHByZXBhcmUgbGlnaHQgc2hpZnQifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXhkdXc0YWFuanNteXIzZ2s4OGt2OXVjNHA4eG1lbGQzcWxsOXJxIiwiTW5lbW9uaWMiOiJydWRlIGJhc2tldCB0dXJrZXkgZWFybiBpbnNpZGUgYmVjb21lIGF3YWtlIG1vdmUgbGF5ZXIgYmFycmVsIHBlbmNpbCB1bmRvIGxhYm9yIGF2ZXJhZ2UgZHVuZSBjaGFuZ2UgYmFyZ2FpbiBwcmV0dHkgbGl0dGxlIGx1Y2t5IHN1aXQgcmVnaW9uIG1lbW9yeSBsYXp5In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTU4NXA1ZzMyeHZ5N21weDA3eGhkeWF3NHZnZXN2YzRjZ3l5dThsIiwiTW5lbW9uaWMiOiJwYXRjaCB1bmxvY2sgdGhlcmUgY29weSBzaWxlbnQgcmVhZHkgcHVuY2ggdmVyYiBhZ2VudCBpbnZlc3QgbXl0aCByZXZlYWwgZHVuZSBsb25nIGNoaWxkIHN1bnNldCBrbmlmZSBzbWlsZSBtYWQgcm9vbSBtZXJjeSBhdWd1c3QgZ3JhY2UgcmVzb3VyY2UifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXprNWtkNXA2Z2xlOHJsdzVqZ2huaDh2aHI2ZWNuYXdqbXpucHN3IiwiTW5lbW9uaWMiOiJlY2hvIHdpc2UgY2hhdCBkb2xwaGluIGhhcHB5IG5leHQgdGltZSBmaWN0aW9uIGlkbGUgZmxhdCBwcm9maXQgYXJyb3cgZGlmZmVyIGJlaGF2ZSB0YXN0ZSBmbGlwIGNyb3AgZ2xhbmNlIGNvbmdyZXNzIGZldGNoIGNhcnBldCBzcGljZSBzdGVyZW8gZXZpZGVuY2UifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWY0MDU0azYwZjY5eXVtZnh6ZWc5dmNlbTRzeTByZWQ2cTRza2R5IiwiTW5lbW9uaWMiOiJqYXp6IG5hbWUgYmx1ZSBhbGJ1bSBhc3NldCBjaW5uYW1vbiBwZW5hbHR5IHJ1cmFsIG1hcGxlIGhlYWx0aCBzaWxseSBmbG9hdCBob3Jyb3Iga25pZmUgY2FuYWwgY3ViZSB3aGF0IHRvcHBsZSBlbXB0eSBqZWFucyBzcGhlcmUgYWdyZWUgYmxpbmQgdHJheSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTMwcjNwNG1nOWg1Z3FnanZ5d2hyazh3MDMwOXdkZzl6MmR1Z3ByIiwiTW5lbW9uaWMiOiJjb2FjaCBzZWdtZW50IHBhcnJvdCB1cmJhbiBjbG9jayBleHByZXNzIGp1ZGdlIGRhbWFnZSB2b3lhZ2Ugd2VhciByb3VnaCBoZWFydCBsaXF1aWQgZ3J1bnQgc29jY2VyIHBvaW50IGlkbGUgdGlkZSBzYXRvc2hpIGdpcmwgYmFnIG1hY2hpbmUgaW1wb3NlIGJyb3RoZXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXdnNWdjZHg0ZTRoemRwenpkajNuM2hneTNqZHlkbDI1ZGFrbWVlIiwiTW5lbW9uaWMiOiJrbmVlIGNyaXRpYyBwcm92aWRlIGRvZyBvc3RyaWNoIGxhd3N1aXQgYm9uZSBzbWFydCBwcm9qZWN0IGluZGV4IGZhaW50IHNwb2lsIGRlY3JlYXNlIGV4aWxlIGNhdHRsZSBodXJ0IGJsYW5rZXQgYXJ0d29yayBkcnVtIHdhZ29uIHNvdXRoIHVwb24gb3JiaXQgcGhvbmUifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVnZjNnZTZ5cW55cjJneHRyNHo3dXI3dnpuN3NsNzZ2NnB0NTJ1IiwiTW5lbW9uaWMiOiJjdXAgY291bnRyeSB0cnVtcGV0IGFjdCBhc3RobWEgdXBwZXIgaW5wdXQgd2FsbnV0IGZsYWcgcHJhY3RpY2Ugc3RhYmxlIGN1dGUgbWlsbGlvbiBmaWd1cmUgbGFkeSBkaXJ0IHNoYXJlIHByZXZlbnQgb2ZmIGFkanVzdCBzdGluZyB0b3JuYWRvIGd1biBqdW5nbGUifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXE4c214aDRtY3BlcDNucWE0bHMyd2p3eXlxOXo3cmdhemhxZ2c1IiwiTW5lbW9uaWMiOiJlY2hvIGJhc2UgY2FiYmFnZSBleGhpYml0IGluamVjdCBpY2UgY3JlZGl0IGhhdCBzdGVhayB3YXJmYXJlIGRlc2lnbiBqZXdlbCBjaHVuayBzdGVlbCB1bmRvIGVucmljaCBrZXRjaHVwIHNpeCB0aG91Z2h0IGplYW5zIG11c2V1bSBzZWN1cml0eSBlbGJvdyByb29mIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTk3ZHhmNzMyd3c1M2RwdXl4em4wcThjZ3d0Z3ZmeHZ1dnprZGw3IiwiTW5lbW9uaWMiOiJwaWxvdCBhYmFuZG9uIG11c3QgcmFpbiBkZXNrIGdsb3cgd29ycnkgc2VtaW5hciBncmFpbiByaHl0aG0gZGF3biBsaXF1aWQgd2lsZCBlbm91Z2ggZm9zdGVyIGVuam95IHdyZXN0bGUgZXllYnJvdyBpbnZlc3QgcmVsYXggYmFyIHByb3VkIHN1YmplY3Qgc3R1ZGVudCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnOGQ2dnhnbXNybGd4bXZqeHI2Y2R6dTdqYzQ0aG11dXptNTBmIiwiTW5lbW9uaWMiOiJjbGVhbiBub21pbmVlIHByb29mIGJvbWIga2lkbmV5IHByb2JsZW0gd2lsZCBpc29sYXRlIGhhcmQgYmljeWNsZSBzdXJ2ZXkgbm93IHJlZ3VsYXIgZGlyZWN0IHN1bm55IGNvbmdyZXNzIGFibGUgam91cm5leSBwb3dkZXIgZmF1bHQgbW90aW9uIHRhY2tsZSB2aXZpZCBqb3VybmV5In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJsNGVzcGFsZ3NxZTk4czRzMnd4dmdhY3BhaDNyMnRxZTNneXF4IiwiTW5lbW9uaWMiOiJjbG9nIGxhYiBkb3VibGUgc2VjdGlvbiBkaXp6eSBicmFpbiBpbnRhY3QgZGV2ZWxvcCBtb2RpZnkgaGVkZ2Vob2cgdG93ZXIgc2x1c2ggY2F1Z2h0IGRpdmlkZSBzcGFjZSBsaXR0bGUgdGFzayB0ZXJtIGF0dHJhY3QgbWlkZGxlIHNoaWZ0IGNsdWIgY3VsdHVyZSBodW1hbiJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXgwYXlwYW10ZjN5bjRmbHQ2NjN2dmN0Zmd4d24yZnRucWozM2dzIiwiTW5lbW9uaWMiOiJiYWJ5IGJvcmluZyB3YWdlIHF1YWxpdHkgY2xpbmljIHNpZGUgYWZyYWlkIGtpbmQgd2FsbCBpbm5vY2VudCBzdGluZyBpZGVudGlmeSBjdWJlIG5pY2Ugc2xlZXAgcmFuZ2UgZmVlZCBjYXNpbm8gc3R1bWJsZSB1c2VmdWwgZWRpdCBob3N0IGZyb3N0IGJsaW5kIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWVtZ2ZjZWM4N3o1dXV0MnA5ZHFsYTVtNncwZ3luNzc4eHdwOTN0IiwiTW5lbW9uaWMiOiJidXJzdCBzaWNrIHR3byB0cnVtcGV0IGRyaWZ0IGJvdHRvbSBzaWJsaW5nIGNsb2NrIHllbGxvdyBtYXhpbXVtIGtpc3Mgc2hvY2sgaGVpZ2h0IHRlYWNoIHNhbHV0ZSBpZ25vcmUgY2F1dGlvbiBlYWdlciBmaW5kIGFwb2xvZ3kgc2F0b3NoaSBzcG9vbiBzYWRuZXNzIG1hdHRlciJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWh2Y3Nmc2xzZXQzcXI0ODRocGxuN3FhY2x5cnpyZXc1ejcyd3d0IiwiTW5lbW9uaWMiOiJhaXNsZSBpbnB1dCB0ZW4gZ3JlZW4gbWFuYWdlIHZpYnJhbnQgZmFtZSBidXNpbmVzcyBibGluZCByYWNjb29uIHNsaW0gdHJhaW4gYnVzaW5lc3MgZW5nYWdlIGRlc3Ryb3kgaW1wb3NlIHBsdWcgcG90YXRvIGFib3ZlIHZlc3NlbCBhdmVyYWdlIGFncmVlIHN0ZWVsIGNhdGFsb2cifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxqNmhnaDkzamRjZ2c5NGowNWtnc3ZuYzl2OTd3c3BlcXRjNHU1IiwiTW5lbW9uaWMiOiJiYXR0bGUgYm9udXMgbnVyc2UgYWRkcmVzcyBzZWxsIHRvb3RoIGxhcmdlIGN5Y2xlIHB1ZGRpbmcgZXJhc2UgZGVwb3NpdCBtZWFkb3cgb2JzY3VyZSB0YWcgYWN0IGJhbGwgYXR0cmFjdCBjb3lvdGUgcmVwbGFjZSBpbm1hdGUgb3Bwb3NlIGFyb3VuZCByYXZlbiBwYXBlciJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXhobTVyNTRobHR2M2FzM2hna3d0cW5xdXUybXE0bXdyZ3B6anpzIiwiTW5lbW9uaWMiOiJuZWl0aGVyIGdhbGF4eSB2aXJ1cyBwbGF5IHN1biBiZWxpZXZlIG9ycGhhbiBmaW5nZXIgYnVsayBzaG9jayBsZWcgY2FwdGFpbiBicnVzaCBzcGluIG1pZG5pZ2h0IGx1Y2t5IHVnbHkgcmV1bmlvbiB3ZWVrZW5kIHdvcmQgYnVkZ2V0IHZhbiBzY3JlZW4gc2xlbmRlciJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN4Nm5oZXNsa3RrczV3cXRlOThhYWhxbnVsZGNseG5sZ3ZtdHRtIiwiTW5lbW9uaWMiOiJjYXN0bGUgZW5nYWdlIHNoaWVsZCByb29raWUgY2hlZXNlIHB1enpsZSBiZXR3ZWVuIGZlZWQgbGlvbiBhY2N1c2UgYWhlYWQgY2FudmFzIGltYWdlIGluc3BpcmUgb21pdCBtb3JlIGNyYW5lIGRyYXN0aWMgc3Rvb2wgYmVjb21lIGhvbGUgcGx1Y2sgY29yZSB0cm9waHkifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXE3cDdlYTQ2bGZkaGU0cncycThucGM1cGh2bTJhY2x5bm0wM3R0IiwiTW5lbW9uaWMiOiJhc3N1bWUgdmFuaXNoIHVwcGVyIGdvZGRlc3MgY29taWMgd3JlY2sgdGVhY2ggd3Jpc3QgbWlzZXJ5IGd1ZXNzIHJlbnQgaGF3ayB0ZXh0IHNhbG1vbiBlcXVpcCBnZW51aW5lIGJsdXNoIHZlcmIgY29pbCByb3V0ZSB1cGdyYWRlIGJhZGdlIHN1bm55IHNwZW5kIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW12d3loN2x0NnI5NXJseHBoN3UyMnB3OTZnemp1MDcwZHNycGd3IiwiTW5lbW9uaWMiOiJyYWJiaXQgd2F0ZXIgcGVuY2lsIHRvcm5hZG8gbmFycm93IGV4YWN0IGVuZG9yc2UgZmluZSBnaXJhZmZlIHB1cGlsIG1vbmtleSB2YWNhbnQgd2VpcmQgb2N0b2JlciB0aG91Z2h0IHN0ZWFrIGRlcGVuZCB2b2x1bWUgbmFzdHkgdG9iYWNjbyBzbGVlcCB3ZWFzZWwgYmxvb2QgdGFpbCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWF3M2twcXV6Z2x0c2F1NTRoOWtxZGxuaG1ldjVkNmNudnM1a25rIiwiTW5lbW9uaWMiOiJwb3RhdG8gc3dhcm0geW91dGggY2FzdWFsIHVzZWxlc3MgZ2FyZGVuIGRheSBzZXR0bGUgdG9wcGxlIGZsb2NrIG9idmlvdXMgcmViZWwgYnJpY2sgdmV0ZXJhbiBnbHVlIGZyZXF1ZW50IGJlaGF2ZSBzZW50ZW5jZSBjb29sIHN1cmdlIHVuaWZvcm0gYXR0ZW5kIG1lbnUgZGV2aWNlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXV3OGwwcHFqNGxxZGFqbnN3NHB1bTd4dHR3c3E0azNqYXh3NnZqIiwiTW5lbW9uaWMiOiJtb3JuaW5nIGZsYXQgb3duIGJhcnJlbCBmcm9nIHNpeCBpbm1hdGUgY2xvd24gcHVkZGluZyBuZWdhdGl2ZSBleG90aWMgaG9ycm9yIHNoZWxsIGNyaW1lIHJpdmFsIGJlc3QgYnJva2VuIGNsaWNrIHN1bnNldCB0YWxlbnQgY2FibGUgZW1wb3dlciBhcm1vciBoZWFkIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXU5dDdjcXJwY3R2bHB5ZGRtMnBkbHJwNm45bDA4bWVyMjd1aHQ4IiwiTW5lbW9uaWMiOiJsZXNzb24gY29yZSBkaXNhZ3JlZSBkaWFsIHNhZCBoaXJlIG1ha2UgbGF0ZXIgZW52ZWxvcGUgaG9tZSBiZWF1dHkgYmVhY2ggYWZmYWlyIHZvdGUgdHJpYWwgZnJvd24gcmF0ZSBjYXN0bGUgcmVjZWl2ZSBvY2N1ciBodW1ibGUgd2VsY29tZSB1bnZlaWwgdW5rbm93biJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXY4aHQwNThyOGM2czJlaGE2bjQyeDZueHBrZnE3cjJ3NjhnejlnIiwiTW5lbW9uaWMiOiJjb29sIGdvc3BlbCBkaXNoIG1ha2UgaGFyZCB3aXNkb20gYmVhY2ggdmlkZW8gYmFyZWx5IGNhdGNoIHNvbGFyIHN0ZXJlbyBmdW5ueSByb2FkIGFubnVhbCBib251cyBnYXRlIGFkanVzdCBsdW5jaCBmbGF0IGV4aXN0IGZldmVyIHN0cm9uZyByb3V0ZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMThoeWg0bnk5Nzh2bTQ3YXN4eXluM3VxeDNkOXJkaDN1aGx1a2hoIiwiTW5lbW9uaWMiOiJjYW1wIGJpZCBtYXplIG9seW1waWMgYmFsYW5jZSBzaWRlIGd1YXJkIHNwYXRpYWwgYXJyZXN0IG1lcnJ5IHBsYXkgc3VtbWVyIGdhdGUgbXVzaHJvb20gc2NpZW5jZSByaXBwbGUgcmVqZWN0IHRvcnRvaXNlIGZsb2NrIHN3YWxsb3cgcnVuIGNodWNrbGUgZWFnbGUgcmVmb3JtIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZmZWRtOXpxMnBndnU1NXczZ2Z0NWRqcWNsa3Vubnc5NHBzZ2RlIiwiTW5lbW9uaWMiOiJ3aGFsZSBiYXJnYWluIGRpdmVydCBzb29uIGVyYXNlIGxvbmVseSBjbG90aCBidWRkeSBzY2llbmNlIHZhcG9yIG1pc3MgcXVvdGUgZml4IGxvb3AgZmllbGQgY2hlY2sgaGlzdG9yeSBwbHVjayB0b2RkbGVyIGltcHVsc2UgbWlyYWNsZSBiZWx0IHBvb2wgaW1tdW5lIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTRuMmU5bWN4dHZxN2xoeWNmZWhrc2YzYXYzMnJ2dTl5d3ZsMjcwIiwiTW5lbW9uaWMiOiJidWxiIGdhcmFnZSBhZGRpY3QgYXJjdGljIHN1YmplY3QgcmF2ZW4gdG9vbCBoZWxtZXQgY2FwYWJsZSBjb3VwbGUgYmFzZSBpbnZlc3QgYmVnaW4gY2FsbCBmYXRpZ3VlIGFsdGVyIGVhc3kgdXNlbGVzcyBnZW5pdXMgdW52ZWlsIGJlZWYga2luZ2RvbSBjb252aW5jZSBkYW5nZXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXlwcXk0dHN1NHUwZHhnM2d6OTdyNmtxY2dmNjg0dWN4cGptbWxhIiwiTW5lbW9uaWMiOiJsYXB0b3AgcHJvY2VzcyBub3NlIHRlYWNoIGJhcmVseSBqZXdlbCBpbml0aWFsIGF2b2NhZG8gZGlubmVyIGNoYWxrIHRyYW5zZmVyIG5lYXIgc3dpdGNoIGNhYmJhZ2UgYWJvdXQgY2hhbGsgY2hhaXIgYXNwZWN0IGd1biBsaWJlcnR5IGhvb2Qgc2VsZWN0IGJyYW5kIGthbmdhcm9vIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTByZmwwOG5heWRjZnc4cWtnNmNjdXB6YWRrdGVlZXRkMmx1NmpzIiwiTW5lbW9uaWMiOiJ0d2luIGdsYWQgc2VydmljZSBmaWd1cmUgcm9hc3QgY3JlZWsgb3lzdGVyIHB1bGwgY2xheSBhdXRvIGNsb3VkIGtldGNodXAgYm91bmNlIGZpZWxkIGdlbnRsZSBncmlkIGJyYW5kIHN0YWdlIGhlbG1ldCBzcGF0aWFsIHNwb2lsIHRleHQgY2FydCBzcHJpbmcifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBhZTI4bDNua3FtN25saG5tczBwNnc4OHEyYWdzNWd1MHNrNjZ5IiwiTW5lbW9uaWMiOiJyZWd1bGFyIHdvb2wgb3JhbmdlIGlzbGFuZCBzaXJlbiB1bWJyZWxsYSBjcnVpc2UgYWxsZXkgdGlkZSBmbGlwIHNsYWIgdmVyaWZ5IHNob3VsZGVyIHR3aW4gbWV0YWwga2l0dGVuIGN1cGJvYXJkIGFjcXVpcmUgYWJsZSBzdXJmYWNlIHRlbGwgdW5kbyBiZXN0IGxlZ2VuZCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxoNWhjeG1nOWNna3Bkcm10NzZkeXJheGtwdzhndDR3aHR3ZnQ1IiwiTW5lbW9uaWMiOiJ2b2xjYW5vIGJyb256ZSBzcHJlYWQgbnVtYmVyIHdlYWx0aCBkZWZ5IGNpdGl6ZW4gd2luZSBlZmZvcnQgbmV4dCBoYW1zdGVyIGJldHRlciBsb2NrIHN5bXB0b20gaHVzYmFuZCB1bmlmb3JtIGhvdXIgdmF1bHQgcGl0Y2ggd2FzcCBzd2lmdCBpbmRpY2F0ZSBhZXJvYmljIHRvd2FyZCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWZhNjA0bTdoa3NucXZoc2YydWpjbHFqZ3k1cDIwdXU1c3FoMHltIiwiTW5lbW9uaWMiOiJ3ZWFyIGJhbGwgaW52b2x2ZSBndWVzcyBzcG9uc29yIGVwaXNvZGUgZmljdGlvbiBjcmltZSBib3JpbmcgbWF0aCB3ZWIgc2NlbmUgYm95IGZsaWdodCBhY3RyZXNzIGltYWdlIG1hbnVhbCBxdWljayBtZWNoYW5pYyBiZWNhdXNlIGdyb3cgcnVkZSBub3JtYWwgYW50aXF1ZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNwamZ1YWd3MnRlZDBhbjVhcWhtdDJsOGhrM3Q2YTk1czcyZzV5IiwiTW5lbW9uaWMiOiJzbG93IGRlZmVuc2UgZHJ5IGNyYW0gbHVtYmVyIGdpYW50IGRhdWdodGVyIG1ldGFsIGJyZWV6ZSBmb3J3YXJkIG5ldCB3b2xmIGZsYW1lIGRhbXAgcGxhY2UgdHdpc3QgZWxpdGUgcHJvb2YgZWFybHkgcG90dGVyeSBzb25nIGNveW90ZSBsaXphcmQgc29tZW9uZSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTgwODJnZzU3dHlwd3ZxM2N0YWNhZzljcWg5ejJqZjdkbDJzeDlhIiwiTW5lbW9uaWMiOiJsb3ZlIG1lbHQgZ3JpZCBzaGFsbG93IGZhY3VsdHkgdG9zcyBzdXJyb3VuZCBpbWl0YXRlIG5lY2sgY2F0IGJhc2ljIHNsaWdodCBqYWd1YXIgYWNyb3NzIGdpdmUgYWJzZW50IHJlZ2lvbiBncmF2aXR5IGVuZG9yc2UgYnJpZ2h0IHNpbXBsZSBvY3RvYmVyIHJldW5pb24gc3RvcnkifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxqd3Jsczg3MnB4MnEwNWFyZmdrazZnajQ0YXBxOHM1ajk5Z3Q1IiwiTW5lbW9uaWMiOiJzY291dCBtb2JpbGUgcmVjYWxsIG1lbWJlciByYWxseSB0aWx0IGNhcmQgaW50byB1bWJyZWxsYSBmZWVkIHZlcnNpb24gbm92ZWwgZ2lyYWZmZSBoYW1tZXIgem9uZSBrZWVuIG9yaWVudCBoYWxmIGRpc2FncmVlIGJlYWNoIHBvZXQgaW1wYWN0IGRpbm5lciBtYXNrIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTVzYTc4eTRkZ2tlc3oyN3k5bTZyNDByMDBzZTdtd2h5MjU2dGxoIiwiTW5lbW9uaWMiOiJnb2RkZXNzIGZpeCBjcmFuZSByaWdpZCBjYXN1YWwgd2hlYXQgc3ByYXkgY3JlYW0gY29pbiBsZWFmIGRpc3BsYXkgaHVyZGxlIGVuc3VyZSBhcm1lZCBjb3JyZWN0IGJ1bmtlciBpZGVudGlmeSBkb25hdGUgc3Bpa2UgZmFudGFzeSByZWxpZWYgZGlzYWdyZWUgZ3JhcGUgc2hvdWxkZXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTN6OWNteHVrdzdoaHYzNXgweDU0YXZhbXJuOXA2NWF0cGcybmR4IiwiTW5lbW9uaWMiOiJtb25zdGVyIGxhbmd1YWdlIHZvY2FsIGZseSBtYXJjaCBqb2tlIG5ldXRyYWwgamVsbHkgY2h1cm4gZ29kZGVzcyB3ZWFyIGNhbG0gdmFsaWQgbm93IGF1dHVtbiBsaWFyIHdhbnQgc3Bvb24gZ2xvb20gaGlnaCBqdXN0IHNvbWVvbmUgbWFudWFsIGVuZXJneSJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTZjdTB4cTRyeDhlZWZqN3BrMmY5cHJmcmttejhtM3g1bWtyNjZyIiwiTW5lbW9uaWMiOiJtb3JuaW5nIG9mdGVuIGxhdGVyIGVjaG8geW91bmcgZGlsZW1tYSB1bnZlaWwgc3Vuc2V0IGdsYW5jZSBzaG9wIG9ic2VydmUgZXhwaXJlIHN0YWdlIG1lbWJlciBzaGlmdCBhY291c3RpYyBjb25maXJtIHJhZGlvIGp1ZGdlIGxhYiBtdWZmaW4gdHJpbSBnZW51aW5lIGJ1aWxkIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXQzcnVxZmN6aGp5cjRycDU5amNkdjZ4dmgwNnNhcDZuMzBjc2FhIiwiTW5lbW9uaWMiOiJsdW5jaCBib3Jyb3cgZGVmeSBwb29sIGxvY2FsIGdyYW50IHNoaXAgbXVzaHJvb20gYXdrd2FyZCBpbmNsdWRlIGtpZCBiZWx0IHBhaXIgaW50byBsZW5zIHRyYXZlbCByZWZsZWN0IHJvdXRlIG1pbmQgZW5hYmxlIG5lY2sga25lZSBzaXggd2lkdGgifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWg4MmVnOXBuN3pzM2w1bHRqdHN6ejN0MGdkNWVhejdnd3lyN2M1IiwiTW5lbW9uaWMiOiJzeXN0ZW0gdHJ5IGVhZ2VyIGNhcmQgbGVzc29uIGN1cnRhaW4gYmVjYXVzZSBmbGFtZSBpbWl0YXRlIHNpemUgc2libGluZyBsYXRlciBoaWdoIHNhbXBsZSBjbGF3IHNjYXR0ZXIgdXNlIHNlcmllcyBiYWNoZWxvciBwZXBwZXIgbmV4dCBhZ2FpbiBhbmdyeSBsb2dpYyJ9"), + ) +) diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go new file mode 100644 index 000000000..8b05da7d2 --- /dev/null +++ b/testutil/testkeyring/gen_accounts/gen.go @@ -0,0 +1,79 @@ +//go:build ignore + +package main + +import ( + "bytes" + "flag" + "fmt" + "log" + "os" + "strings" + + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/testutil/testkeyring" + + "github.com/pokt-network/poktroll/app" +) + +var ( + flagOut string + flagAccountsLimit int + defaultOutPath = "accounts_table.go" +) + +func init() { + flag.StringVar(&flagOut, "out", defaultOutPath, "the path to the generated go source of pre-generated accounts.") + flag.IntVar(&flagAccountsLimit, "limit", 100, "the number of accounts to generate.") +} + +func main() { + flag.Parse() + + kr := keyring.NewInMemory(app.MakeEncodingConfig().Marshaler) + + preGeneratedAccountLines := make([]string, flagAccountsLimit) + for i := range preGeneratedAccountLines { + record, mnemonic, err := kr.NewMnemonic( + fmt.Sprintf("key-%d", i), + keyring.English, + types.FullFundraiserPath, + keyring.DefaultBIP39Passphrase, + hd.Secp256k1, + ) + addr, err := record.GetAddress() + if err != nil { + log.Fatal(err) + } + + preGeneratedAccount := &testkeyring.PreGeneratedAccount{ + Address: addr, + Mnemonic: mnemonic, + } + + preGeneratedAccountStr, err := preGeneratedAccount.Marshal() + if err != nil { + log.Fatal(err) + } + + preGeneratedAccountLines[i] = fmt.Sprintf(preGeneratedAccountLineFmt, preGeneratedAccountStr) + } + + newPreGeneratedAccountIteratorArgLines := strings.Join(preGeneratedAccountLines, "\n") + outputBuffer := new(bytes.Buffer) + if err := accountsTableTemplate.Execute( + outputBuffer, + map[string]any{ + "newPreGeneratedAccountIteratorArgLines": newPreGeneratedAccountIteratorArgLines, + }, + ); err != nil { + log.Fatal(err) + } + + if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { + log.Fatal(err) + } +} diff --git a/testutil/testkeyring/gen_accounts/template.go b/testutil/testkeyring/gen_accounts/template.go new file mode 100644 index 000000000..e7dfb5b57 --- /dev/null +++ b/testutil/testkeyring/gen_accounts/template.go @@ -0,0 +1,26 @@ +//go:build ignore + +package main + +import "text/template" + +var ( + preGeneratedAccountLineFmt = "\t\tmustParsePreGeneratedAccount(%q)," + accountsTableTemplate = template.Must( + template.New("accounts_table.go").Parse( + `// DO NOT EDIT. This Code is generated by gen_accounts/gen.go, +// changes will be overwritten upon regeneration. +// +// To regenerate this file, use make go_testgen_accounts or go generate ./testutil/testkeyring/keyring.go. + +package testkeyring + +var ( + preGeneratedAccounts = NewPreGeneratedAccountIterator( +{{.newPreGeneratedAccountIteratorArgLines}} + ) +) +`, + ), + ) +) diff --git a/testutil/testkeyring/keyring.go b/testutil/testkeyring/keyring.go new file mode 100644 index 000000000..f6c503d8e --- /dev/null +++ b/testutil/testkeyring/keyring.go @@ -0,0 +1,47 @@ +//go:generate go run ./gen_accounts/gen.go ./gen_accounts/template.go + +package testkeyring + +import ( + "fmt" + "testing" + + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" +) + +// CreatePreGeneratedKeyringAccounts uses the mnemonic from limit number of +// pre-generated accounts to populated the provided keyring, kr. It then returns +// the pre-generated accounts which were used. +// +// TODO_CONSIDERATION: Returning a new PreGeneratedAccountIterator instead of +// the slice of accounts could be more idiomatic. It would only contain keys which +// are known to be in the keyring. +func CreatePreGeneratedKeyringAccounts( + t *testing.T, + kr keyring.Keyring, + limit int, +) []*PreGeneratedAccount { + t.Helper() + + accounts := make([]*PreGeneratedAccount, limit) + for i := range accounts { + preGeneratedAccount := MustPreGeneratedAccountAtIndex(uint32(i)) + + uid := fmt.Sprintf("key-%d", i) + _, err := kr.NewAccount( + uid, + preGeneratedAccount.Mnemonic, + keyring.DefaultBIP39Passphrase, + types.FullFundraiserPath, + hd.Secp256k1, + ) + assert.NoError(t, err) + + accounts[i] = preGeneratedAccount + } + + return accounts[:limit] +} diff --git a/testutil/testpolylog/event.go b/testutil/testpolylog/event.go new file mode 100644 index 000000000..c41708c13 --- /dev/null +++ b/testutil/testpolylog/event.go @@ -0,0 +1,193 @@ +package testpolylog + +import ( + "bytes" + "fmt" + "reflect" + "strings" + "testing" + + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +type ( + // NewLoggerAndOutputFn is called in the test helper to create a new logger + // configured with the given level and options. It returns the logger and + // the buffer to which the logger writes. It is useful for decoupling test + // helpers from a specific logger implementation and reducing boilerplate + // code in various tests. + NewLoggerAndOutputFn func( + *testing.T, + polylog.Level, + ...polylog.LoggerOption, + ) (polylog.Logger, *bytes.Buffer) + + // NewEventWithLevelFn is called in the test helper to create a new event + // at the given level from the given logger. It is useful for decoupling + // test helpers from a specific logger implementation so that we can + // call `logger.() without knowing the concrete logger + // type nor the level. + NewEventWithLevelFn func( + *testing.T, + polylog.Logger, + polylog.Level, + ) polylog.Event +) + +// EventFuncSpy is a mock which implements a #Fn() method that is intended to be +// used in tests to assert that the function passed to polylog.Event#Func() is +// called with the expected arg(s). +type EventFuncSpy struct{ mock.Mock } + +// Fn is a mock method which can be asserted on via the mock.Mock API. +// See: https://pkg.go.dev/github.com/stretchr/testify@v1.8.4/mock#Mock. +func (m *EventFuncSpy) Fn(event polylog.Event) { + m.Called(event) +} + +// EventMethodTestCase is a test case for expressing and exercising polylog.Event +// methods in a concise way. +type EventMethodTestCase struct { + // Msg is the string to pass to polylog.Event#Msg(), which will be called + // after the event method under test. Usage of Msg is mutually exclusive + // with MsgFmt. If neither are provided, then polylog.Event#Send() is called + // after the event method instead. + Msg string + + // MsgFmt is the format string to pass to polylog.Event#Msgf(), which will + // be called on the event returned from the event method under test. Usage + // of MsgFmt is mutually exclusive with Msg. If neither are provided, then + // polylog.Event#Send() is called after the event method instead. + MsgFmt string + + // MsgFmtArgs are the args to pass to polylog.Event#Msgf(). It is an error + // to provide MsgFmtArgs without also providing MsgFmt or while providing + // Msg. + MsgFmtArgs []any + + // Key is the key to pass to the event method under test. + Key string + + // Value is the value to pass to the event method under test. + Value any + + // EventMethodName is the name of the event method to call on the logger. + EventMethodName string + + // ExpectedOutputContains is the string that is expected to be contained + // in the log output. + ExpectedOutputContains string +} + +// RunEventMethodTests runs a set of tests for a given level. +func RunEventMethodTests( + t *testing.T, + level polylog.Level, + tests []EventMethodTestCase, + newLoggerAndOutput NewLoggerAndOutputFn, + newEventWithLevel NewEventWithLevelFn, + getExpectedLevelOutputContains func(level polylog.Level) string, +) { + t.Helper() + + // Title-case level string so that it can be used as the name of the + // method to call on the logger using reflect and for the sub-test + // descriptions. + // + // TODO_TECHDEBT/TODO_COMMUNITY: `strings.Title()` is deprecated. Follow + // migration guidance in godocs: https://pkg.go.dev/strings@go1.21.4#Title. + levelMethodName := strings.Title(level.String()) + + for _, tt := range tests { + var ( + eventMethodArgs []reflect.Value + doneMethodName string + doneMethodArgs []reflect.Value + ) + + // Ensure that calls to #Msg(), #Msgf(), and #Send() are mutually exclusive. + switch { + case tt.Msg != "": + require.Emptyf(t, tt.MsgFmt, "Msg and MsgFmt are mutually exclusive but MsgFmt was not empty: %s", tt.MsgFmt) + require.Emptyf(t, tt.MsgFmtArgs, "Msg and MsgFmt are mutually exclusive but MsgFmtArgs was not empty: %v", tt.MsgFmtArgs) + + // Set up call args for polylog.Event#Msg() if tt.msg is not empty. + doneMethodName = "Msg" + doneMethodArgs = append(doneMethodArgs, reflect.ValueOf(tt.Msg)) + case tt.MsgFmt != "": + // Set up call args for polylog.Event#Msgf() if tt.msgFmt is not empty. + doneMethodName = "Msgf" + doneMethodArgs = append( + doneMethodArgs, + reflect.ValueOf(tt.MsgFmt), + reflect.ValueOf(tt.MsgFmtArgs), + ) + default: + // Default to calling polylog.Event#Send() if tt.msg and tt.msgFmt are + // both empty. + doneMethodName = "Send" + } + + // Test description for this sub-test is interpolated based on the logger + // level, event, and "done" method names (e.g. `Debug().Msg()` or `Info().Str()`). + // If the event method name is not empty, the done method name is omitted. + // This is done for brevity as not every permutation of event method and done + // method is exercised (nor need they be). + // If the event method name is empty, then the test description is interpolated + // using the level method name and the "done" method name (e.g. `Error().Msg()` + // or `Warn().Send()`). + descMethodName := tt.EventMethodName + if tt.EventMethodName == "" { + descMethodName = doneMethodName + } + testDesc := fmt.Sprintf("%s().%s()", levelMethodName, descMethodName) + + // Run this sub-test for the current level. + t.Run(testDesc, func(t *testing.T) { + logger, logOutput := newLoggerAndOutput(t, level) + + // Need to use reflection in order to minimize the test code necessary + // to exercise all the permutations of logger level and event type methods. + logEvent := newEventWithLevel(t, logger, level) + logEventValue := reflect.ValueOf(logEvent) + + // If tt.EventMethodName is not empty, build the args and call it. + if tt.EventMethodName != "" { + // Append tt.key to polylog.Event#() call args. + if tt.Key != "" { + eventMethodArgs = append(eventMethodArgs, reflect.ValueOf(tt.Key)) + } + // Append tt.value to polylog.Event#() call args. + if tt.Value != nil { + eventMethodArgs = append(eventMethodArgs, reflect.ValueOf(tt.Value)) + } + + // E.g.: logEvent := logger.Debug().Str("str", "str_value") + // or: logEvent := logger.Debug().Bool("bool", true) + logEventValue. + MethodByName(tt.EventMethodName). + Call(eventMethodArgs) + } + + // E.g.: logEvent.Send() + // or: logEvent.Msg("msg") + // or: logEvent.Msgf("meaning of life: %d", 42) + logEventValue. + MethodByName(doneMethodName). + Call(doneMethodArgs) + + // Assert that each line contains the expected prefix. + require.Contains(t, logOutput.String(), getExpectedLevelOutputContains(level)) + + // Assert that the log output contains the expected messages. Split the log + // output into lines and iterate over them. + require.Contains(t, logOutput.String(), tt.ExpectedOutputContains) + + // Print log output for manual inspection. + t.Log(logOutput.String()) + }) + } +} diff --git a/testutil/testpolylog/logger.go b/testutil/testpolylog/logger.go new file mode 100644 index 000000000..d5abf37fc --- /dev/null +++ b/testutil/testpolylog/logger.go @@ -0,0 +1,21 @@ +package testpolylog + +import ( + "context" + + "github.com/rs/zerolog" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +) + +func NewLoggerWithCtx( + ctx context.Context, + level polylog.Level, +) (polylog.Logger, context.Context) { + levelOpt := polyzero.WithLevel(zerolog.Level(level.Int())) + logger := polyzero.NewLogger(levelOpt) + ctx = logger.WithContext(ctx) + + return logger, ctx +} diff --git a/testutil/tokenomics/mocks/mocks.go b/testutil/tokenomics/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/tokenomics/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/yaml/yaml.go b/testutil/yaml/yaml.go new file mode 100644 index 000000000..56a29cc89 --- /dev/null +++ b/testutil/yaml/yaml.go @@ -0,0 +1,31 @@ +package yaml + +import "strings" + +// YAML is indentation sensitive, so we need to remove the extra indentation from the test cases and make sure +// it is space-indented instead of tab-indented, otherwise the YAML parser will fail +func NormalizeYAMLIndentation(rawContent string) string { + var processedContent = rawContent + // Remove extra newlines + processedContent = strings.TrimPrefix(processedContent, "\n") + + // Replace tab indentation with 2 spaces as our code is tab-indented but YAML is expecting double spaces + processedContent = strings.ReplaceAll(processedContent, "\t", " ") + + // Get the extra indentation from the first line that will serve as the basis for the rest of the lines + extraIndentationCount := len(processedContent) - len(strings.TrimLeft(processedContent, " ")) + + // Create a prefix to trim from the beginning of each line + extraIndentation := strings.Repeat(" ", extraIndentationCount) + + // Split the content into lines, trim the extra indentation from each line, and rejoin the lines + lines := strings.Split(processedContent, "\n") + for i := range lines { + lines[i] = strings.TrimPrefix(lines[i], extraIndentation) + } + + // Recover the processed content + processedContent = strings.Trim(strings.Join(lines, "\n"), "\n") + + return processedContent +} diff --git a/x/application/keeper/application.go b/x/application/keeper/application.go new file mode 100644 index 000000000..817499c86 --- /dev/null +++ b/x/application/keeper/application.go @@ -0,0 +1,71 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/application/types" +) + +// SetApplication set a specific application in the store from its index +func (k Keeper) SetApplication(ctx context.Context, application types.Application) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) + b := k.cdc.MustMarshal(&application) + store.Set(types.ApplicationKey( + application.Address, + ), b) +} + +// GetApplication returns a application from its index +func (k Keeper) GetApplication( + ctx context.Context, + appAddr string, + +) (app types.Application, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) + + b := store.Get(types.ApplicationKey( + appAddr, + )) + if b == nil { + return app, false + } + + k.cdc.MustUnmarshal(b, &app) + return app, true +} + +// RemoveApplication removes a application from the store +func (k Keeper) RemoveApplication( + ctx context.Context, + appAddr string, + +) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) + store.Delete(types.ApplicationKey( + appAddr, + )) +} + +// GetAllApplication returns all application +func (k Keeper) GetAllApplication(ctx context.Context) (apps []types.Application) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Application + k.cdc.MustUnmarshal(iterator.Value(), &val) + apps = append(apps, val) + } + + return +} diff --git a/x/application/keeper/application_test.go b/x/application/keeper/application_test.go new file mode 100644 index 000000000..e871cf75d --- /dev/null +++ b/x/application/keeper/application_test.go @@ -0,0 +1,63 @@ +package keeper_test + +import ( + "context" + "strconv" + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNApplication(keeper keeper.Keeper, ctx context.Context, n int) []types.Application { + apps := make([]types.Application, n) + for i := range apps { + apps[i].Address = strconv.Itoa(i) + + keeper.SetApplication(ctx, apps[i]) + } + return apps +} + +func TestApplicationGet(t *testing.T) { + keeper, ctx := keepertest.ApplicationKeeper(t) + apps := createNApplication(keeper, ctx, 10) + for _, app := range apps { + rst, found := keeper.GetApplication(ctx, + app.Address, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&app), + nullify.Fill(&rst), + ) + } +} +func TestApplicationRemove(t *testing.T) { + keeper, ctx := keepertest.ApplicationKeeper(t) + apps := createNApplication(keeper, ctx, 10) + for _, app := range apps { + keeper.RemoveApplication(ctx, + app.Address, + ) + _, found := keeper.GetApplication(ctx, + app.Address, + ) + require.False(t, found) + } +} + +func TestApplicationGetAll(t *testing.T) { + keeper, ctx := keepertest.ApplicationKeeper(t) + apps := createNApplication(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(apps), + nullify.Fill(keeper.GetAllApplication(ctx)), + ) +} diff --git a/x/application/keeper/keeper.go b/x/application/keeper/keeper.go new file mode 100644 index 000000000..a621a1dcf --- /dev/null +++ b/x/application/keeper/keeper.go @@ -0,0 +1,64 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/application/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + bankKeeper types.BankKeeper + accountKeeper types.AccountKeeper + gatewayKeeper types.GatewayKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, + accountKeeper types.AccountKeeper, + gatewayKeeper types.GatewayKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + bankKeeper: bankKeeper, + accountKeeper: accountKeeper, + gatewayKeeper: gatewayKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/application/keeper/msg_server.go b/x/application/keeper/msg_server.go new file mode 100644 index 000000000..8f740e15c --- /dev/null +++ b/x/application/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/application/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/application/keeper/msg_server_delegate_to_gateway.go b/x/application/keeper/msg_server_delegate_to_gateway.go new file mode 100644 index 000000000..305b48baf --- /dev/null +++ b/x/application/keeper/msg_server_delegate_to_gateway.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/application/types" +) + +func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelegateToGateway) (*types.MsgDelegateToGatewayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "DelegateToGateway") + logger.Info(fmt.Sprintf("About to delegate application to gateway with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("Delegation Message failed basic validation: %v", err)) + return nil, err + } + + // Retrieve the application from the store + app, found := k.GetApplication(ctx, msg.AppAddress) + if !found { + logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) + return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) + } + logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) + + // Check if the gateway is staked + if _, found := k.gatewayKeeper.GetGateway(ctx, msg.GatewayAddress); !found { + logger.Info(fmt.Sprintf("Gateway not found with address [%s]", msg.GatewayAddress)) + return nil, sdkerrors.Wrapf(types.ErrAppGatewayNotFound, "gateway not found with address: %s", msg.GatewayAddress) + } + + // Ensure the application is not already delegated to the maximum number of gateways + maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways + if uint64(len(app.DelegateeGatewayAddresses)) >= maxDelegatedParam { + logger.Info(fmt.Sprintf("Application already delegated to maximum number of gateways: %d", maxDelegatedParam)) + return nil, sdkerrors.Wrapf(types.ErrAppMaxDelegatedGateways, "application already delegated to %d gateways", maxDelegatedParam) + } + + // Check if the application is already delegated to the gateway + for _, gatewayAddr := range app.DelegateeGatewayAddresses { + if gatewayAddr == msg.GatewayAddress { + logger.Info(fmt.Sprintf("Application already delegated to gateway with address [%s]", msg.GatewayAddress)) + return nil, sdkerrors.Wrapf(types.ErrAppAlreadyDelegated, "application already delegated to gateway with address: %s", msg.GatewayAddress) + } + } + + // Update the application with the new delegatee public key + app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses, msg.GatewayAddress) + logger.Info(fmt.Sprintf("Successfully added delegatee public key to application")) + + // Update the application store with the new delegation + k.SetApplication(ctx, app) + logger.Info(fmt.Sprintf("Successfully delegated application to gateway for app: %+v", app)) + + // Emit the application redelegation event + event := msg.NewRedelegationEvent() + logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) + if err := ctx.EventManager().EmitTypedEvent(event); err != nil { + logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) + return nil, err + } + + return &types.MsgDelegateToGatewayResponse{}, nil +} diff --git a/x/application/keeper/msg_server_delegate_to_gateway_test.go b/x/application/keeper/msg_server_delegate_to_gateway_test.go new file mode 100644 index 000000000..36081a290 --- /dev/null +++ b/x/application/keeper/msg_server_delegate_to_gateway_test.go @@ -0,0 +1,277 @@ +package keeper_test + +import ( + "fmt" + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application and gateways + appAddr := sample.AccAddress() + gatewayAddr1 := sample.AccAddress() + gatewayAddr2 := sample.AccAddress() + // Mock the gateway being staked via the staked gateway map + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr1) + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Prepare the delegation message + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr1, + } + + // Delegate the application to the gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.NoError(t, err) + events := ctx.EventManager().Events() + require.Equal(t, 1, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) + require.Equal(t, "app_address", events[0].Attributes[0].Key) + require.Equal(t, "gateway_address", events[0].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr1), events[0].Attributes[1].Value) + + // Verify that the application exists + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) + require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) + + // Prepare a second delegation message + delegateMsg2 := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr2, + } + + // Delegate the application to the second gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg2) + require.NoError(t, err) + events = ctx.EventManager().Events() + require.Equal(t, 2, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[1].Type) + require.Equal(t, "app_address", events[1].Attributes[0].Key) + require.Equal(t, "gateway_address", events[1].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[1].Attributes[0].Value) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr2), events[1].Attributes[1].Value) + + // Verify that the application exists + foundApp, isAppFound = k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, 2, len(foundApp.DelegateeGatewayAddresses)) + require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) + require.Equal(t, gatewayAddr2, foundApp.DelegateeGatewayAddresses[1]) +} + +func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application and gateway + appAddr := sample.AccAddress() + gatewayAddr := sample.AccAddress() + // Mock the gateway being staked via the staked gateway map + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Prepare the delegation message + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + + // Delegate the application to the gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.NoError(t, err) + events := ctx.EventManager().Events() + require.Equal(t, 1, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) + require.Equal(t, "app_address", events[0].Attributes[0].Key) + require.Equal(t, "gateway_address", events[0].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) + + // Verify that the application exists + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) + require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) + + // Prepare a second delegation message + delegateMsg2 := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + + // Attempt to delegate the application to the gateway again + _, err = srv.DelegateToGateway(ctx, delegateMsg2) + require.ErrorIs(t, err, types.ErrAppAlreadyDelegated) + events = ctx.EventManager().Events() + require.Equal(t, 1, len(events)) + foundApp, isAppFound = k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) + require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) +} + +func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application and gateway + appAddr := sample.AccAddress() + gatewayAddr := sample.AccAddress() + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Prepare the delegation message + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + + // Attempt to delegate the application to the unstaked gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.ErrorIs(t, err, types.ErrAppGatewayNotFound) + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) +} + +func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application + appAddr := sample.AccAddress() + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Delegate the application to the max number of gateways + maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways + gatewayAddresses := make([]string, maxDelegatedParam) + for i := uint64(0); i < k.GetParams(ctx).MaxDelegatedGateways; i++ { + // Prepare the delegation message + gatewayAddr := sample.AccAddress() + gatewayAddresses[i] = gatewayAddr + // Mock the gateway being staked via the staked gateway map + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + // Delegate the application to the gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.NoError(t, err) + // Check number of gateways delegated to is correct + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, int(i+1), len(foundApp.DelegateeGatewayAddresses)) + } + + events := ctx.EventManager().Events() + require.Equal(t, int(maxDelegatedParam), len(events)) + for i, event := range events { + require.Equal(t, "poktroll.application.EventRedelegation", event.Type) + require.Equal(t, "app_address", event.Attributes[0].Key) + require.Equal(t, "gateway_address", event.Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), event.Attributes[0].Value) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[i]), event.Attributes[1].Value) + } + + // Generate an address for the gateway that'll exceed the max + gatewayAddr := sample.AccAddress() + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) + + // Prepare the delegation message + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + + // Attempt to delegate the application when the max is already reached + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.ErrorIs(t, err, types.ErrAppMaxDelegatedGateways) + events = ctx.EventManager().Events() + require.Equal(t, int(maxDelegatedParam), len(events)) + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, maxDelegatedParam, uint64(len(foundApp.DelegateeGatewayAddresses))) +} diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go new file mode 100644 index 000000000..b8eb5757d --- /dev/null +++ b/x/application/keeper/msg_server_stake_application.go @@ -0,0 +1,101 @@ +package keeper + +import ( + "context" + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/application/types" +) + +func (k msgServer) StakeApplication(goCtx context.Context, msg *types.MsgStakeApplication) (*types.MsgStakeApplicationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "StakeApplication") + logger.Info(fmt.Sprintf("About to stake application with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("invalid MsgStakeApplication: %v", err)) + return nil, err + } + + // Check if the application already exists or not + var err error + var coinsToDelegate sdk.Coin + app, isAppFound := k.GetApplication(ctx, msg.Address) + if !isAppFound { + logger.Info(fmt.Sprintf("Application not found. Creating new application for address %s", msg.Address)) + app = k.createApplication(ctx, msg) + coinsToDelegate = *msg.Stake + } else { + logger.Info(fmt.Sprintf("Application found. Updating application for address %s", msg.Address)) + currAppStake := *app.Stake + if err = k.updateApplication(ctx, &app, msg); err != nil { + return nil, err + } + coinsToDelegate = (*msg.Stake).Sub(currAppStake) + } + + // Retrieve the address of the application + appAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? + // Send the coins from the application to the staked application pool + err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, appAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Application in the store + k.SetApplication(ctx, app) + logger.Info(fmt.Sprintf("Successfully updated application stake for app: %+v", app)) + + return &types.MsgStakeApplicationResponse{}, nil +} + +func (k msgServer) createApplication( + ctx sdk.Context, + msg *types.MsgStakeApplication, +) types.Application { + return types.Application{ + Address: msg.Address, + Stake: msg.Stake, + ServiceConfigs: msg.Services, + DelegateeGatewayAddresses: make([]string, 0), + } +} + +func (k msgServer) updateApplication( + ctx sdk.Context, + app *types.Application, + msg *types.MsgStakeApplication, +) error { + // Checks if the the msg address is the same as the current owner + if msg.Address != app.Address { + return sdkerrors.Wrapf(types.ErrAppUnauthorized, "msg Address (%s) != application address (%s)", msg.Address, app.Address) + } + + // Validate that the stake is not being lowered + if msg.Stake == nil { + return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount cannot be nil") + } + if msg.Stake.IsLTE(*app.Stake) { + return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake) + } + app.Stake = msg.Stake + + // Validate that the service configs maintain at least one service. + // Additional validation is done in `msg.ValidateBasic` above. + if len(msg.Services) == 0 { + return sdkerrors.Wrapf(types.ErrAppInvalidServiceConfigs, "must have at least one service") + } + app.ServiceConfigs = msg.Services + + return nil +} diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go new file mode 100644 index 000000000..f25079592 --- /dev/null +++ b/x/application/keeper/msg_server_stake_application_test.go @@ -0,0 +1,179 @@ +package keeper_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application + addr := sample.AccAddress() + + // Verify that the app does not exist yet + _, isAppFound := k.GetApplication(ctx, addr) + require.False(t, isAppFound) + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + + // Verify that the application exists + appFound, isAppFound := k.GetApplication(ctx, addr) + require.True(t, isAppFound) + require.Equal(t, addr, appFound.Address) + require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) + require.Len(t, appFound.ServiceConfigs, 1) + require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) + + // Prepare an updated application with a higher stake and another service + updateStakeMsg := &types.MsgStakeApplication{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(200)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + { + Service: &sharedtypes.Service{Id: "svc2"}, + }, + }, + } + + // Update the staked application + _, err = srv.StakeApplication(ctx, updateStakeMsg) + require.NoError(t, err) + appFound, isAppFound = k.GetApplication(ctx, addr) + require.True(t, isAppFound) + require.Equal(t, int64(200), appFound.Stake.Amount.Int64()) + require.Len(t, appFound.ServiceConfigs, 2) + require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) + require.Equal(t, "svc2", appFound.ServiceConfigs[1].Service.Id) +} + +func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + appAddr := sample.AccAddress() + + // Prepare the application stake message + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + + // Prepare the application stake message without any services + updateStakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{}, + } + + // Fail updating the application when the list of services is empty + _, err = srv.StakeApplication(ctx, updateStakeMsg) + require.Error(t, err) + + // Verify the app still exists and is staked for svc1 + app, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, app.Address) + require.Len(t, app.ServiceConfigs, 1) + require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) + + // Prepare the application stake message with an invalid service ID + updateStakeMsg = &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, + }, + }, + } + + // Fail updating the application when the list of services is empty + _, err = srv.StakeApplication(ctx, updateStakeMsg) + require.Error(t, err) + + // Verify the app still exists and is staked for svc1 + app, isAppFound = k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, app.Address) + require.Len(t, app.ServiceConfigs, 1) + require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) +} + +func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Prepare the application + addr := sample.AccAddress() + stakeMsg := &types.MsgStakeApplication{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, addr) + require.True(t, isAppFound) + + // Prepare an updated application with a lower stake + updateMsg := &types.MsgStakeApplication{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(50)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Verify that it fails + _, err = srv.StakeApplication(ctx, updateMsg) + require.Error(t, err) + + // Verify that the application stake is unchanged + appFound, isAppFound := k.GetApplication(ctx, addr) + require.True(t, isAppFound) + require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) +} diff --git a/x/application/keeper/msg_server_test.go b/x/application/keeper/msg_server_test.go new file mode 100644 index 000000000..02d1f03bc --- /dev/null +++ b/x/application/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.ApplicationKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/application/keeper/msg_server_undelegate_from_gateway.go b/x/application/keeper/msg_server_undelegate_from_gateway.go new file mode 100644 index 000000000..e414c9216 --- /dev/null +++ b/x/application/keeper/msg_server_undelegate_from_gateway.go @@ -0,0 +1,59 @@ +package keeper + +import ( + "context" + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/application/types" +) + +func (k msgServer) UndelegateFromGateway(goCtx context.Context, msg *types.MsgUndelegateFromGateway) (*types.MsgUndelegateFromGatewayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "UndelegateFromGateway") + logger.Info(fmt.Sprintf("About to undelegate application from gateway with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("Undelegation Message failed basic validation: %v", err)) + return nil, err + } + + // Retrieve the application from the store + app, found := k.GetApplication(ctx, msg.AppAddress) + if !found { + logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) + return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) + } + logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) + + // Check if the application is already delegated to the gateway + foundIdx := -1 + for i, gatewayAddr := range app.DelegateeGatewayAddresses { + if gatewayAddr == msg.GatewayAddress { + foundIdx = i + } + } + if foundIdx == -1 { + logger.Info(fmt.Sprintf("Application not delegated to gateway with address [%s]", msg.GatewayAddress)) + return nil, sdkerrors.Wrapf(types.ErrAppNotDelegated, "application not delegated to gateway with address: %s", msg.GatewayAddress) + } + + // Remove the gateway from the application's delegatee gateway public keys + app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses[:foundIdx], app.DelegateeGatewayAddresses[foundIdx+1:]...) + + // Update the application store with the new delegation + k.SetApplication(ctx, app) + logger.Info(fmt.Sprintf("Successfully undelegated application from gateway for app: %+v", app)) + + // Emit the application redelegation event + event := msg.NewRedelegationEvent() + logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) + if err := ctx.EventManager().EmitTypedEvent(event); err != nil { + logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) + return nil, err + } + + return &types.MsgUndelegateFromGatewayResponse{}, nil +} diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go new file mode 100644 index 000000000..408d3869d --- /dev/null +++ b/x/application/keeper/msg_server_undelegate_from_gateway_test.go @@ -0,0 +1,255 @@ +package keeper_test + +import ( + "fmt" + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application and gateways + appAddr := sample.AccAddress() + maxDelegatedGateways := k.GetParams(ctx).MaxDelegatedGateways + gatewayAddresses := make([]string, int(maxDelegatedGateways)) + for i := 0; i < len(gatewayAddresses); i++ { + gatewayAddr := sample.AccAddress() + // Mock the gateway being staked via the staked gateway map + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) + gatewayAddresses[i] = gatewayAddr + } + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Prepare the delegation messages and delegate the application to the gateways + for _, gatewayAddr := range gatewayAddresses { + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + // Delegate the application to the gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.NoError(t, err) + } + events := ctx.EventManager().Events() + require.Equal(t, int(maxDelegatedGateways), len(events)) + for i, event := range events { + require.Equal(t, "poktroll.application.EventRedelegation", event.Type) + require.Equal(t, "app_address", event.Attributes[0].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), event.Attributes[0].Value) + require.Equal(t, "gateway_address", event.Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[i]), event.Attributes[1].Value) + } + + // Verify that the application exists + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, maxDelegatedGateways, uint64(len(foundApp.DelegateeGatewayAddresses))) + for i, gatewayAddr := range gatewayAddresses { + require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) + } + + // Prepare an undelegation message + undelegateMsg := &types.MsgUndelegateFromGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddresses[3], + } + + // Undelegate the application from the gateway + _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) + require.NoError(t, err) + events = ctx.EventManager().Events() + require.Equal(t, int(maxDelegatedGateways)+1, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[7].Type) + require.Equal(t, "app_address", events[7].Attributes[0].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[7].Attributes[0].Value) + require.Equal(t, "gateway_address", events[7].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddresses[3]), events[7].Attributes[1].Value) + + // Verify that the application exists + foundApp, isAppFound = k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, maxDelegatedGateways-1, uint64(len(foundApp.DelegateeGatewayAddresses))) + gatewayAddresses = append(gatewayAddresses[:3], gatewayAddresses[4:]...) + for i, gatewayAddr := range gatewayAddresses { + require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) + } +} + +func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application and gateway + appAddr := sample.AccAddress() + gatewayAddr1 := sample.AccAddress() + gatewayAddr2 := sample.AccAddress() + // Mock the gateway being staked via the staked gateway map + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr1) + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Prepare the undelegation message + undelegateMsg := &types.MsgUndelegateFromGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr1, + } + + // Attempt to undelgate the application from the gateway + _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) + require.ErrorIs(t, err, types.ErrAppNotDelegated) + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) + events := ctx.EventManager().Events() + require.Equal(t, 0, len(events)) + + // Prepare a delegation message + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr2, + } + + // Delegate the application to the gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.NoError(t, err) + events = ctx.EventManager().Events() + require.Equal(t, 1, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) + require.Equal(t, "app_address", events[0].Attributes[0].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) + require.Equal(t, "gateway_address", events[0].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr2), events[0].Attributes[1].Value) + + // Ensure the failed undelegation did not affect the application + _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) + require.ErrorIs(t, err, types.ErrAppNotDelegated) + events = ctx.EventManager().Events() + require.Equal(t, 1, len(events)) + foundApp, isAppFound = k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) + require.Equal(t, gatewayAddr2, foundApp.DelegateeGatewayAddresses[0]) +} + +func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGateway(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application and gateways + appAddr := sample.AccAddress() + gatewayAddr := sample.AccAddress() + // Mock the gateway being staked via the staked gateway map + keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) + + // Prepare the application + stakeMsg := &types.MsgStakeApplication{ + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application & verify that the application exists + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + + // Prepare the delegation message and delegate the application to the gateway + delegateMsg := &types.MsgDelegateToGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + // Delegate the application to the gateway + _, err = srv.DelegateToGateway(ctx, delegateMsg) + require.NoError(t, err) + events := ctx.EventManager().Events() + require.Equal(t, 1, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) + require.Equal(t, "app_address", events[0].Attributes[0].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[0].Attributes[0].Value) + require.Equal(t, "gateway_address", events[0].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) + + // Verify that the application exists + foundApp, isAppFound := k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) + require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) + + // Mock unstaking the gateway + keepertest.RemoveGatewayFromStakedGatewayMap(t, gatewayAddr) + + // Prepare an undelegation message + undelegateMsg := &types.MsgUndelegateFromGateway{ + AppAddress: appAddr, + GatewayAddress: gatewayAddr, + } + + // Undelegate the application from the gateway + _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) + require.NoError(t, err) + events = ctx.EventManager().Events() + require.Equal(t, 2, len(events)) + require.Equal(t, "poktroll.application.EventRedelegation", events[1].Type) + require.Equal(t, "app_address", events[1].Attributes[0].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", appAddr), events[1].Attributes[0].Value) + require.Equal(t, "gateway_address", events[0].Attributes[1].Key) + require.Equal(t, fmt.Sprintf("\"%s\"", gatewayAddr), events[0].Attributes[1].Value) + + // Verify that the application exists + foundApp, isAppFound = k.GetApplication(ctx, appAddr) + require.True(t, isAppFound) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) +} diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go new file mode 100644 index 000000000..48b6bf41d --- /dev/null +++ b/x/application/keeper/msg_server_unstake_application.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/application/types" +) + +// TODO(#73): Determine if an application needs an unbonding period after unstaking. +func (k msgServer) UnstakeApplication(goCtx context.Context, msg *types.MsgUnstakeApplication) (*types.MsgUnstakeApplicationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "UnstakeApplication") + logger.Info(fmt.Sprintf("About to unstake application with msg: %v", msg)) + + // Check if the application already exists or not + var err error + app, isAppFound := k.GetApplication(ctx, msg.Address) + if !isAppFound { + logger.Info(fmt.Sprintf("Application not found. Cannot unstake address %s", msg.Address)) + return nil, types.ErrAppNotFound + } + logger.Info(fmt.Sprintf("Application found. Unstaking application for address %s", msg.Address)) + + // Retrieve the address of the application + appAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // Send the coins from the application pool back to the application + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, appAddress, []sdk.Coin{*app.Stake}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", app.Stake, appAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Application in the store + k.RemoveApplication(ctx, appAddress.String()) + logger.Info(fmt.Sprintf("Successfully removed the application: %+v", app)) + + return &types.MsgUnstakeApplicationResponse{}, nil +} diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go new file mode 100644 index 000000000..82effa708 --- /dev/null +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -0,0 +1,80 @@ +package keeper_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgServer_UnstakeApplication_Success(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application + addr := sample.AccAddress() + + // Verify that the app does not exist yet + _, isAppFound := k.GetApplication(ctx, addr) + require.False(t, isAppFound) + + // Prepare the application + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + stakeMsg := &types.MsgStakeApplication{ + Address: addr, + Stake: &initialStake, + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + }, + } + + // Stake the application + _, err := srv.StakeApplication(ctx, stakeMsg) + require.NoError(t, err) + + // Verify that the application exists + appFound, isAppFound := k.GetApplication(ctx, addr) + require.True(t, isAppFound) + require.Equal(t, addr, appFound.Address) + require.Equal(t, initialStake.Amount, appFound.Stake.Amount) + require.Len(t, appFound.ServiceConfigs, 1) + + // Unstake the application + unstakeMsg := &types.MsgUnstakeApplication{Address: addr} + _, err = srv.UnstakeApplication(ctx, unstakeMsg) + require.NoError(t, err) + + // Make sure the app can no longer be found after unstaking + _, isAppFound = k.GetApplication(ctx, addr) + require.False(t, isAppFound) +} + +func TestMsgServer_UnstakeApplication_FailIfNotStaked(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the application + addr := sample.AccAddress() + + // Verify that the app does not exist yet + _, isAppFound := k.GetApplication(ctx, addr) + require.False(t, isAppFound) + + // Unstake the application + unstakeMsg := &types.MsgUnstakeApplication{Address: addr} + _, err := srv.UnstakeApplication(ctx, unstakeMsg) + require.Error(t, err) + require.ErrorIs(t, err, types.ErrAppNotFound) + + _, isAppFound = k.GetApplication(ctx, addr) + require.False(t, isAppFound) +} diff --git a/x/application/keeper/msg_update_params.go b/x/application/keeper/msg_update_params.go new file mode 100644 index 000000000..c5aeb7407 --- /dev/null +++ b/x/application/keeper/msg_update_params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/application/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrAppInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/application/keeper/msg_update_params_test.go b/x/application/keeper/msg_update_params_test.go new file mode 100644 index 000000000..1906f0338 --- /dev/null +++ b/x/application/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/application/keeper/params.go b/x/application/keeper/params.go new file mode 100644 index 000000000..7e302935d --- /dev/null +++ b/x/application/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/application/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/application/keeper/params_test.go b/x/application/keeper/params_test.go new file mode 100644 index 000000000..ae438b984 --- /dev/null +++ b/x/application/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/application/keeper/query.go b/x/application/keeper/query.go new file mode 100644 index 000000000..288fcb527 --- /dev/null +++ b/x/application/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/application/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/application/keeper/query_application.go b/x/application/keeper/query_application.go new file mode 100644 index 000000000..405f8cff6 --- /dev/null +++ b/x/application/keeper/query_application.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/pokt-network/poktroll/x/application/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) ApplicationAll(ctx context.Context, req *types.QueryAllApplicationRequest) (*types.QueryAllApplicationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var applications []types.Application + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + applicationStore := prefix.NewStore(store, types.KeyPrefix(types.ApplicationKeyPrefix)) + + pageRes, err := query.Paginate(applicationStore, req.Pagination, func(key []byte, value []byte) error { + var application types.Application + if err := k.cdc.Unmarshal(value, &application); err != nil { + return err + } + + applications = append(applications, application) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllApplicationResponse{Application: applications, Pagination: pageRes}, nil +} + +func (k Keeper) Application(ctx context.Context, req *types.QueryGetApplicationRequest) (*types.QueryGetApplicationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + val, found := k.GetApplication( + ctx, + req.Address, + ) + if !found { + return nil, status.Error(codes.NotFound, "application not found") + } + + return &types.QueryGetApplicationResponse{Application: val}, nil +} diff --git a/x/application/keeper/query_application_test.go b/x/application/keeper/query_application_test.go new file mode 100644 index 000000000..9eba83def --- /dev/null +++ b/x/application/keeper/query_application_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/application/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestApplicationQuerySingle(t *testing.T) { + keeper, ctx := keepertest.ApplicationKeeper(t) + msgs := createNApplication(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetApplicationRequest + response *types.QueryGetApplicationResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetApplicationRequest{ + Address: msgs[0].Address, + }, + response: &types.QueryGetApplicationResponse{Application: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetApplicationRequest{ + Address: msgs[1].Address, + }, + response: &types.QueryGetApplicationResponse{Application: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetApplicationRequest{ + Address: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "application not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Application(ctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestApplicationQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.ApplicationKeeper(t) + msgs := createNApplication(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllApplicationRequest { + return &types.QueryAllApplicationRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.ApplicationAll(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Application), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Application), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.ApplicationAll(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Application), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Application), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.ApplicationAll(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Application), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.ApplicationAll(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/application/keeper/query_params.go b/x/application/keeper/query_params.go new file mode 100644 index 000000000..b0c717d4f --- /dev/null +++ b/x/application/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/application/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/application/keeper/query_params_test.go b/x/application/keeper/query_params_test.go new file mode 100644 index 000000000..86c541f6f --- /dev/null +++ b/x/application/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := keepertest.ApplicationKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/application/module/autocli.go b/x/application/module/autocli.go new file mode 100644 index 000000000..919f4b944 --- /dev/null +++ b/x/application/module/autocli.go @@ -0,0 +1,104 @@ +package application + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/application" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + Long: `Shows all the parameters related to the application module. + +Example: +$ poktrolld q application params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + }, + { + RpcMethod: "ApplicationAll", + Use: "list-application", + Short: "List all application", + Long: `List all the applications that staked in the network. + +Example: +$ poktrolld q application list-application --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + }, + { + RpcMethod: "Application", + Use: "show-application [address]", + Short: "Shows a application", + Long: `Finds a staked application given its address. + +Example: +$ poktrolld q application show-application $(APP_ADDRESS) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + { + RpcMethod: "StakeApplication", + Use: "stake-application [stake] [services]", + Short: "Send a stake-application tx", + Long: `Stake an application using a config file. This is a broadcast operation that will stake +the tokens and serviceIds and associate them with the application specified by the 'from' address. + +Example: +$ poktrolld tx application stake-application --config app_stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, + }, + { + RpcMethod: "UnstakeApplication", + Use: "unstake-application", + Short: "Send a unstake-application tx", + Long: `Unstake an application. This is a broadcast operation that will unstake +the application specified by the 'from' address. + +Example: +$ poktrolld tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + }, + { + RpcMethod: "DelegateToGateway", + Use: "delegate-to-gateway [gateway-address]", + Short: "Send a delegate-to-gateway tx", + Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation +that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway +act on the behalf of the application during a session. + +Example: +$ poktrolld tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "gateway_address"}}, + }, + { + RpcMethod: "UndelegateFromGateway", + Use: "undelegate-from-gateway [gateway-address]", + Short: "Send a undelegate-from-gateway tx", + Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation +that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway +act on the behalf of the application during a session. + +Example: +$ poktrolld tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "gateway_address"}}, + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/application/module/config/application_configs_reader.go b/x/application/module/config/application_configs_reader.go new file mode 100644 index 000000000..871ac8709 --- /dev/null +++ b/x/application/module/config/application_configs_reader.go @@ -0,0 +1,91 @@ +package config + +import ( + "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" + + sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// YAMLApplicationConfig is the structure describing a single service stake entry in the stake config file +// TODO_DOCUMENT(@red-0ne): Add additional documentation on app config files. +type YAMLApplicationConfig struct { + StakeAmount string `yaml:"stake_amount"` + ServiceIds []string `yaml:"service_ids"` +} + +type ApplicationStakeConfig struct { + // StakeAmount is the amount of upokt tokens that the application is willing to stake + StakeAmount sdk.Coin + // Services is the list of services that the application is willing to stake for + Services []*sharedtypes.ApplicationServiceConfig +} + +// ParseApplicationConfig parses the stake config file and returns a slice of ApplicationServiceConfig +func ParseApplicationConfigs(configContent []byte) (*ApplicationStakeConfig, error) { + var parsedAppConfig YAMLApplicationConfig + + if len(configContent) == 0 { + return nil, ErrApplicationConfigEmptyContent + } + + // Unmarshal the stake config file into a applicationServiceConfig + if err := yaml.Unmarshal(configContent, &parsedAppConfig); err != nil { + return nil, ErrApplicationConfigUnmarshalYAML.Wrapf("%s", err) + } + + if len(parsedAppConfig.ServiceIds) == 0 || parsedAppConfig.ServiceIds == nil { + return nil, ErrApplicationConfigInvalidServiceId.Wrap("serviceIds cannot be empty") + } + + if parsedAppConfig.StakeAmount == "" { + return nil, ErrApplicationConfigInvalidStake.Wrap("stake amount cannot be empty") + } + + stakeAmount, err := sdk.ParseCoinNormalized(parsedAppConfig.StakeAmount) + if err != nil { + return nil, ErrApplicationConfigInvalidStake.Wrap(err.Error()) + } + + if err := stakeAmount.Validate(); err != nil { + return nil, ErrApplicationConfigInvalidStake.Wrap(err.Error()) + } + + if stakeAmount.IsZero() { + return nil, ErrApplicationConfigInvalidStake.Wrap("stake amount cannot be zero") + } + + if stakeAmount.Denom != "upokt" { + return nil, ErrApplicationConfigInvalidStake.Wrapf( + "invalid stake denom, expecting: upokt, got: %s", + stakeAmount.Denom, + ) + } + + // Prepare the applicationServiceConfig + applicationServiceConfig := make( + []*sharedtypes.ApplicationServiceConfig, + 0, + len(parsedAppConfig.ServiceIds), + ) + + for _, serviceId := range parsedAppConfig.ServiceIds { + // Validate serviceId + if !sharedhelpers.IsValidServiceId(serviceId) { + return nil, ErrApplicationConfigInvalidServiceId.Wrapf("%s", serviceId) + } + + appServiceConfig := &sharedtypes.ApplicationServiceConfig{ + Service: &sharedtypes.Service{Id: serviceId}, + } + + applicationServiceConfig = append(applicationServiceConfig, appServiceConfig) + } + + return &ApplicationStakeConfig{ + StakeAmount: stakeAmount, + Services: applicationServiceConfig, + }, nil +} diff --git a/x/application/module/config/application_configs_reader_test.go b/x/application/module/config/application_configs_reader_test.go new file mode 100644 index 000000000..1f951e8ba --- /dev/null +++ b/x/application/module/config/application_configs_reader_test.go @@ -0,0 +1,141 @@ +package config_test + +import ( + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/yaml" + "github.com/pokt-network/poktroll/x/application/module/config" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func Test_ParseApplicationConfigs(t *testing.T) { + tests := []struct { + desc string + + inputConfig string + + expectedError *sdkerrors.Error + expectedConfig *config.ApplicationStakeConfig + }{ + // Valid Configs + { + desc: "valid: service staking config", + + inputConfig: ` + stake_amount: 1000upokt + service_ids: + - svc1 + - svc2 + `, + + expectedError: nil, + expectedConfig: &config.ApplicationStakeConfig{ + StakeAmount: sdk.NewCoin("upokt", sdkmath.NewInt(1000)), + Services: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1"}, + }, + { + Service: &sharedtypes.Service{Id: "svc2"}, + }, + }, + }, + }, + // Invalid Configs + { + desc: "invalid: empty service staking config", + + inputConfig: ``, + + expectedError: config.ErrApplicationConfigEmptyContent, + }, + { + desc: "invalid: no service ids", + + inputConfig: ` + stake_amount: 1000upokt + service_ids: # explicitly omitting service ids + `, + + expectedError: config.ErrApplicationConfigInvalidServiceId, + }, + { + desc: "invalid: invalid serviceId", + + inputConfig: ` + stake_amount: 1000upokt + service_ids: + - sv c1 + `, + + expectedError: config.ErrApplicationConfigInvalidServiceId, + }, + { + desc: "invalid: no stake amount", + + inputConfig: ` + stake_amount: # explicitly omitting stake amount + service_ids: + - svc1 + - svc2 + `, + + expectedError: config.ErrApplicationConfigInvalidStake, + }, + { + desc: "invalid: non-positive stake amount", + + inputConfig: ` + stake_amount: 0upokt + service_ids: + - svc1 + - svc2 + `, + + expectedError: config.ErrApplicationConfigInvalidStake, + }, + { + desc: "invalid: unsupported stake denom", + + inputConfig: ` + stake_amount: 1000npokt + service_ids: + - svc1 + - svc2 + `, + + expectedError: config.ErrApplicationConfigInvalidStake, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + appServiceConfig, err := config.ParseApplicationConfigs([]byte(normalizedConfig)) + + if tt.expectedError != nil { + require.Error(t, err) + require.ErrorIs(t, err, tt.expectedError) + require.Contains(t, err.Error(), tt.expectedError.Error()) + require.Nil(t, appServiceConfig) + return + } + + require.NoError(t, err) + + require.Equal(t, tt.expectedConfig.StakeAmount.Amount, appServiceConfig.StakeAmount.Amount) + require.Equal(t, tt.expectedConfig.StakeAmount.Denom, appServiceConfig.StakeAmount.Denom) + + t.Logf("serviceIds: %v", tt.expectedConfig.Services) + require.Equal(t, len(tt.expectedConfig.Services), len(appServiceConfig.Services)) + for i, expected := range tt.expectedConfig.Services { + require.Equal(t, expected.Service.Id, appServiceConfig.Services[i].Service.Id) + } + }) + } +} diff --git a/x/application/module/config/errors.go b/x/application/module/config/errors.go new file mode 100644 index 000000000..cc009197e --- /dev/null +++ b/x/application/module/config/errors.go @@ -0,0 +1,11 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "applicationconfig" + ErrApplicationConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") + ErrApplicationConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in application config") + ErrApplicationConfigEmptyContent = sdkerrors.Register(codespace, 3, "empty application config content") + ErrApplicationConfigInvalidStake = sdkerrors.Register(codespace, 4, "invalid stake amount in application config") +) diff --git a/x/application/module/genesis.go b/x/application/module/genesis.go new file mode 100644 index 000000000..e7f65df01 --- /dev/null +++ b/x/application/module/genesis.go @@ -0,0 +1,29 @@ +package application + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the application + for _, app := range genState.ApplicationList { + k.SetApplication(ctx, app) + } + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.ApplicationList = k.GetAllApplication(ctx) + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/application/module/genesis_test.go b/x/application/module/genesis_test.go new file mode 100644 index 000000000..9bcfc6502 --- /dev/null +++ b/x/application/module/genesis_test.go @@ -0,0 +1,409 @@ +package application_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + svc1AppConfig := &sharedtypes.ApplicationServiceConfig{ + Service: &sharedtypes.Service{Id: "svc1"}, + } + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + svc2AppConfig := &sharedtypes.ApplicationServiceConfig{ + Service: &sharedtypes.Service{Id: "svc2"}, + } + + emptyDelegatees := make([]string, 0) + gatewayAddr1 := sample.AccAddress() + gatewayAddr2 := sample.AccAddress() + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, + }, + { + Address: addr2, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid - zero app stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative application stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to duplicated app address", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr1, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to nil app stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: nil, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to missing app stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + // Explicitly missing stake + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to invalid delegatee pub key", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{"invalid address"}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to invalid delegatee pub keys", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr1}, + }, + { + Address: addr2, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{"invalid address", gatewayAddr2}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - service config not present", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + // ServiceConfigs: omitted + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - empty service config", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - service ID too long", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "12345678901"}}, + }, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - service name too long", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{ + Id: "123", + Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", + }}, + }, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - service ID with invalid characters", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "12 45 !"}}, + }, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - MaxDelegatedGateways less than 1", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 0, + }, + }, + valid: false, + }, + { + desc: "duplicated application", + genState: &types.GenesisState{ + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, + }, + { + Address: addr1, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, + }, + }, + }, + valid: false, + }, + + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/application/module/helpers_test.go b/x/application/module/helpers_test.go new file mode 100644 index 000000000..84b7b82e7 --- /dev/null +++ b/x/application/module/helpers_test.go @@ -0,0 +1,33 @@ +// Package cli_test provides unit tests for the CLI functionality. +package application_test + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/x/application/types" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +func init() { + cmd.InitSDKConfig() +} + +// networkWithApplicationObjects creates a new network with a given number of application objects. +// It returns the network and a slice of the created application objects. +func networkWithApplicationObjects(t *testing.T, n int) (*network.Network, []types.Application) { + t.Helper() + cfg := network.DefaultConfig() + appGenesisState := network.DefaultApplicationModuleGenesisState(t, n) + buf, err := cfg.Codec.MarshalJSON(appGenesisState) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), appGenesisState.ApplicationList +} diff --git a/x/application/module/module.go b/x/application/module/module.go new file mode 100644 index 000000000..5efac2d46 --- /dev/null +++ b/x/application/module/module.go @@ -0,0 +1,218 @@ +package application + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/application/module" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + GatewayKeeper types.GatewayKeeper +} + +type ModuleOutputs struct { + depinject.Out + + ApplicationKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + in.AccountKeeper, + in.GatewayKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{ApplicationKeeper: k, Module: m} +} diff --git a/x/application/module/query.go b/x/application/module/query.go new file mode 100644 index 000000000..e09436dac --- /dev/null +++ b/x/application/module/query.go @@ -0,0 +1,30 @@ +package application + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/pokt-network/poktroll/x/application/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd(queryRoute string) *cobra.Command { + // Group application queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdListApplication()) + cmd.AddCommand(CmdShowApplication()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/application/module/query_application.go b/x/application/module/query_application.go new file mode 100644 index 000000000..ff6250de2 --- /dev/null +++ b/x/application/module/query_application.go @@ -0,0 +1,86 @@ +package application + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/application/types" +) + +func CmdListApplication() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-application", + Short: "list all application", + Long: `List all the applications that staked in the network. + +Example: +$ poktrolld q application list-application --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllApplicationRequest{ + Pagination: pageReq, + } + + res, err := queryClient.ApplicationAll(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowApplication() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-application ", + Short: "shows a application", + Long: `Finds a staked application given its address. + +Example: +$ poktrolld q application show-application $(APP_ADDRESS) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + argAddress := args[0] + + params := &types.QueryGetApplicationRequest{ + Address: argAddress, + } + + res, err := queryClient.Application(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/application/module/query_application_test.go b/x/application/module/query_application_test.go new file mode 100644 index 000000000..557514282 --- /dev/null +++ b/x/application/module/query_application_test.go @@ -0,0 +1,139 @@ +package application_test + +import ( + "fmt" + "strconv" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/nullify" + application "github.com/pokt-network/poktroll/x/application/module" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestShowApplication(t *testing.T) { + net, objs := networkWithApplicationObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idAddress string + + args []string + err error + obj types.Application + }{ + { + desc: "found", + idAddress: objs[0].Address, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idAddress: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idAddress, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdShowApplication(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetApplicationResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.Application) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.Application), + ) + } + }) + } +} + +func TestListApplication(t *testing.T) { + net, objs := networkWithApplicationObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdListApplication(), args) + require.NoError(t, err) + var resp types.QueryAllApplicationResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Application), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Application), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdListApplication(), args) + require.NoError(t, err) + var resp types.QueryAllApplicationResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Application), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Application), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdListApplication(), args) + require.NoError(t, err) + var resp types.QueryAllApplicationResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.Application), + ) + }) +} diff --git a/x/application/module/query_params.go b/x/application/module/query_params.go new file mode 100644 index 000000000..b588a672e --- /dev/null +++ b/x/application/module/query_params.go @@ -0,0 +1,40 @@ +package application + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/application/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Long: `Shows all the parameters related to the application module. + +Example: +$ poktrolld q application params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/application/module/simulation.go b/x/application/module/simulation.go new file mode 100644 index 000000000..0cd35bfe6 --- /dev/null +++ b/x/application/module/simulation.go @@ -0,0 +1,156 @@ +package application + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + applicationsimulation "github.com/pokt-network/poktroll/x/application/simulation" + "github.com/pokt-network/poktroll/x/application/types" +) + +// avoid unused import issue +var ( + _ = applicationsimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( + opWeightMsgStakeApplication = "op_weight_msg_stake_application" + // TODO: Determine the simulation weight value + defaultWeightMsgStakeApplication int = 100 + + opWeightMsgUnstakeApplication = "op_weight_msg_unstake_application" + // TODO: Determine the simulation weight value + defaultWeightMsgUnstakeApplication int = 100 + + opWeightMsgDelegateToGateway = "op_weight_msg_delegate_to_gateway" + // TODO: Determine the simulation weight value + defaultWeightMsgDelegateToGateway int = 100 + + opWeightMsgUndelegateFromGateway = "op_weight_msg_undelegate_from_gateway" + // TODO: Determine the simulation weight value + defaultWeightMsgUndelegateFromGateway int = 100 + + // this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + applicationGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&applicationGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + var weightMsgStakeApplication int + simState.AppParams.GetOrGenerate(opWeightMsgStakeApplication, &weightMsgStakeApplication, nil, + func(_ *rand.Rand) { + weightMsgStakeApplication = defaultWeightMsgStakeApplication + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgStakeApplication, + applicationsimulation.SimulateMsgStakeApplication(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgUnstakeApplication int + simState.AppParams.GetOrGenerate(opWeightMsgUnstakeApplication, &weightMsgUnstakeApplication, nil, + func(_ *rand.Rand) { + weightMsgUnstakeApplication = defaultWeightMsgUnstakeApplication + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnstakeApplication, + applicationsimulation.SimulateMsgUnstakeApplication(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgDelegateToGateway int + simState.AppParams.GetOrGenerate(opWeightMsgDelegateToGateway, &weightMsgDelegateToGateway, nil, + func(_ *rand.Rand) { + weightMsgDelegateToGateway = defaultWeightMsgDelegateToGateway + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgDelegateToGateway, + applicationsimulation.SimulateMsgDelegateToGateway(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgUndelegateFromGateway int + simState.AppParams.GetOrGenerate(opWeightMsgUndelegateFromGateway, &weightMsgUndelegateFromGateway, nil, + func(_ *rand.Rand) { + weightMsgUndelegateFromGateway = defaultWeightMsgUndelegateFromGateway + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUndelegateFromGateway, + applicationsimulation.SimulateMsgUndelegateFromGateway(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgStakeApplication, + defaultWeightMsgStakeApplication, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + applicationsimulation.SimulateMsgStakeApplication(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + simulation.NewWeightedProposalMsg( + opWeightMsgUnstakeApplication, + defaultWeightMsgUnstakeApplication, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + applicationsimulation.SimulateMsgUnstakeApplication(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + simulation.NewWeightedProposalMsg( + opWeightMsgDelegateToGateway, + defaultWeightMsgDelegateToGateway, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + applicationsimulation.SimulateMsgDelegateToGateway(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + simulation.NewWeightedProposalMsg( + opWeightMsgUndelegateFromGateway, + defaultWeightMsgUndelegateFromGateway, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + applicationsimulation.SimulateMsgUndelegateFromGateway(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/application/module/tx.go b/x/application/module/tx.go new file mode 100644 index 000000000..8c849b64d --- /dev/null +++ b/x/application/module/tx.go @@ -0,0 +1,35 @@ +package application + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/pokt-network/poktroll/x/application/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdStakeApplication()) + cmd.AddCommand(CmdUnstakeApplication()) + + cmd.AddCommand(CmdDelegateToGateway()) + cmd.AddCommand(CmdUndelegateFromGateway()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/application/module/tx_delegate_to_gateway.go b/x/application/module/tx_delegate_to_gateway.go new file mode 100644 index 000000000..03b5255de --- /dev/null +++ b/x/application/module/tx_delegate_to_gateway.go @@ -0,0 +1,49 @@ +package application + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/application/types" +) + +var _ = strconv.Itoa(0) + +func CmdDelegateToGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegate-to-gateway ", + Short: "Delegate an application to a gateway", + Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation +that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway +act on the behalf of the application during a session. + +Example: +$ poktrolld tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + gatewayAddress := args[0] + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgDelegateToGateway( + clientCtx.GetFromAddress().String(), + gatewayAddress, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/application/module/tx_delegate_to_gateway_test.go b/x/application/module/tx_delegate_to_gateway_test.go new file mode 100644 index 000000000..7344f76a2 --- /dev/null +++ b/x/application/module/tx_delegate_to_gateway_test.go @@ -0,0 +1,117 @@ +package application_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + application "github.com/pokt-network/poktroll/x/application/module" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestCLI_DelegateToGateway(t *testing.T) { + net, _ := networkWithApplicationObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the application to be delegated + // and the gateway to be delegated to + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 2) + appAccount := accounts[0] + gatewayAccount := accounts[1] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + appAddress string + gatewayAddress string + err *sdkerrors.Error + }{ + { + desc: "delegate to gateway: valid", + appAddress: appAccount.Address.String(), + gatewayAddress: gatewayAccount.Address.String(), + }, + { + desc: "invalid - missing app address", + // appAddress: appAccount.Address.String(), + gatewayAddress: gatewayAccount.Address.String(), + err: types.ErrAppInvalidAddress, + }, + { + desc: "invalid - invalid app address", + appAddress: "invalid address", + gatewayAddress: gatewayAccount.Address.String(), + err: types.ErrAppInvalidAddress, + }, + { + desc: "invalid - missing gateway address", + appAddress: appAccount.Address.String(), + // gatewayAddress: gatewayAccount.Address.String(), + err: types.ErrAppInvalidGatewayAddress, + }, + { + desc: "invalid - invalid gateway address", + appAddress: appAccount.Address.String(), + gatewayAddress: "invalid address", + err: types.ErrAppInvalidGatewayAddress, + }, + } + + // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis + network.InitAccountWithSequence(t, net, appAccount.Address, 1) + network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + tt.gatewayAddress, + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), + } + args = append(args, commonArgs...) + + // Execute the command + delegateOutput, err := clitestutil.ExecTestCLICmd(ctx, application.CmdDelegateToGateway(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(delegateOutput.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/application/module/tx_stake_application.go b/x/application/module/tx_stake_application.go new file mode 100644 index 000000000..a30d8c0c2 --- /dev/null +++ b/x/application/module/tx_stake_application.go @@ -0,0 +1,66 @@ +package application + +import ( + "os" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/application/module/config" + "github.com/pokt-network/poktroll/x/application/types" +) + +var ( + flagStakeConfig string + _ = strconv.Itoa(0) +) + +func CmdStakeApplication() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "stake-application --config ", + Short: "Stake an application", + Long: `Stake an application with the provided parameters. This is a broadcast operation that +will stake the tokens and serviceIds and associate them with the application specified by the 'from' address. + +Example: +$ poktrolld tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, _ []string) (err error) { + configContent, err := os.ReadFile(flagStakeConfig) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + appStakeConfigs, err := config.ParseApplicationConfigs(configContent) + if err != nil { + return err + } + + msg := types.NewMsgStakeApplication( + clientCtx.GetFromAddress().String(), + appStakeConfigs.StakeAmount, + appStakeConfigs.Services, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/application/module/tx_stake_application_test.go b/x/application/module/tx_stake_application_test.go new file mode 100644 index 000000000..2b88144a9 --- /dev/null +++ b/x/application/module/tx_stake_application_test.go @@ -0,0 +1,235 @@ +package application_test + +import ( + "fmt" + "os" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/testutil/yaml" + application "github.com/pokt-network/poktroll/x/application/module" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestCLI_StakeApplication(t *testing.T) { + net, _ := networkWithApplicationObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the application to be staked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + appAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + defaultConfig := ` + stake_amount: 1000upokt + service_ids: + - svc1 + - svc2 + - svc3 + ` + + tests := []struct { + desc string + + inputConfig string + inputAddress string + + expectedError *sdkerrors.Error + }{ + // Happy Paths + { + desc: "valid", + + inputAddress: appAccount.Address.String(), + inputConfig: defaultConfig, + + expectedError: nil, + }, + + // Error Paths - Address Related + { + desc: "invalid: missing address", + // inputAddress: "explicitly missing", + inputConfig: defaultConfig, + + expectedError: types.ErrAppInvalidAddress, + }, + { + desc: "invalid: invalid address", + + inputAddress: "invalid", + inputConfig: defaultConfig, + + expectedError: types.ErrAppInvalidAddress, + }, + + // Error Paths - Stake Related + { + desc: "invalid: missing stake", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: # explicitly missing + service_ids: + - svc1 + - svc2 + - svc3 + `, + + expectedError: types.ErrAppInvalidStake, + }, + { + desc: "invalid: invalid stake denom", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: 1000invalid + service_ids: + - svc1 + - svc2 + - svc3 + `, + + expectedError: types.ErrAppInvalidStake, + }, + { + desc: "invalid: stake amount (zero)", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: 0upokt + service_ids: + - svc1 + - svc2 + - svc3 + `, + + expectedError: types.ErrAppInvalidStake, + }, + { + desc: "invalid: stake amount (negative)", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: -1000upokt + service_ids: + - svc1 + - svc2 + - svc3 + `, + + expectedError: types.ErrAppInvalidStake, + }, + + // Error Paths - Service Related + { + desc: "invalid: services (empty string)", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + `, + + expectedError: types.ErrAppInvalidServiceConfigs, + }, + { + desc: "invalid: single invalid service contains spaces", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + service_ids: + - svc1 svc1_part2 svc1_part3 + `, + + expectedError: types.ErrAppInvalidServiceConfigs, + }, + { + desc: "invalid: one of two services is invalid because it contains spaces", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + service_ids: + - svc1 svc1_part2 + - svc2 + `, + + expectedError: types.ErrAppInvalidServiceConfigs, + }, + { + desc: "invalid: service ID is too long (8 chars is the max)", + + inputAddress: appAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + service_ids: + - svc1, + - abcdefghi + `, + + expectedError: types.ErrAppInvalidServiceConfigs, + }, + } + + // Initialize the App Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, appAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // write the stake config to a file + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() + t.Cleanup(func() { os.Remove(configPath) }) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--config=%s", configPath), + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.inputAddress), + } + args = append(args, commonArgs...) + + // Execute the command + outStake, err := clitestutil.ExecTestCLICmd(ctx, application.CmdStakeApplication(), args) + + // Validate the error if one is expected + if tt.expectedError != nil { + stat, ok := status.FromError(tt.expectedError) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.expectedError.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/application/module/tx_undelegate_from_gateway.go b/x/application/module/tx_undelegate_from_gateway.go new file mode 100644 index 000000000..0a3e6e694 --- /dev/null +++ b/x/application/module/tx_undelegate_from_gateway.go @@ -0,0 +1,49 @@ +package application + +import ( + "strconv" + + "github.com/pokt-network/poktroll/x/application/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdUndelegateFromGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "undelegate-from-gateway [gateway address]", + Short: "Undelegate an application from a gateway", + Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation +that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway +act on the behalf of the application during a session. + +Example: +$ poktrolld tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + gatewayAddress := args[0] + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUndelegateFromGateway( + clientCtx.GetFromAddress().String(), + gatewayAddress, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/application/module/tx_undelegate_from_gateway_test.go b/x/application/module/tx_undelegate_from_gateway_test.go new file mode 100644 index 000000000..7c510f8f2 --- /dev/null +++ b/x/application/module/tx_undelegate_from_gateway_test.go @@ -0,0 +1,117 @@ +package application_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + application "github.com/pokt-network/poktroll/x/application/module" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestCLI_UndelegateFromGateway(t *testing.T) { + net, _ := networkWithApplicationObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the application to be delegated + // and the gateway to be delegated to + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 2) + appAccount := accounts[0] + gatewayAccount := accounts[1] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + appAddress string + gatewayAddress string + err *sdkerrors.Error + }{ + { + desc: "undelegate from gateway: valid", + appAddress: appAccount.Address.String(), + gatewayAddress: gatewayAccount.Address.String(), + }, + { + desc: "invalid - missing app address", + // appAddress: appAccount.Address.String(), + gatewayAddress: gatewayAccount.Address.String(), + err: types.ErrAppInvalidAddress, + }, + { + desc: "invalid - invalid app address", + appAddress: "invalid address", + gatewayAddress: gatewayAccount.Address.String(), + err: types.ErrAppInvalidAddress, + }, + { + desc: "invalid - missing gateway address", + appAddress: appAccount.Address.String(), + // gatewayAddress: gatewayAccount.Address.String(), + err: types.ErrAppInvalidGatewayAddress, + }, + { + desc: "invalid - invalid gateway address", + appAddress: appAccount.Address.String(), + gatewayAddress: "invalid address", + err: types.ErrAppInvalidGatewayAddress, + }, + } + + // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis + network.InitAccountWithSequence(t, net, appAccount.Address, 1) + network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + tt.gatewayAddress, + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), + } + args = append(args, commonArgs...) + + // Execute the command + undelegateOutput, err := clitestutil.ExecTestCLICmd(ctx, application.CmdUndelegateFromGateway(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(undelegateOutput.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/application/module/tx_unstake_application.go b/x/application/module/tx_unstake_application.go new file mode 100644 index 000000000..25f36e6d4 --- /dev/null +++ b/x/application/module/tx_unstake_application.go @@ -0,0 +1,47 @@ +package application + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/application/types" +) + +var _ = strconv.Itoa(0) + +func CmdUnstakeApplication() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "unstake-application", + Short: "Unstake an application", + Long: `Unstake an application. This is a broadcast operation that will unstake +the application specified by the 'from' address. + +Example: +$ poktrolld tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUnstakeApplication( + clientCtx.GetFromAddress().String(), + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/application/module/tx_unstake_application_test.go b/x/application/module/tx_unstake_application_test.go new file mode 100644 index 000000000..6aad0f5a5 --- /dev/null +++ b/x/application/module/tx_unstake_application_test.go @@ -0,0 +1,97 @@ +package application_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + application "github.com/pokt-network/poktroll/x/application/module" + "github.com/pokt-network/poktroll/x/application/types" +) + +func TestCLI_UnstakeApplication(t *testing.T) { + net, _ := networkWithApplicationObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the application to be unstaked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + appAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + address string + err *sdkerrors.Error + }{ + { + desc: "unstake application: valid", + address: appAccount.Address.String(), + }, + { + desc: "unstake application: missing address", + // address: "explicitly missing", + err: types.ErrAppInvalidAddress, + }, + { + desc: "unstake application: invalid address", + address: "invalid", + err: types.ErrAppInvalidAddress, + }, + } + + // Initialize the App Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, appAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outUnstake, err := clitestutil.ExecTestCLICmd(ctx, application.CmdUnstakeApplication(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/application/simulation/delegate_to_gateway.go b/x/application/simulation/delegate_to_gateway.go new file mode 100644 index 000000000..f8230ef75 --- /dev/null +++ b/x/application/simulation/delegate_to_gateway.go @@ -0,0 +1,32 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +func SimulateMsgDelegateToGateway( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + simGatewayAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgDelegateToGateway{ + AppAddress: simAccount.Address.String(), + GatewayAddress: simGatewayAccount.Address.String(), + } + + // TODO: Handling the DelegateToGateway simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "DelegateToGateway simulation not implemented"), nil, nil + } +} diff --git a/x/application/simulation/helpers.go b/x/application/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/application/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/application/simulation/stake_application.go b/x/application/simulation/stake_application.go new file mode 100644 index 000000000..286f94230 --- /dev/null +++ b/x/application/simulation/stake_application.go @@ -0,0 +1,31 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +// TODO(@Olshansk): Implement simulation for application staking +func SimulateMsgStakeApplication( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + stakeMsg := &types.MsgStakeApplication{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the StakeApplication simulation + // See the documentation here to simulate application staking: https://docs.cosmos.network/main/learn/advanced/simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(stakeMsg), "StakeApplication simulation not implemented"), nil, nil + } +} diff --git a/x/application/simulation/undelegate_from_gateway.go b/x/application/simulation/undelegate_from_gateway.go new file mode 100644 index 000000000..5f6badb68 --- /dev/null +++ b/x/application/simulation/undelegate_from_gateway.go @@ -0,0 +1,32 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +func SimulateMsgUndelegateFromGateway( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAppAccount, _ := simtypes.RandomAcc(r, accs) + simGatewayAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUndelegateFromGateway{ + AppAddress: simAppAccount.Address.String(), + GatewayAddress: simGatewayAccount.Address.String(), + } + + // TODO: Handling the UndelegateFromGateway simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UndelegateFromGateway simulation not implemented"), nil, nil + } +} diff --git a/x/application/simulation/unstake_application.go b/x/application/simulation/unstake_application.go new file mode 100644 index 000000000..80e337110 --- /dev/null +++ b/x/application/simulation/unstake_application.go @@ -0,0 +1,30 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" +) + +func SimulateMsgUnstakeApplication( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUnstakeApplication{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the UnstakeApplication simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UnstakeApplication simulation not implemented"), nil, nil + } +} diff --git a/x/application/types/codec.go b/x/application/types/codec.go new file mode 100644 index 000000000..0bb895958 --- /dev/null +++ b/x/application/types/codec.go @@ -0,0 +1,29 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgStakeApplication{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnstakeApplication{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgDelegateToGateway{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUndelegateFromGateway{}, + ) + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/application/types/errors.go b/x/application/types/errors.go new file mode 100644 index 000000000..eabbba623 --- /dev/null +++ b/x/application/types/errors.go @@ -0,0 +1,24 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/application module sentinel errors +var ( + ErrAppInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrAppSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1102, "invalid application stake") + ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 1103, "invalid application address") + ErrAppUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized application signer") + ErrAppNotFound = sdkerrors.Register(ModuleName, 1105, "application not found") + ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 1107, "invalid service configs") + ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 1108, "gateway not found") + ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 1109, "invalid gateway address") + ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 1110, "application already delegated to gateway") + ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1111, "maximum number of delegated gateways reached") + ErrAppInvalidMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1112, "invalid MaxDelegatedGateways parameter") + ErrAppNotDelegated = sdkerrors.Register(ModuleName, 1113, "application not delegated to gateway") +) diff --git a/x/application/types/expected_keepers.go b/x/application/types/expected_keepers.go new file mode 100644 index 000000000..bf19c659b --- /dev/null +++ b/x/application/types/expected_keepers.go @@ -0,0 +1,34 @@ +package types + +//go:generate mockgen -destination ../../../testutil/application/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,GatewayKeeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +// GatewayKeeper defines the expected interface needed to retrieve gateway information. +type GatewayKeeper interface { + GetGateway(ctx context.Context, addr string) (gatewaytypes.Gateway, bool) +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/application/types/genesis.go b/x/application/types/genesis.go new file mode 100644 index 000000000..1e47c655b --- /dev/null +++ b/x/application/types/genesis.go @@ -0,0 +1,75 @@ +package types + +import ( + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + ApplicationList: []Application{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in application + applicationIndexMap := make(map[string]struct{}) + + for _, app := range gs.ApplicationList { + index := string(ApplicationKey(app.Address)) + if _, ok := applicationIndexMap[index]; ok { + return fmt.Errorf("duplicated index for application") + } + applicationIndexMap[index] = struct{}{} + } + + // Check that the stake value for the apps is valid and that the delegatee addresses are valid + for _, app := range gs.ApplicationList { + // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, + // similar to how we have `ValidateAppServiceConfigs` below + if app.Stake == nil { + return sdkerrors.Wrapf(ErrAppInvalidStake, "nil stake amount for application") + } + stake, err := sdk.ParseCoinNormalized(app.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse stake amount for application %v; (%v)", app.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", app.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application %v", app.Stake) + } + + // Check that the application's delegated gateway addresses are valid + for _, gatewayAddr := range app.DelegateeGatewayAddresses { + if _, err := sdk.AccAddressFromBech32(gatewayAddr); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", gatewayAddr, err) + } + } + + // Validate the application service configs + if err := servicehelpers.ValidateAppServiceConfigs(app.ServiceConfigs); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) + } + } + + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/application/types/key_application.go b/x/application/types/key_application.go new file mode 100644 index 000000000..02cbefc4e --- /dev/null +++ b/x/application/types/key_application.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // ApplicationKeyPrefix is the prefix to retrieve all Application + ApplicationKeyPrefix = "Application/value/" +) + +// ApplicationKey returns the store key to retrieve a Application from the index fields +func ApplicationKey( + address string, +) []byte { + var key []byte + + addressBytes := []byte(address) + key = append(key, addressBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/application/types/keys.go b/x/application/types/keys.go new file mode 100644 index 000000000..aad5dc550 --- /dev/null +++ b/x/application/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "application" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_application" +) + +var ( + ParamsKey = []byte("p_application") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/application/types/message_delegate_to_gateway.go b/x/application/types/message_delegate_to_gateway.go new file mode 100644 index 000000000..cc505287f --- /dev/null +++ b/x/application/types/message_delegate_to_gateway.go @@ -0,0 +1,34 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgDelegateToGateway)(nil) + +func NewMsgDelegateToGateway(appAddress, gatewayAddress string) *MsgDelegateToGateway { + return &MsgDelegateToGateway{ + AppAddress: appAddress, + GatewayAddress: gatewayAddress, + } +} + +func (msg *MsgDelegateToGateway) NewRedelegationEvent() *EventRedelegation { + return &EventRedelegation{ + AppAddress: msg.AppAddress, + GatewayAddress: msg.GatewayAddress, + } +} + +func (msg *MsgDelegateToGateway) ValidateBasic() error { + // Validate the application address + if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) + } + // Validate the gateway address + if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) + } + return nil +} diff --git a/x/application/types/message_delegate_to_gateway_test.go b/x/application/types/message_delegate_to_gateway_test.go new file mode 100644 index 000000000..3d0f88b6b --- /dev/null +++ b/x/application/types/message_delegate_to_gateway_test.go @@ -0,0 +1,58 @@ +package types + +import ( + "testing" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgDelegateToGateway_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgDelegateToGateway + err error + }{ + { + name: "invalid app address - no gateway address", + msg: MsgDelegateToGateway{ + AppAddress: "invalid_address", + // GatewayAddress: intentionally omitted, + }, + err: ErrAppInvalidAddress, + }, + { + name: "valid app address - no gateway address", + msg: MsgDelegateToGateway{ + AppAddress: sample.AccAddress(), + // GatewayAddress: intentionally omitted, + }, + err: ErrAppInvalidGatewayAddress, + }, + { + name: "valid app address - invalid gateway address", + msg: MsgDelegateToGateway{ + AppAddress: sample.AccAddress(), + GatewayAddress: "invalid_address", + }, + err: ErrAppInvalidGatewayAddress, + }, + { + name: "valid address", + msg: MsgDelegateToGateway{ + AppAddress: sample.AccAddress(), + GatewayAddress: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/application/types/message_stake_application.go b/x/application/types/message_stake_application.go new file mode 100644 index 000000000..f7c739fcc --- /dev/null +++ b/x/application/types/message_stake_application.go @@ -0,0 +1,58 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +var _ sdk.Msg = (*MsgStakeApplication)(nil) + +// TODO_TECHDEBT: See `NewMsgStakeSupplier` and follow the same pattern for the `Services` parameter +func NewMsgStakeApplication( + address string, + stake sdk.Coin, + appServiceConfigs []*sharedtypes.ApplicationServiceConfig, +) *MsgStakeApplication { + return &MsgStakeApplication{ + Address: address, + Stake: &stake, + Services: appServiceConfigs, + } +} + +func (msg *MsgStakeApplication) ValidateBasic() error { + // Validate the address + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.Address, err) + } + + // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code + // Validate the stake amount + if msg.Stake == nil { + return sdkerrors.Wrapf(ErrAppInvalidStake, "nil application stake; (%v)", err) + } + stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid application stake %v; (%v)", msg.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse application stake %v; (%v)", msg.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", msg.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application: %v", msg.Stake) + } + + // Validate the application service configs + if err := servicehelpers.ValidateAppServiceConfigs(msg.Services); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) + } + + return nil +} diff --git a/x/application/types/message_stake_application_test.go b/x/application/types/message_stake_application_test.go new file mode 100644 index 000000000..155986110 --- /dev/null +++ b/x/application/types/message_stake_application_test.go @@ -0,0 +1,173 @@ +package types + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgStakeApplication_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgStakeApplication + err error + }{ + // address related tests + { + name: "invalid address - nil stake", + msg: MsgStakeApplication{ + Address: "invalid_address", + // Stake explicitly nil + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + err: ErrAppInvalidAddress, + }, + + // stake related tests + { + name: "valid address - nil stake", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + // Stake explicitly nil + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + err: ErrAppInvalidStake, + }, { + name: "valid address - valid stake", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + }, { + name: "valid address - zero stake", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + err: ErrAppInvalidStake, + }, { + name: "valid address - negative stake", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + err: ErrAppInvalidStake, + }, { + name: "valid address - invalid stake denom", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + err: ErrAppInvalidStake, + }, { + name: "valid address - invalid stake missing denom", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + }, + }, + err: ErrAppInvalidStake, + }, + + // service related tests + { + name: "valid service configs - multiple services", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "svc1"}}, + {Service: &sharedtypes.Service{Id: "svc2"}}, + }, + }, + }, + { + name: "invalid service configs - not present", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + // Services: omitted + }, + err: ErrAppInvalidServiceConfigs, + }, + { + name: "invalid service configs - empty", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{}, + }, + err: ErrAppInvalidServiceConfigs, + }, + { + name: "invalid service configs - invalid service ID that's too long", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "123456790"}}, + }, + }, + err: ErrAppInvalidServiceConfigs, + }, + { + name: "invalid service configs - invalid service Name that's too long", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{ + Id: "123", + Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", + }}, + }, + }, + err: ErrAppInvalidServiceConfigs, + }, + { + name: "invalid service configs - invalid service ID that contains invalid characters", + msg: MsgStakeApplication{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Services: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "12 45 !"}}, + }, + }, + err: ErrAppInvalidServiceConfigs, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/application/types/message_undelegate_from_gateway.go b/x/application/types/message_undelegate_from_gateway.go new file mode 100644 index 000000000..e2bf8ac44 --- /dev/null +++ b/x/application/types/message_undelegate_from_gateway.go @@ -0,0 +1,34 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUndelegateFromGateway)(nil) + +func NewMsgUndelegateFromGateway(appAddress string, gatewayAddress string) *MsgUndelegateFromGateway { + return &MsgUndelegateFromGateway{ + AppAddress: appAddress, + GatewayAddress: gatewayAddress, + } +} + +func (msg *MsgUndelegateFromGateway) NewRedelegationEvent() *EventRedelegation { + return &EventRedelegation{ + AppAddress: msg.AppAddress, + GatewayAddress: msg.GatewayAddress, + } +} + +func (msg *MsgUndelegateFromGateway) ValidateBasic() error { + // Validate the application address + if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) + } + // Validate the gateway address + if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { + return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) + } + return nil +} diff --git a/x/application/types/message_undelegate_from_gateway_test.go b/x/application/types/message_undelegate_from_gateway_test.go new file mode 100644 index 000000000..87ad660c9 --- /dev/null +++ b/x/application/types/message_undelegate_from_gateway_test.go @@ -0,0 +1,56 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUndelegateFromGateway_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUndelegateFromGateway + err error + }{ + { + name: "invalid app address - no gateway address", + msg: MsgUndelegateFromGateway{ + AppAddress: "invalid_address", + // GatewayAddress: sample.AccAddress(), + }, + err: ErrAppInvalidAddress, + }, { + name: "valid app address - no gateway address", + msg: MsgUndelegateFromGateway{ + AppAddress: sample.AccAddress(), + // GatewayAddress: sample.AccAddress(), + }, + err: ErrAppInvalidGatewayAddress, + }, { + name: "valid app address - invalid gateway address", + msg: MsgUndelegateFromGateway{ + AppAddress: sample.AccAddress(), + GatewayAddress: "invalid_address", + }, + err: ErrAppInvalidGatewayAddress, + }, { + name: "valid address", + msg: MsgUndelegateFromGateway{ + AppAddress: sample.AccAddress(), + GatewayAddress: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/application/types/message_unstake_application.go b/x/application/types/message_unstake_application.go new file mode 100644 index 000000000..bceeda6d7 --- /dev/null +++ b/x/application/types/message_unstake_application.go @@ -0,0 +1,22 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUnstakeApplication)(nil) + +func NewMsgUnstakeApplication(address string) *MsgUnstakeApplication { + return &MsgUnstakeApplication{ + Address: address, + } +} + +func (msg *MsgUnstakeApplication) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return errorsmod.Wrapf(ErrAppInvalidAddress, "invalid address address (%s)", err) + } + return nil +} diff --git a/x/application/types/message_unstake_application_test.go b/x/application/types/message_unstake_application_test.go new file mode 100644 index 000000000..fdc9a5a91 --- /dev/null +++ b/x/application/types/message_unstake_application_test.go @@ -0,0 +1,46 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUnstakeApplication_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUnstakeApplication + err error + }{ + { + name: "valid", + msg: MsgUnstakeApplication{ + Address: sample.AccAddress(), + }, + }, + { + name: "invalid - missing address", + msg: MsgUnstakeApplication{}, + err: ErrAppInvalidAddress, + }, + { + name: "invalid - invalid address", + msg: MsgUnstakeApplication{ + Address: "invalid_address", + }, + err: ErrAppInvalidAddress, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/application/types/msg_update_params.go b/x/application/types/msg_update_params.go new file mode 100644 index 000000000..aeed4a633 --- /dev/null +++ b/x/application/types/msg_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/application/types/params.go b/x/application/types/params.go new file mode 100644 index 000000000..2efad3990 --- /dev/null +++ b/x/application/types/params.go @@ -0,0 +1,69 @@ +package types + +import ( + "fmt" + + sdkerrors "cosmossdk.io/errors" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + KeyMaxDelegatedGateways = []byte("MaxDelegatedGateways") + // TODO: Determine the default value + DefaultMaxDelegatedGateways uint64 = 7 +) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + maxDelegatedGateways uint64, +) Params { + return Params{ + MaxDelegatedGateways: maxDelegatedGateways, + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams( + DefaultMaxDelegatedGateways, + ) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyMaxDelegatedGateways, &p.MaxDelegatedGateways, validateMaxDelegatedGateways), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + if err := validateMaxDelegatedGateways(p.MaxDelegatedGateways); err != nil { + return err + } + + return nil +} + +// validateMaxDelegatedGateways validates the MaxDelegatedGateways param +func validateMaxDelegatedGateways(v interface{}) error { + maxDelegatedGateways, ok := v.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // Hard-coding a value of 1 because we never expect this to change. + // If an application choses to delegate, at least one is required. + if maxDelegatedGateways < 1 { + return sdkerrors.Wrapf(ErrAppInvalidMaxDelegatedGateways, "MaxDelegatedGateways param < 1: got %d", maxDelegatedGateways) + } + + return nil +} diff --git a/x/application/types/types.go b/x/application/types/types.go new file mode 100644 index 000000000..78d9ec9f9 --- /dev/null +++ b/x/application/types/types.go @@ -0,0 +1,3 @@ +package types + +// This file is in place to declare the package for dynamically generated protobufs diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go new file mode 100644 index 000000000..a1b8ea56d --- /dev/null +++ b/x/gateway/keeper/gateway.go @@ -0,0 +1,71 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// SetGateway set a specific gateway in the store from its index +func (k Keeper) SetGateway(ctx context.Context, gateway types.Gateway) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + b := k.cdc.MustMarshal(&gateway) + store.Set(types.GatewayKey( + gateway.Address, + ), b) +} + +// GetGateway returns a gateway from its index +func (k Keeper) GetGateway( + ctx context.Context, + address string, + +) (val types.Gateway, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + + b := store.Get(types.GatewayKey( + address, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveGateway removes a gateway from the store +func (k Keeper) RemoveGateway( + ctx context.Context, + address string, + +) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + store.Delete(types.GatewayKey( + address, + )) +} + +// GetAllGateway returns all gateway +func (k Keeper) GetAllGateway(ctx context.Context) (list []types.Gateway) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Gateway + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go new file mode 100644 index 000000000..0e77c232e --- /dev/null +++ b/x/gateway/keeper/gateway_test.go @@ -0,0 +1,75 @@ +package keeper_test + +import ( + "context" + "strconv" + "testing" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func init() { + cmd.InitSDKConfig() +} + +func createNGateway(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { + items := make([]types.Gateway, n) + for i := range items { + items[i].Address = strconv.Itoa(i) + + keeper.SetGateway(ctx, items[i]) + } + return items +} + +func TestGatewayModuleAddress(t *testing.T) { + moduleAddress := authtypes.NewModuleAddress(types.ModuleName) + require.Equal(t, "pokt1f6j7u6875p2cvyrgjr0d2uecyzah0kget9vlpl", moduleAddress.String()) +} + +func TestGatewayGet(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + items := createNGateway(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetGateway(ctx, + item.Address, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestGatewayRemove(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + items := createNGateway(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveGateway(ctx, + item.Address, + ) + _, found := keeper.GetGateway(ctx, + item.Address, + ) + require.False(t, found) + } +} + +func TestGatewayGetAll(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + items := createNGateway(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllGateway(ctx)), + ) +} diff --git a/x/gateway/keeper/keeper.go b/x/gateway/keeper/keeper.go new file mode 100644 index 000000000..e5bd0187e --- /dev/null +++ b/x/gateway/keeper/keeper.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + bankKeeper types.BankKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + bankKeeper: bankKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/gateway/keeper/msg_server.go b/x/gateway/keeper/msg_server.go new file mode 100644 index 000000000..fafeff27b --- /dev/null +++ b/x/gateway/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/gateway/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go new file mode 100644 index 000000000..1a08d0049 --- /dev/null +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -0,0 +1,91 @@ +package keeper + +import ( + "context" + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k msgServer) StakeGateway( + goCtx context.Context, + msg *types.MsgStakeGateway, +) (*types.MsgStakeGatewayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "StakeGateway") + logger.Info(fmt.Sprintf("About to stake gateway with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // Check if the gateway already exists or not + var err error + var coinsToDelegate sdk.Coin + gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) + if !isGatewayFound { + logger.Info(fmt.Sprintf("Gateway not found. Creating new gateway for address %s", msg.Address)) + gateway = k.createGateway(ctx, msg) + coinsToDelegate = *msg.Stake + } else { + logger.Info(fmt.Sprintf("Gateway found. Updating gateway stake for address %s", msg.Address)) + currGatewayStake := *gateway.Stake + if err = k.updateGateway(ctx, &gateway, msg); err != nil { + return nil, err + } + coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) + } + + // Retrieve the address of the gateway + gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // Send the coins from the gateway to the staked gateway pool + err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Gateway in the store + k.SetGateway(ctx, gateway) + logger.Info(fmt.Sprintf("Successfully updated stake for gateway: %+v", gateway)) + + return &types.MsgStakeGatewayResponse{}, nil +} + +func (k msgServer) createGateway( + _ sdk.Context, + msg *types.MsgStakeGateway, +) types.Gateway { + return types.Gateway{ + Address: msg.Address, + Stake: msg.Stake, + } +} + +func (k msgServer) updateGateway( + _ sdk.Context, + gateway *types.Gateway, + msg *types.MsgStakeGateway, +) error { + // Checks if the the msg address is the same as the current owner + if msg.Address != gateway.Address { + return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) + } + if msg.Stake == nil { + return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") + } + if msg.Stake.IsLTE(*gateway.Stake) { + return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) + } + gateway.Stake = msg.Stake + return nil +} diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go new file mode 100644 index 000000000..113304ee9 --- /dev/null +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -0,0 +1,92 @@ +package keeper_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the gateway + addr := sample.AccAddress() + + // Verify that the gateway does not exist yet + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) + + // Prepare the gateway + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + stakeMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &initialStake, + } + + // Stake the gateway + _, err := srv.StakeGateway(ctx, stakeMsg) + require.NoError(t, err) + + // Verify that the gateway exists + foundGateway, isGatewayFound := k.GetGateway(ctx, addr) + require.True(t, isGatewayFound) + require.Equal(t, addr, foundGateway.Address) + require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) + + // Prepare an updated gateway with a higher stake + updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(200)) + updateMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &updatedStake, + } + + // Update the staked gateway + _, err = srv.StakeGateway(ctx, updateMsg) + require.NoError(t, err) + foundGateway, isGatewayFound = k.GetGateway(ctx, addr) + require.True(t, isGatewayFound) + require.Equal(t, updatedStake.Amount, foundGateway.Stake.Amount) +} + +func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Prepare the gateway + addr := sample.AccAddress() + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + stakeMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &initialStake, + } + + // Stake the gateway & verify that the gateway exists + _, err := srv.StakeGateway(ctx, stakeMsg) + require.NoError(t, err) + _, isGatewayFound := k.GetGateway(ctx, addr) + require.True(t, isGatewayFound) + + // Prepare an updated gateway with a lower stake + updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(50)) + updateMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &updatedStake, + } + + // Verify that it fails + _, err = srv.StakeGateway(ctx, updateMsg) + require.Error(t, err) + + // Verify that the gateway stake is unchanged + gatewayFound, isGatewayFound := k.GetGateway(ctx, addr) + require.True(t, isGatewayFound) + require.Equal(t, initialStake.Amount, gatewayFound.Stake.Amount) +} diff --git a/x/gateway/keeper/msg_server_test.go b/x/gateway/keeper/msg_server_test.go new file mode 100644 index 000000000..64fa7a9d3 --- /dev/null +++ b/x/gateway/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.GatewayKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go new file mode 100644 index 000000000..302c388f2 --- /dev/null +++ b/x/gateway/keeper/msg_server_unstake_gateway.go @@ -0,0 +1,54 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// TODO_TECHDEBT(#49): Add un-delegation from delegated apps +// TODO(#73): Determine if a gateway needs an unbonding period after unstaking. +func (k msgServer) UnstakeGateway( + goCtx context.Context, + msg *types.MsgUnstakeGateway, +) (*types.MsgUnstakeGatewayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "UnstakeGateway") + logger.Info(fmt.Sprintf("About to unstake gateway with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // Check if the gateway already exists or not + var err error + gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) + if !isGatewayFound { + logger.Info(fmt.Sprintf("Gateway not found. Cannot unstake address %s", msg.Address)) + return nil, types.ErrGatewayNotFound + } + logger.Info(fmt.Sprintf("Gateway found. Unstaking gateway for address %s", msg.Address)) + + // Retrieve the address of the gateway + gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // Send the coins from the gateway pool back to the gateway + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, gatewayAddress, []sdk.Coin{*gateway.Stake}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", gateway.Stake, gatewayAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Gateway in the store + k.RemoveGateway(ctx, gatewayAddress.String()) + logger.Info(fmt.Sprintf("Successfully removed the gateway: %+v", gateway)) + return &types.MsgUnstakeGatewayResponse{}, nil +} diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go new file mode 100644 index 000000000..8f1dcf351 --- /dev/null +++ b/x/gateway/keeper/msg_server_unstake_gateway_test.go @@ -0,0 +1,73 @@ +package keeper_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgServer_UnstakeGateway_Success(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the gateway + addr := sample.AccAddress() + + // Verify that the gateway does not exist yet + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) + + // Prepare the gateway + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + stakeMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &initialStake, + } + + // Stake the gateway + _, err := srv.StakeGateway(ctx, stakeMsg) + require.NoError(t, err) + + // Verify that the gateway exists + foundGateway, isGatewayFound := k.GetGateway(ctx, addr) + require.True(t, isGatewayFound) + require.Equal(t, addr, foundGateway.Address) + require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) + + // Unstake the gateway + unstakeMsg := &types.MsgUnstakeGateway{Address: addr} + _, err = srv.UnstakeGateway(ctx, unstakeMsg) + require.NoError(t, err) + + // Make sure the gateway can no longer be found after unstaking + _, isGatewayFound = k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) +} + +func TestMsgServer_UnstakeGateway_FailIfNotStaked(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the gateway + addr := sample.AccAddress() + + // Verify that the gateway does not exist yet + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) + + // Unstake the gateway + unstakeMsg := &types.MsgUnstakeGateway{Address: addr} + _, err := srv.UnstakeGateway(ctx, unstakeMsg) + require.Error(t, err) + require.ErrorIs(t, err, types.ErrGatewayNotFound) + + _, isGatewayFound = k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) +} diff --git a/x/gateway/keeper/msg_update_params.go b/x/gateway/keeper/msg_update_params.go new file mode 100644 index 000000000..abfd5938d --- /dev/null +++ b/x/gateway/keeper/msg_update_params.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k msgServer) UpdateParams( + goCtx context.Context, + req *types.MsgUpdateParams, +) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrGatewayInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/gateway/keeper/msg_update_params_test.go b/x/gateway/keeper/msg_update_params_test.go new file mode 100644 index 000000000..80ab28696 --- /dev/null +++ b/x/gateway/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/gateway/keeper/params.go b/x/gateway/keeper/params.go new file mode 100644 index 000000000..7a720a898 --- /dev/null +++ b/x/gateway/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go new file mode 100644 index 000000000..27bf9d53d --- /dev/null +++ b/x/gateway/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.GatewayKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/gateway/keeper/query.go b/x/gateway/keeper/query.go new file mode 100644 index 000000000..ffa80d00d --- /dev/null +++ b/x/gateway/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go new file mode 100644 index 000000000..06712114c --- /dev/null +++ b/x/gateway/keeper/query_gateway.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var gateways []types.Gateway + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + gatewayStore := prefix.NewStore(store, types.KeyPrefix(types.GatewayKeyPrefix)) + + pageRes, err := query.Paginate(gatewayStore, req.Pagination, func(key []byte, value []byte) error { + var gateway types.Gateway + if err := k.cdc.Unmarshal(value, &gateway); err != nil { + return err + } + + gateways = append(gateways, gateway) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil +} + +func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + val, found := k.GetGateway( + ctx, + req.Address, + ) + if !found { + return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) + } + return &types.QueryGetGatewayResponse{Gateway: val}, nil +} diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go new file mode 100644 index 000000000..ff5146f60 --- /dev/null +++ b/x/gateway/keeper/query_gateway_test.go @@ -0,0 +1,125 @@ +package keeper_test + +import ( + "fmt" + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestGatewayQuerySingle(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + msgs := createNGateway(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetGatewayRequest + response *types.QueryGetGatewayResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetGatewayRequest{ + Address: msgs[0].Address, + }, + response: &types.QueryGetGatewayResponse{Gateway: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetGatewayRequest{ + Address: msgs[1].Address, + }, + response: &types.QueryGetGatewayResponse{Gateway: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetGatewayRequest{ + Address: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", strconv.Itoa(100000))), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Gateway(ctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestGatewayQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + msgs := createNGateway(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewayRequest { + return &types.QueryAllGatewayRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.GatewayAll(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Gateway), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.GatewayAll(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Gateway), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.GatewayAll(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Gateway), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.GatewayAll(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/gateway/keeper/query_params.go b/x/gateway/keeper/query_params.go new file mode 100644 index 000000000..8d3afe26d --- /dev/null +++ b/x/gateway/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/gateway/keeper/query_params_test.go b/x/gateway/keeper/query_params_test.go new file mode 100644 index 000000000..cca74a59b --- /dev/null +++ b/x/gateway/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.GatewayKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go new file mode 100644 index 000000000..8506d3c82 --- /dev/null +++ b/x/gateway/module/autocli.go @@ -0,0 +1,58 @@ +package gateway + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + { + RpcMethod: "GatewayAll", + Use: "list-gateway", + Short: "List all gateway", + }, + { + RpcMethod: "Gateway", + Use: "show-gateway [id]", + Short: "Shows a gateway", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + { + RpcMethod: "StakeGateway", + Use: "stake-gateway [stake]", + Short: "Send a stake_gateway tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, + }, + { + RpcMethod: "UnstakeGateway", + Use: "unstake-gateway", + Short: "Send a unstake_gateway tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/gateway/module/config/errors.go b/x/gateway/module/config/errors.go new file mode 100644 index 000000000..aa01b3a46 --- /dev/null +++ b/x/gateway/module/config/errors.go @@ -0,0 +1,10 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "gatewayconfig" + ErrGatewayConfigEmptyContent = sdkerrors.Register(codespace, 1, "empty gateway staking config content") + ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(codespace, 2, "config reader cannot unmarshal yaml content") + ErrGatewayConfigInvalidStake = sdkerrors.Register(codespace, 3, "invalid stake in gateway stake config") +) diff --git a/x/gateway/module/config/gateway_config_reader.go b/x/gateway/module/config/gateway_config_reader.go new file mode 100644 index 000000000..6bf7aa3e3 --- /dev/null +++ b/x/gateway/module/config/gateway_config_reader.go @@ -0,0 +1,62 @@ +package config + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" +) + +// YAMLStakeGateway is the structure describing the gateway stake config file +type YAMLStakeGateway struct { + StakeAmount string `yaml:"stake_amount"` +} + +// GatewayStakeConfig is the structure describing the gateway stake config +type GatewayStakeConfig struct { + StakeAmount sdk.Coin +} + +// ParseGatewayConfig parses the gateway stake yaml config file into a StakeGatewayConfig struct +func ParseGatewayConfig(configContent []byte) (*GatewayStakeConfig, error) { + var stakeConfig *YAMLStakeGateway + + if len(configContent) == 0 { + return nil, ErrGatewayConfigEmptyContent + } + + // Unmarshal the stake config file into a stakeConfig + if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { + return nil, ErrGatewayConfigUnmarshalYAML.Wrap(err.Error()) + } + + // Validate the stake config + if len(stakeConfig.StakeAmount) == 0 { + return nil, ErrGatewayConfigInvalidStake + } + + // Parse the stake amount to a coin struct + stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) + if err != nil { + return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) + } + + // Basic validation of the stake amount + if err := stakeAmount.Validate(); err != nil { + return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) + } + + if stakeAmount.IsZero() { + return nil, ErrGatewayConfigInvalidStake.Wrap("stake amount cannot be zero") + } + + // Only allow upokt coins staking + if stakeAmount.Denom != "upokt" { + return nil, ErrGatewayConfigInvalidStake.Wrapf( + "invalid stake denom, expecting: upokt, got: %s", + stakeAmount.Denom, + ) + } + + return &GatewayStakeConfig{ + StakeAmount: stakeAmount, + }, nil +} diff --git a/x/gateway/module/config/gateway_config_reader_test.go b/x/gateway/module/config/gateway_config_reader_test.go new file mode 100644 index 000000000..11c632cc8 --- /dev/null +++ b/x/gateway/module/config/gateway_config_reader_test.go @@ -0,0 +1,81 @@ +package config_test + +import ( + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/yaml" + "github.com/pokt-network/poktroll/x/gateway/module/config" +) + +func Test_ParseGatewayStakeConfig(t *testing.T) { + tests := []struct { + desc string + expectedError *sdkerrors.Error + expectedConfig *config.GatewayStakeConfig + inputConfig string + }{ + // Valid Configs + { + desc: "valid gateway stake config", + inputConfig: ` + stake_amount: 1000upokt + `, + expectedError: nil, + expectedConfig: &config.GatewayStakeConfig{ + StakeAmount: sdk.NewCoin("upokt", sdkmath.NewInt(1000)), + }, + }, + // Invalid Configs + { + desc: "services_test: invalid service config with empty content", + expectedError: config.ErrGatewayConfigEmptyContent, + inputConfig: ``, + }, + { + desc: "invalid stake denom", + inputConfig: ` + stake_amount: 1000invalid + `, + expectedError: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "negative stake amount", + inputConfig: ` + stake_amount: -1000upokt + `, + expectedError: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "zero stake amount", + inputConfig: ` + stake_amount: 0upokt + `, + expectedError: config.ErrGatewayConfigInvalidStake, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) + + if tt.expectedError != nil { + require.Error(t, err) + require.ErrorIs(t, err, tt.expectedError) + require.Contains(t, err.Error(), tt.expectedError.Error()) + require.Nil(t, supplierServiceConfig) + return + } + + require.NoError(t, err) + + require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) + require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) + }) + } +} diff --git a/x/gateway/module/genesis.go b/x/gateway/module/genesis.go new file mode 100644 index 000000000..302f2a1cc --- /dev/null +++ b/x/gateway/module/genesis.go @@ -0,0 +1,29 @@ +package gateway + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the gateway + for _, elem := range genState.GatewayList { + k.SetGateway(ctx, elem) + } + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.GatewayList = k.GetAllGateway(ctx) + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go new file mode 100644 index 000000000..0d9ac318d --- /dev/null +++ b/x/gateway/module/genesis_test.go @@ -0,0 +1,172 @@ +package gateway_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &stake2, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid - duplicated gateway address", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr1, + Stake: &stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - nil gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: nil, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + // Stake: stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - zero gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + }, + }, + }, + valid: false, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/gateway/module/helpers_test.go b/x/gateway/module/helpers_test.go new file mode 100644 index 000000000..45f9c42a8 --- /dev/null +++ b/x/gateway/module/helpers_test.go @@ -0,0 +1,31 @@ +package gateway_test + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +func init() { + cmd.InitSDKConfig() +} + +// networkWithGatewayObjects creates a network with a populated gateway state of n gateway objects +func networkWithGatewayObjects(t *testing.T, n int) (*network.Network, []types.Gateway) { + t.Helper() + cfg := network.DefaultConfig() + gatewayGenesisState := network.DefaultGatewayModuleGenesisState(t, n) + buf, err := cfg.Codec.MarshalJSON(gatewayGenesisState) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), gatewayGenesisState.GatewayList +} diff --git a/x/gateway/module/module.go b/x/gateway/module/module.go new file mode 100644 index 000000000..0294e85cc --- /dev/null +++ b/x/gateway/module/module.go @@ -0,0 +1,215 @@ +package gateway + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper +} + +type ModuleOutputs struct { + depinject.Out + + GatewayKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{GatewayKeeper: k, Module: m} +} diff --git a/x/gateway/module/query.go b/x/gateway/module/query.go new file mode 100644 index 000000000..4c3856f0e --- /dev/null +++ b/x/gateway/module/query.go @@ -0,0 +1,29 @@ +package gateway + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd(queryRoute string) *cobra.Command { + // Group gateway queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdListGateway()) + cmd.AddCommand(CmdShowGateway()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/gateway/module/query_gateway.go b/x/gateway/module/query_gateway.go new file mode 100644 index 000000000..be7cdaa23 --- /dev/null +++ b/x/gateway/module/query_gateway.go @@ -0,0 +1,82 @@ +package gateway + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func CmdListGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-gateway", + Short: "list all gateways", + Long: `List all the gateways that the node being queried has in its state. + +Example: +$ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllGatewayRequest{ + Pagination: pageReq, + } + + res, err := queryClient.GatewayAll(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-gateway ", + Short: "shows a gateway", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + argAddress := args[0] + + params := &types.QueryGetGatewayRequest{ + Address: argAddress, + } + + res, err := queryClient.Gateway(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/query_gateway_test.go b/x/gateway/module/query_gateway_test.go new file mode 100644 index 000000000..fd2d12d5a --- /dev/null +++ b/x/gateway/module/query_gateway_test.go @@ -0,0 +1,142 @@ +package gateway_test + +import ( + "fmt" + "strconv" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/nullify" + gateway "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestShowGateway(t *testing.T) { + net, objs := networkWithGatewayObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idAddress string + + args []string + err error + obj types.Gateway + }{ + { + desc: "found", + idAddress: objs[0].Address, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idAddress: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idAddress, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdShowGateway(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.Gateway) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.Gateway), + ) + } + }) + } +} + +func TestListGateway(t *testing.T) { + net, objs := networkWithGatewayObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) + require.NoError(t, err) + var resp types.QueryAllGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Gateway), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) + require.NoError(t, err) + var resp types.QueryAllGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Gateway), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) + require.NoError(t, err) + var resp types.QueryAllGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.Gateway), + ) + }) +} diff --git a/x/gateway/module/query_params.go b/x/gateway/module/query_params.go new file mode 100644 index 000000000..cdca5a567 --- /dev/null +++ b/x/gateway/module/query_params.go @@ -0,0 +1,40 @@ +package gateway + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Long: `Shows all the parameters related to the Gateway module. + +Example: +$ poktrolld q gateway params --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/simulation.go b/x/gateway/module/simulation.go new file mode 100644 index 000000000..d87166a4c --- /dev/null +++ b/x/gateway/module/simulation.go @@ -0,0 +1,110 @@ +package gateway + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + gatewaysimulation "github.com/pokt-network/poktroll/x/gateway/simulation" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// avoid unused import issue +var ( + _ = gatewaysimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( + opWeightMsgStakeGateway = "op_weight_msg_stake_gateway" + // TODO: Determine the simulation weight value + defaultWeightMsgStakeGateway int = 100 + + opWeightMsgUnstakeGateway = "op_weight_msg_unstake_gateway" + // TODO: Determine the simulation weight value + defaultWeightMsgUnstakeGateway int = 100 + + // this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + gatewayGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&gatewayGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + var weightMsgStakeGateway int + simState.AppParams.GetOrGenerate(opWeightMsgStakeGateway, &weightMsgStakeGateway, nil, + func(_ *rand.Rand) { + weightMsgStakeGateway = defaultWeightMsgStakeGateway + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgStakeGateway, + gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgUnstakeGateway int + simState.AppParams.GetOrGenerate(opWeightMsgUnstakeGateway, &weightMsgUnstakeGateway, nil, + func(_ *rand.Rand) { + weightMsgUnstakeGateway = defaultWeightMsgUnstakeGateway + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnstakeGateway, + gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgStakeGateway, + defaultWeightMsgStakeGateway, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + simulation.NewWeightedProposalMsg( + opWeightMsgUnstakeGateway, + defaultWeightMsgUnstakeGateway, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/gateway/module/tx.go b/x/gateway/module/tx.go new file mode 100644 index 000000000..3f6b0060a --- /dev/null +++ b/x/gateway/module/tx.go @@ -0,0 +1,35 @@ +package gateway + +import ( + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdStakeGateway()) + cmd.AddCommand(CmdUnstakeGateway()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/gateway/module/tx_stake_gateway.go b/x/gateway/module/tx_stake_gateway.go new file mode 100644 index 000000000..e9e02dcef --- /dev/null +++ b/x/gateway/module/tx_stake_gateway.go @@ -0,0 +1,61 @@ +package gateway + +import ( + "os" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/module/config" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var ( + flagStakeConfig string + _ = strconv.Itoa(0) +) + +func CmdStakeGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "stake-gateway --config ", + Short: "Stake a gateway", + Long: `Stake a gateway with the provided parameters. This is a broadcast operation that +will stake the tokens and associate them with the gateway specified by the 'from' address. +Example: +$ poktrolld tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, _ []string) (err error) { + configContent, err := os.ReadFile(flagStakeConfig) + if err != nil { + return err + } + + gatewayStakeConfig, err := config.ParseGatewayConfig(configContent) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgStakeGateway( + clientCtx.GetFromAddress().String(), + gatewayStakeConfig.StakeAmount, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/tx_stake_gateway_test.go b/x/gateway/module/tx_stake_gateway_test.go new file mode 100644 index 000000000..5a2f82f21 --- /dev/null +++ b/x/gateway/module/tx_stake_gateway_test.go @@ -0,0 +1,150 @@ +package gateway_test + +import ( + "fmt" + "os" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/testutil/yaml" + gateway "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestCLI_StakeGateway(t *testing.T) { + net, _ := networkWithGatewayObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the gateway to be staked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + gatewayAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + address string + inputConfig string + expectedError *sdkerrors.Error + }{ + { + desc: "stake gateway: invalid address", + address: "invalid", + inputConfig: ` + stake_amount: 1000upokt + `, + expectedError: types.ErrGatewayInvalidAddress, + }, + { + desc: "stake gateway: missing address", + // address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + `, + expectedError: types.ErrGatewayInvalidAddress, + }, + { + desc: "stake gateway: invalid stake amount (zero)", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 0upokt + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake amount (negative)", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: -1000upokt + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake denom", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000invalid + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake missing denom", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000 + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake missing stake", + address: gatewayAccount.Address.String(), + inputConfig: ``, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: valid", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + `, + }, + } + + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // write the stake config to a file + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() + t.Cleanup(func() { os.Remove(configPath) }) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--config=%s", configPath), + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outStake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdStakeGateway(), args) + if tt.expectedError != nil { + stat, ok := status.FromError(tt.expectedError) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.expectedError.Error()) + return + } + require.NoError(t, err) + + require.NoError(t, err) + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/gateway/module/tx_unstake_gateway.go b/x/gateway/module/tx_unstake_gateway.go new file mode 100644 index 000000000..a5760aa1a --- /dev/null +++ b/x/gateway/module/tx_unstake_gateway.go @@ -0,0 +1,44 @@ +package gateway + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var _ = strconv.Itoa(0) + +func CmdUnstakeGateway() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "unstake-gateway ", + Short: "Unstake a gateway", + Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. + +Example: +$ poktrolld tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, _ []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgUnstakeGateway( + clientCtx.GetFromAddress().String(), + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/tx_unstake_gateway_test.go b/x/gateway/module/tx_unstake_gateway_test.go new file mode 100644 index 000000000..fb2e1cc07 --- /dev/null +++ b/x/gateway/module/tx_unstake_gateway_test.go @@ -0,0 +1,97 @@ +package gateway_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + gateway "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestCLI_UnstakeGateway(t *testing.T) { + net, _ := networkWithGatewayObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the gateway to be unstaked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + gatewayAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + address string + err *sdkerrors.Error + }{ + { + desc: "unstake gateway: valid", + address: gatewayAccount.Address.String(), + }, + { + desc: "unstake gateway: missing address", + // address: gatewayAccount.Address.String(), + err: types.ErrGatewayInvalidAddress, + }, + { + desc: "unstake gateway: invalid address", + address: "invalid", + err: types.ErrGatewayInvalidAddress, + }, + } + + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outUnstake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdUnstakeGateway(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/gateway/simulation/helpers.go b/x/gateway/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/gateway/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go new file mode 100644 index 000000000..ea7474891 --- /dev/null +++ b/x/gateway/simulation/stake_gateway.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func SimulateMsgStakeGateway( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + stakeMsg := &types.MsgStakeGateway{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the StakeGateway simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(stakeMsg), "StakeGateway simulation not implemented"), nil, nil + } +} diff --git a/x/gateway/simulation/unstake_gateway.go b/x/gateway/simulation/unstake_gateway.go new file mode 100644 index 000000000..69bc3233b --- /dev/null +++ b/x/gateway/simulation/unstake_gateway.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func SimulateMsgUnstakeGateway( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUnstakeGateway{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the UnstakeGateway simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UnstakeGateway simulation not implemented"), nil, nil + } +} diff --git a/x/gateway/types/codec.go b/x/gateway/types/codec.go new file mode 100644 index 000000000..4d175c529 --- /dev/null +++ b/x/gateway/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgStakeGateway{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnstakeGateway{}, + ) + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go new file mode 100644 index 000000000..298df8889 --- /dev/null +++ b/x/gateway/types/errors.go @@ -0,0 +1,17 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/gateway module sentinel errors +var ( + ErrGatewayInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrGatewaySample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid gateway address") + ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1103, "invalid gateway stake") + ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized signer") + ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1105, "gateway not found") +) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go new file mode 100644 index 000000000..10cde1203 --- /dev/null +++ b/x/gateway/types/expected_keepers.go @@ -0,0 +1,37 @@ +package types + +//go:generate mockgen -destination ../../../testutil/gateway/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + DelegateCoinsFromAccountToModule( + ctx context.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error + UndelegateCoinsFromModuleToAccount( + ctx context.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go new file mode 100644 index 000000000..5cb161252 --- /dev/null +++ b/x/gateway/types/genesis.go @@ -0,0 +1,53 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + GatewayList: []Gateway{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + gatewayIndexMap := make(map[string]struct{}) + + for _, gateway := range gs.GatewayList { + // Check for duplicated index in gateway + index := string(GatewayKey(gateway.Address)) + if _, ok := gatewayIndexMap[index]; ok { + return sdkerrors.Wrap(ErrGatewayInvalidAddress, "duplicated index for gateway") + } + gatewayIndexMap[index] = struct{}{} + // Validate the stake of each gateway + if gateway.Stake == nil { + return sdkerrors.Wrap(ErrGatewayInvalidStake, "nil stake amount for gateway") + } + stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", gateway.Stake) + } + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go new file mode 100644 index 000000000..8fe1e65f7 --- /dev/null +++ b/x/gateway/types/key_gateway.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // GatewayKeyPrefix is the prefix to retrieve all Gateways + GatewayKeyPrefix = "Gateway/value/" +) + +// GatewayKey returns the store key to retrieve a Gateway from the index fields +func GatewayKey( + address string, +) []byte { + var key []byte + + addressBytes := []byte(address) + key = append(key, addressBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/gateway/types/keys.go b/x/gateway/types/keys.go new file mode 100644 index 000000000..4d65ff460 --- /dev/null +++ b/x/gateway/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "gateway" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_gateway" +) + +var ( + ParamsKey = []byte("p_gateway") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go new file mode 100644 index 000000000..9f349cf16 --- /dev/null +++ b/x/gateway/types/message_stake_gateway.go @@ -0,0 +1,41 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgStakeGateway)(nil) + +func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { + return &MsgStakeGateway{ + Address: address, + Stake: &stake, + } +} + +func (msg *MsgStakeGateway) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) + } + + // Validate the stake amount + if msg.Stake == nil { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "nil gateway stake; (%v)", err) + } + stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse gateway stake %v; (%v)", msg.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", msg.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", msg.Stake) + } + return nil +} diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go new file mode 100644 index 000000000..d1cb20902 --- /dev/null +++ b/x/gateway/types/message_stake_gateway_test.go @@ -0,0 +1,81 @@ +package types + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgStakeGateway_ValidateBasic(t *testing.T) { + coins := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + tests := []struct { + name string + msg MsgStakeGateway + err error + }{ + { + name: "invalid address - no stake", + msg: MsgStakeGateway{ + Address: "invalid_address", + // Stake explicitly nil + }, + err: ErrGatewayInvalidAddress, + }, { + name: "valid address - nil stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + // Stake explicitly nil + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - zero stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - negative stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - invalid stake denom", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - invalid stake missing denom", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - valid stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &coins, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go new file mode 100644 index 000000000..fc163d022 --- /dev/null +++ b/x/gateway/types/message_unstake_gateway.go @@ -0,0 +1,22 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUnstakeGateway)(nil) + +func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { + return &MsgUnstakeGateway{ + Address: address, + } +} + +func (msg *MsgUnstakeGateway) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) + } + return nil +} diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go new file mode 100644 index 000000000..301ad05ef --- /dev/null +++ b/x/gateway/types/message_unstake_gateway_test.go @@ -0,0 +1,45 @@ +package types + +import ( + "testing" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUnstakeGateway + err error + }{ + { + name: "invalid address", + msg: MsgUnstakeGateway{ + Address: "invalid_address", + }, + err: ErrGatewayInvalidAddress, + }, + { + name: "missing address", + msg: MsgUnstakeGateway{}, + err: ErrGatewayInvalidAddress, + }, + { + name: "valid address", + msg: MsgUnstakeGateway{ + Address: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/gateway/types/msg_update_params.go b/x/gateway/types/msg_update_params.go new file mode 100644 index 000000000..597e9f93a --- /dev/null +++ b/x/gateway/types/msg_update_params.go @@ -0,0 +1,17 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + return m.Params.Validate() +} diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go new file mode 100644 index 000000000..4f3215e35 --- /dev/null +++ b/x/gateway/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/gateway/types/types.go b/x/gateway/types/types.go new file mode 100644 index 000000000..78d9ec9f9 --- /dev/null +++ b/x/gateway/types/types.go @@ -0,0 +1,3 @@ +package types + +// This file is in place to declare the package for dynamically generated protobufs diff --git a/x/proof/keeper/claim.go b/x/proof/keeper/claim.go new file mode 100644 index 000000000..04ce2735c --- /dev/null +++ b/x/proof/keeper/claim.go @@ -0,0 +1,108 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// UpsertClaim set a specific claim in the store from its index +func (k Keeper) UpsertClaim(ctx context.Context, claim types.Claim) { + logger := k.Logger().With("method", "UpsertClaim") + + claimBz := k.cdc.MustMarshal(&claim) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) + + sessionId := claim.GetSessionHeader().GetSessionId() + primaryKey := types.ClaimPrimaryKey(sessionId, claim.SupplierAddress) + primaryStore.Set(primaryKey, claimBz) + + logger.Info(fmt.Sprintf("upserted claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) + + // Update the address index: supplierAddress -> [ClaimPrimaryKey] + addressStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) + addressKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) + addressStoreIndex.Set(addressKey, primaryKey) + + logger.Info(fmt.Sprintf("indexed claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) + + // Update the session end height index: sessionEndHeight -> [ClaimPrimaryKey] + sessionHeightStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) + sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() + heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) + sessionHeightStoreIndex.Set(heightKey, primaryKey) + + logger.Info(fmt.Sprintf("indexed claim for supplier %s at session ending height %d", claim.SupplierAddress, sessionEndBlockHeight)) +} + +// GetClaim returns a claim from its index +func (k Keeper) GetClaim(ctx context.Context, sessionId, supplierAddr string) (claim types.Claim, found bool) { + primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) + return k.getClaimByPrimaryKey(ctx, primaryKey) +} + +// RemoveClaim removes a claim from the store +func (k Keeper) RemoveClaim(ctx context.Context, sessionId, supplierAddr string) { + logger := k.Logger().With("method", "RemoveClaim") + + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) + + // Check if the claim exists + primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) + claim, foundClaim := k.getClaimByPrimaryKey(ctx, primaryKey) + if !foundClaim { + logger.Error(fmt.Sprintf("trying to delete non-existent claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) + return + } + + // Prepare the indices for deletion + addressStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) + sessionHeightStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) + + addressKey := types.ClaimSupplierAddressKey(claim.GetSupplierAddress(), primaryKey) + sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() + heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) + + // Delete all the entries (primary store and secondary indices) + primaryStore.Delete(primaryKey) + addressStoreIndex.Delete(addressKey) + sessionHeightStoreIndex.Delete(heightKey) + + logger.Info(fmt.Sprintf("deleted claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) +} + +// GetAllClaims returns all claim +func (k Keeper) GetAllClaims(ctx context.Context) (claims []types.Claim) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(primaryStore, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var claim types.Claim + k.cdc.MustUnmarshal(iterator.Value(), &claim) + claims = append(claims, claim) + } + + return +} + +// getClaimByPrimaryKey is a helper that retrieves, if exists, the Claim associated with the key provided +func (k Keeper) getClaimByPrimaryKey(ctx context.Context, primaryKey []byte) (val types.Claim, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) + b := primaryStore.Get(primaryKey) + if b == nil { + return val, false + } + k.cdc.MustUnmarshal(b, &val) + return val, true +} diff --git a/x/proof/keeper/claim_test.go b/x/proof/keeper/claim_test.go new file mode 100644 index 000000000..14c331600 --- /dev/null +++ b/x/proof/keeper/claim_test.go @@ -0,0 +1,78 @@ +package keeper_test + +import ( + "context" + "fmt" + "strconv" + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNClaims(keeper keeper.Keeper, ctx context.Context, n int) []types.Claim { + claims := make([]types.Claim, n) + for i := range claims { + claims[i].SupplierAddress = sample.AccAddress() + claims[i].SessionHeader = &sessiontypes.SessionHeader{ + SessionId: fmt.Sprintf("session-%d", i), + SessionEndBlockHeight: int64(i), + } + claims[i].RootHash = []byte(fmt.Sprintf("rootHash-%d", i)) + keeper.UpsertClaim(ctx, claims[i]) + } + return claims +} + +func TestClaimGet(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + claims := createNClaims(keeper, ctx, 10) + for _, claim := range claims { + foundClaim, isClaimFound := keeper.GetClaim(ctx, + claim.GetSessionHeader().GetSessionId(), + claim.SupplierAddress, + ) + require.True(t, isClaimFound) + require.Equal(t, + nullify.Fill(&claim), + nullify.Fill(&foundClaim), + ) + } +} +func TestClaimRemove(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + claims := createNClaims(keeper, ctx, 10) + for _, claim := range claims { + sessionId := claim.GetSessionHeader().GetSessionId() + keeper.RemoveClaim(ctx, + sessionId, + claim.SupplierAddress, + ) + _, isClaimFound := keeper.GetClaim(ctx, + sessionId, + claim.SupplierAddress, + ) + require.False(t, isClaimFound) + } +} + +func TestClaimGetAll(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + claims := createNClaims(keeper, ctx, 10) + + // Get all the claims and check if they match + allFoundClaims := keeper.GetAllClaims(ctx) + require.ElementsMatch(t, + nullify.Fill(claims), + nullify.Fill(allFoundClaims), + ) +} diff --git a/x/proof/keeper/keeper.go b/x/proof/keeper/keeper.go new file mode 100644 index 000000000..09e5d465a --- /dev/null +++ b/x/proof/keeper/keeper.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + sessionKeeper types.SessionKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + sessionKeeper types.SessionKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + sessionKeeper: sessionKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/proof/keeper/msg_server.go b/x/proof/keeper/msg_server.go new file mode 100644 index 000000000..d910bb935 --- /dev/null +++ b/x/proof/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/proof/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go new file mode 100644 index 000000000..1eda037ac --- /dev/null +++ b/x/proof/keeper/msg_server_create_claim.go @@ -0,0 +1,75 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func (k msgServer) CreateClaim(goCtx context.Context, msg *types.MsgCreateClaim) (*types.MsgCreateClaimResponse, error) { + // TODO_BLOCKER: Prevent Claim upserts after the ClaimWindow is closed. + // TODO_BLOCKER: Validate the signature on the Claim message corresponds to the supplier before Upserting. + + ctx := sdk.UnwrapSDKContext(goCtx) + logger := k.Logger().With("method", "CreateClaim") + logger.Debug("creating claim") + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + session, err := k.queryAndValidateSessionHeader( + goCtx, + msg.GetSessionHeader(), + msg.GetSupplierAddress(), + ) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + logger. + With( + "session_id", session.GetSessionId(), + "session_end_height", msg.GetSessionHeader().GetSessionEndBlockHeight(), + "supplier", msg.GetSupplierAddress(), + ). + Debug("validated claim") + + /* + TODO_INCOMPLETE: + + ### Msg distribution validation (depends on sessionRes validation) + 1. [ ] governance-based earliest block offset + 2. [ ] pseudo-randomize earliest block offset + + ### Claim validation + 1. [x] sessionRes validation + 2. [ ] msg distribution validation + */ + + // Construct and upsert claim after all validation. + claim := types.Claim{ + SupplierAddress: msg.GetSupplierAddress(), + SessionHeader: msg.GetSessionHeader(), + RootHash: msg.RootHash, + } + + // TODO_BLOCKER: check if this claim already exists and return an appropriate error + // in any case where the supplier should no longer be able to update the given proof. + k.Keeper.UpsertClaim(ctx, claim) + + logger. + With( + "session_id", claim.GetSessionHeader().GetSessionId(), + "session_end_height", claim.GetSessionHeader().GetSessionEndBlockHeight(), + "supplier", claim.GetSupplierAddress(), + ). + Debug("created claim") + + // TODO: return the claim in the response. + return &types.MsgCreateClaimResponse{}, nil +} diff --git a/x/proof/keeper/msg_server_create_claim_test.go b/x/proof/keeper/msg_server_create_claim_test.go new file mode 100644 index 000000000..39c2a4725 --- /dev/null +++ b/x/proof/keeper/msg_server_create_claim_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/proof" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgServer_CreateClaim_Success(t *testing.T) { + appSupplierPair := proof.AppSupplierPair{ + AppAddr: sample.AccAddress(), + SupplierAddr: sample.AccAddress(), + } + service := &sharedtypes.Service{Id: testServiceId} + sessionFixturesByAddr := proof.NewSessionFixturesWithPairings(t, service, appSupplierPair) + + proofKeeper, sdkCtx := keepertest.ProofKeeper(t, sessionFixturesByAddr) + srv := keeper.NewMsgServerImpl(proofKeeper) + + claimMsg := newTestClaimMsg(t, testSessionId) + claimMsg.SupplierAddress = appSupplierPair.SupplierAddr + claimMsg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr + + createClaimRes, err := srv.CreateClaim(sdkCtx, claimMsg) + require.NoError(t, err) + require.NotNil(t, createClaimRes) + + claimRes, err := proofKeeper.AllClaims(sdkCtx, &types.QueryAllClaimsRequest{}) + require.NoError(t, err) + + claims := claimRes.GetClaims() + require.Lenf(t, claims, 1, "expected 1 claim, got %d", len(claims)) + require.Equal(t, claimMsg.SessionHeader.SessionId, claims[0].GetSessionHeader().GetSessionId()) + require.Equal(t, claimMsg.SupplierAddress, claims[0].GetSupplierAddress()) + require.Equal(t, claimMsg.SessionHeader.GetSessionEndBlockHeight(), claims[0].GetSessionHeader().GetSessionEndBlockHeight()) + require.Equal(t, claimMsg.RootHash, claims[0].GetRootHash()) +} + +func TestMsgServer_CreateClaim_Error(t *testing.T) { + service := &sharedtypes.Service{Id: testServiceId} + appSupplierPair := proof.AppSupplierPair{ + AppAddr: sample.AccAddress(), + SupplierAddr: sample.AccAddress(), + } + sessionFixturesByAppAddr := proof.NewSessionFixturesWithPairings(t, service, appSupplierPair) + + proofKeeper, sdkCtx := keepertest.ProofKeeper(t, sessionFixturesByAppAddr) + srv := keeper.NewMsgServerImpl(proofKeeper) + + tests := []struct { + desc string + claimMsgFn func(t *testing.T) *types.MsgCreateClaim + expectedErr error + }{ + { + desc: "on-chain session ID must match claim msg session ID", + claimMsgFn: func(t *testing.T) *types.MsgCreateClaim { + msg := newTestClaimMsg(t, "invalid_session_id") + msg.SupplierAddress = appSupplierPair.SupplierAddr + msg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr + + return msg + }, + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidSessionId.Wrapf( + "session ID does not match on-chain session ID; expected %q, got %q", + testSessionId, + "invalid_session_id", + ).Error(), + ), + }, + { + desc: "claim msg supplier address must be in the session", + claimMsgFn: func(t *testing.T) *types.MsgCreateClaim { + msg := newTestClaimMsg(t, testSessionId) + msg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr + + // Overwrite supplier address to one not included in the session fixtures. + msg.SupplierAddress = sample.AccAddress() + + return msg + }, + expectedErr: types.ErrProofNotFound, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + createClaimRes, err := srv.CreateClaim(sdkCtx, tt.claimMsgFn(t)) + require.ErrorContains(t, err, tt.expectedErr.Error()) + require.Nil(t, createClaimRes) + }) + } +} + +func newTestClaimMsg(t *testing.T, sessionId string) *prooftypes.MsgCreateClaim { + t.Helper() + + return prooftypes.NewMsgCreateClaim( + sample.AccAddress(), + &sessiontypes.SessionHeader{ + ApplicationAddress: sample.AccAddress(), + SessionStartBlockHeight: 0, + SessionId: sessionId, + Service: &sharedtypes.Service{ + Id: "svc1", + Name: "svc1", + }, + }, + []byte{0, 0, 0, 0}, + ) +} diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go new file mode 100644 index 000000000..c1210b9d6 --- /dev/null +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -0,0 +1,136 @@ +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/proof/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +func (k msgServer) SubmitProof(ctx context.Context, msg *types.MsgSubmitProof) (*types.MsgSubmitProofResponse, error) { + // TODO_BLOCKER: Prevent Proof upserts after the tokenomics module has processes the respective session. + // TODO_BLOCKER: Validate the signature on the Proof message corresponds to the supplier before Upserting. + logger := k.Logger().With("method", "SubmitProof") + logger.Debug("submitting proof") + + /* + TODO_INCOMPLETE: Handling the message + + ## Actions (error if anything fails) + 1. Retrieve a fully hydrated `session` from on-chain store using `msg` metadata + 2. Retrieve a fully hydrated `claim` from on-chain store using `msg` metadata + 3. Retrieve `relay.Req` and `relay.Res` from deserializing `proof.ClosestValueHash` + + ## Basic Validations (metadata only) + 1. proof.sessionId == claim.sessionId + 2. msg.supplier in session.suppliers + 3. relay.Req.signer == session.appAddr + 4. relay.Res.signer == msg.supplier + + ## Msg distribution validation (governance based params) + 1. Validate Proof submission is not too early; governance-based param + pseudo-random variation + 2. Validate Proof submission is not too late; governance-based param + pseudo-random variation + + ## Relay Signature validation + 1. verify(relay.Req.Signature, appRing) + 2. verify(relay.Res.Signature, supplier.pubKey) + + ## Relay Mining validation + 1. verify(proof.path) is the expected path; pseudo-random variation using on-chain data + 2. verify(proof.ValueHash, expectedDiffictulty); governance based + 3. verify(claim.Root, proof.ClosestProof); verify the closest proof is correct + */ + + if err := msg.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + if _, err := k.queryAndValidateSessionHeader( + ctx, + msg.GetSessionHeader(), + msg.GetSupplierAddress(), + ); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + // Construct and insert proof after all validation. + proof := types.Proof{ + SupplierAddress: msg.GetSupplierAddress(), + SessionHeader: msg.GetSessionHeader(), + ClosestMerkleProof: msg.Proof, + } + + if err := k.queryAndValidateClaimForProof(ctx, &proof); err != nil { + return nil, status.Error(codes.FailedPrecondition, err.Error()) + } + + // TODO_BLOCKER: check if this proof already exists and return an appropriate error + // in any case where the supplier should no longer be able to update the given proof. + k.Keeper.UpsertProof(ctx, proof) + + // TODO_UPNEXT(@Olshansk, #359): Call `tokenomics.SettleSessionAccounting()` here + + logger. + With( + "session_id", proof.GetSessionHeader().GetSessionId(), + "session_end_height", proof.GetSessionHeader().GetSessionEndBlockHeight(), + "supplier", proof.GetSupplierAddress(), + ). + Debug("created proof") + + return &types.MsgSubmitProofResponse{}, nil +} + +// queryAndValidateClaimForProof ensures that a claim corresponding to the given proof's +// session exists & has a matching supplier address and session header. +func (k msgServer) queryAndValidateClaimForProof(ctx context.Context, proof *types.Proof) error { + sessionId := proof.GetSessionHeader().GetSessionId() + // NB: no need to assert the testSessionId or supplier address as it is retrieved + // by respective values of the given proof. I.e., if the claim exists, then these + // values are guaranteed to match. + claim, found := k.GetClaim(ctx, sessionId, proof.GetSupplierAddress()) + if !found { + return suppliertypes.ErrSupplierClaimNotFound.Wrapf("no claim found for session ID %q and supplier %q", sessionId, proof.GetSupplierAddress()) + } + + // Ensure session start heights match. + if claim.GetSessionHeader().GetSessionStartBlockHeight() != proof.GetSessionHeader().GetSessionStartBlockHeight() { + return suppliertypes.ErrSupplierInvalidSessionStartHeight.Wrapf( + "claim session start height %d does not match proof session start height %d", + claim.GetSessionHeader().GetSessionStartBlockHeight(), + proof.GetSessionHeader().GetSessionStartBlockHeight(), + ) + } + + // Ensure session end heights match. + if claim.GetSessionHeader().GetSessionEndBlockHeight() != proof.GetSessionHeader().GetSessionEndBlockHeight() { + return suppliertypes.ErrSupplierInvalidSessionEndHeight.Wrapf( + "claim session end height %d does not match proof session end height %d", + claim.GetSessionHeader().GetSessionEndBlockHeight(), + proof.GetSessionHeader().GetSessionEndBlockHeight(), + ) + } + + // Ensure application addresses match. + if claim.GetSessionHeader().GetApplicationAddress() != proof.GetSessionHeader().GetApplicationAddress() { + return suppliertypes.ErrSupplierInvalidAddress.Wrapf( + "claim application address %q does not match proof application address %q", + claim.GetSessionHeader().GetApplicationAddress(), + proof.GetSessionHeader().GetApplicationAddress(), + ) + } + + // Ensure service IDs match. + if claim.GetSessionHeader().GetService().GetId() != proof.GetSessionHeader().GetService().GetId() { + return suppliertypes.ErrSupplierInvalidService.Wrapf( + "claim service ID %q does not match proof service ID %q", + claim.GetSessionHeader().GetService().GetId(), + proof.GetSessionHeader().GetService().GetId(), + ) + } + + return nil +} diff --git a/x/proof/keeper/msg_server_test.go b/x/proof/keeper/msg_server_test.go new file mode 100644 index 000000000..a7522098a --- /dev/null +++ b/x/proof/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.ProofKeeper(t, nil) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/proof/keeper/msg_update_params.go b/x/proof/keeper/msg_update_params.go new file mode 100644 index 000000000..53035a815 --- /dev/null +++ b/x/proof/keeper/msg_update_params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go new file mode 100644 index 000000000..a07165f78 --- /dev/null +++ b/x/proof/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/proof/keeper/params.go b/x/proof/keeper/params.go new file mode 100644 index 000000000..97a300f21 --- /dev/null +++ b/x/proof/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go new file mode 100644 index 000000000..8037069a0 --- /dev/null +++ b/x/proof/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := keepertest.ProofKeeper(t, nil) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/proof/keeper/proof.go b/x/proof/keeper/proof.go new file mode 100644 index 000000000..1ff3405f8 --- /dev/null +++ b/x/proof/keeper/proof.go @@ -0,0 +1,85 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// UpsertProof set a specific proof in the store from its index +func (k Keeper) UpsertProof(ctx context.Context, proof types.Proof) { + logger := k.Logger().With("method", "UpsertProof") + + proofBz := k.cdc.MustMarshal(&proof) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) + sessionId := proof.GetSessionHeader().GetSessionId() + primaryKey := types.ProofPrimaryKey(sessionId, proof.GetSupplierAddress()) + primaryStore.Set(primaryKey, proofBz) + + logger.Info(fmt.Sprintf("upserted proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) + + // Update the address index: supplierAddress -> [ProofPrimaryKey] + addressStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSupplierAddressPrefix)) + addressKey := types.ProofSupplierAddressKey(proof.GetSupplierAddress(), primaryKey) + addressStoreIndex.Set(addressKey, primaryKey) + + logger.Info(fmt.Sprintf("indexed Proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) + + // Update the session end height index: sessionEndHeight -> [ProofPrimaryKey] + sessionHeightStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSessionEndHeightPrefix)) + sessionEndHeight := proof.GetSessionHeader().GetSessionEndBlockHeight() + heightKey := types.ProofSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) + sessionHeightStoreIndex.Set(heightKey, primaryKey) +} + +// GetProof returns a proof from its index +func (k Keeper) GetProof(ctx context.Context, sessionId, supplierAdd string) (val types.Proof, found bool) { + primaryKey := types.ProofPrimaryKey(sessionId, supplierAdd) + return k.getProofByPrimaryKey(ctx, primaryKey) +} + +// RemoveProof removes a proof from the store +func (k Keeper) RemoveProof(ctx context.Context, sessionId, supplierAddr string) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) + primaryKey := types.ProofPrimaryKey(sessionId, supplierAddr) + primaryStore.Delete(primaryKey) +} + +// GetAllProofs returns all proof +func (k Keeper) GetAllProofs(ctx context.Context) (list []types.Proof) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(primaryStore, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Proof + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// getProofByPrimaryKey is a helper that retrieves, if exists, the Proof associated with the key provided +func (k Keeper) getProofByPrimaryKey(ctx context.Context, primaryKey []byte) (proof types.Proof, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) + + proofBz := primaryStore.Get(primaryKey) + if proofBz == nil { + return proof, false + } + + k.cdc.MustUnmarshal(proofBz, &proof) + return proof, true +} diff --git a/x/proof/keeper/proof_test.go b/x/proof/keeper/proof_test.go new file mode 100644 index 000000000..9e8145f88 --- /dev/null +++ b/x/proof/keeper/proof_test.go @@ -0,0 +1,83 @@ +package keeper_test + +import ( + "context" + "fmt" + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +const ( + testServiceId = "svc1" + testSessionId = "mock_session_id" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNProofs(keeper keeper.Keeper, ctx context.Context, n int) []types.Proof { + proofs := make([]types.Proof, n) + for i := range proofs { + proofs[i] = types.Proof{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: sample.AccAddress(), + Service: &sharedtypes.Service{Id: testServiceId}, + SessionId: fmt.Sprintf("session-%d", i), + SessionStartBlockHeight: 1, + SessionEndBlockHeight: 1 + sessionkeeper.NumBlocksPerSession, + }, + ClosestMerkleProof: nil, + } + + keeper.UpsertProof(ctx, proofs[i]) + } + return proofs +} + +func TestProofGet(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + proofs := createNProofs(keeper, ctx, 10) + for _, proof := range proofs { + rst, found := keeper.GetProof( + ctx, + proof.GetSessionHeader().GetSessionId(), + proof.GetSupplierAddress(), + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&proof), + nullify.Fill(&rst), + ) + } +} +func TestProofRemove(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + proofs := createNProofs(keeper, ctx, 10) + for _, proof := range proofs { + sessionId := proof.GetSessionHeader().GetSessionId() + keeper.RemoveProof(ctx, sessionId, proof.GetSupplierAddress()) + _, found := keeper.GetProof(ctx, sessionId, proof.GetSupplierAddress()) + require.False(t, found) + } +} + +func TestProofGetAll(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + proofs := createNProofs(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(proofs), + nullify.Fill(keeper.GetAllProofs(ctx)), + ) +} diff --git a/x/proof/keeper/query.go b/x/proof/keeper/query.go new file mode 100644 index 000000000..6ac55c397 --- /dev/null +++ b/x/proof/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/proof/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/proof/keeper/query_claim.go b/x/proof/keeper/query_claim.go new file mode 100644 index 000000000..4678b01e6 --- /dev/null +++ b/x/proof/keeper/query_claim.go @@ -0,0 +1,101 @@ +package keeper + +import ( + "context" + "encoding/binary" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func (k Keeper) AllClaims(ctx context.Context, req *types.QueryAllClaimsRequest) (*types.QueryAllClaimsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + //claimStore := prefix.NewStore(store, types.KeyPrefix(types.ClaimKeyPrefix)) + + // isCustomIndex is used to determined if we'll be using the store that points + // to the actual Claim values, or a secondary index that points to the primary keys. + var isCustomIndex bool + var keyPrefix []byte + switch filter := req.Filter.(type) { + case *types.QueryAllClaimsRequest_SupplierAddress: + isCustomIndex = true + keyPrefix = types.KeyPrefix(types.ClaimSupplierAddressPrefix) + keyPrefix = append(keyPrefix, []byte(filter.SupplierAddress)...) + + case *types.QueryAllClaimsRequest_SessionEndHeight: + isCustomIndex = true + heightBz := make([]byte, 8) + binary.BigEndian.PutUint64(heightBz, filter.SessionEndHeight) + + keyPrefix = types.KeyPrefix(types.ClaimSessionEndHeightPrefix) + keyPrefix = append(keyPrefix, heightBz...) + + case *types.QueryAllClaimsRequest_SessionId: + isCustomIndex = false + keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) + keyPrefix = append(keyPrefix, []byte(filter.SessionId)...) + + default: + isCustomIndex = false + keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) + } + claimStore := prefix.NewStore(store, keyPrefix) + + var claims []types.Claim + pageRes, err := query.Paginate(claimStore, req.Pagination, func(key []byte, value []byte) error { + if isCustomIndex { + // We retrieve the primaryKey, and need to query the actual Claim before decoding it. + claim, claimFound := k.getClaimByPrimaryKey(ctx, value) + if claimFound { + claims = append(claims, claim) + } + } else { + // The value is an encoded Claim. + var claim types.Claim + if err := k.cdc.Unmarshal(value, &claim); err != nil { + return err + } + claims = append(claims, claim) + } + + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllClaimsResponse{Claims: claims, Pagination: pageRes}, nil +} + +func (k Keeper) Claim(ctx context.Context, req *types.QueryGetClaimRequest) (*types.QueryGetClaimResponse, error) { + if req == nil { + err := types.ErrProofInvalidQueryRequest.Wrapf("request cannot be nil") + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + if err := req.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + val, found := k.GetClaim( + ctx, + req.SessionId, + req.SupplierAddress, + ) + if !found { + err := types.ErrProofClaimNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryGetClaimResponse{Claim: val}, nil +} diff --git a/x/proof/keeper/query_claim_test.go b/x/proof/keeper/query_claim_test.go new file mode 100644 index 000000000..8d5620636 --- /dev/null +++ b/x/proof/keeper/query_claim_test.go @@ -0,0 +1,235 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/proof/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestClaimQuerySingle(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + claims := createNClaims(keeper, ctx, 2) + + var wrongSupplierAddr = sample.AccAddress() + tests := []struct { + desc string + + request *types.QueryGetClaimRequest + + response *types.QueryGetClaimResponse + expectedErr error + }{ + { + desc: "First Claim", + + request: &types.QueryGetClaimRequest{ + SessionId: claims[0].GetSessionHeader().GetSessionId(), + SupplierAddress: claims[0].SupplierAddress, + }, + + response: &types.QueryGetClaimResponse{Claim: claims[0]}, + expectedErr: nil, + }, + { + desc: "Second Claim", + + request: &types.QueryGetClaimRequest{ + SessionId: claims[1].GetSessionHeader().GetSessionId(), + SupplierAddress: claims[1].SupplierAddress, + }, + + response: &types.QueryGetClaimResponse{Claim: claims[1]}, + expectedErr: nil, + }, + { + desc: "Claim Not Found - Random SessionId", + + request: &types.QueryGetClaimRequest{ + SessionId: "not a real session id", + SupplierAddress: claims[0].GetSupplierAddress(), + }, + + expectedErr: status.Error( + codes.NotFound, + types.ErrProofClaimNotFound.Wrapf( + // TODO_CONSIDERATION: factor out error message format strings to constants. + "session ID %q and supplier %q", + "not a real session id", + claims[0].GetSupplierAddress(), + ).Error(), + ), + }, + { + desc: "Claim Not Found - Wrong Supplier Address", + + request: &types.QueryGetClaimRequest{ + SessionId: claims[0].GetSessionHeader().GetSessionId(), + SupplierAddress: wrongSupplierAddr, + }, + + expectedErr: status.Error( + codes.NotFound, + types.ErrProofClaimNotFound.Wrapf( + "session ID %q and supplier %q", + claims[0].GetSessionHeader().GetSessionId(), + wrongSupplierAddr, + ).Error(), + ), + }, + { + desc: "InvalidRequest - Missing SessionId", + request: &types.QueryGetClaimRequest{ + // SessionId: Intentionally Omitted + SupplierAddress: claims[0].GetSupplierAddress(), + }, + + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidSessionId.Wrapf( + "invalid session ID for claim being retrieved %s", + "", + ).Error(), + ), + }, + { + desc: "InvalidRequest - Missing SupplierAddress", + request: &types.QueryGetClaimRequest{ + SessionId: claims[0].GetSessionHeader().GetSessionId(), + // SupplierAddress: Intentionally Omitted, + }, + + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidAddress.Wrap( + "invalid supplier address for claim being retrieved ; (empty address string is not allowed)", + ).Error(), + ), + }, + { + desc: "InvalidRequest - nil QueryGetClaimRequest", + request: nil, + + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidQueryRequest.Wrap( + "request cannot be nil", + ).Error(), + ), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Claim(ctx, tc.request) + if tc.expectedErr != nil { + actualStatus, ok := status.FromError(err) + require.True(t, ok) + + require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) + require.ErrorContains(t, err, tc.expectedErr.Error()) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestClaimQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + claims := createNClaims(keeper, ctx, 10) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllClaimsRequest { + return &types.QueryAllClaimsRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(claims); i += step { + resp, err := keeper.AllClaims(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Claims), step) + require.Subset(t, + nullify.Fill(claims), + nullify.Fill(resp.Claims), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(claims); i += step { + resp, err := keeper.AllClaims(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Claims), step) + require.Subset(t, + nullify.Fill(claims), + nullify.Fill(resp.Claims), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.AllClaims(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(claims), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(claims), + nullify.Fill(resp.Claims), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.AllClaims(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) + + t.Run("BySupplierAddress", func(t *testing.T) { + req := request(nil, 0, 0, true) + req.Filter = &types.QueryAllClaimsRequest_SupplierAddress{ + SupplierAddress: claims[0].SupplierAddress, + } + resp, err := keeper.AllClaims(ctx, req) + require.NoError(t, err) + require.Equal(t, 1, int(resp.Pagination.Total)) + }) + + t.Run("BySessionId", func(t *testing.T) { + req := request(nil, 0, 0, true) + req.Filter = &types.QueryAllClaimsRequest_SessionId{ + SessionId: claims[0].GetSessionHeader().GetSessionId(), + } + resp, err := keeper.AllClaims(ctx, req) + require.NoError(t, err) + require.Equal(t, 1, int(resp.Pagination.Total)) + }) + + t.Run("BySessionEndHeight", func(t *testing.T) { + req := request(nil, 0, 0, true) + req.Filter = &types.QueryAllClaimsRequest_SessionEndHeight{ + SessionEndHeight: uint64(claims[0].GetSessionHeader().GetSessionEndBlockHeight()), + } + resp, err := keeper.AllClaims(ctx, req) + require.NoError(t, err) + require.Equal(t, 1, int(resp.Pagination.Total)) + }) +} diff --git a/x/proof/keeper/query_params.go b/x/proof/keeper/query_params.go new file mode 100644 index 000000000..b30236464 --- /dev/null +++ b/x/proof/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/proof/keeper/query_params_test.go b/x/proof/keeper/query_params_test.go new file mode 100644 index 000000000..40d78695f --- /dev/null +++ b/x/proof/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/proof/keeper/query_proof.go b/x/proof/keeper/query_proof.go new file mode 100644 index 000000000..6e8a9d585 --- /dev/null +++ b/x/proof/keeper/query_proof.go @@ -0,0 +1,98 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func (k Keeper) AllProofs(ctx context.Context, req *types.QueryAllProofsRequest) (*types.QueryAllProofsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if err := req.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + + var ( + // isCustomIndex is used to determined if we'll be using the store that points + // to the actual Claim values, or a secondary index that points to the primary keys. + isCustomIndex bool + keyPrefix []byte + ) + + switch filter := req.Filter.(type) { + case *types.QueryAllProofsRequest_SupplierAddress: + isCustomIndex = true + keyPrefix = types.KeyPrefix(types.ProofSupplierAddressPrefix) + keyPrefix = append(keyPrefix, []byte(filter.SupplierAddress)...) + case *types.QueryAllProofsRequest_SessionEndHeight: + isCustomIndex = true + keyPrefix = types.KeyPrefix(types.ProofSessionEndHeightPrefix) + keyPrefix = append(keyPrefix, []byte(fmt.Sprintf("%d", filter.SessionEndHeight))...) + case *types.QueryAllProofsRequest_SessionId: + isCustomIndex = false + keyPrefix = types.KeyPrefix(types.ProofPrimaryKeyPrefix) + keyPrefix = append(keyPrefix, []byte(filter.SessionId)...) + default: + isCustomIndex = false + keyPrefix = types.KeyPrefix(types.ProofPrimaryKeyPrefix) + } + proofStore := prefix.NewStore(store, keyPrefix) + + var proofs []types.Proof + pageRes, err := query.Paginate(proofStore, req.Pagination, func(key []byte, value []byte) error { + if isCustomIndex { + // We retrieve the primaryKey, and need to query the actual proof before decoding it. + proof, proofFound := k.getProofByPrimaryKey(ctx, value) + if proofFound { + proofs = append(proofs, proof) + } + } else { + // The value is an encoded proof. + var proof types.Proof + if err := k.cdc.Unmarshal(value, &proof); err != nil { + return err + } + + proofs = append(proofs, proof) + } + + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllProofsResponse{Proofs: proofs, Pagination: pageRes}, nil +} + +func (k Keeper) Proof(ctx context.Context, req *types.QueryGetProofRequest) (*types.QueryGetProofResponse, error) { + if req == nil { + err := types.ErrProofInvalidQueryRequest.Wrap("request cannot be nil") + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + if err := req.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + val, found := k.GetProof(ctx, req.GetSessionId(), req.GetSupplierAddress()) + if !found { + err := types.ErrProofProofNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryGetProofResponse{Proof: val}, nil +} diff --git a/x/proof/keeper/query_proof_test.go b/x/proof/keeper/query_proof_test.go new file mode 100644 index 000000000..e99c83169 --- /dev/null +++ b/x/proof/keeper/query_proof_test.go @@ -0,0 +1,190 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + _ "github.com/pokt-network/poktroll/testutil/testpolylog" + "github.com/pokt-network/poktroll/x/proof/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestProofQuerySingle(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + proofs := createNProofs(keeper, ctx, 2) + + var randSupplierAddr = sample.AccAddress() + tests := []struct { + desc string + request *types.QueryGetProofRequest + response *types.QueryGetProofResponse + expectedErr error + }{ + { + desc: "First", + request: &types.QueryGetProofRequest{ + SessionId: proofs[0].GetSessionHeader().GetSessionId(), + SupplierAddress: proofs[0].SupplierAddress, + }, + response: &types.QueryGetProofResponse{Proof: proofs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetProofRequest{ + SessionId: proofs[1].GetSessionHeader().GetSessionId(), + SupplierAddress: proofs[1].SupplierAddress, + }, + response: &types.QueryGetProofResponse{Proof: proofs[1]}, + }, + { + desc: "Proof Not Found - Random SessionId", + request: &types.QueryGetProofRequest{ + SessionId: "not a real session id", + SupplierAddress: proofs[0].GetSupplierAddress(), + }, + expectedErr: status.Error( + codes.NotFound, + types.ErrProofProofNotFound.Wrapf( + "session ID %q and supplier %q", + "not a real session id", + proofs[0].GetSupplierAddress(), + ).Error(), + ), + }, + { + desc: "Proof Not Found - Random Supplier Address", + request: &types.QueryGetProofRequest{ + SessionId: proofs[0].GetSessionHeader().GetSessionId(), + SupplierAddress: randSupplierAddr, + }, + expectedErr: status.Error( + codes.NotFound, + types.ErrProofProofNotFound.Wrapf( + "session ID %q and supplier %q", + proofs[0].GetSessionHeader().GetSessionId(), + randSupplierAddr, + ).Error(), + ), + }, + { + desc: "InvalidRequest - Missing SessionId", + request: &types.QueryGetProofRequest{ + // SessionId: Intentionally Omitted + SupplierAddress: proofs[0].GetSupplierAddress(), + }, + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidSessionId.Wrapf( + "invalid session ID for proof being retrieved %s", + "", + ).Error(), + ), + }, + { + desc: "InvalidRequest - Missing SupplierAddress", + request: &types.QueryGetProofRequest{ + SessionId: proofs[0].GetSessionHeader().GetSessionId(), + // SupplierAddress: Intentionally Omitted, + }, + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidAddress.Wrap( + "invalid supplier address for proof being retrieved ; (empty address string is not allowed)", + ).Error(), + ), + }, + { + desc: "InvalidRequest - nil QueryGetProofRequest", + request: nil, + expectedErr: status.Error( + codes.InvalidArgument, + types.ErrProofInvalidQueryRequest.Wrap( + "request cannot be nil", + ).Error(), + ), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Proof(ctx, tc.request) + if tc.expectedErr != nil { + actualStatus, ok := status.FromError(err) + require.True(t, ok) + + require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) + require.ErrorContains(t, err, tc.expectedErr.Error()) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestProofQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.ProofKeeper(t, nil) + proofs := createNProofs(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllProofsRequest { + return &types.QueryAllProofsRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(proofs); i += step { + resp, err := keeper.AllProofs(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Proofs), step) + require.Subset(t, + nullify.Fill(proofs), + nullify.Fill(resp.Proofs), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(proofs); i += step { + resp, err := keeper.AllProofs(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Proofs), step) + require.Subset(t, + nullify.Fill(proofs), + nullify.Fill(resp.Proofs), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.AllProofs(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(proofs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(proofs), + nullify.Fill(resp.Proofs), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.AllProofs(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/proof/keeper/session.go b/x/proof/keeper/session.go new file mode 100644 index 000000000..160c590c2 --- /dev/null +++ b/x/proof/keeper/session.go @@ -0,0 +1,80 @@ +package keeper + +import ( + "context" + + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +// queryAndValidateSessionHeader ensures that a session with the sessionID of the given session +// header exists and that this session includes the supplier with the given address. +func (k msgServer) queryAndValidateSessionHeader( + ctx context.Context, + sessionHeader *sessiontypes.SessionHeader, + supplierAddr string, +) (*sessiontypes.Session, error) { + logger := k.Logger().With("method", "SubmitProof") + + sessionReq := &sessiontypes.QueryGetSessionRequest{ + ApplicationAddress: sessionHeader.GetApplicationAddress(), + Service: sessionHeader.GetService(), + BlockHeight: sessionHeader.GetSessionStartBlockHeight(), + } + + // Get the on-chain session for the ground-truth against which the given + // session header is to be validated. + sessionRes, err := k.Keeper.sessionKeeper.GetSession(ctx, sessionReq) + if err != nil { + return nil, err + } + onChainSession := sessionRes.GetSession() + + logger. + With( + "session_id", onChainSession.GetSessionId(), + "session_end_height", sessionHeader.GetSessionEndBlockHeight(), + "supplier", supplierAddr, + ). + Debug("got sessionId for proof") + + // Ensure that the given session header's session ID matches the on-chain onChainSession ID. + if sessionHeader.GetSessionId() != onChainSession.GetSessionId() { + return nil, suppliertypes.ErrSupplierInvalidSessionId.Wrapf( + "session ID does not match on-chain session ID; expected %q, got %q", + onChainSession.GetSessionId(), + sessionHeader.GetSessionId(), + ) + } + + // NB: it is redundant to assert that the service ID in the request matches the + // on-chain session service ID because the session is queried using the service + // ID as a parameter. Either a different session (i.e. different session ID) + // or an error would be returned depending on whether an application/supplier + // pair exists for the given service ID or not, respectively. + + // Ensure the given supplier is in the onChainSession supplier list. + if found := foundSupplier( + sessionRes.GetSession().GetSuppliers(), + supplierAddr, + ); !found { + return nil, suppliertypes.ErrSupplierNotFound.Wrapf( + "supplier address %q not found in session ID %q", + supplierAddr, + sessionHeader.GetSessionId(), + ) + } + + return onChainSession, nil +} + +// foundSupplier ensures that the given supplier address is in the given list of suppliers. +func foundSupplier(suppliers []*sharedtypes.Supplier, supplierAddr string) bool { + for _, supplier := range suppliers { + if supplier.Address == supplierAddr { + return true + } + } + return false +} diff --git a/x/proof/module/autocli.go b/x/proof/module/autocli.go new file mode 100644 index 000000000..73da757e1 --- /dev/null +++ b/x/proof/module/autocli.go @@ -0,0 +1,70 @@ +package proof + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/proof" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + { + RpcMethod: "AllClaims", + Use: "list-claim", + Short: "List all claim", + }, + { + RpcMethod: "Claim", + Use: "show-claim [id]", + Short: "Shows a claim", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + }, + { + RpcMethod: "AllProofs", + Use: "list-proof", + Short: "List all proof", + }, + { + RpcMethod: "Proof", + Use: "show-proof [id]", + Short: "Shows a proof", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // TODO_TECHDEBT(#370): Integrate with AutoCLI + //{ + // RpcMethod: "CreateClaim", + // Use: "create-claim [session-header] [root-hash]", + // Short: "Send a create-claim tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "sessionHeader"}, {ProtoField: "rootHash"}}, + //}, + //{ + // RpcMethod: "SubmitProof", + // Use: "submit-proof [session-header] [proof]", + // Short: "Send a submit-proof tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "sessionHeader"}, {ProtoField: "proof"}}, + //}, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/proof/module/flags.go b/x/proof/module/flags.go new file mode 100644 index 000000000..3afd82824 --- /dev/null +++ b/x/proof/module/flags.go @@ -0,0 +1,7 @@ +package proof + +const ( + FlagSessionEndHeight = "session-end-height" + FlagSessionId = "session-id" + FlagSupplierAddress = "supplier-address" +) diff --git a/x/proof/module/genesis.go b/x/proof/module/genesis.go new file mode 100644 index 000000000..ee0e3a7fe --- /dev/null +++ b/x/proof/module/genesis.go @@ -0,0 +1,34 @@ +package proof + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the claim + for _, claim := range genState.ClaimList { + k.UpsertClaim(ctx, claim) + } + // Set all the proof + for _, proof := range genState.ProofList { + k.UpsertProof(ctx, proof) + } + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.ClaimList = k.GetAllClaims(ctx) + genesis.ProofList = k.GetAllProofs(ctx) + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/proof/module/genesis_test.go b/x/proof/module/genesis_test.go new file mode 100644 index 000000000..1169893c0 --- /dev/null +++ b/x/proof/module/genesis_test.go @@ -0,0 +1,55 @@ +package proof_test + +import ( + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/proof/module" + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + mockSessionId := "mock_session_id" + + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + ClaimList: []types.Claim{ + { + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionId: mockSessionId, + ApplicationAddress: sample.AccAddress(), + }, + RootHash: []byte{1, 2, 3}, + }, + }, + // TODO_BLOCKER: finish genesis proof list validation. + //ProofList: []types.Proof{ + // { + // Index: "0", + // }, + // { + // Index: "1", + // }, + //}, + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.ProofKeeper(t, nil) + proof.InitGenesis(ctx, k, genesisState) + got := proof.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.ClaimList, got.ClaimList) + require.ElementsMatch(t, genesisState.ProofList, got.ProofList) + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/proof/module/helpers_test.go b/x/proof/module/helpers_test.go new file mode 100644 index 000000000..2a7eec325 --- /dev/null +++ b/x/proof/module/helpers_test.go @@ -0,0 +1,248 @@ +package proof_test + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + "strconv" + "testing" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + testcli "github.com/cosmos/cosmos-sdk/testutil/cli" + sdktypes "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/testutil/testkeyring" + apptypes "github.com/pokt-network/poktroll/x/application/types" + proof "github.com/pokt-network/poktroll/x/proof/module" + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +// TODO_TECHDEBT: This should not be hardcoded once the num blocks per session is configurable. +const ( + numBlocksPerSession = 4 + testServiceId = "svc1" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +func init() { + cmd.InitSDKConfig() +} + +// TODO_CONSIDERATION: perhaps this (and/or other similar helpers) can be refactored +// into something more generic and moved into a shared testutil package. +// TODO_TECHDEBT: refactor; this function has more than a single responsibility, +// which should be to configure and start the test network. The genesis state, +// accounts, and claims set up logic can probably be factored out and/or reduced. +func networkWithClaimObjects( + t *testing.T, + sessionCount int, + supplierCount int, + appCount int, +) (net *network.Network, claims []types.Claim) { + t.Helper() + + // Initialize a network config. + cfg := network.DefaultConfig() + + // Construct an in-memory keyring so that it can be populated and used prior + // to network start. + kr := keyring.NewInMemory(cfg.Codec) + // Populate the in-memmory keyring with as many pre-generated accounts as + // we expect to need for the test (i.e. appCount + supplierCount). + testkeyring.CreatePreGeneratedKeyringAccounts(t, kr, supplierCount+appCount) + + // Use the pre-generated accounts iterator to populate the supplier and + // application accounts and addresses lists for use in genesis state construction. + preGeneratedAccts := testkeyring.PreGeneratedAccounts().Clone() + + // Create a supplier for each session in numClaimsSessions and an app for each + // claim in numClaimsPerSession. + supplierAccts := make([]*testkeyring.PreGeneratedAccount, supplierCount) + supplierAddrs := make([]string, supplierCount) + for i := range supplierAccts { + account, ok := preGeneratedAccts.Next() + require.True(t, ok) + supplierAccts[i] = account + supplierAddrs[i] = account.Address.String() + } + appAccts := make([]*testkeyring.PreGeneratedAccount, appCount) + appAddrs := make([]string, appCount) + for i := range appAccts { + account, ok := preGeneratedAccts.Next() + require.True(t, ok) + appAccts[i] = account + appAddrs[i] = account.Address.String() + } + + // Construct supplier and application module genesis states given the account addresses. + supplierGenesisState := network.SupplierModuleGenesisStateWithAddresses(t, supplierAddrs) + supplierGenesisBuffer, err := cfg.Codec.MarshalJSON(supplierGenesisState) + require.NoError(t, err) + appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, appAddrs) + appGenesisBuffer, err := cfg.Codec.MarshalJSON(appGenesisState) + require.NoError(t, err) + + // Add supplier and application module genesis states to the network config. + cfg.GenesisState[suppliertypes.ModuleName] = supplierGenesisBuffer + cfg.GenesisState[apptypes.ModuleName] = appGenesisBuffer + + // Construct the network with the configuration. + net = network.New(t, cfg) + // Only the first validator's client context is populated. + // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk/testutil/network#pkg-overview) + ctx := net.Validators[0].ClientCtx + // Overwrite the client context's keyring with the in-memory one that contains + // our pre-generated accounts. + ctx = ctx.WithKeyring(kr) + + // Initialize all the accounts + sequenceIndex := 1 + for _, supplierAcct := range supplierAccts { + network.InitAccountWithSequence(t, net, supplierAcct.Address, sequenceIndex) + sequenceIndex++ + } + for _, appAcct := range appAccts { + network.InitAccountWithSequence(t, net, appAcct.Address, sequenceIndex) + sequenceIndex++ + } + // need to wait for the account to be initialized in the next block + require.NoError(t, net.WaitForNextBlock()) + + // Create sessionCount * numClaimsPerSession claims for the supplier + sessionEndHeight := int64(1) + for sessionIdx := 0; sessionIdx < sessionCount; sessionIdx++ { + sessionEndHeight += numBlocksPerSession + for _, appAcct := range appAccts { + for _, supplierAcct := range supplierAccts { + claim := createClaim( + t, net, ctx, + supplierAcct.Address.String(), + sessionEndHeight, + appAcct.Address.String(), + ) + claims = append(claims, *claim) + // TODO_TECHDEBT(#196): Move this outside of the forloop so that the test iteration is faster + require.NoError(t, net.WaitForNextBlock()) + } + } + } + + return net, claims +} + +// encodeSessionHeader returns a base64 encoded string of a json +// serialized session header. +func encodeSessionHeader( + t *testing.T, + appAddr string, + sessionId string, + sessionStartHeight int64, +) string { + t.Helper() + + argSessionHeader := &sessiontypes.SessionHeader{ + ApplicationAddress: appAddr, + SessionStartBlockHeight: sessionStartHeight, + SessionId: sessionId, + SessionEndBlockHeight: sessionStartHeight + numBlocksPerSession, + Service: &sharedtypes.Service{Id: testServiceId}, + } + cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + sessionHeaderBz := cdc.MustMarshalJSON(argSessionHeader) + return base64.StdEncoding.EncodeToString(sessionHeaderBz) +} + +// createClaim sends a tx using the test CLI to create an on-chain claim +func createClaim( + t *testing.T, + net *network.Network, + ctx client.Context, + supplierAddr string, + sessionEndHeight int64, + appAddress string, +) *types.Claim { + t.Helper() + + rootHash := []byte("root_hash") + sessionStartHeight := sessionEndHeight - numBlocksPerSession + sessionId := getSessionId(t, net, appAddress, supplierAddr, sessionStartHeight) + sessionHeaderEncoded := encodeSessionHeader(t, appAddress, sessionId, sessionStartHeight) + rootHashEncoded := base64.StdEncoding.EncodeToString(rootHash) + + args := []string{ + sessionHeaderEncoded, + rootHashEncoded, + fmt.Sprintf("--%s=%s", flags.FlagFrom, supplierAddr), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdktypes.NewCoins(sdktypes.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), + } + + responseRaw, err := testcli.ExecTestCLICmd(ctx, proof.CmdCreateClaim(), args) + require.NoError(t, err) + var responseJson map[string]interface{} + err = json.Unmarshal(responseRaw.Bytes(), &responseJson) + require.NoError(t, err) + require.Equal(t, float64(0), responseJson["code"], "code is not 0 in the response: %v", responseJson) + + // TODO_TECHDEBT: Forward the actual claim in the response once the response is updated to return it. + return &types.Claim{ + SupplierAddress: supplierAddr, + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: appAddress, + Service: &sharedtypes.Service{Id: testServiceId}, + SessionId: sessionId, + SessionStartBlockHeight: sessionStartHeight, + SessionEndBlockHeight: sessionEndHeight, + }, + RootHash: rootHash, + } +} + +// getSessionId sends a query using the test CLI to get a session for the inputs provided. +// It is assumed that the supplierAddr will be in that session based on the test design, but this +// is insured in this function before it's successfully returned. +func getSessionId( + t *testing.T, + net *network.Network, + appAddr string, + supplierAddr string, + sessionStartHeight int64, +) string { + t.Helper() + ctx := context.TODO() + + sessionQueryClient := sessiontypes.NewQueryClient(net.Validators[0].ClientCtx) + res, err := sessionQueryClient.GetSession(ctx, &sessiontypes.QueryGetSessionRequest{ + ApplicationAddress: appAddr, + Service: &sharedtypes.Service{Id: testServiceId}, + BlockHeight: sessionStartHeight, + }) + require.NoError(t, err) + + var found bool + for _, supplier := range res.GetSession().GetSuppliers() { + if supplier.GetAddress() == supplierAddr { + found = true + break + } + } + require.Truef(t, found, "supplier address %s not found in session", supplierAddr) + + return res.Session.SessionId +} diff --git a/x/proof/module/module.go b/x/proof/module/module.go new file mode 100644 index 000000000..44e4154aa --- /dev/null +++ b/x/proof/module/module.go @@ -0,0 +1,216 @@ +package proof + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/proof/module" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + SessionKeeper types.SessionKeeper +} + +type ModuleOutputs struct { + depinject.Out + + ProofKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.SessionKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{ProofKeeper: k, Module: m} +} diff --git a/x/proof/module/query.go b/x/proof/module/query.go new file mode 100644 index 000000000..5d4cae772 --- /dev/null +++ b/x/proof/module/query.go @@ -0,0 +1,31 @@ +package proof + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd() *cobra.Command { + // Group supplier queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdListClaims()) + cmd.AddCommand(CmdShowClaim()) + cmd.AddCommand(CmdListProof()) + cmd.AddCommand(CmdShowProof()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/proof/module/query_claim.go b/x/proof/module/query_claim.go new file mode 100644 index 000000000..0e423dbc2 --- /dev/null +++ b/x/proof/module/query_claim.go @@ -0,0 +1,168 @@ +package proof + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// AddPaginationFlagsToCmd adds common pagination flags to cmd +func AddClaimFilterFlags(cmd *cobra.Command) { + cmd.Flags().Uint64(FlagSessionEndHeight, 0, "claims whose session ends at this height will be returned") + cmd.Flags().String(FlagSessionId, "", "claims matching this session id will be returned") + cmd.Flags().String(FlagSupplierAddress, "", "claims submitted by suppliers matching this address will be returned") +} + +func CmdListClaims() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-claims", + Short: "list all claims", + Long: `List all the claims that the node being queried has in its state. + +The claims can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --node $(POCKET_NODE) +$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-id --node $(POCKET_NODE) +$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-end-height --node $(POCKET_NODE) +$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --supplier-address --node $(POCKET_NODE)`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + req := &types.QueryAllClaimsRequest{ + Pagination: pageReq, + } + if err := updateClaimsFilter(cmd, req); err != nil { + return err + } + if err := req.ValidateBasic(); err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.AllClaims(cmd.Context(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + AddClaimFilterFlags(cmd) + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowClaim() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-claim ", + Short: "shows a specific claim", + Long: `List a specific claim that the node being queried has access to (if it still exists). + +A unique claim can be defined via a ` + "`session_id`" + ` that the given ` + "`supplier`" + ` participated in. + +` + "`Claims`" + ` are pruned, according to protocol parameters, some time after their respective ` + "`proof`" + ` has been submitted and any dispute window has elapsed. + +This is done to minimize the rate at which state accumulates by eliminating claims as a long-term factor to persistence requirements. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) q claim show-claims --node $(POCKET_NODE)`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + sessionId := args[0] + supplierAddr := args[1] + + getClaimRequest := &types.QueryGetClaimRequest{ + SessionId: sessionId, + SupplierAddress: supplierAddr, + } + if err := getClaimRequest.ValidateBasic(); err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Claim(cmd.Context(), getClaimRequest) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// updateClaimsFilter updates the claims filter request based on the flags set provided +func updateClaimsFilter(cmd *cobra.Command, req *types.QueryAllClaimsRequest) error { + sessionId, _ := cmd.Flags().GetString(FlagSessionId) + supplierAddr, _ := cmd.Flags().GetString(FlagSupplierAddress) + sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) + + // Preparing a shared error in case more than one flag was set + err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) + + // Use the session id as the filter + if sessionId != "" { + // If the session id is set, then the other flags must not be set + if supplierAddr != "" || sessionEndHeight > 0 { + return err + } + // Set the session id filter + req.Filter = &types.QueryAllClaimsRequest_SessionId{ + SessionId: sessionId, + } + return nil + } + + // Use the supplier address as the filter + if supplierAddr != "" { + // If the supplier address is set, then the other flags must not be set + if sessionId != "" || sessionEndHeight > 0 { + return err + } + // Set the supplier address filter + req.Filter = &types.QueryAllClaimsRequest_SupplierAddress{ + SupplierAddress: supplierAddr, + } + return nil + } + + // Use the session end height as the filter + if sessionEndHeight > 0 { + // If the session end height is set, then the other flags must not be set + if sessionId != "" || supplierAddr != "" { + return err + } + // Set the session end height filter + req.Filter = &types.QueryAllClaimsRequest_SessionEndHeight{ + SessionEndHeight: sessionEndHeight, + } + return nil + } + + return nil +} diff --git a/x/proof/module/query_claim_test.go b/x/proof/module/query_claim_test.go new file mode 100644 index 000000000..1e8c12130 --- /dev/null +++ b/x/proof/module/query_claim_test.go @@ -0,0 +1,285 @@ +package proof_test + +import ( + "fmt" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + _ "github.com/pokt-network/poktroll/testutil/testpolylog" + proof "github.com/pokt-network/poktroll/x/proof/module" + "github.com/pokt-network/poktroll/x/proof/types" +) + +func TestClaim_Show(t *testing.T) { + sessionCount := 1 + supplierCount := 3 + appCount := 3 + + net, claims := networkWithClaimObjects( + t, sessionCount, + appCount, + supplierCount, + ) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + + var wrongSupplierAddr = sample.AccAddress() + tests := []struct { + desc string + sessionId string + supplierAddr string + + args []string + expectedErr error + claim types.Claim + }{ + { + desc: "claim found", + sessionId: claims[0].GetSessionHeader().GetSessionId(), + supplierAddr: claims[0].GetSupplierAddress(), + + args: common, + claim: claims[0], + }, + { + desc: "claim not found (wrong session ID)", + sessionId: "wrong_session_id", + supplierAddr: claims[0].GetSupplierAddress(), + + args: common, + + expectedErr: status.Error( + codes.NotFound, + types.ErrProofClaimNotFound.Wrapf( + "session ID %q and supplier %q", + "wrong_session_id", + claims[0].GetSupplierAddress(), + ).Error(), + ), + }, + { + desc: "claim not found (invalid bech32 supplier address)", + sessionId: claims[0].GetSessionHeader().GetSessionId(), + supplierAddr: "invalid_bech32_supplier_address", + + args: common, + // NB: this is *NOT* a gRPC status error because the bech32 parse + // error occurs during request validation (i.e. client-side). + expectedErr: types.ErrProofInvalidAddress.Wrapf( + // TODO_CONSIDERATION: prefer using "%q" in error format strings + // to disambiguate empty string from space or no output. + "invalid supplier address for claim being retrieved %s; (decoding bech32 failed: invalid separator index -1)", + "invalid_bech32_supplier_address", + ), + }, + { + desc: "claim not found (wrong supplier address)", + sessionId: claims[0].GetSessionHeader().GetSessionId(), + supplierAddr: wrongSupplierAddr, + + args: common, + expectedErr: status.Error( + codes.NotFound, + types.ErrProofClaimNotFound.Wrapf( + "session ID %q and supplier %q", + claims[0].GetSessionHeader().GetSessionId(), + wrongSupplierAddr, + ).Error(), + ), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.sessionId, + tc.supplierAddr, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdShowClaim(), args) + if tc.expectedErr != nil { + require.ErrorContains(t, err, tc.expectedErr.Error()) + } else { + require.NoError(t, err) + var resp types.QueryGetClaimResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.Claim) + + require.Equal(t, tc.claim.GetSupplierAddress(), resp.Claim.GetSupplierAddress()) + require.Equal(t, tc.claim.GetRootHash(), resp.Claim.GetRootHash()) + require.Equal(t, tc.claim.GetSessionHeader(), resp.Claim.GetSessionHeader()) + } + }) + } +} + +func TestClaim_List(t *testing.T) { + sessionCount := 2 + supplierCount := 4 + appCount := 3 + serviceCount := 1 + // Each supplier will submit a claim for each app x service combination (per session). + numClaimsPerSession := supplierCount * appCount * serviceCount + totalClaims := sessionCount * numClaimsPerSession + + net, claims := networkWithClaimObjects( + t, sessionCount, + supplierCount, + appCount, + ) + + ctx := net.Validators[0].ClientCtx + prepareArgs := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < totalClaims; i += step { + args := prepareArgs(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdListClaims(), args) + require.NoError(t, err) + + var resp types.QueryAllClaimsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + + require.LessOrEqual(t, len(resp.Claims), step) + require.Subset(t, + nullify.Fill(claims), + nullify.Fill(resp.Claims), + ) + } + }) + + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < totalClaims; i += step { + args := prepareArgs(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdListClaims(), args) + require.NoError(t, err) + + var resp types.QueryAllClaimsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + + require.LessOrEqual(t, len(resp.Claims), step) + require.Subset(t, + nullify.Fill(claims), + nullify.Fill(resp.Claims), + ) + next = resp.Pagination.NextKey + } + }) + + t.Run("ByAddress", func(t *testing.T) { + supplierAddr := claims[0].SupplierAddress + args := prepareArgs(nil, 0, uint64(totalClaims), true) + args = append(args, fmt.Sprintf("--%s=%s", proof.FlagSupplierAddress, supplierAddr)) + + expectedClaims := make([]types.Claim, 0) + for _, claim := range claims { + if claim.SupplierAddress == supplierAddr { + expectedClaims = append(expectedClaims, claim) + } + } + + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdListClaims(), args) + require.NoError(t, err) + + var resp types.QueryAllClaimsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + + require.ElementsMatch(t, + nullify.Fill(expectedClaims), + nullify.Fill(resp.Claims), + ) + require.Equal(t, sessionCount*appCount, int(resp.Pagination.Total)) + }) + + t.Run("BySession", func(t *testing.T) { + sessionId := claims[0].GetSessionHeader().SessionId + args := prepareArgs(nil, 0, uint64(totalClaims), true) + args = append(args, fmt.Sprintf("--%s=%s", proof.FlagSessionId, sessionId)) + + expectedClaims := make([]types.Claim, 0) + for _, claim := range claims { + if claim.GetSessionHeader().SessionId == sessionId { + expectedClaims = append(expectedClaims, claim) + } + } + + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdListClaims(), args) + require.NoError(t, err) + + var resp types.QueryAllClaimsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + + require.ElementsMatch(t, + nullify.Fill(expectedClaims), + nullify.Fill(resp.Claims), + ) + require.Equal(t, supplierCount, int(resp.Pagination.Total)) + }) + + t.Run("ByHeight", func(t *testing.T) { + sessionEndHeight := claims[0].GetSessionHeader().GetSessionEndBlockHeight() + args := prepareArgs(nil, 0, uint64(totalClaims), true) + args = append(args, fmt.Sprintf("--%s=%d", proof.FlagSessionEndHeight, sessionEndHeight)) + + expectedClaims := make([]types.Claim, 0) + for _, claim := range claims { + if claim.GetSessionHeader().GetSessionEndBlockHeight() == sessionEndHeight { + expectedClaims = append(expectedClaims, claim) + } + } + + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdListClaims(), args) + require.NoError(t, err) + + var resp types.QueryAllClaimsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + + require.Equal(t, numClaimsPerSession, int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(expectedClaims), + nullify.Fill(resp.Claims), + ) + }) + + t.Run("Total", func(t *testing.T) { + args := prepareArgs(nil, 0, uint64(totalClaims), true) + out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdListClaims(), args) + require.NoError(t, err) + + var resp types.QueryAllClaimsResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + + require.Equal(t, totalClaims, int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(claims), + nullify.Fill(resp.Claims), + ) + }) +} diff --git a/x/proof/module/query_params.go b/x/proof/module/query_params.go new file mode 100644 index 000000000..5a06000be --- /dev/null +++ b/x/proof/module/query_params.go @@ -0,0 +1,36 @@ +package proof + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/proof/module/query_proof.go b/x/proof/module/query_proof.go new file mode 100644 index 000000000..e3771f865 --- /dev/null +++ b/x/proof/module/query_proof.go @@ -0,0 +1,165 @@ +package proof + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// AddProofFilterFlagsToCmd adds common pagination flags to cmd +func AddProofFilterFlagsToCmd(cmd *cobra.Command) { + cmd.Flags().Uint64(FlagSessionEndHeight, 0, "proofs whose session ends at this height will be returned") + cmd.Flags().String(FlagSessionId, "", "proofs matching this session id will be returned") + cmd.Flags().String(FlagSupplierAddress, "", "proofs submitted by suppliers matching this address will be returned") +} + +func CmdListProof() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-proofs", + Short: "list all proofs", + Long: `List all the proofs that the node being queried has in its state. + +The proofs can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags + +Example: +$ poktrolld q proof list-proofs --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) +$ poktrolld q proof list-proofs --session-id --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) +$ poktrolld q proof list-proofs --session-end-height --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) +$ poktrolld q proof list-proofs --supplier-address --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + req := &types.QueryAllProofsRequest{ + Pagination: pageReq, + } + if err := updateProofsFilter(cmd, req); err != nil { + return err + } + if err := req.ValidateBasic(); err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.AllProofs(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + AddProofFilterFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowProof() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-proof ", + Short: "shows a specific proof", + Long: `List a specific proof that the node being queried has access to. + +A unique proof can be defined via a session_id that a given supplier participated in. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) q proof show-proofs --node $(POCKET_NODE)`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + sessionId := args[0] + supplierAddr := args[1] + + getProofRequest := &types.QueryGetProofRequest{ + SessionId: sessionId, + SupplierAddress: supplierAddr, + } + if err := getProofRequest.ValidateBasic(); err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Proof(cmd.Context(), getProofRequest) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// updateProofsFilter updates the proofs filter request based on the flags set provided +func updateProofsFilter(cmd *cobra.Command, req *types.QueryAllProofsRequest) error { + sessionId, _ := cmd.Flags().GetString(FlagSessionId) + supplierAddr, _ := cmd.Flags().GetString(FlagSupplierAddress) + sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) + + // Preparing a shared error in case more than one flag was set + err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) + + // Use the session id as the filter + if sessionId != "" { + // If the session id is set, then the other flags must not be set + if supplierAddr != "" || sessionEndHeight > 0 { + return err + } + // Set the session id filter + req.Filter = &types.QueryAllProofsRequest_SessionId{ + SessionId: sessionId, + } + return nil + } + + // Use the supplier address as the filter + if supplierAddr != "" { + // If the supplier address is set, then the other flags must not be set + if sessionId != "" || sessionEndHeight > 0 { + return err + } + // Set the supplier address filter + req.Filter = &types.QueryAllProofsRequest_SupplierAddress{ + SupplierAddress: supplierAddr, + } + return nil + } + + // Use the session end height as the filter + if sessionEndHeight > 0 { + // If the session end height is set, then the other flags must not be set + if sessionId != "" || supplierAddr != "" { + return err + } + // Set the session end height filter + req.Filter = &types.QueryAllProofsRequest_SessionEndHeight{ + SessionEndHeight: sessionEndHeight, + } + return nil + } + + return nil +} diff --git a/x/proof/module/query_proof_test.go b/x/proof/module/query_proof_test.go new file mode 100644 index 000000000..ea348519e --- /dev/null +++ b/x/proof/module/query_proof_test.go @@ -0,0 +1,145 @@ +package proof_test + +// TODO_UPNEXT(@Olshansk): Add these tests back in after merging on-chain Proof persistence. +// Prevent strconv unused error +// var _ = strconv.IntSize + +// func networkWithProofObjects(t *testing.T, n int) (*network.Network, []types.Proof) { +// t.Helper() +// cfg := network.DefaultConfig() +// state := types.GenesisState{} +// for i := 0; i < n; i++ { +// proof := types.Proof{ +// Index: strconv.Itoa(i), + +// } +// nullify.Fill(&proof) +// state.ProofList = append(state.ProofList, proof) +// } +// buf, err := cfg.Codec.MarshalJSON(&state) +// require.NoError(t, err) +// cfg.GenesisState[types.ModuleName] = buf +// return network.New(t, cfg), state.ProofList +// } + +// func TestShowProof(t *testing.T) { +// net, objs := networkWithProofObjects(t, 2) + +// ctx := net.Validators[0].ClientCtx +// common := []string{ +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// } +// tests := []struct { +// desc string +// idIndex string + +// args []string +// err error +// obj types.Proof +// }{ +// { +// desc: "found", +// idIndex: objs[0].Index, + +// args: common, +// obj: objs[0], +// }, +// { +// desc: "not found", +// idIndex: strconv.Itoa(100000), + +// args: common, +// err: status.Error(codes.NotFound, "not found"), +// }, +// } +// for _, tc := range tests { +// t.Run(tc.desc, func(t *testing.T) { +// args := []string{ +// tc.idIndex, + +// } +// args = append(args, tc.args...) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowProof(), args) +// if tc.err != nil { +// stat, ok := status.FromError(tc.err) +// require.True(t, ok) +// require.ErrorIs(t, stat.Err(), tc.err) +// } else { +// require.NoError(t, err) +// var resp types.QueryGetProofResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.NotNil(t, resp.Proof) +// require.Equal(t, +// nullify.Fill(&tc.obj), +// nullify.Fill(&resp.Proof), +// ) +// } +// }) +// } +// } + +// func TestListProof(t *testing.T) { +// net, objs := networkWithProofObjects(t, 5) + +// ctx := net.Validators[0].ClientCtx +// request := func(next []byte, offset, limit uint64, total bool) []string { +// args := []string{ +// fmt.Sprintf("--%s=json", tmcli.OutputFlag), +// } +// if next == nil { +// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) +// } else { +// args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) +// } +// args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) +// if total { +// args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) +// } +// return args +// } +// t.Run("ByOffset", func(t *testing.T) { +// step := 2 +// for i := 0; i < len(objs); i += step { +// args := request(nil, uint64(i), uint64(step), false) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) +// require.NoError(t, err) +// var resp types.QueryAllProofsResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.LessOrEqual(t, len(resp.Proof), step) +// require.Subset(t, +// nullify.Fill(objs), +// nullify.Fill(resp.Proof), +// ) +// } +// }) +// t.Run("ByKey", func(t *testing.T) { +// step := 2 +// var next []byte +// for i := 0; i < len(objs); i += step { +// args := request(next, 0, uint64(step), false) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) +// require.NoError(t, err) +// var resp types.QueryAllProofsResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.LessOrEqual(t, len(resp.Proof), step) +// require.Subset(t, +// nullify.Fill(objs), +// nullify.Fill(resp.Proof), +// ) +// next = resp.Pagination.NextKey +// } +// }) +// t.Run("Total", func(t *testing.T) { +// args := request(nil, 0, uint64(len(objs)), true) +// out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) +// require.NoError(t, err) +// var resp types.QueryAllProofsResponse +// require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) +// require.NoError(t, err) +// require.Equal(t, len(objs), int(resp.Pagination.Total)) +// require.ElementsMatch(t, +// nullify.Fill(objs), +// nullify.Fill(resp.Proof), +// ) +// }) +// } diff --git a/x/proof/module/simulation.go b/x/proof/module/simulation.go new file mode 100644 index 000000000..0458e0998 --- /dev/null +++ b/x/proof/module/simulation.go @@ -0,0 +1,110 @@ +package proof + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + proofsimulation "github.com/pokt-network/poktroll/x/proof/simulation" + "github.com/pokt-network/poktroll/x/proof/types" +) + +// avoid unused import issue +var ( + _ = proofsimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( + opWeightMsgCreateClaim = "op_weight_msg_create_claim" + // TODO: Determine the simulation weight value + defaultWeightMsgCreateClaim int = 100 + + opWeightMsgSubmitProof = "op_weight_msg_submit_proof" + // TODO: Determine the simulation weight value + defaultWeightMsgSubmitProof int = 100 + + // this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + proofGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&proofGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + var weightMsgCreateClaim int + simState.AppParams.GetOrGenerate(opWeightMsgCreateClaim, &weightMsgCreateClaim, nil, + func(_ *rand.Rand) { + weightMsgCreateClaim = defaultWeightMsgCreateClaim + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgCreateClaim, + proofsimulation.SimulateMsgCreateClaim(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgSubmitProof int + simState.AppParams.GetOrGenerate(opWeightMsgSubmitProof, &weightMsgSubmitProof, nil, + func(_ *rand.Rand) { + weightMsgSubmitProof = defaultWeightMsgSubmitProof + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgSubmitProof, + proofsimulation.SimulateMsgSubmitProof(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgCreateClaim, + defaultWeightMsgCreateClaim, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + proofsimulation.SimulateMsgCreateClaim(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + simulation.NewWeightedProposalMsg( + opWeightMsgSubmitProof, + defaultWeightMsgSubmitProof, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + proofsimulation.SimulateMsgSubmitProof(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/proof/module/tx.go b/x/proof/module/tx.go new file mode 100644 index 000000000..fcda0cb76 --- /dev/null +++ b/x/proof/module/tx.go @@ -0,0 +1,27 @@ +package proof + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdCreateClaim()) + cmd.AddCommand(CmdSubmitProof()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/proof/module/tx_create_claim.go b/x/proof/module/tx_create_claim.go new file mode 100644 index 000000000..11963fad7 --- /dev/null +++ b/x/proof/module/tx_create_claim.go @@ -0,0 +1,65 @@ +package proof + +import ( + "encoding/base64" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +// TODO(@bryanchriswhite): Add unit tests for the CLI command when implementing the business logic. + +func CmdCreateClaim() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-claim ", + Short: "Broadcast message create-claim", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + sessionHeaderEncodedStr := args[0] + rootHashEncodedStr := args[1] + + // Get the session header + cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + sessionHeaderBz, err := base64.StdEncoding.DecodeString(sessionHeaderEncodedStr) + if err != nil { + return err + } + sessionHeader := sessiontypes.SessionHeader{} + cdc.MustUnmarshalJSON(sessionHeaderBz, &sessionHeader) + + // Get the root hash + rootHash, err := base64.StdEncoding.DecodeString(rootHashEncodedStr) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + supplierAddress := clientCtx.GetFromAddress().String() + + msg := types.NewMsgCreateClaim( + supplierAddress, + &sessionHeader, + rootHash, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/proof/module/tx_create_claim_test.go b/x/proof/module/tx_create_claim_test.go new file mode 100644 index 000000000..fc74039f4 --- /dev/null +++ b/x/proof/module/tx_create_claim_test.go @@ -0,0 +1,3 @@ +package proof + +// TODO_NEXT(@bryanchriswhite #140): add comprehensive CLI test coverage for creating claims. diff --git a/x/proof/module/tx_submit_proof.go b/x/proof/module/tx_submit_proof.go new file mode 100644 index 000000000..d1b161052 --- /dev/null +++ b/x/proof/module/tx_submit_proof.go @@ -0,0 +1,65 @@ +package proof + +import ( + "encoding/base64" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +// TODO(@bryanchriswhite): Add unit tests for the CLI command when implementing the business logic. + +var _ = strconv.Itoa(0) + +func CmdSubmitProof() *cobra.Command { + cmd := &cobra.Command{ + Use: "submit-proof ", + Short: "Broadcast message submit-proof", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + sessionHeaderEncodedStr := args[0] + smstProofEncodedStr := args[1] + + // Get the session header + sessionHeaderBz, err := base64.StdEncoding.DecodeString(sessionHeaderEncodedStr) + if err != nil { + return err + } + sessionHeader := &sessiontypes.SessionHeader{} + cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + cdc.MustUnmarshalJSON(sessionHeaderBz, sessionHeader) + + smstProof, err := base64.StdEncoding.DecodeString(smstProofEncodedStr) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgSubmitProof( + clientCtx.GetFromAddress().String(), + sessionHeader, + smstProof, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/proof/module/tx_submit_proof_test.go b/x/proof/module/tx_submit_proof_test.go new file mode 100644 index 000000000..75279675c --- /dev/null +++ b/x/proof/module/tx_submit_proof_test.go @@ -0,0 +1,3 @@ +package proof_test + +// TODO_NEXT(@bryanchriswhite #141): add comprehensive CLI test coverage for submitting proofs. diff --git a/x/proof/simulation/create_claim.go b/x/proof/simulation/create_claim.go new file mode 100644 index 000000000..99cc17228 --- /dev/null +++ b/x/proof/simulation/create_claim.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +func SimulateMsgCreateClaim( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgCreateClaim{ + SupplierAddress: simAccount.Address.String(), + } + + // TODO: Handling the CreateClaim simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "CreateClaim simulation not implemented"), nil, nil + } +} diff --git a/x/proof/simulation/helpers.go b/x/proof/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/proof/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/proof/simulation/submit_proof.go b/x/proof/simulation/submit_proof.go new file mode 100644 index 000000000..d30c988de --- /dev/null +++ b/x/proof/simulation/submit_proof.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/proof/keeper" + "github.com/pokt-network/poktroll/x/proof/types" +) + +func SimulateMsgSubmitProof( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgSubmitProof{ + SupplierAddress: simAccount.Address.String(), + } + + // TODO: Handling the SubmitProof simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "SubmitProof simulation not implemented"), nil, nil + } +} diff --git a/x/proof/types/codec.go b/x/proof/types/codec.go new file mode 100644 index 000000000..0aa2c1cd4 --- /dev/null +++ b/x/proof/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateClaim{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitProof{}, + ) + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/proof/types/errors.go b/x/proof/types/errors.go new file mode 100644 index 000000000..65cb135a3 --- /dev/null +++ b/x/proof/types/errors.go @@ -0,0 +1,26 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/proof module sentinel errors +var ( + ErrProofInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") + //ErrProofUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") + ErrProofNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") + //ErrProofInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") + ErrProofInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") + ErrProofInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") + ErrProofInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") + ErrProofInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") + ErrProofInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") + ErrProofInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") + ErrProofClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") + ErrProofProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") + ErrProofInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") + //ErrProofInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") +) diff --git a/x/proof/types/expected_keepers.go b/x/proof/types/expected_keepers.go new file mode 100644 index 000000000..aa5987481 --- /dev/null +++ b/x/proof/types/expected_keepers.go @@ -0,0 +1,33 @@ +//go:generate mockgen -destination=../../../testutil/proof/mocks/expected_keepers_mock.go -package=mocks . SessionKeeper + +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +type SessionKeeper interface { + GetSession(context.Context, *sessiontypes.QueryGetSessionRequest) (*sessiontypes.QueryGetSessionResponse, error) +} + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/proof/types/genesis.go b/x/proof/types/genesis.go new file mode 100644 index 000000000..5b43877a4 --- /dev/null +++ b/x/proof/types/genesis.go @@ -0,0 +1,61 @@ +package types + +import ( + "fmt" +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + ClaimList: []Claim{}, + ProofList: []Proof{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in claim + claimIndexMap := make(map[string]struct{}) + + // Ensure claims are unique with respect to a given session ID and supplier address. + for _, claim := range gs.ClaimList { + // TODO_BLOCKER: ensure the corresponding supplier exists and is staked. + + if claim.GetRootHash() == nil { + return fmt.Errorf("root hash cannot be nil") + } + + if len(claim.GetRootHash()) == 0 { + return fmt.Errorf("root hash cannot be empty") + } + + sessionId := claim.GetSessionHeader().GetSessionId() + primaryKey := string(ClaimPrimaryKey(sessionId, claim.SupplierAddress)) + if _, ok := claimIndexMap[primaryKey]; ok { + return fmt.Errorf("duplicated supplierAddr for claim") + } + claimIndexMap[primaryKey] = struct{}{} + } + // Check for duplicated index in proof + proofIndexMap := make(map[string]struct{}) + + for _, proof := range gs.ProofList { + primaryKey := string(ProofPrimaryKey( + proof.GetSessionHeader().GetSessionId(), + proof.GetSupplierAddress(), + )) + if _, ok := proofIndexMap[primaryKey]; ok { + return fmt.Errorf("duplicated primaryKey for proof") + } + proofIndexMap[primaryKey] = struct{}{} + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/proof/types/genesis_test.go b/x/proof/types/genesis_test.go new file mode 100644 index 000000000..14171bd92 --- /dev/null +++ b/x/proof/types/genesis_test.go @@ -0,0 +1,139 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +func TestGenesisState_Validate(t *testing.T) { + randSupplierAddr := sample.AccAddress() + mockSessionId := "mock_session_id" + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + ClaimList: []types.Claim{ + { + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionId: mockSessionId, + ApplicationAddress: sample.AccAddress(), + }, + RootHash: []byte{1, 2, 3}, + }, + }, + // TODO_BLOCKER: finish genesis proof list validation. + //ProofList: []types.Proof{ + // { + // SupplierAddress: sample.AccAddress(), + // SessionHeader: &sessiontypes.SessionHeader{ + // SessionId: mockSessionId, + // ApplicationAddress: sample.AccAddress(), + // }, + // ClosestMerkleProof: validMerkleProof, + // }, + //}, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "duplicated claim", + genState: &types.GenesisState{ + ClaimList: []types.Claim{ + { + SupplierAddress: randSupplierAddr, + SessionHeader: &sessiontypes.SessionHeader{ + SessionId: mockSessionId, + ApplicationAddress: sample.AccAddress(), + }, + RootHash: []byte{1, 2, 3}, + }, + { + SupplierAddress: randSupplierAddr, + SessionHeader: &sessiontypes.SessionHeader{ + SessionId: mockSessionId, + ApplicationAddress: sample.AccAddress(), + }, + RootHash: []byte{1, 2, 3}, + }, + }, + }, + valid: false, + }, + { + desc: "empty root hash", + genState: &types.GenesisState{ + ClaimList: []types.Claim{ + { + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionId: mockSessionId, + ApplicationAddress: sample.AccAddress(), + }, + RootHash: []byte{}, + }, + }, + }, + valid: false, + }, + { + desc: "nil root hash", + genState: &types.GenesisState{ + ClaimList: []types.Claim{ + { + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionId: mockSessionId, + ApplicationAddress: sample.AccAddress(), + }, + RootHash: nil, + }, + }, + }, + valid: false, + }, + // TODO_BLOCKER: finish genesis proof list validation. + //{ + // desc: "duplicated proof", + // genState: &types.GenesisState{ + // ProofList: []types.Proof{ + // { + // Index: "0", + // }, + // { + // Index: "0", + // }, + // }, + // }, + // valid: false, + //}, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/proof/types/key_claim.go b/x/proof/types/key_claim.go new file mode 100644 index 000000000..ea1284870 --- /dev/null +++ b/x/proof/types/key_claim.go @@ -0,0 +1,36 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // ClaimPrimaryKeyPrefix is the prefix to retrieve the entire Claim object (the primary store) + ClaimPrimaryKeyPrefix = "Claim/value/" + + // ClaimSupplierAddressPrefix is the key to retrieve a Claim's Primary Key from the Address index + ClaimSupplierAddressPrefix = "Claim/address/" + + // ClaimSessionEndHeightPrefix is the key to retrieve a Claim's Primary Key from the Height index + ClaimSessionEndHeightPrefix = "Claim/height/" +) + +// ClaimPrimaryKey returns the primary store key used to retrieve a Claim by creating a composite key of the sessionId and supplierAddr. +func ClaimPrimaryKey(sessionId, supplierAddr string) []byte { + // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr) + // because every supplier can only have one claim per session. + return KeyComposite([]byte(sessionId), []byte(supplierAddr)) +} + +// ClaimSupplierAddressKey returns the key used to iterate through claims given a supplier Address. +func ClaimSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { + return KeyComposite([]byte(supplierAddr), primaryKey) +} + +// ClaimSupplierEndSessionHeightKey returns the key used to iterate through claims given a session end height. +func ClaimSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { + heightBz := make([]byte, 8) + binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) + + return KeyComposite(heightBz, primaryKey) +} diff --git a/x/proof/types/key_proof.go b/x/proof/types/key_proof.go new file mode 100644 index 000000000..f74bb7fa9 --- /dev/null +++ b/x/proof/types/key_proof.go @@ -0,0 +1,36 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // ProofPrimaryKeyPrefix is the prefix to retrieve the entire Proof object (the primary store) + ProofPrimaryKeyPrefix = "Proof/value/" + + // ProofSupplierAddressPrefix is the key to retrieve a Proof's Primary Key from the Address index + ProofSupplierAddressPrefix = "Proof/address/" + + // ProofSessionEndHeightPrefix is the key to retrieve a Proof's Primary Key from the Height index + ProofSessionEndHeightPrefix = "Proof/height/" +) + +// ProofPrimaryKey returns the primary store key used to retrieve a Proof by creating a composite key of the sessionId and supplierAddr. +func ProofPrimaryKey(sessionId, supplierAddr string) []byte { + // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr). + // because every supplier can only have one Proof per session. + return KeyComposite([]byte(sessionId), []byte(supplierAddr)) +} + +// ProofSupplierAddressKey returns the key used to iterate through Proofs given a supplier Address. +func ProofSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { + return KeyComposite([]byte(supplierAddr), primaryKey) +} + +// ProofSupplierEndSessionHeightKey returns the key used to iterate through Proofs given a session end height. +func ProofSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { + heightBz := make([]byte, 8) + binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) + + return KeyComposite(heightBz, primaryKey) +} diff --git a/x/proof/types/keys.go b/x/proof/types/keys.go new file mode 100644 index 000000000..71b5cd1ef --- /dev/null +++ b/x/proof/types/keys.go @@ -0,0 +1,29 @@ +package types + +import "bytes" + +const ( + // ModuleName defines the module name + ModuleName = "proof" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_proof" +) + +var ( + ParamsKey = []byte("p_proof") + // KeyDelimiter is the delimiter for composite keys. + KeyDelimiter = []byte("/") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} + +// KeyComposite combines the given keys into a single key for use with KVStore. +func KeyComposite(keys ...[]byte) []byte { + return bytes.Join(keys, KeyDelimiter) +} diff --git a/x/proof/types/message_create_claim.go b/x/proof/types/message_create_claim.go new file mode 100644 index 000000000..beb5b9c07 --- /dev/null +++ b/x/proof/types/message_create_claim.go @@ -0,0 +1,52 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" +) + +const TypeMsgCreateClaim = "create_claim" + +var _ sdk.Msg = &MsgCreateClaim{} + +func NewMsgCreateClaim( + supplierAddress string, + sessionHeader *sessiontypes.SessionHeader, + rootHash []byte, +) *MsgCreateClaim { + return &MsgCreateClaim{ + SupplierAddress: supplierAddress, + SessionHeader: sessionHeader, + RootHash: rootHash, + } +} + +func (msg *MsgCreateClaim) ValidateBasic() error { + // Validate the supplier address + _, err := sdk.AccAddressFromBech32(msg.GetSupplierAddress()) + if err != nil { + return ErrProofInvalidAddress.Wrapf("%s", msg.GetSupplierAddress()) + } + + // Validate the session header + sessionHeader := msg.SessionHeader + if sessionHeader.SessionStartBlockHeight < 0 { + return ErrProofInvalidSessionStartHeight.Wrapf("%d", sessionHeader.SessionStartBlockHeight) + } + if len(sessionHeader.SessionId) == 0 { + return ErrProofInvalidSessionId.Wrapf("%s", sessionHeader.SessionId) + } + if !sharedhelpers.IsValidService(sessionHeader.Service) { + return ErrProofInvalidService.Wrapf("%v", sessionHeader.Service) + } + + // Validate the root hash + // TODO_IMPROVE: Only checking to make sure a non-nil hash was provided for now, but we can validate the length as well. + if len(msg.RootHash) == 0 { + return ErrProofInvalidClaimRootHash.Wrapf("%v", msg.RootHash) + } + + return nil +} diff --git a/x/proof/types/message_create_claim_test.go b/x/proof/types/message_create_claim_test.go new file mode 100644 index 000000000..9ab74aa5c --- /dev/null +++ b/x/proof/types/message_create_claim_test.go @@ -0,0 +1,109 @@ +package types + +import ( + "testing" + + "github.com/pokt-network/poktroll/testutil/sample" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "github.com/stretchr/testify/require" +) + +func TestMsgCreateClaim_ValidateBasic(t *testing.T) { + tests := []struct { + desc string + + msg MsgCreateClaim + err error + }{ + { + desc: "invalid address", + + msg: MsgCreateClaim{ + SupplierAddress: "invalid_address", + }, + err: ErrProofInvalidAddress, + }, + { + desc: "valid address but invalid session start height", + + msg: MsgCreateClaim{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionStartBlockHeight: -1, // Invalid start height + }, + }, + err: ErrProofInvalidSessionStartHeight, + }, + { + desc: "valid address and session start height but invalid session ID", + + msg: MsgCreateClaim{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionStartBlockHeight: 100, + SessionId: "", // Invalid session ID + }, + }, + err: ErrProofInvalidSessionId, + }, + { + desc: "valid address, session start height, session ID but invalid service", + + msg: MsgCreateClaim{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionStartBlockHeight: 100, + SessionId: "valid_session_id", + Service: &sharedtypes.Service{ + Id: "invalid_service_id", // Assuming this ID is invalid + }, // Should trigger error + }, + }, + err: ErrProofInvalidService, + }, + { + desc: "valid address, session start height, session ID, service but invalid root hash", + + msg: MsgCreateClaim{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionStartBlockHeight: 100, + SessionId: "valid_session_id", + Service: &sharedtypes.Service{ + Id: "svcId", // Assuming this ID is valid + }, + }, + RootHash: []byte(""), // Invalid root hash + }, + err: ErrProofInvalidClaimRootHash, + }, + { + desc: "all valid inputs", + + msg: MsgCreateClaim{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + SessionStartBlockHeight: 100, + SessionId: "valid_session_id", + Service: &sharedtypes.Service{ + Id: "svcId", // Assuming this ID is valid + }, + }, + RootHash: []byte("valid_root_hash"), // Assuming this is valid + }, + err: nil, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/proof/types/message_submit_proof.go b/x/proof/types/message_submit_proof.go new file mode 100644 index 000000000..6e587293c --- /dev/null +++ b/x/proof/types/message_submit_proof.go @@ -0,0 +1,50 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +var _ sdk.Msg = &MsgSubmitProof{} + +func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.SessionHeader, proof []byte) *MsgSubmitProof { + return &MsgSubmitProof{ + SupplierAddress: supplierAddress, + SessionHeader: sessionHeader, + Proof: proof, + } +} + +func (msg *MsgSubmitProof) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.GetSupplierAddress()) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf( + "supplier address %q, error: %s", + msg.GetSupplierAddress(), + err, + ) + } + + _, err = sdk.AccAddressFromBech32(msg.GetSessionHeader().GetApplicationAddress()) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf( + "application address: %q, error: %s", + msg.GetSessionHeader().GetApplicationAddress(), + err, + ) + } + + if msg.GetSessionHeader().GetService().GetId() == "" { + return ErrProofInvalidService.Wrap("proof service ID %q cannot be empty") + } + + if len(msg.GetProof()) == 0 { + return ErrProofInvalidProof.Wrap("proof cannot be empty") + } + + // TODO_BLOCKER: attempt to deserialize the proof for additional validation. + + return nil +} diff --git a/x/proof/types/message_submit_proof_test.go b/x/proof/types/message_submit_proof_test.go new file mode 100644 index 000000000..af803155c --- /dev/null +++ b/x/proof/types/message_submit_proof_test.go @@ -0,0 +1,103 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/pokt-network/poktroll/testutil/sample" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "github.com/stretchr/testify/require" +) + +func TestMsgSubmitProof_ValidateBasic(t *testing.T) { + testService := &sharedtypes.Service{Id: "svc01"} + testClosestMerkleProof := []byte{1, 2, 3, 4} + + tests := []struct { + desc string + msg MsgSubmitProof + expectedErr error + }{ + { + desc: "application bech32 address is invalid", + msg: MsgSubmitProof{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: "not_a_bech32_address", + Service: testService, + SessionStartBlockHeight: 0, + SessionId: "mock_session_id", + SessionEndBlockHeight: 5, + }, + Proof: testClosestMerkleProof, + }, + expectedErr: sdkerrors.ErrInvalidAddress.Wrapf( + "application address: %q, error: %s", + "not_a_bech32_address", + "decoding bech32 failed: invalid separator index -1", + ), + }, + { + desc: "supplier bech32 address is invalid", + msg: MsgSubmitProof{ + SupplierAddress: "not_a_bech32_address", + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: sample.AccAddress(), + Service: testService, + SessionStartBlockHeight: 0, + SessionId: "mock_session_id", + SessionEndBlockHeight: 5, + }, + Proof: testClosestMerkleProof, + }, + expectedErr: sdkerrors.ErrInvalidAddress.Wrapf( + "supplier address %q, error: %s", + "not_a_bech32_address", + "decoding bech32 failed: invalid separator index -1", + ), + }, + { + desc: "session service ID is empty", + msg: MsgSubmitProof{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: sample.AccAddress(), + Service: &sharedtypes.Service{Id: ""}, + SessionStartBlockHeight: 0, + SessionId: "mock_session_id", + SessionEndBlockHeight: 5, + }, + Proof: testClosestMerkleProof, + }, + expectedErr: ErrProofInvalidService.Wrap("proof service ID %q cannot be empty"), + }, + { + desc: "valid message metadata", + msg: MsgSubmitProof{ + SupplierAddress: sample.AccAddress(), + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: sample.AccAddress(), + Service: testService, + SessionId: "mock_session_id", + SessionStartBlockHeight: 0, + SessionEndBlockHeight: 5, + }, + Proof: testClosestMerkleProof, + }, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.expectedErr != nil { + require.ErrorIs(t, err, tt.expectedErr) + require.ErrorContains(t, err, tt.expectedErr.Error()) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/proof/types/msg_update_params.go b/x/proof/types/msg_update_params.go new file mode 100644 index 000000000..e36d023de --- /dev/null +++ b/x/proof/types/msg_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/proof/types/params.go b/x/proof/types/params.go new file mode 100644 index 000000000..4f3215e35 --- /dev/null +++ b/x/proof/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/proof/types/query_validation.go b/x/proof/types/query_validation.go new file mode 100644 index 000000000..1b433e839 --- /dev/null +++ b/x/proof/types/query_validation.go @@ -0,0 +1,94 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// NOTE: Please note that these messages are not of type `sdk.Msg`, and are therefore not a message/request +// that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern +// allows us to localize & reuse validation logic. + +// ValidateBasic performs basic (non-state-dependant) validation on a QueryGetClaimRequest. +func (query *QueryGetClaimRequest) ValidateBasic() error { + // Validate the supplier address + if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { + return ErrProofInvalidAddress.Wrapf("invalid supplier address for claim being retrieved %s; (%v)", query.SupplierAddress, err) + } + + // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it + if query.SessionId == "" { + return ErrProofInvalidSessionId.Wrapf("invalid session ID for claim being retrieved %s", query.SessionId) + } + + return nil +} + +// ValidateBasic performs basic (non-state-dependant) validation on a QueryAllClaimsRequest. +func (query *QueryAllClaimsRequest) ValidateBasic() error { + logger := polylog.Ctx(context.Background()) + + switch filter := query.Filter.(type) { + case *QueryAllClaimsRequest_SupplierAddress: + if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { + return ErrProofInvalidAddress.Wrapf("invalid supplier address for claims being retrieved %s; (%v)", filter.SupplierAddress, err) + } + + case *QueryAllClaimsRequest_SessionId: + logger.Warn(). + Str("session_id", filter.SessionId). + Msg("TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it") + + case *QueryAllClaimsRequest_SessionEndHeight: + if filter.SessionEndHeight < 0 { + return ErrProofInvalidSessionEndHeight.Wrapf("invalid session end height for claims being retrieved %d", filter.SessionEndHeight) + } + } + + return nil +} + +func (query *QueryGetProofRequest) ValidateBasic() error { + // Validate the supplier address + if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { + return ErrProofInvalidAddress.Wrapf("invalid supplier address for proof being retrieved %s; (%v)", query.SupplierAddress, err) + } + + // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it + if query.SessionId == "" { + return ErrProofInvalidSessionId.Wrapf("invalid session ID for proof being retrieved %s", query.SessionId) + } + + return nil +} + +func (query *QueryAllProofsRequest) ValidateBasic() error { + // TODO_TECHDEBT: update function signature to receive a context. + logger := polylog.Ctx(context.TODO()) + + switch filter := query.Filter.(type) { + case *QueryAllProofsRequest_SupplierAddress: + if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { + return ErrProofInvalidAddress.Wrapf("invalid supplier address for proofs being retrieved %s; (%v)", filter.SupplierAddress, err) + } + + case *QueryAllProofsRequest_SessionId: + logger.Warn(). + Str("session_id", filter.SessionId). + Msg("TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it") + + case *QueryAllProofsRequest_SessionEndHeight: + if filter.SessionEndHeight < 0 { + return ErrProofInvalidSessionEndHeight.Wrapf("invalid session end height for proofs being retrieved %d", filter.SessionEndHeight) + } + + default: + // No filter is set + logger.Debug().Msg("No specific filter set when requesting proofs") + } + + return nil +} diff --git a/x/proof/types/types.go b/x/proof/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/proof/types/types.go @@ -0,0 +1 @@ +package types diff --git a/x/service/keeper/keeper.go b/x/service/keeper/keeper.go new file mode 100644 index 000000000..445e73e0f --- /dev/null +++ b/x/service/keeper/keeper.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/service/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + bankKeeper types.BankKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + bankKeeper: bankKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/service/keeper/msg_server.go b/x/service/keeper/msg_server.go new file mode 100644 index 000000000..e5f891b01 --- /dev/null +++ b/x/service/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/service/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go new file mode 100644 index 000000000..0b3c9c718 --- /dev/null +++ b/x/service/keeper/msg_server_add_service.go @@ -0,0 +1,86 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/service/types" +) + +// AddService handles MsgAddService and adds a service to the network storing +// it in the service keeper's store using the provided ID from the message. +// If the transaction's signer does not have enough funds (upokt) to cover the +// AddServiceFee service module's governance parameter, it will not be able to +// add the service. If it does, the fee will be deducted and debited to the +// service module's account, then the service will be added on-chain. +func (k msgServer) AddService( + goCtx context.Context, + msg *types.MsgAddService, +) (*types.MsgAddServiceResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "AddService") + logger.Info(fmt.Sprintf("About to add a new service with msg: %v", msg)) + + // Validate the message. + if err := msg.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("Adding service failed basic validation: %v", err)) + return nil, err + } + + // Check if the service already exists or not. + if _, found := k.GetService(ctx, msg.Service.Id); found { + logger.Error(fmt.Sprintf("Service already exists: %v", msg.Service)) + return nil, types.ErrServiceAlreadyExists.Wrapf( + "duplicate service ID: %s", msg.Service.Id, + ) + } + + // Retrieve the address of the actor adding the service. + accAddr, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, types.ErrServiceInvalidAddress.Wrapf( + "%s is not in Bech32 format", msg.Address, + ) + } + + // Check the actor has sufficient funds to pay for the add service fee. + accCoins := k.bankKeeper.SpendableCoins(ctx, accAddr) + if accCoins.Len() == 0 { + logger.Error(fmt.Sprintf("%s doesn't have any funds to add service: %v", msg.Address, err)) + return nil, types.ErrServiceNotEnoughFunds.Wrapf( + "account has no spendable coins", + ) + } + + // Check the balance of upokt is enough to cover the AddServiceFee. + accBalance := accCoins.AmountOf("upokt") + addServiceFee := math.NewIntFromUint64(k.GetParams(ctx).AddServiceFee) + if accBalance.LTE(addServiceFee) { + logger.Error(fmt.Sprintf("%s doesn't have enough funds to add service: %v", msg.Address, err)) + return nil, types.ErrServiceNotEnoughFunds.Wrapf( + "account has %d uPOKT, but the service fee is %d uPOKT", + accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, + ) + } + + // Deduct the service fee from the actor's balance. + serviceFee := sdk.Coins{sdk.NewCoin("upokt", addServiceFee)} + err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, accAddr, types.ModuleName, serviceFee) + if err != nil { + logger.Error(fmt.Sprintf("Failed to deduct service fee from actor's balance: %v", err)) + return nil, types.ErrServiceFailedToDeductFee.Wrapf( + "account has %d uPOKT, failed to deduct %d uPOKT", + accBalance.Uint64(), k.GetParams(ctx).AddServiceFee, + ) + } + + logger.Info(fmt.Sprintf("Adding service: %v", msg.Service)) + k.SetService(ctx, msg.Service) + + return &types.MsgAddServiceResponse{}, nil +} diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go new file mode 100644 index 000000000..d1bfbfedd --- /dev/null +++ b/x/service/keeper/msg_server_add_service_test.go @@ -0,0 +1,197 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// oneUPOKTGreaterThanFee is 1 upokt more than the AddServiceFee +const oneUPOKTGreaterThanFee = types.DefaultAddServiceFee + 1 + +func TestMsgServer_AddService(t *testing.T) { + k, ctx := keepertest.ServiceKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Create a service + svc1 := sharedtypes.Service{ + Id: "svc1", + Name: "service 1", + } + + // Generate a valid address + addr := sample.AccAddress() + // Create a service + preExistingService := sharedtypes.Service{ + Id: "svc2", + Name: "service 2", + } + // Mock adding a balance to the account + keepertest.AddAccToAccMapCoins(t, addr, "upokt", oneUPOKTGreaterThanFee) + // Add the service to the store + _, err := srv.AddService(ctx, &types.MsgAddService{ + Address: addr, + Service: preExistingService, + }) + require.NoError(t, err) + // Validate the service was added + serviceFound, found := k.GetService(ctx, preExistingService.Id) + require.True(t, found) + require.Equal(t, preExistingService, serviceFound) + + validAddr1 := sample.AccAddress() + validAddr2 := sample.AccAddress() + + tests := []struct { + desc string + setup func(t *testing.T) + address string + service sharedtypes.Service + expectedError error + }{ + { + desc: "valid - service added successfully", + setup: func(t *testing.T) { + // Add 10000000001 upokt to the account + keepertest.AddAccToAccMapCoins(t, validAddr1, "upokt", oneUPOKTGreaterThanFee) + }, + address: validAddr1, + service: svc1, + expectedError: nil, + }, + { + desc: "invalid - service supplier address is empty", + setup: func(t *testing.T) {}, + address: "", // explicitly set to empty string + service: sharedtypes.Service{ + Id: "svc1", + Name: "service 1", + }, + expectedError: types.ErrServiceInvalidAddress, + }, + { + desc: "invalid - invalid service supplier address", + setup: func(t *testing.T) {}, + address: "invalid address", + service: svc1, + expectedError: types.ErrServiceInvalidAddress, + }, + { + desc: "invalid - missing service ID", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: sharedtypes.Service{ + // Explicitly omitting Id field + Name: "service 1", + }, + expectedError: types.ErrServiceMissingID, + }, + { + desc: "invalid - empty service ID", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: sharedtypes.Service{ + Id: "", // explicitly set to empty string + Name: "service 1", + }, + expectedError: types.ErrServiceMissingID, + }, + { + desc: "invalid - missing service name", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: sharedtypes.Service{ + Id: "svc1", + // Explicitly omitting Name field + }, + expectedError: types.ErrServiceMissingName, + }, + { + desc: "invalid - empty service name", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: sharedtypes.Service{ + Id: "svc1", + Name: "", // explicitly set to empty string + }, + expectedError: types.ErrServiceMissingName, + }, + { + desc: "invalid - service already exists (same service supplier)", + setup: func(t *testing.T) {}, + address: addr, + service: preExistingService, + expectedError: types.ErrServiceAlreadyExists, + }, + { + desc: "invalid - service already exists (different service supplier)", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: preExistingService, + expectedError: types.ErrServiceAlreadyExists, + }, + { + desc: "invalid - no spendable coins", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: svc1, + expectedError: types.ErrServiceNotEnoughFunds, + }, + { + desc: "invalid - insufficient upokt balance", + setup: func(t *testing.T) { + // Add 999999999 upokt to the account (one less than AddServiceFee) + keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", oneUPOKTGreaterThanFee-2) + }, + address: validAddr2, + service: svc1, + expectedError: types.ErrServiceNotEnoughFunds, + }, + { + desc: "invalid - account has exactly AddServiceFee", + setup: func(t *testing.T) { + // Add the exact fee in upokt to the account + keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", types.DefaultAddServiceFee) + }, + address: validAddr2, + service: svc1, + expectedError: types.ErrServiceNotEnoughFunds, + }, + { + desc: "invalid - sufficient balance of different denom", + setup: func(t *testing.T) { + // Adds 10000000001 wrong coins to the account + keepertest.AddAccToAccMapCoins(t, validAddr2, "wrong", oneUPOKTGreaterThanFee) + }, + address: validAddr2, + service: svc1, + expectedError: types.ErrServiceNotEnoughFunds, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + tt.setup(t) + _, err := srv.AddService(ctx, &types.MsgAddService{ + Address: tt.address, + Service: tt.service, + }) + if tt.expectedError != nil { + // Using ErrorAs as wrapping the error sometimes gives errors with ErrorIs + require.ErrorAs(t, err, &tt.expectedError) + return + } + require.NoError(t, err) + // Validate the service was added + serviceFound, found := k.GetService(ctx, tt.service.Id) + require.True(t, found) + require.Equal(t, tt.service, serviceFound) + }) + } +} diff --git a/x/service/keeper/msg_server_test.go b/x/service/keeper/msg_server_test.go new file mode 100644 index 000000000..a2aed4881 --- /dev/null +++ b/x/service/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.ServiceKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/service/keeper/msg_update_params.go b/x/service/keeper/msg_update_params.go new file mode 100644 index 000000000..e7fc8cc1f --- /dev/null +++ b/x/service/keeper/msg_update_params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/service/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/service/keeper/msg_update_params_test.go b/x/service/keeper/msg_update_params_test.go new file mode 100644 index 000000000..b9cc12a59 --- /dev/null +++ b/x/service/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/service/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/service/keeper/params.go b/x/service/keeper/params.go new file mode 100644 index 000000000..e980f9ec4 --- /dev/null +++ b/x/service/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/service/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/service/keeper/params_test.go b/x/service/keeper/params_test.go new file mode 100644 index 000000000..2c7100aef --- /dev/null +++ b/x/service/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := keepertest.ServiceKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/service/keeper/query.go b/x/service/keeper/query.go new file mode 100644 index 000000000..ac3116f9a --- /dev/null +++ b/x/service/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/service/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/service/keeper/query_params.go b/x/service/keeper/query_params.go new file mode 100644 index 000000000..c04f32dd9 --- /dev/null +++ b/x/service/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/service/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/service/keeper/query_params_test.go b/x/service/keeper/query_params_test.go new file mode 100644 index 000000000..96325f611 --- /dev/null +++ b/x/service/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/service/keeper/query_service.go b/x/service/keeper/query_service.go new file mode 100644 index 000000000..d308e0038 --- /dev/null +++ b/x/service/keeper/query_service.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// ServiceAll queries all services. +func (k Keeper) ServiceAll(ctx context.Context, req *types.QueryAllServiceRequest) (*types.QueryAllServiceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var services []sharedtypes.Service + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + serviceStore := prefix.NewStore(store, types.KeyPrefix(types.ServiceKeyPrefix)) + + pageRes, err := query.Paginate(serviceStore, req.Pagination, func(key []byte, value []byte) error { + var service sharedtypes.Service + if err := k.cdc.Unmarshal(value, &service); err != nil { + return err + } + + services = append(services, service) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllServiceResponse{Service: services, Pagination: pageRes}, nil +} + +// Service returns the requested service if it exists. +func (k Keeper) Service(ctx context.Context, req *types.QueryGetServiceRequest) (*types.QueryGetServiceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + service, found := k.GetService( + ctx, + req.Index, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetServiceResponse{Service: service}, nil +} diff --git a/x/service/keeper/query_service_test.go b/x/service/keeper/query_service_test.go new file mode 100644 index 000000000..50ba3117c --- /dev/null +++ b/x/service/keeper/query_service_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/service/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestServiceQuerySingle(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + msgs := createNService(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetServiceRequest + response *types.QueryGetServiceResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetServiceRequest{ + Index: msgs[0].Id, + }, + response: &types.QueryGetServiceResponse{Service: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetServiceRequest{ + Index: msgs[1].Id, + }, + response: &types.QueryGetServiceResponse{Service: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetServiceRequest{ + Index: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Service(ctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestServiceQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + msgs := createNService(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllServiceRequest { + return &types.QueryAllServiceRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.ServiceAll(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Service), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Service), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.ServiceAll(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Service), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Service), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.ServiceAll(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Service), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.ServiceAll(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/service/keeper/service.go b/x/service/keeper/service.go new file mode 100644 index 000000000..38c5b9a96 --- /dev/null +++ b/x/service/keeper/service.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// SetService set a specific service in the store from its index +func (k Keeper) SetService(ctx context.Context, service sharedtypes.Service) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) + serviceBz := k.cdc.MustMarshal(&service) + store.Set(types.ServiceKey( + service.Id, + ), serviceBz) +} + +// GetService returns a service from its index +func (k Keeper) GetService( + ctx context.Context, + serviceId string, +) (service sharedtypes.Service, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) + + serviceBz := store.Get(types.ServiceKey( + serviceId, + )) + if serviceBz == nil { + return service, false + } + + k.cdc.MustUnmarshal(serviceBz, &service) + return service, true +} + +// RemoveService removes a service from the store +func (k Keeper) RemoveService( + ctx context.Context, + serviceId string, +) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) + store.Delete(types.ServiceKey( + serviceId, + )) +} + +// GetAllService returns all service +func (k Keeper) GetAllService(ctx context.Context) (services []sharedtypes.Service) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var service sharedtypes.Service + k.cdc.MustUnmarshal(iterator.Value(), &service) + services = append(services, service) + } + + return +} diff --git a/x/service/keeper/service_test.go b/x/service/keeper/service_test.go new file mode 100644 index 000000000..231f8c151 --- /dev/null +++ b/x/service/keeper/service_test.go @@ -0,0 +1,79 @@ +package keeper_test + +import ( + "context" + "fmt" + "strconv" + "testing" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func init() { + cmd.InitSDKConfig() +} + +func createNService(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Service { + services := make([]sharedtypes.Service, n) + for i := range services { + services[i].Id = strconv.Itoa(i) + services[i].Name = fmt.Sprintf("svcName%d", i) + + keeper.SetService(ctx, services[i]) + } + return services +} + +func TestServiceModuleAddress(t *testing.T) { + moduleAddress := authtypes.NewModuleAddress(types.ModuleName) + require.Equal(t, "pokt1nhmtqf4gcmpxu0p6e53hpgtwj0llmsqpxtumcf", moduleAddress.String()) +} + +func TestServiceGet(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + services := createNService(keeper, ctx, 10) + for _, service := range services { + foundService, found := keeper.GetService(ctx, + service.Id, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&service), + nullify.Fill(&foundService), + ) + } +} +func TestServiceRemove(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + services := createNService(keeper, ctx, 10) + for _, service := range services { + keeper.RemoveService(ctx, + service.Id, + ) + _, found := keeper.GetService(ctx, + service.Id, + ) + require.False(t, found) + } +} + +func TestServiceGetAll(t *testing.T) { + keeper, ctx := keepertest.ServiceKeeper(t) + services := createNService(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(services), + nullify.Fill(keeper.GetAllService(ctx)), + ) +} diff --git a/x/service/module/autocli.go b/x/service/module/autocli.go new file mode 100644 index 000000000..cb9fa8e88 --- /dev/null +++ b/x/service/module/autocli.go @@ -0,0 +1,51 @@ +package service + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + // TODO_TECHDEBT(#370): Integrate with AutoCLI + // Query: &autocliv1.ServiceCommandDescriptor{ + // Service: modulev1.Query_ServiceDesc.ServiceName, + // RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "ServiceAll", + // Use: "list-service", + // Short: "List all service", + // }, + // { + // RpcMethod: "Service", + // Use: "show-service [id]", + // Short: "Shows a service", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + // }, + // // this line is used by ignite scaffolding # autocli/query + // }, + // }, + // Tx: &autocliv1.ServiceCommandDescriptor{ + // Service: modulev1.Msg_ServiceDesc.ServiceName, + // EnhanceCustomCommand: true, // only required if you want to use the custom command + // RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "AddService", + // Use: "add-service", + // Short: "Send a add-service tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + // }, + // // this line is used by ignite scaffolding # autocli/tx + // }, + // }, + } +} diff --git a/x/service/module/genesis.go b/x/service/module/genesis.go new file mode 100644 index 000000000..d3bdb9acd --- /dev/null +++ b/x/service/module/genesis.go @@ -0,0 +1,29 @@ +package service + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the service + for _, service := range genState.ServiceList { + k.SetService(ctx, service) + } + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.ServiceList = k.GetAllService(ctx) + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/service/module/genesis_test.go b/x/service/module/genesis_test.go new file mode 100644 index 000000000..c95032594 --- /dev/null +++ b/x/service/module/genesis_test.go @@ -0,0 +1,42 @@ +package service_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + service "github.com/pokt-network/poktroll/x/service/module" + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + ServiceList: []sharedtypes.Service{ + { + Id: "svc1", + Name: "service one", + }, + { + Id: "svc2", + Name: "service two", + }, + }, + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.ServiceKeeper(t) + service.InitGenesis(ctx, k, genesisState) + got := service.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.ServiceList, got.ServiceList) + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/service/module/module.go b/x/service/module/module.go new file mode 100644 index 000000000..6a733dd22 --- /dev/null +++ b/x/service/module/module.go @@ -0,0 +1,215 @@ +package service + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/service/module" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper +} + +type ModuleOutputs struct { + depinject.Out + + ServiceKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{ServiceKeeper: k, Module: m} +} diff --git a/x/service/module/simulation.go b/x/service/module/simulation.go new file mode 100644 index 000000000..3547838be --- /dev/null +++ b/x/service/module/simulation.go @@ -0,0 +1,87 @@ +package service + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + servicesimulation "github.com/pokt-network/poktroll/x/service/simulation" + "github.com/pokt-network/poktroll/x/service/types" +) + +// avoid unused import issue +var ( + _ = servicesimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( + opWeightMsgAddService = "op_weight_msg_add_service" + // TODO: Determine the simulation weight value + defaultWeightMsgAddService int = 100 + + // this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + serviceGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&serviceGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + var weightMsgAddService int + simState.AppParams.GetOrGenerate(opWeightMsgAddService, &weightMsgAddService, nil, + func(_ *rand.Rand) { + weightMsgAddService = defaultWeightMsgAddService + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgAddService, + servicesimulation.SimulateMsgAddService(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgAddService, + defaultWeightMsgAddService, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + servicesimulation.SimulateMsgAddService(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/service/module/tx.go b/x/service/module/tx.go new file mode 100644 index 000000000..ccbad12ed --- /dev/null +++ b/x/service/module/tx.go @@ -0,0 +1,36 @@ +package service + +import ( + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/service/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdAddService()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/service/module/tx_add_service.go b/x/service/module/tx_add_service.go new file mode 100644 index 000000000..5676fc440 --- /dev/null +++ b/x/service/module/tx_add_service.go @@ -0,0 +1,51 @@ +package service + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/service/types" +) + +var _ = strconv.Itoa(0) + +func CmdAddService() *cobra.Command { + cmd := &cobra.Command{ + Use: "add-service ", + Short: "Add a new service to the network", + Long: `Add a new service to the network that will be available for applications, +gateways and suppliers to use. The service id MUST be unique - or the command +will fail, however the name you use to describe it does not have to be unique. + +Example: +$ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + serviceIdStr := args[0] + serviceNameStr := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgAddService( + clientCtx.GetFromAddress().String(), + serviceIdStr, + serviceNameStr, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/service/module/tx_add_service_test.go b/x/service/module/tx_add_service_test.go new file mode 100644 index 000000000..9a1bc3ace --- /dev/null +++ b/x/service/module/tx_add_service_test.go @@ -0,0 +1,144 @@ +package service_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + service "github.com/pokt-network/poktroll/x/service/module" + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestCLI_AddService(t *testing.T) { + net := network.New(t, network.DefaultConfig()) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the address adding the service + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + account := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), + } + + // Initialize the Supplier account by sending it some funds from the + // validator account that is part of genesis + network.InitAccountWithSequence(t, net, account.Address, 1) + + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare two valid services + svc1 := sharedtypes.Service{ + Id: "svc1", + Name: "service name", + } + svc2 := sharedtypes.Service{ + Id: "svc2", + Name: "service name 2", + } + // Add svc2 to the network + args := []string{ + svc2.Id, + svc2.Name, + fmt.Sprintf("--%s=%s", flags.FlagFrom, account.Address.String()), + } + args = append(args, commonArgs...) + + _, err := clitestutil.ExecTestCLICmd(ctx, service.CmdAddService(), args) + require.NoError(t, err) + + tests := []struct { + desc string + supplierAddress string + service sharedtypes.Service + err *sdkerrors.Error + }{ + { + desc: "valid - add new service", + supplierAddress: account.Address.String(), + service: svc1, + }, + { + desc: "invalid - missing service id", + supplierAddress: account.Address.String(), + service: sharedtypes.Service{Name: "service name"}, // ID intentionally omitted + err: types.ErrServiceMissingID, + }, + { + desc: "invalid - missing service name", + supplierAddress: account.Address.String(), + service: sharedtypes.Service{Id: "svc1"}, // Name intentionally omitted + err: types.ErrServiceMissingName, + }, + { + desc: "invalid - invalid supplier address", + supplierAddress: "invalid address", + service: svc1, + err: types.ErrServiceInvalidAddress, + }, + { + desc: "invalid - service already staked", + supplierAddress: account.Address.String(), + service: svc2, + err: types.ErrServiceAlreadyExists, + }, + } + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + tt.service.Id, + tt.service.Name, + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.supplierAddress), + } + args = append(args, commonArgs...) + + // Execute the command + addServiceOutput, err := clitestutil.ExecTestCLICmd(ctx, service.CmdAddService(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(addServiceOutput.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/service/simulation/add_service.go b/x/service/simulation/add_service.go new file mode 100644 index 000000000..4872ab877 --- /dev/null +++ b/x/service/simulation/add_service.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/service/keeper" + "github.com/pokt-network/poktroll/x/service/types" +) + +func SimulateMsgAddService( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgAddService{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the AddService simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "AddService simulation not implemented"), nil, nil + } +} diff --git a/x/service/simulation/helpers.go b/x/service/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/service/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/service/types/codec.go b/x/service/types/codec.go new file mode 100644 index 000000000..76458e731 --- /dev/null +++ b/x/service/types/codec.go @@ -0,0 +1,20 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgAddService{}, + ) + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/service/types/errors.go b/x/service/types/errors.go new file mode 100644 index 000000000..4a8ad050e --- /dev/null +++ b/x/service/types/errors.go @@ -0,0 +1,21 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/service module sentinel errors +var ( + ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1, "duplicate index when adding a new service") + ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address when adding a new service") + ErrServiceMissingID = sdkerrors.Register(ModuleName, 3, "missing service ID") + ErrServiceMissingName = sdkerrors.Register(ModuleName, 4, "missing service name") + ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 5, "service already exists") + ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 6, "invalid service fee") + ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found") + ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 8, "not enough funds to add service") + ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 9, "failed to deduct fee") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") +) diff --git a/x/service/types/expected_keepers.go b/x/service/types/expected_keepers.go new file mode 100644 index 000000000..5f5c88175 --- /dev/null +++ b/x/service/types/expected_keepers.go @@ -0,0 +1,33 @@ +//go:generate mockgen -destination ../../../testutil/service/mocks/expected_keepers_mock.go -package mocks . BankKeeper +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here + + SendCoinsFromAccountToModule( + ctx context.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go new file mode 100644 index 000000000..06cc3f252 --- /dev/null +++ b/x/service/types/genesis.go @@ -0,0 +1,40 @@ +package types + +import ( + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + ServiceList: []sharedtypes.Service{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in services + serviceIDIndexMap := make(map[string]struct{}) + serviceNameIndexMap := make(map[string]struct{}) + for _, service := range gs.ServiceList { + idIndex := string(ServiceKey(service.Id)) + if _, ok := serviceIDIndexMap[idIndex]; ok { + return ErrServiceDuplicateIndex.Wrapf("duplicated ID for service: %v", service) + } + serviceIDIndexMap[idIndex] = struct{}{} + nameIndex := string(ServiceKey(service.Name)) + if _, ok := serviceNameIndexMap[nameIndex]; ok { + return ErrServiceDuplicateIndex.Wrapf("duplicated name for service: %v", service) + } + serviceNameIndexMap[nameIndex] = struct{}{} + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go new file mode 100644 index 000000000..149d004e8 --- /dev/null +++ b/x/service/types/genesis_test.go @@ -0,0 +1,94 @@ +package types_test + +import ( + "testing" + + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + svc1 := &sharedtypes.Service{ + Id: "svcId1", + Name: "svcName1", + } + + svc2 := &sharedtypes.Service{ + Id: "svcId2", + Name: "svcName2", + } + + svc3 := &sharedtypes.Service{ + Id: "svcId3", + Name: "svcName1", + } + + tests := []struct { + desc string + genState *types.GenesisState + expectedError error + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + expectedError: nil, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + ServiceList: []sharedtypes.Service{ + *svc1, *svc2, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + expectedError: nil, + }, + { + desc: "invalid - duplicate service ID", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + ServiceList: []sharedtypes.Service{ + *svc1, *svc1, + }, + }, + expectedError: types.ErrServiceDuplicateIndex, + }, + { + desc: "invalid - duplicate service name", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + ServiceList: []sharedtypes.Service{ + *svc1, *svc3, + }, + }, + expectedError: types.ErrServiceDuplicateIndex, + }, + { + desc: "invalid - invalid add service fee parameter (below minimum)", + genState: &types.GenesisState{ + Params: types.Params{ + AddServiceFee: 999999, // 0.999999 POKT + }, + ServiceList: []sharedtypes.Service{ + *svc1, *svc2, + }, + }, + expectedError: types.ErrServiceInvalidServiceFee, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.expectedError == nil { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, tc.expectedError) + } + }) + } +} diff --git a/x/service/types/key_service.go b/x/service/types/key_service.go new file mode 100644 index 000000000..cf6a10a79 --- /dev/null +++ b/x/service/types/key_service.go @@ -0,0 +1,21 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // ServiceKeyPrefix is the prefix to retrieve all Service + ServiceKeyPrefix = "Service/value/" +) + +// ServiceKey returns the store key to retrieve a Service from the index fields +func ServiceKey(serviceID string) []byte { + var key []byte + + serviceIDBz := []byte(serviceID) + key = append(key, serviceIDBz...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/service/types/keys.go b/x/service/types/keys.go new file mode 100644 index 000000000..24ab75ebb --- /dev/null +++ b/x/service/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "service" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_service" +) + +var ( + ParamsKey = []byte("p_service") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/service/types/message_add_service.go b/x/service/types/message_add_service.go new file mode 100644 index 000000000..efd2d2f9f --- /dev/null +++ b/x/service/types/message_add_service.go @@ -0,0 +1,36 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/shared/types" +) + +var _ sdk.Msg = (*MsgAddService)(nil) + +func NewMsgAddService(address, serviceId, serviceName string) *MsgAddService { + return &MsgAddService{ + Address: address, + Service: types.Service{ + Id: serviceId, + Name: serviceName, + }, + } +} + +// ValidateBasic performs basic validation of the message and its fields +func (msg *MsgAddService) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return ErrServiceInvalidAddress.Wrapf( + "invalid supplier address %s; (%v)", msg.Address, err, + ) + } + // TODO_TECHDEBT: Add a validate basic function to the `Service` object + if msg.Service.Id == "" { + return ErrServiceMissingID + } + if msg.Service.Name == "" { + return ErrServiceMissingName + } + return nil +} diff --git a/x/service/types/message_add_service_test.go b/x/service/types/message_add_service_test.go new file mode 100644 index 000000000..6a44da578 --- /dev/null +++ b/x/service/types/message_add_service_test.go @@ -0,0 +1,58 @@ +package types + +import ( + "testing" + + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "github.com/stretchr/testify/require" +) + +func TestMsgAddService_ValidateBasic(t *testing.T) { + tests := []struct { + desc string + msg MsgAddService + expectedErr error + }{ + { + desc: "invalid service supplier address - no service", + msg: MsgAddService{ + Address: "invalid_address", + // Service: intentionally omitted, + }, + expectedErr: ErrServiceInvalidAddress, + }, { + desc: "valid service supplier address - no service ID", + msg: MsgAddService{ + Address: sample.AccAddress(), + Service: sharedtypes.Service{Name: "service name"}, // ID intentionally omitted + }, + expectedErr: ErrServiceMissingID, + }, { + desc: "valid service supplier address - no service name", + msg: MsgAddService{ + Address: sample.AccAddress(), + Service: sharedtypes.Service{Id: "svc1"}, // Name intentionally omitted + }, + expectedErr: ErrServiceMissingName, + }, { + desc: "valid service supplier address and service", + msg: MsgAddService{ + Address: sample.AccAddress(), + Service: sharedtypes.Service{Id: "svc1", Name: "service name"}, + }, + expectedErr: nil, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.expectedErr != nil { + require.ErrorIs(t, err, tt.expectedErr) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/service/types/msg_update_params.go b/x/service/types/msg_update_params.go new file mode 100644 index 000000000..aeed4a633 --- /dev/null +++ b/x/service/types/msg_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/service/types/params.go b/x/service/types/params.go new file mode 100644 index 000000000..90201e142 --- /dev/null +++ b/x/service/types/params.go @@ -0,0 +1,74 @@ +package types + +import ( + "fmt" + + sdkerrors "cosmossdk.io/errors" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// DefaultAddServiceFee is the default value for the add service fee +// parameter in the genesis state of the service module. +// TODO_BLOCKER: Revisit default param values for service fee +const DefaultAddServiceFee = 1000000000 // 1000 POKT + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + KeyAddServiceFee = []byte("AddServiceFee") +) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + addServiceFee uint64, +) Params { + return Params{ + AddServiceFee: addServiceFee, + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams( + DefaultAddServiceFee, + ) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyAddServiceFee, &p.AddServiceFee, validateAddServiceFee), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + // TODO(@h5law): Look into better validation + if p.AddServiceFee < DefaultAddServiceFee { + return sdkerrors.Wrapf( + ErrServiceInvalidServiceFee, + "AddServiceFee param %d uPOKT: got %d", + DefaultAddServiceFee, + p.AddServiceFee, + ) + } + return nil +} + +// validateAddServiceFee validates the AddServiceFee param +func validateAddServiceFee(v interface{}) error { + addServiceFee, ok := v.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // TODO_BLOCKER: implement validation + _ = addServiceFee + + return nil +} diff --git a/x/service/types/types.go b/x/service/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/service/types/types.go @@ -0,0 +1 @@ +package types diff --git a/x/session/keeper/block_hash.go b/x/session/keeper/block_hash.go index dccfca958..080a1fd0c 100644 --- a/x/session/keeper/block_hash.go +++ b/x/session/keeper/block_hash.go @@ -1,18 +1,17 @@ package keeper import ( - "fmt" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/session/types" ) // GetBlockHash returns the hash of the block at the given height. -func (k Keeper) GetBlockHash(ctx sdk.Context, height int64) []byte { - store := ctx.KVStore(k.storeKey) - return store.Get(GetBlockHashKey(height)) -} - -// GetBlockHashKey returns the key used to store the block hash for a given height. -func GetBlockHashKey(height int64) []byte { - return []byte(fmt.Sprintf("Blockhash:%d", height)) +func (k Keeper) GetBlockHash(ctx context.Context, height int64) []byte { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.BlockHashKeyPrefix)) + return store.Get(types.BlockHashKey(height)) } diff --git a/x/session/keeper/keeper.go b/x/session/keeper/keeper.go new file mode 100644 index 000000000..1c321b13f --- /dev/null +++ b/x/session/keeper/keeper.go @@ -0,0 +1,86 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/session/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + applicationKeeper types.ApplicationKeeper + supplierKeeper types.SupplierKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + applicationKeeper types.ApplicationKeeper, + supplierKeeper types.SupplierKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + applicationKeeper: applicationKeeper, + supplierKeeper: supplierKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +// BeginBlocker is called at the beginning of every block. +// It fetches the block hash from the committed block ans saves its hash +// in the store. +func (k Keeper) BeginBlocker(goCtx context.Context) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // ctx.BlockHeader().AppHash is the hash of the last block committed + hash := ctx.BlockHeader().AppHash + // ctx.BlockHeader().Height is the height of the last committed block. + height := ctx.BlockHeader().Height + + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(goCtx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.BlockHashKeyPrefix)) + store.Set(types.BlockHashKey(height), hash) +} diff --git a/x/session/keeper/msg_server.go b/x/session/keeper/msg_server.go new file mode 100644 index 000000000..6dbe55462 --- /dev/null +++ b/x/session/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/session/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/session/keeper/msg_server_test.go b/x/session/keeper/msg_server_test.go new file mode 100644 index 000000000..d3c3bd5bd --- /dev/null +++ b/x/session/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/session/keeper" + "github.com/pokt-network/poktroll/x/session/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.SessionKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/session/keeper/msg_update_params.go b/x/session/keeper/msg_update_params.go new file mode 100644 index 000000000..e483b7984 --- /dev/null +++ b/x/session/keeper/msg_update_params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/session/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrSessionInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/session/keeper/msg_update_params_test.go b/x/session/keeper/msg_update_params_test.go new file mode 100644 index 000000000..d645dac66 --- /dev/null +++ b/x/session/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/session/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/session/keeper/params.go b/x/session/keeper/params.go new file mode 100644 index 000000000..deb132ff1 --- /dev/null +++ b/x/session/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/session/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/session/keeper/params_test.go b/x/session/keeper/params_test.go new file mode 100644 index 000000000..77e756c64 --- /dev/null +++ b/x/session/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/session/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := testkeeper.SessionKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/session/keeper/query.go b/x/session/keeper/query.go new file mode 100644 index 000000000..700ec87e8 --- /dev/null +++ b/x/session/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/session/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/session/keeper/query_get_session.go b/x/session/keeper/query_get_session.go new file mode 100644 index 000000000..8d365f171 --- /dev/null +++ b/x/session/keeper/query_get_session.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/session/types" +) + +// GetSession should be deterministic and always return the same session for +// the same block height. +func (k Keeper) GetSession(goCtx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if err := req.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Note that `GetSession` is called via the `Query` service rather than the `Msg` server. + // The former is stateful but does not lead to state transitions, while the latter one + // does. The request height depends on how much the node has synched and only acts as a read, + // while the `Msg` server handles the code flow of the validator/sequencer when a new block + // is being proposed. + blockHeight := req.BlockHeight + + k.Logger().Info("Getting session for height: %d", blockHeight) + + sessionHydrator := NewSessionHydrator(req.ApplicationAddress, req.Service.Id, blockHeight) + session, err := k.HydrateSession(ctx, sessionHydrator) + if err != nil { + return nil, err + } + + res := &types.QueryGetSessionResponse{ + Session: session, + } + return res, nil +} diff --git a/x/session/keeper/query_get_session_test.go b/x/session/keeper/query_get_session_test.go new file mode 100644 index 000000000..597095833 --- /dev/null +++ b/x/session/keeper/query_get_session_test.go @@ -0,0 +1,166 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func init() { + cmd.InitSDKConfig() +} + +// NOTE: See `session_hydrator_test.go` for more extensive test coverage of different +// GetSession scenarios. This is just used to verify a few basic scenarios that act as +// the Cosmos SDK context aware wrapper around it. + +func TestSession_GetSession_Success(t *testing.T) { + keeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + // TODO_TECHDEBT(#377): These test assume that the genesis block has a height of 0, + // rewrite them in terms of height = 1 genesis. + type test struct { + name string + + appAddr string + serviceId string + blockHeight int64 + + expectedSessionId string + expectedSessionNumber int64 + expectedNumSuppliers int + } + + tests := []test{ + { + name: "valid - app1 svc1 at height=1", + + appAddr: keepertest.TestApp1Address, + serviceId: keepertest.TestServiceId1, + blockHeight: 1, + + // Intentionally only checking a subset of the session metadata returned + expectedSessionId: "6f2e0b6cba5a8cb93506ed4045143c4268945ebfb730b2c98fc7e3dc40132926", + expectedSessionNumber: 0, + expectedNumSuppliers: 1, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := &types.QueryGetSessionRequest{ + ApplicationAddress: tt.appAddr, + Service: &sharedtypes.Service{ + Id: tt.serviceId, + }, + BlockHeight: 1, + } + + response, err := keeper.GetSession(ctx, req) + require.NoError(t, err) + require.NotNil(t, response) + + require.Equal(t, tt.expectedSessionId, response.Session.SessionId) + require.Equal(t, tt.expectedSessionNumber, response.Session.SessionNumber) + require.Len(t, response.Session.Suppliers, tt.expectedNumSuppliers) + }) + } +} + +func TestSession_GetSession_Failure(t *testing.T) { + keeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + type test struct { + name string + + appAddr string + serviceId string + blockHeight int64 + + expectedErrContains string + } + + tests := []test{ + { + name: "application address does not reflected a staked application", + + appAddr: sample.AccAddress(), // a random (valid) app address that's not staked + serviceId: keepertest.TestServiceId1, + blockHeight: 1, + + expectedErrContains: types.ErrSessionAppNotFound.Error(), + }, + { + name: "application staked for service that has no available suppliers", + + appAddr: keepertest.TestApp1Address, + serviceId: keepertest.TestServiceId11, + blockHeight: 1, + + expectedErrContains: types.ErrSessionSuppliersNotFound.Error(), + }, + { + name: "application is valid but not staked for the specified service", + + appAddr: keepertest.TestApp1Address, + serviceId: "svc9001", // App1 is not staked for service over 9000 + blockHeight: 1, + + expectedErrContains: types.ErrSessionAppNotStakedForService.Error(), + }, + { + name: "application address is invalid format", + + appAddr: "invalid_app_address", + serviceId: keepertest.TestServiceId1, + blockHeight: 1, + + expectedErrContains: types.ErrSessionInvalidAppAddress.Error(), + }, + { + name: "service ID is invalid", + + appAddr: keepertest.TestApp1Address, + serviceId: "service_id_is_too_long_to_be_valid", + blockHeight: 1, + + expectedErrContains: "invalid service in session", + }, + { + name: "negative block height", + + appAddr: keepertest.TestApp1Address, + serviceId: keepertest.TestServiceId1, + blockHeight: -1, + + expectedErrContains: "invalid block height for session being retrieved", + }, + } + + expectedRes := (*types.QueryGetSessionResponse)(nil) + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := &types.QueryGetSessionRequest{ + ApplicationAddress: tt.appAddr, + Service: &sharedtypes.Service{ + Id: tt.serviceId, + }, + BlockHeight: tt.blockHeight, + } + + res, err := keeper.GetSession(ctx, req) + require.Error(t, err) + require.Contains(t, err.Error(), tt.expectedErrContains) + require.Equal(t, expectedRes, res) + }) + } +} diff --git a/x/session/keeper/query_params.go b/x/session/keeper/query_params.go new file mode 100644 index 000000000..75734ad7a --- /dev/null +++ b/x/session/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/session/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/session/keeper/query_params_test.go b/x/session/keeper/query_params_test.go new file mode 100644 index 000000000..26d2859a9 --- /dev/null +++ b/x/session/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/session/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := testkeeper.SessionKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go new file mode 100644 index 000000000..6a36309c7 --- /dev/null +++ b/x/session/keeper/session_hydrator.go @@ -0,0 +1,306 @@ +package keeper + +import ( + "crypto" + "encoding/binary" + "encoding/hex" + "fmt" + "math/rand" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + _ "golang.org/x/crypto/sha3" + + "github.com/pokt-network/poktroll/x/session/types" + sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// TODO_TECHDEBT(#377): The business logic in this file assume that genesis has +// a block height of 0. Revisit it and adjust, where/if necessary, accounting for the +// fact that it's 1. + +var SHA3HashLen = crypto.SHA3_256.Size() + +// TODO_BLOCKER(#21): Make these configurable governance param +const ( + // TODO_BLOCKER: Remove direct usage of these constants in helper functions + // when they will be replaced by governance params + NumBlocksPerSession = 4 + // Duration of the grace period in number of sessions + SessionGracePeriod = 1 + NumSupplierPerSession = 15 + SessionIDComponentDelimiter = "." +) + +type sessionHydrator struct { + // The session header that is used to hydrate the rest of the session data + sessionHeader *types.SessionHeader + + // The fully hydrated session object + session *types.Session + + // The height at which the session being request + blockHeight int64 + + // A redundant helper that maintains a hex decoded copy of `session.Id` used for session hydration + sessionIdBz []byte +} + +func NewSessionHydrator( + appAddress string, + serviceId string, + blockHeight int64, +) *sessionHydrator { + sessionHeader := &types.SessionHeader{ + ApplicationAddress: appAddress, + Service: &sharedtypes.Service{Id: serviceId}, + } + return &sessionHydrator{ + sessionHeader: sessionHeader, + session: &types.Session{}, + blockHeight: blockHeight, + sessionIdBz: make([]byte, 0), + } +} + +// GetSession implements of the exposed `UtilityModule.GetSession` function +// TECHDEBT(#519): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. +func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Session, error) { + logger := k.Logger().With("method", "hydrateSession") + + if err := k.hydrateSessionMetadata(ctx, sh); err != nil { + return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session metadata: %v", err) + } + logger.Debug("Finished hydrating session metadata") + + if err := k.hydrateSessionID(ctx, sh); err != nil { + return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session ID: %v", err) + } + logger.Info(fmt.Sprintf("Finished hydrating session ID: %s", sh.sessionHeader.SessionId)) + + if err := k.hydrateSessionApplication(ctx, sh); err != nil { + return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate application for session: %v", err) + } + logger.Debug("Finished hydrating session application: %+v", sh.session.Application) + + if err := k.hydrateSessionSuppliers(ctx, sh); err != nil { + return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate suppliers for session: %v", err) + } + logger.Debug("Finished hydrating session suppliers: %+v") + + sh.session.Header = sh.sessionHeader + sh.session.SessionId = sh.sessionHeader.SessionId + + return sh.session, nil +} + +// hydrateSessionMetadata hydrates metadata related to the session such as the height at which the session started, its number, the number of blocks per session, etc.. +func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) error { + // TODO_TECHDEBT: Add a test if `blockHeight` is ahead of the current chain or what this node is aware of + + if sh.blockHeight > ctx.BlockHeight() { + return sdkerrors.Wrapf( + types.ErrSessionHydration, + "block height %d is ahead of the last committed block height %d", + sh.blockHeight, ctx.BlockHeight(), + ) + } + + sh.session.NumBlocksPerSession = NumBlocksPerSession + sh.session.SessionNumber = GetSessionNumber(sh.blockHeight) + + sh.sessionHeader.SessionStartBlockHeight = GetSessionStartBlockHeight(sh.blockHeight) + sh.sessionHeader.SessionEndBlockHeight = GetSessionEndBlockHeight(sh.blockHeight) + return nil +} + +// hydrateSessionID use both session and on-chain data to determine a unique session ID +func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { + prevHashBz := k.GetBlockHash(ctx, sh.sessionHeader.SessionStartBlockHeight) + + // TODO_TECHDEBT: In the future, we will need to valid that the Service is a valid service depending on whether + // or not its permissioned or permissionless + + if !sharedhelpers.IsValidService(sh.sessionHeader.Service) { + return sdkerrors.Wrapf(types.ErrSessionHydration, "invalid service: %v", sh.sessionHeader.Service) + } + + sh.sessionHeader.SessionId, sh.sessionIdBz = GetSessionId( + sh.sessionHeader.ApplicationAddress, + sh.sessionHeader.Service.Id, + prevHashBz, + sh.blockHeight, + ) + + return nil +} + +// hydrateSessionApplication hydrates the full Application actor based on the address provided +func (k Keeper) hydrateSessionApplication(ctx sdk.Context, sh *sessionHydrator) error { + app, appIsFound := k.applicationKeeper.GetApplication(ctx, sh.sessionHeader.ApplicationAddress) + if !appIsFound { + return sdkerrors.Wrapf(types.ErrSessionAppNotFound, "could not find app with address: %s at height %d", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.SessionStartBlockHeight) + } + + for _, appServiceConfig := range app.ServiceConfigs { + if appServiceConfig.Service.Id == sh.sessionHeader.Service.Id { + sh.session.Application = &app + return nil + } + } + + return sdkerrors.Wrapf(types.ErrSessionAppNotStakedForService, "application %s not staked for service %s", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id) +} + +// hydrateSessionSuppliers finds the suppliers that are staked at the session height and populates the session with them +func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) error { + logger := k.Logger().With("method", "hydrateSessionSuppliers") + + // TODO_TECHDEBT(@Olshansk, @bryanchriswhite): Need to retrieve the suppliers at SessionStartBlockHeight, + // NOT THE CURRENT ONE which is what's provided by the context. For now, for simplicity, + // only retrieving the suppliers at the current block height which could create a discrepancy + // if new suppliers were staked mid session. + // TODO(@bryanchriswhite): Investigate if `BlockClient` + `ReplayObservable` where `N = SessionLength` could be used here.` + suppliers := k.supplierKeeper.GetAllSupplier(ctx) + + candidateSuppliers := make([]*sharedtypes.Supplier, 0) + for _, s := range suppliers { + // NB: Allocate a new heap variable as s is a value and we're appending + // to a slice of pointers; otherwise, we'd be appending new pointers to + // the same memory address containing the last supplier in the loop. + supplier := s + // TODO_OPTIMIZE: If `supplier.Services` was a map[string]struct{}, we could eliminate `slices.Contains()`'s loop + for _, supplierServiceConfig := range supplier.Services { + if supplierServiceConfig.Service.Id == sh.sessionHeader.Service.Id { + candidateSuppliers = append(candidateSuppliers, &supplier) + break + } + } + } + + if len(candidateSuppliers) == 0 { + logger.Error("[ERROR] no suppliers found for session") + return sdkerrors.Wrapf(types.ErrSessionSuppliersNotFound, "could not find suppliers for service %s at height %d", sh.sessionHeader.Service, sh.sessionHeader.SessionStartBlockHeight) + } + + if len(candidateSuppliers) < NumSupplierPerSession { + logger.Info(fmt.Sprintf("[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", len(candidateSuppliers), NumSupplierPerSession)) + sh.session.Suppliers = candidateSuppliers + } else { + sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIdBz) + } + + return nil +} + +// TODO_INVESTIGATE: We are using a `Go` native implementation for a pseudo-random number generator. In order +// for it to be language agnostic, a general purpose algorithm MUST be used. +// pseudoRandomSelection returns a random subset of the candidates. +func pseudoRandomSelection(candidates []*sharedtypes.Supplier, numTarget int, sessionIdBz []byte) []*sharedtypes.Supplier { + // Take the first 8 bytes of sessionId to use as the seed + // NB: There is specific reason why `BigEndian` was chosen over `LittleEndian` in this specific context. + seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIdBz)[:8])) + + // Retrieve the indices for the candidates + actors := make([]*sharedtypes.Supplier, 0) + uniqueIndices := uniqueRandomIndices(seed, int64(len(candidates)), int64(numTarget)) + for idx := range uniqueIndices { + actors = append(actors, candidates[idx]) + } + + return actors +} + +// uniqueRandomIndices returns a map of `numIndices` unique random numbers less than `maxIndex` +// seeded by `seed`. +// panics if `numIndicies > maxIndex` since that code path SHOULD never be executed. +// NB: A map pointing to empty structs is used to simulate set behavior. +func uniqueRandomIndices(seed, maxIndex, numIndices int64) map[int64]struct{} { + // This should never happen + if numIndices > maxIndex { + panic(fmt.Sprintf("uniqueRandomIndices: numIndices (%d) is greater than maxIndex (%d)", numIndices, maxIndex)) + } + + // create a new random source with the seed + randSrc := rand.NewSource(seed) + + // initialize a map to capture the indicesMap we'll return + indicesMap := make(map[int64]struct{}, maxIndex) + + // The random source could potentially return duplicates, so while loop until we have enough unique indices + for int64(len(indicesMap)) < numIndices { + indicesMap[randSrc.Int63()%int64(maxIndex)] = struct{}{} + } + + return indicesMap +} + +func concatWithDelimiter(delimiter string, b ...[]byte) (result []byte) { + for _, bz := range b { + result = append(result, bz...) + result = append(result, []byte(delimiter)...) + } + return result +} + +func sha3Hash(bz []byte) []byte { + hasher := crypto.SHA3_256.New() + hasher.Write(bz) + return hasher.Sum(nil) +} + +// GetSessionStartBlockHeight returns the block height at which the session starts +func GetSessionStartBlockHeight(blockHeight int64) int64 { + return blockHeight - (blockHeight % NumBlocksPerSession) +} + +// GetSessionEndBlockHeight returns the block height at which the session ends +func GetSessionEndBlockHeight(blockHeight int64) int64 { + return GetSessionStartBlockHeight(blockHeight) + NumBlocksPerSession - 1 +} + +// GetSessionNumber returns the session number given the block height +func GetSessionNumber(blockHeight int64) int64 { + return blockHeight / NumBlocksPerSession +} + +// GetSessionId returns the string and bytes representation of the sessionId +// given the application public key, service ID, block hash, and block height +// that is used to get the session start block height. +func GetSessionId( + appPubKey, + serviceId string, + blockHashBz []byte, + blockHeight int64, +) (sessionId string, sessionIdBz []byte) { + appPubKeyBz := []byte(appPubKey) + serviceIdBz := []byte(serviceId) + + blockHeightBz := getSessionStartBlockHeightBz(blockHeight) + sessionIdBz = concatWithDelimiter( + SessionIDComponentDelimiter, + blockHashBz, + serviceIdBz, + appPubKeyBz, + blockHeightBz, + ) + sessionId = hex.EncodeToString(sha3Hash(sessionIdBz)) + + return sessionId, sessionIdBz +} + +// GetSessionGracePeriodBlockCount returns the number of blocks in the session +// grace period. +func GetSessionGracePeriodBlockCount() int64 { + return SessionGracePeriod * NumBlocksPerSession +} + +// getSessionStartBlockHeightBz returns the bytes representation of the session +// start block height given the block height. +func getSessionStartBlockHeightBz(blockHeight int64) []byte { + sessionStartBlockHeight := GetSessionStartBlockHeight(blockHeight) + sessionStartBlockHeightBz := make([]byte, 8) + binary.LittleEndian.PutUint64(sessionStartBlockHeightBz, uint64(sessionStartBlockHeight)) + return sessionStartBlockHeightBz +} diff --git a/x/session/keeper/session_hydrator_test.go b/x/session/keeper/session_hydrator_test.go new file mode 100644 index 000000000..e914ca0ea --- /dev/null +++ b/x/session/keeper/session_hydrator_test.go @@ -0,0 +1,359 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/session/keeper" + "github.com/pokt-network/poktroll/x/session/types" +) + +// TODO_TECHDEBT(#377): All the tests in this file assume genesis has a block +// height of 0. Rewrite them in terms of height = 1 genesis. + +func TestSession_HydrateSession_Success_BaseCase(t *testing.T) { + sessionKeeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + blockHeight := int64(10) + + sessionHydrator := keeper.NewSessionHydrator(keepertest.TestApp1Address, keepertest.TestServiceId1, blockHeight) + session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) + require.NoError(t, err) + + // Check the header + sessionHeader := session.Header + require.Equal(t, keepertest.TestApp1Address, sessionHeader.ApplicationAddress) + require.Equal(t, keepertest.TestServiceId1, sessionHeader.Service.Id) + require.Equal(t, "", sessionHeader.Service.Name) + require.Equal(t, int64(8), sessionHeader.SessionStartBlockHeight) + require.Equal(t, int64(11), sessionHeader.SessionEndBlockHeight) + require.Equal(t, "f621ad93e2d9ebf2e967eb16b8ea2bc470baa1d4e13a82f348f34c6fc93eae7f", sessionHeader.SessionId) + + // Check the session + require.Equal(t, int64(4), session.NumBlocksPerSession) + require.Equal(t, "f621ad93e2d9ebf2e967eb16b8ea2bc470baa1d4e13a82f348f34c6fc93eae7f", session.SessionId) + require.Equal(t, int64(2), session.SessionNumber) + + // Check the application + app := session.Application + require.Equal(t, keepertest.TestApp1Address, app.Address) + require.Len(t, app.ServiceConfigs, 3) + + // Check the suppliers + suppliers := session.Suppliers + require.Len(t, suppliers, 1) + supplier := suppliers[0] + require.Equal(t, keepertest.TestSupplierAddress, supplier.Address) + require.Len(t, supplier.Services, 3) +} + +func TestSession_HydrateSession_Metadata(t *testing.T) { + type test struct { + desc string + blockHeight int64 + + expectedNumBlocksPerSession int64 + expectedSessionNumber int64 + expectedSessionStartBlock int64 + expectedSessionEndBlock int64 + errExpected error + } + + // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. + // Currently assumes NumBlocksPerSession=4 + tests := []test{ + { + desc: "blockHeight = 0", + blockHeight: 0, + + expectedNumBlocksPerSession: 4, + expectedSessionNumber: 0, + expectedSessionStartBlock: 0, + expectedSessionEndBlock: 3, + errExpected: nil, + }, + { + desc: "blockHeight = 1", + blockHeight: 1, + + expectedNumBlocksPerSession: 4, + expectedSessionNumber: 0, + expectedSessionStartBlock: 0, + expectedSessionEndBlock: 3, + errExpected: nil, + }, + { + desc: "blockHeight = sessionHeight", + blockHeight: 4, + + expectedNumBlocksPerSession: 4, + expectedSessionNumber: 1, + expectedSessionStartBlock: 4, + expectedSessionEndBlock: 7, + errExpected: nil, + }, + { + desc: "blockHeight != sessionHeight", + blockHeight: 5, + + expectedNumBlocksPerSession: 4, + expectedSessionNumber: 1, + expectedSessionStartBlock: 4, + expectedSessionEndBlock: 7, + errExpected: nil, + }, + { + desc: "blockHeight > contextHeight", + blockHeight: 9001, // block height over 9000 is too high given that the context height is 100 + + errExpected: types.ErrSessionHydration, + }, + } + + appAddr := keepertest.TestApp1Address + serviceId := keepertest.TestServiceId1 + sessionKeeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + sessionHydrator := keeper.NewSessionHydrator(appAddr, serviceId, tt.blockHeight) + session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) + + if tt.errExpected != nil { + require.ErrorIs(t, tt.errExpected, err) + return + } + require.NoError(t, err) + + require.Equal(t, tt.expectedNumBlocksPerSession, session.NumBlocksPerSession) + require.Equal(t, tt.expectedSessionNumber, session.SessionNumber) + require.Equal(t, tt.expectedSessionStartBlock, session.Header.SessionStartBlockHeight) + require.Equal(t, tt.expectedSessionEndBlock, session.Header.SessionEndBlockHeight) + }) + } +} + +func TestSession_HydrateSession_SessionId(t *testing.T) { + type test struct { + desc string + + blockHeight1 int64 + blockHeight2 int64 + + appAddr1 string + appAddr2 string + + serviceId1 string + serviceId2 string + + expectedSessionId1 string + expectedSessionId2 string + } + + // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. + // Currently assumes NumBlocksPerSession=4 + tests := []test{ + { + desc: "(app1, svc1): sessionId at first session block != sessionId at next session block", + + blockHeight1: 4, + blockHeight2: 8, + + appAddr1: keepertest.TestApp1Address, // app1 + appAddr2: keepertest.TestApp1Address, // app1 + + serviceId1: keepertest.TestServiceId1, // svc1 + serviceId2: keepertest.TestServiceId1, // svc1 + + expectedSessionId1: "8d7919d1addb175425ed99bc897aee7fecd6a184e46a0ce4119b610db9242db5", + expectedSessionId2: "f621ad93e2d9ebf2e967eb16b8ea2bc470baa1d4e13a82f348f34c6fc93eae7f", + }, + { + desc: "app1: sessionId for svc1 != sessionId for svc12", + + blockHeight1: 4, + blockHeight2: 4, + + appAddr1: keepertest.TestApp1Address, // app1 + appAddr2: keepertest.TestApp1Address, // app1 + + serviceId1: keepertest.TestServiceId1, // svc1 + serviceId2: keepertest.TestServiceId12, // svc12 + + expectedSessionId1: "8d7919d1addb175425ed99bc897aee7fecd6a184e46a0ce4119b610db9242db5", + expectedSessionId2: "40d02827f0f3f717caf844cd4cfbe1ebc2f3ada7d4e5974ed6ec795b9a715e07", + }, + { + desc: "svc12: sessionId for app1 != sessionId for app2", + + blockHeight1: 4, + blockHeight2: 4, + + appAddr1: keepertest.TestApp1Address, // app1 + appAddr2: keepertest.TestApp2Address, // app2 + + serviceId1: keepertest.TestServiceId12, // svc12 + serviceId2: keepertest.TestServiceId12, // svc12 + + expectedSessionId1: "40d02827f0f3f717caf844cd4cfbe1ebc2f3ada7d4e5974ed6ec795b9a715e07", + expectedSessionId2: "5c338ae8bf5138b7ca9a0ca124942984734531fb30f1670da772ef3e635939f6", + }, + } + + sessionKeeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + sessionHydrator1 := keeper.NewSessionHydrator(tt.appAddr1, tt.serviceId1, tt.blockHeight1) + session1, err := sessionKeeper.HydrateSession(ctx, sessionHydrator1) + require.NoError(t, err) + + sessionHydrator2 := keeper.NewSessionHydrator(tt.appAddr2, tt.serviceId2, tt.blockHeight2) + session2, err := sessionKeeper.HydrateSession(ctx, sessionHydrator2) + require.NoError(t, err) + + require.NotEqual(t, session1.Header.SessionId, session2.Header.SessionId) + require.Equal(t, tt.expectedSessionId1, session1.Header.SessionId) + require.Equal(t, tt.expectedSessionId2, session2.Header.SessionId) + }) + } +} + +// TODO_TECHDEBT: Expand these tests to account for application joining/leaving the network at different heights as well changing the services they support +func TestSession_HydrateSession_Application(t *testing.T) { + type test struct { + // Description + desc string + // Inputs + appAddr string + serviceId string + + // Outputs + expectedErr error + } + + tests := []test{ + { + desc: "app is found", + + appAddr: keepertest.TestApp1Address, + serviceId: keepertest.TestServiceId1, + + expectedErr: nil, + }, + { + desc: "app is not found", + + appAddr: sample.AccAddress(), // Generating a random address on the fly + serviceId: keepertest.TestServiceId1, + + expectedErr: types.ErrSessionHydration, + }, + { + desc: "invalid app address", + + appAddr: "invalid", + serviceId: keepertest.TestServiceId1, + + expectedErr: types.ErrSessionHydration, + }, + { + desc: "invalid - app not staked for service", + + appAddr: keepertest.TestApp1Address, // app1 + serviceId: "svc9001", // app1 is only stake for svc1 and svc11 + + expectedErr: types.ErrSessionHydration, + }, + // TODO_TECHDEBT: Add tests for when: + // - Application join/leaves (stakes/unstakes) altogether + // - Application adds/removes certain services mid-session + // - Application increases stakes mid-session + } + + blockHeight := int64(10) + sessionKeeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) + _, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) + if tt.expectedErr != nil { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +// TODO_TECHDEBT: Expand these tests to account for supplier joining/leaving the network at different heights as well changing the services they support +func TestSession_HydrateSession_Suppliers(t *testing.T) { + type test struct { + // Description + desc string + + // Inputs + appAddr string + serviceId string + + // Outputs + numExpectedSuppliers int + expectedErr error + } + + // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. + // Currently assumes NumSupplierPerSession=15 + tests := []test{ + { + desc: "num_suppliers_available = 0", + + appAddr: keepertest.TestApp1Address, // app1 + serviceId: keepertest.TestServiceId11, + + numExpectedSuppliers: 0, + expectedErr: types.ErrSessionSuppliersNotFound, + }, + { + desc: "num_suppliers_available < num_suppliers_per_session_param", + + appAddr: keepertest.TestApp1Address, // app1 + serviceId: keepertest.TestServiceId1, // svc1 + + numExpectedSuppliers: 1, + expectedErr: nil, + }, + // TODO_TECHDEBT: Add this test once we make the num suppliers per session configurable + // { + // name: "num_suppliers_available > num_suppliers_per_session_param", + // }, + // TODO_TECHDEBT: Add tests for when: + // - Supplier join/leaves (stakes/unstakes) altogether + // - Supplier adds/removes certain services mid-session + // - Supplier increases stakes mid-session + } + + blockHeight := int64(10) + sessionKeeper, ctx := keepertest.SessionKeeper(t) + ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) {}) + + sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) + session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) + + if tt.expectedErr != nil { + require.ErrorContains(t, err, tt.expectedErr.Error()) + continue + } + require.NoError(t, err) + require.Len(t, session.Suppliers, tt.numExpectedSuppliers) + } +} diff --git a/x/session/module/autocli.go b/x/session/module/autocli.go new file mode 100644 index 000000000..bf35f4984 --- /dev/null +++ b/x/session/module/autocli.go @@ -0,0 +1,48 @@ +package session + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/session" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + { + RpcMethod: "GetSession", + Use: "get-session [application-address] [service] [block-height]", + Short: "Query get-session", + Long: `Query the session data for a specific (app, service, height) tuple. + +This is a query operation that will not result in a state transition but simply gives a view into the chain state. + +Example: +$ poktrolld q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE) --home $(POKTROLLD_HOME) `, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "application_address"}, {ProtoField: "service"}, {ProtoField: "block_height"}}, + }, + + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/session/module/genesis.go b/x/session/module/genesis.go new file mode 100644 index 000000000..2007b8a74 --- /dev/null +++ b/x/session/module/genesis.go @@ -0,0 +1,24 @@ +package session + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/session/keeper" + "github.com/pokt-network/poktroll/x/session/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/session/module/genesis_test.go b/x/session/module/genesis_test.go new file mode 100644 index 000000000..0c9b49159 --- /dev/null +++ b/x/session/module/genesis_test.go @@ -0,0 +1,42 @@ +package session_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/session/types" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/session/module/helpers_test.go b/x/session/module/helpers_test.go new file mode 100644 index 000000000..7a2cf436e --- /dev/null +++ b/x/session/module/helpers_test.go @@ -0,0 +1,45 @@ +// Package session_test provides unit tests for the CLI functionality. +package session_test + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/network" + apptypes "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +func init() { + cmd.InitSDKConfig() +} + +// networkWithApplicationsAndSupplier creates a new network with a given number of supplier & application objects. +// It returns the network and a slice of the created supplier & application objects. +func networkWithApplicationsAndSupplier(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier, []apptypes.Application) { + t.Helper() + cfg := network.DefaultConfig() + + // Prepare the application genesis state + applicationGenesisState := network.DefaultApplicationModuleGenesisState(t, n) + buf, err := cfg.Codec.MarshalJSON(applicationGenesisState) + require.NoError(t, err) + cfg.GenesisState[apptypes.ModuleName] = buf + + // Prepare the supplier genesis state + supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) + buf, err = cfg.Codec.MarshalJSON(supplierGenesisState) + require.NoError(t, err) + cfg.GenesisState[suppliertypes.ModuleName] = buf + + // Start the network + return network.New(t, cfg), supplierGenesisState.SupplierList, applicationGenesisState.ApplicationList +} diff --git a/x/session/module/module.go b/x/session/module/module.go new file mode 100644 index 000000000..a7f99ea0d --- /dev/null +++ b/x/session/module/module.go @@ -0,0 +1,221 @@ +package session + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/session/module" + "github.com/pokt-network/poktroll/x/session/keeper" + "github.com/pokt-network/poktroll/x/session/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(ctx context.Context) error { + am.keeper.BeginBlocker(ctx) + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + ApplicationKeeper types.ApplicationKeeper + SupplierKeeper types.SupplierKeeper +} + +type ModuleOutputs struct { + depinject.Out + + SessionKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.AccountKeeper, + in.BankKeeper, + in.ApplicationKeeper, + in.SupplierKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{SessionKeeper: k, Module: m} +} diff --git a/x/session/module/query.go b/x/session/module/query.go new file mode 100644 index 000000000..cd9fa7ed0 --- /dev/null +++ b/x/session/module/query.go @@ -0,0 +1,31 @@ +package session + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/pokt-network/poktroll/x/session/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd() *cobra.Command { + // Group session queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdGetSession()) + + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/session/module/query_get_session.go b/x/session/module/query_get_session.go new file mode 100644 index 000000000..d28d66861 --- /dev/null +++ b/x/session/module/query_get_session.go @@ -0,0 +1,63 @@ +package session + +import ( + "fmt" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/session/types" +) + +var _ = strconv.Itoa(0) + +func CmdGetSession() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-session ", + Short: "Query get-session", + Long: `Query the session data for a specific (app, service, height) tuple. + +This is a query operation that will not result in a state transition but simply gives a view into the chain state. + +Example: +$ poktrolld q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.RangeArgs(2, 3), + RunE: func(cmd *cobra.Command, args []string) (err error) { + appAddressString := args[0] + serviceIdString := args[1] + blockHeightString := "0" // 0 will default to latest height + if len(args) == 3 { + blockHeightString = args[2] + } + + blockHeight, err := strconv.ParseInt(blockHeightString, 10, 64) + if err != nil { + return fmt.Errorf("couldn't convert block height to int: %s; (%v)", blockHeightString, err) + } + + getSessionReq := types.NewQueryGetSessionRequest(appAddressString, serviceIdString, blockHeight) + if err := getSessionReq.ValidateBasic(); err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + getSessionRes, err := queryClient.GetSession(cmd.Context(), getSessionReq) + if err != nil { + return err + } + + return clientCtx.PrintProto(getSessionRes) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/session/module/query_get_session_test.go b/x/session/module/query_get_session_test.go new file mode 100644 index 000000000..4a482afda --- /dev/null +++ b/x/session/module/query_get_session_test.go @@ -0,0 +1,198 @@ +package session_test + +import ( + "fmt" + "testing" + "time" + + sdkerrors "cosmossdk.io/errors" + tmcli "github.com/cometbft/cometbft/libs/cli" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/gogo/status" + "github.com/stretchr/testify/require" + + session "github.com/pokt-network/poktroll/x/session/module" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +func TestCLI_GetSession(t *testing.T) { + // Prepare the network + net, suppliers, applications := networkWithApplicationsAndSupplier(t, 2) + _, err := net.WaitForHeightWithTimeout(10, 30*time.Second) // Wait for a sufficiently high block height to ensure the staking transactions have been processed + require.NoError(t, err) + val := net.Validators[0] + ctx := val.ClientCtx + + // Sanity check the application configs are what we expect them to be + appSvc0 := applications[0] + appSvc1 := applications[1] + + require.Len(t, appSvc0.ServiceConfigs, 2) + require.Len(t, appSvc1.ServiceConfigs, 2) + + require.Equal(t, appSvc0.ServiceConfigs[0].Service.Id, "svc0") // svc0 has a supplier + require.Equal(t, appSvc0.ServiceConfigs[1].Service.Id, "svc00") // svc00 doesn't have a supplier + require.Equal(t, appSvc1.ServiceConfigs[0].Service.Id, "svc1") // svc1 has a supplier + require.Equal(t, appSvc1.ServiceConfigs[1].Service.Id, "svc11") // svc11 doesn't have a supplier + + // Sanity check the supplier configs are what we expect them to be + supplierSvc0 := suppliers[0] // supplier for svc0 + supplierSvc1 := suppliers[1] // supplier for svc1 + + require.Len(t, supplierSvc0.Services, 1) + require.Len(t, supplierSvc1.Services, 1) + + require.Equal(t, supplierSvc0.Services[0].Service.Id, "svc0") + require.Equal(t, supplierSvc1.Services[0].Service.Id, "svc1") + + // Prepare the test cases + tests := []struct { + desc string + + appAddress string + serviceId string + blockHeight int64 + + expectedErr *sdkerrors.Error + expectedNumSuppliers int + }{ + // Valid requests + { + desc: "valid - block height specified and is zero", + + appAddress: appSvc0.Address, + serviceId: "svc0", + blockHeight: 0, + + expectedErr: nil, + expectedNumSuppliers: 1, + }, + { + desc: "valid - block height specified and is greater than zero", + + appAddress: appSvc1.Address, + serviceId: "svc1", + blockHeight: 10, + + expectedErr: nil, + expectedNumSuppliers: 1, + }, + { + desc: "valid - block height unspecified and defaults to 0", + + appAddress: appSvc0.Address, + serviceId: "svc0", + // blockHeight: intentionally omitted, + + expectedErr: nil, + expectedNumSuppliers: 1, + }, + + // Invalid requests - incompatible state + { + desc: "invalid - app not staked for service", + + appAddress: appSvc0.Address, + serviceId: "svc9001", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) and is not staked for service over 9000 + blockHeight: 0, + + expectedErr: sessiontypes.ErrSessionAppNotStakedForService, + }, + { + desc: "invalid - no suppliers staked for service", + + appAddress: appSvc0.Address, // dynamically getting address from applications + serviceId: "svc00", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) + blockHeight: 0, + + expectedErr: sessiontypes.ErrSessionSuppliersNotFound, + }, + { + desc: "invalid - block height is in the future", + + appAddress: appSvc0.Address, // dynamically getting address from applications + serviceId: "svc0", + blockHeight: 9001, // block height over 9000 is greater than the context height of 10 + + expectedErr: sessiontypes.ErrSessionInvalidBlockHeight, + }, + + // Invalid requests - bad app address input + { + desc: "invalid - invalid appAddress", + + appAddress: "invalidAddress", // providing a deliberately invalid address + serviceId: "svc0", + blockHeight: 0, + + expectedErr: sessiontypes.ErrSessionInvalidAppAddress, + }, + { + desc: "invalid - missing appAddress", + // appAddress: intentionally omitted + serviceId: "svc0", + blockHeight: 0, + + expectedErr: sessiontypes.ErrSessionInvalidAppAddress, + }, + + // Invalid requests - bad serviceID input + { + desc: "invalid - invalid service ID", + appAddress: appSvc0.Address, // dynamically getting address from applications + serviceId: "invalidServiceId", + blockHeight: 0, + + expectedErr: sessiontypes.ErrSessionInvalidService, + }, + { + desc: "invalid - missing service ID", + appAddress: appSvc0.Address, // dynamically getting address from applications + // serviceId: intentionally omitted + blockHeight: 0, + + expectedErr: sessiontypes.ErrSessionInvalidService, + }, + } + + // We want to use the `--output=json` flag for all tests so it's easy to unmarshal below + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Prepare the arguments for the CLI command + args := []string{ + tt.appAddress, + tt.serviceId, + fmt.Sprintf("%d", tt.blockHeight), + } + args = append(args, common...) + + // Execute the command + getSessionOut, err := clitestutil.ExecTestCLICmd(ctx, session.CmdGetSession(), args) + if tt.expectedErr != nil { + stat, ok := status.FromError(tt.expectedErr) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.expectedErr.Error()) + return + } + require.NoError(t, err) + + var getSessionRes sessiontypes.QueryGetSessionResponse + err = net.Config.Codec.UnmarshalJSON(getSessionOut.Bytes(), &getSessionRes) + require.NoError(t, err) + require.NotNil(t, getSessionRes) + + session := getSessionRes.Session + require.NotNil(t, session) + + // Verify some data about the session + require.Equal(t, tt.appAddress, session.Application.Address) + require.Equal(t, tt.serviceId, session.Header.Service.Id) + require.Len(t, session.Suppliers, tt.expectedNumSuppliers) + }) + } +} diff --git a/x/session/module/query_params.go b/x/session/module/query_params.go new file mode 100644 index 000000000..38db81a74 --- /dev/null +++ b/x/session/module/query_params.go @@ -0,0 +1,36 @@ +package session + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/session/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/session/module/simulation.go b/x/session/module/simulation.go new file mode 100644 index 000000000..2a654eb18 --- /dev/null +++ b/x/session/module/simulation.go @@ -0,0 +1,64 @@ +package session + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + sessionsimulation "github.com/pokt-network/poktroll/x/session/simulation" + "github.com/pokt-network/poktroll/x/session/types" +) + +// avoid unused import issue +var ( + _ = sessionsimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( +// this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + sessionGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&sessionGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/session/module/tx.go b/x/session/module/tx.go new file mode 100644 index 000000000..638661956 --- /dev/null +++ b/x/session/module/tx.go @@ -0,0 +1,31 @@ +package session + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/pokt-network/poktroll/x/session/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/session/simulation/helpers.go b/x/session/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/session/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/session/types/codec.go b/x/session/types/codec.go new file mode 100644 index 000000000..ac5526374 --- /dev/null +++ b/x/session/types/codec.go @@ -0,0 +1,17 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/session/types/errors.go b/x/session/types/errors.go new file mode 100644 index 000000000..8e6993f6f --- /dev/null +++ b/x/session/types/errors.go @@ -0,0 +1,21 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/session module sentinel errors +var ( + ErrSessionInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSessionSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrSessionHydration = sdkerrors.Register(ModuleName, 1102, "error during session hydration") + ErrSessionAppNotFound = sdkerrors.Register(ModuleName, 1103, "application for session not found not found ") + ErrSessionAppNotStakedForService = sdkerrors.Register(ModuleName, 1104, "application in session not staked for requested service") + ErrSessionSuppliersNotFound = sdkerrors.Register(ModuleName, 1105, "no suppliers not found for session") + ErrSessionInvalidAppAddress = sdkerrors.Register(ModuleName, 1106, "invalid application address for session") + ErrSessionInvalidService = sdkerrors.Register(ModuleName, 1107, "invalid service in session") + ErrSessionInvalidBlockHeight = sdkerrors.Register(ModuleName, 1108, "invalid block height for session") + ErrSessionInvalidSessionId = sdkerrors.Register(ModuleName, 1109, "invalid sessionId") +) diff --git a/x/session/types/expected_keepers.go b/x/session/types/expected_keepers.go new file mode 100644 index 000000000..7d06db3bc --- /dev/null +++ b/x/session/types/expected_keepers.go @@ -0,0 +1,37 @@ +package types + +//go:generate mockgen -destination ../../../testutil/session/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + apptypes "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // only used for simulation +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins +} + +// ApplicationKeeper defines the expected application keeper to retrieve applications +type ApplicationKeeper interface { + GetApplication(ctx context.Context, address string) (app apptypes.Application, found bool) +} + +type SupplierKeeper interface { + GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Supplier) +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/session/types/genesis.go b/x/session/types/genesis.go new file mode 100644 index 000000000..0af9b4416 --- /dev/null +++ b/x/session/types/genesis.go @@ -0,0 +1,24 @@ +package types + +import ( +// this line is used by starport scaffolding # genesis/types/import +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/session/types/key_block_hash.go b/x/session/types/key_block_hash.go new file mode 100644 index 000000000..56472742a --- /dev/null +++ b/x/session/types/key_block_hash.go @@ -0,0 +1,24 @@ +package types + +import ( + "encoding/binary" + fmt "fmt" +) + +var _ binary.ByteOrder + +const ( + // BlockHashKeyPrefix is the prefix to retrieve all BlockHash + BlockHashKeyPrefix = "BlockHash/value/" +) + +// BlockHashKey returns the store key to retrieve a BlockHash from the index fields +func BlockHashKey(blockHeight int64) []byte { + var key []byte + + serviceIDBz := []byte(fmt.Sprintf("%d", blockHeight)) + key = append(key, serviceIDBz...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/session/types/keys.go b/x/session/types/keys.go new file mode 100644 index 000000000..c798c9a12 --- /dev/null +++ b/x/session/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "session" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_session" +) + +var ( + ParamsKey = []byte("p_session") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/session/types/msg_update_params.go b/x/session/types/msg_update_params.go new file mode 100644 index 000000000..aeed4a633 --- /dev/null +++ b/x/session/types/msg_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/session/types/params.go b/x/session/types/params.go new file mode 100644 index 000000000..4f3215e35 --- /dev/null +++ b/x/session/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/session/types/query_get_session_request.go b/x/session/types/query_get_session_request.go new file mode 100644 index 000000000..3c7b754d3 --- /dev/null +++ b/x/session/types/query_get_session_request.go @@ -0,0 +1,39 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// NOTE: Please note that `QueryGetSessionRequest` is not a `sdk.Msg`, and is therefore not a message/request +// that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern +// allows us to localize & reuse validation logic. +func NewQueryGetSessionRequest(appAddress, serviceId string, blockHeight int64) *QueryGetSessionRequest { + return &QueryGetSessionRequest{ + ApplicationAddress: appAddress, + Service: &sharedtypes.Service{ + Id: serviceId, + }, + BlockHeight: blockHeight, + } +} + +func (query *QueryGetSessionRequest) ValidateBasic() error { + // Validate the application address + if _, err := sdk.AccAddressFromBech32(query.ApplicationAddress); err != nil { + return ErrSessionInvalidAppAddress.Wrapf("invalid app address for session being retrieved %s; (%v)", query.ApplicationAddress, err) + } + + // Validate the Service ID + if !sharedhelpers.IsValidService(query.Service) { + return ErrSessionInvalidService.Wrapf("invalid service for session being retrieved %s;", query.Service) + } + + // Validate the height for which a session is being retrieved + if query.BlockHeight < 0 { // Note that `0` defaults to the latest height rather than genesis + return ErrSessionInvalidBlockHeight.Wrapf("invalid block height for session being retrieved %d;", query.BlockHeight) + } + return nil +} diff --git a/x/session/types/types.go b/x/session/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/session/types/types.go @@ -0,0 +1 @@ +package types diff --git a/x/shared/helpers/service.go b/x/shared/helpers/service.go new file mode 100644 index 000000000..9825f26d4 --- /dev/null +++ b/x/shared/helpers/service.go @@ -0,0 +1,86 @@ +package helpers + +import ( + "net/url" + "regexp" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +const ( + maxServiceIdLength = 8 // Limiting all serviceIds to 8 characters + maxServiceIdName = 42 // Limit the the name of the + + regexServiceId = "^[a-zA-Z0-9_-]+$" // Define the regex pattern to match allowed characters + regexServiceName = "^[a-zA-Z0-9-_ ]+$" // Define the regex pattern to match allowed characters (allows spaces) +) + +var ( + regexExprServiceId *regexp.Regexp + regexExprServiceName *regexp.Regexp +) + +func init() { + // Compile the regex pattern + regexExprServiceId = regexp.MustCompile(regexServiceId) + regexExprServiceName = regexp.MustCompile(regexServiceName) + +} + +// IsValidService checks if the provided ServiceId struct has valid fields +func IsValidService(service *sharedtypes.Service) bool { + // Check if service Id and Name are valid using the provided helper functions + return service != nil && + IsValidServiceId(service.Id) && + IsValidServiceName(service.Name) +} + +// IsValidServiceId checks if the input string is a valid serviceId +func IsValidServiceId(serviceId string) bool { + // ServiceId CANNOT be empty + if len(serviceId) == 0 { + return false + } + + if len(serviceId) > maxServiceIdLength { + return false + } + + // Use the regex to match against the input string + return regexExprServiceId.MatchString(serviceId) +} + +// IsValidServiceName checks if the input string is a valid serviceName +func IsValidServiceName(serviceName string) bool { + // ServiceName CAN be empty + if len(serviceName) == 0 { + return true + } + + if len(serviceName) > maxServiceIdName { + return false + } + + // Use the regex to match against the input string + return regexExprServiceName.MatchString(serviceName) +} + +// IsValidEndpointUrl checks if the provided string is a valid URL. +func IsValidEndpointUrl(endpoint string) bool { + u, err := url.Parse(endpoint) + if err != nil { + return false + } + + // Check if scheme is http or https + if u.Scheme != "http" && u.Scheme != "https" { + return false + } + + // Ensure the URL has a host + if u.Host == "" { + return false + } + + return true +} diff --git a/x/shared/helpers/service_configs.go b/x/shared/helpers/service_configs.go new file mode 100644 index 000000000..95335d058 --- /dev/null +++ b/x/shared/helpers/service_configs.go @@ -0,0 +1,81 @@ +package helpers + +import ( + "fmt" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// ValidateAppServiceConfigs returns an error if any of the application service configs are invalid +func ValidateAppServiceConfigs(services []*sharedtypes.ApplicationServiceConfig) error { + if len(services) == 0 { + return fmt.Errorf("no services configs provided for application: %v", services) + } + for _, serviceConfig := range services { + if serviceConfig == nil { + return fmt.Errorf("serviceConfig cannot be nil: %v", services) + } + // Check the Service + if !IsValidService(serviceConfig.Service) { + return fmt.Errorf("invalid service: %v", serviceConfig.Service) + } + } + return nil +} + +// ValidateSupplierServiceConfigs returns an error if any of the supplier service configs are invalid +func ValidateSupplierServiceConfigs(services []*sharedtypes.SupplierServiceConfig) error { + if len(services) == 0 { + return fmt.Errorf("no services provided for supplier: %v", services) + } + for _, serviceConfig := range services { + if serviceConfig == nil { + return fmt.Errorf("serviceConfig cannot be nil: %v", services) + } + + // Check the Service + if !IsValidService(serviceConfig.Service) { + return fmt.Errorf("invalid service: %v", serviceConfig.Service) + } + + // Check the Endpoints + if serviceConfig.Endpoints == nil { + return fmt.Errorf("endpoints cannot be nil: %v", serviceConfig) + } + if len(serviceConfig.Endpoints) == 0 { + return fmt.Errorf("endpoints must have at least one entry: %v", serviceConfig) + } + + // Check each endpoint + for _, endpoint := range serviceConfig.Endpoints { + if endpoint == nil { + return fmt.Errorf("endpoint cannot be nil: %v", serviceConfig) + } + + // Validate the URL + if endpoint.Url == "" { + return fmt.Errorf("endpoint.Url cannot be empty: %v", serviceConfig) + } + if !IsValidEndpointUrl(endpoint.Url) { + return fmt.Errorf("invalid endpoint.Url: %v", serviceConfig) + } + + // Validate the RPC type + if endpoint.RpcType == sharedtypes.RPCType_UNKNOWN_RPC { + return fmt.Errorf("endpoint.RpcType cannot be UNKNOWN_RPC: %v", serviceConfig) + } + if _, ok := sharedtypes.RPCType_name[int32(endpoint.RpcType)]; !ok { + return fmt.Errorf("endpoint.RpcType is not a valid RPCType: %v", serviceConfig) + } + + // TODO: Validate configs once they are being used + // if endpoint.Configs == nil { + // return fmt.Errorf("endpoint.Configs cannot be nil: %v", serviceConfig) + // } + // if len(endpoint.Configs) == 0 { + // return fmt.Errorf("endpoint.Configs must have at least one entry: %v", serviceConfig) + // } + } + } + return nil +} diff --git a/x/shared/helpers/service_test.go b/x/shared/helpers/service_test.go new file mode 100644 index 000000000..e3dcf57d6 --- /dev/null +++ b/x/shared/helpers/service_test.go @@ -0,0 +1,261 @@ +package helpers + +import ( + "testing" + + "github.com/stretchr/testify/require" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestIsValidService(t *testing.T) { + tests := []struct { + desc string + + serviceId string + serviceName string + + expectedIsValid bool + }{ + { + desc: "Valid ID and Name", + + serviceId: "Service1", + serviceName: "Valid Service Name", + + expectedIsValid: true, + }, + { + desc: "Valid ID and empty Name", + + serviceId: "svc", + serviceName: "", // Valid because the service name can be empty + + expectedIsValid: true, + }, + { + desc: "ID exceeds max length", + + serviceId: "TooLongId123", // Exceeds maxServiceIdLength + serviceName: "Valid Name", + + expectedIsValid: false, + }, + { + desc: "Name exceeds max length", + + serviceId: "ValidID", + serviceName: "This service name is way too long to be considered valid since it exceeds the max length", + + expectedIsValid: false, + }, + { + desc: "Empty ID is invalid", + + serviceId: "", // Invalid because the service ID cannot be empty + serviceName: "Valid Name", + + expectedIsValid: false, + }, + { + desc: "Invalid characters in ID", + + serviceId: "ID@Invalid", // Invalid character '@' + serviceName: "Valid Name", + + expectedIsValid: false, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + service := &sharedtypes.Service{ + Id: test.serviceId, + Name: test.serviceName, + } + result := IsValidService(service) + require.Equal(t, test.expectedIsValid, result) + }) + } +} + +func TestIsValidServiceName(t *testing.T) { + tests := []struct { + desc string + input string + expected bool + }{ + { + desc: "Valid with hyphen and number", + input: "ValidName-1", + expected: true, + }, + { + desc: "Valid with space and underscore", + input: "Valid Name_1", + expected: true, + }, + { + desc: "Valid name with spaces", + input: "valid name with spaces", + expected: true, + }, + { + desc: "Invalid character '@'", + input: "invalid@name", + expected: false, + }, + { + desc: "Invalid character '.'", + input: "Valid.Name", + expected: false, + }, + { + desc: "Empty string", + input: "", + expected: true, + }, + { + desc: "Exceeds maximum length", + input: "validnamebuttoolongvalidnamebuttoolongvalidnamebuttoolong", + expected: false, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + result := IsValidServiceName(test.input) + require.Equal(t, test.expected, result) + }) + } +} + +func TestIsValidServiceId(t *testing.T) { + tests := []struct { + desc string + + input string + expected bool + }{ + { + desc: "Valid alphanumeric with hyphen", + + input: "Hello-1", + expected: true, + }, + { + desc: "Valid alphanumeric with underscore", + + input: "Hello_2", + expected: true, + }, + { + desc: "Exceeds maximum length", + + input: "hello-world", + expected: false, // exceeds maxServiceIdLength + }, + { + desc: "Contains invalid character '@'", + + input: "Hello@", + expected: false, // contains invalid character '@' + }, + { + desc: "All uppercase", + + input: "HELLO", + expected: true, + }, + { + desc: "Maximum length boundary", + + input: "12345678", + expected: true, // exactly maxServiceIdLength + }, + { + desc: "Above maximum length boundary", + + input: "123456789", + expected: false, // exceeds maxServiceIdLength + }, + { + desc: "Contains invalid character '.'", + + input: "Hello.World", + expected: false, // contains invalid character '.' + }, + { + desc: "Empty string", + + input: "", + expected: false, // empty string + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + result := IsValidServiceId(test.input) + require.Equal(t, test.expected, result) + }) + } +} + +func TestIsValidEndpointUrl(t *testing.T) { + tests := []struct { + desc string + + input string + expected bool + }{ + { + desc: "valid http URL", + + input: "http://example.com", + expected: true, + }, + { + desc: "valid https URL", + + input: "https://example.com/path?query=value#fragment", + expected: true, + }, + { + desc: "valid localhost URL with scheme", + + input: "https://localhost:8081", + expected: true, + }, + { + desc: "valid loopback URL with scheme", + + input: "http://127.0.0.1:8081", + expected: true, + }, + { + desc: "invalid scheme", + + input: "ftp://example.com", + expected: false, + }, + { + desc: "missing scheme", + + input: "example.com", + expected: false, + }, + { + desc: "invalid URL", + + input: "not-a-valid-url", + expected: false, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + got := IsValidEndpointUrl(tt.input) + require.Equal(t, tt.expected, got) + }) + } +} diff --git a/x/shared/types/types.go b/x/shared/types/types.go new file mode 100644 index 000000000..78d9ec9f9 --- /dev/null +++ b/x/shared/types/types.go @@ -0,0 +1,3 @@ +package types + +// This file is in place to declare the package for dynamically generated protobufs diff --git a/x/supplier/config/errors.go b/x/supplier/config/errors.go new file mode 100644 index 000000000..6a0194a75 --- /dev/null +++ b/x/supplier/config/errors.go @@ -0,0 +1,15 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "supplierconfig" + ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") + ErrSupplierConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in supplier config") + ErrSupplierConfigNoEndpoints = sdkerrors.Register(codespace, 3, "no endpoints defined for serviceId in supplier config") + ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(codespace, 4, "invalid endpoint config in supplier config") + ErrSupplierConfigInvalidRPCType = sdkerrors.Register(codespace, 5, "invalid rpc type in supplier config") + ErrSupplierConfigInvalidURL = sdkerrors.Register(codespace, 6, "invalid endpoint url in supplier config") + ErrSupplierConfigEmptyContent = sdkerrors.Register(codespace, 7, "empty supplier config content") + ErrSupplierConfigInvalidStake = sdkerrors.Register(codespace, 8, "invalid stake amount in supplier config") +) diff --git a/x/supplier/config/supplier_configs_reader.go b/x/supplier/config/supplier_configs_reader.go new file mode 100644 index 000000000..de9549553 --- /dev/null +++ b/x/supplier/config/supplier_configs_reader.go @@ -0,0 +1,192 @@ +package config + +import ( + "net/url" + + sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" + + sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// YAMLStakeConfig is the structure describing the supplier stake config file +type YAMLStakeConfig struct { + StakeAmount string `yaml:"stake_amount"` + Services []*YAMLStakeService `yaml:"services"` +} + +// YAMLStakeService is the structure describing a single service stake entry in the stake config file +type YAMLStakeService struct { + ServiceId string `yaml:"service_id"` + Endpoints []YAMLServiceEndpoint `yaml:"endpoints"` +} + +// YAMLServiceEndpoint is the structure describing a single service endpoint in the stake config file +type YAMLServiceEndpoint struct { + Url string `yaml:"url"` + RPCType string `yaml:"rpc_type"` + Config map[string]string `yaml:"config,omitempty"` +} + +// SupplierStakeConfig is the structure describing the parsed supplier stake config +type SupplierStakeConfig struct { + StakeAmount sdk.Coin + Services []*sharedtypes.SupplierServiceConfig +} + +// ParseSupplierServiceConfig parses the stake config file into a SupplierServiceConfig +func ParseSupplierConfigs(configContent []byte) (*SupplierStakeConfig, error) { + var stakeConfig *YAMLStakeConfig + + if len(configContent) == 0 { + return nil, ErrSupplierConfigEmptyContent + } + + // Unmarshal the stake config file into a stakeConfig + if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { + return nil, ErrSupplierConfigUnmarshalYAML.Wrapf("%s", err) + } + + // Validate the stake amount + if len(stakeConfig.StakeAmount) == 0 { + return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be empty") + } + + stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) + if err != nil { + return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) + } + + if err := stakeAmount.Validate(); err != nil { + return nil, ErrSupplierConfigInvalidStake.Wrap(err.Error()) + } + + if stakeAmount.IsZero() { + return nil, ErrSupplierConfigInvalidStake.Wrap("stake amount cannot be zero") + } + + if stakeAmount.Denom != "upokt" { + return nil, ErrSupplierConfigInvalidStake.Wrapf( + "invalid stake denom, expecting: upokt, got: %s", + stakeAmount.Denom, + ) + } + + // Validate the services + if stakeConfig.Services == nil || len(stakeConfig.Services) == 0 { + return nil, ErrSupplierConfigInvalidServiceId.Wrap("serviceIds cannot be empty") + } + + // Prepare the supplierServiceConfig + supplierServiceConfig := make([]*sharedtypes.SupplierServiceConfig, 0, len(stakeConfig.Services)) + + // Populate the services slice + for _, svc := range stakeConfig.Services { + // Validate the serviceId + if !sharedhelpers.IsValidServiceId(svc.ServiceId) { + return nil, ErrSupplierConfigInvalidServiceId.Wrapf("%s", svc.ServiceId) + } + + if len(svc.Endpoints) == 0 { + return nil, ErrSupplierConfigNoEndpoints.Wrapf("%s", svc.ServiceId) + } + + // Create a supplied service config with the serviceId + service := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{Id: svc.ServiceId}, + Endpoints: []*sharedtypes.SupplierEndpoint{}, + } + + // Iterate over the service endpoints and add their parsed representation to the supplied service config + for _, endpoint := range svc.Endpoints { + parsedEndpointEntry, err := parseEndpointEntry(endpoint) + if err != nil { + return nil, err + } + service.Endpoints = append(service.Endpoints, parsedEndpointEntry) + } + supplierServiceConfig = append(supplierServiceConfig, service) + } + + return &SupplierStakeConfig{ + StakeAmount: stakeAmount, + Services: supplierServiceConfig, + }, nil +} + +func parseEndpointEntry(endpoint YAMLServiceEndpoint) (*sharedtypes.SupplierEndpoint, error) { + endpointEntry := &sharedtypes.SupplierEndpoint{} + var err error + + // Endpoint URL + if endpointEntry.Url, err = validateEndpointURL(endpoint); err != nil { + return nil, err + } + + // Endpoint config + if endpointEntry.Configs, err = parseEndpointConfigs(endpoint); err != nil { + return nil, err + } + + // Endpoint RPC type + if endpointEntry.RpcType, err = parseEndpointRPCType(endpoint); err != nil { + return nil, err + } + + return endpointEntry, nil +} + +// validateEndpointURL validates the endpoint URL, making sure that the string provided is a valid URL +func validateEndpointURL(endpoint YAMLServiceEndpoint) (string, error) { + // Validate the endpoint URL + if _, err := url.Parse(endpoint.Url); err != nil { + return "", ErrSupplierConfigInvalidURL.Wrapf("%s", err) + } + + return endpoint.Url, nil +} + +// parseEndpointConfigs parses the endpoint config entries into a slice of ConfigOption +// compatible with the SupplierEndpointConfig. +// It accepts a nil config entry or a map of valid config keys. +func parseEndpointConfigs(endpoint YAMLServiceEndpoint) ([]*sharedtypes.ConfigOption, error) { + // Prepare the endpoint configs slice + endpointConfigs := []*sharedtypes.ConfigOption{} + + // If we have an endpoint config entry, parse it into a slice of ConfigOption + if endpoint.Config == nil { + return endpointConfigs, nil + } + + // Iterate over the endpoint config entries and add them to the slice of ConfigOption + for key, value := range endpoint.Config { + var configKey sharedtypes.ConfigOptions + + // Make sure the config key is valid + switch key { + case "timeout": + configKey = sharedtypes.ConfigOptions_TIMEOUT + default: + return nil, ErrSupplierConfigInvalidEndpointConfig.Wrapf("%s", key) + } + + config := &sharedtypes.ConfigOption{ + Key: configKey, + Value: value, + } + endpointConfigs = append(endpointConfigs, config) + } + + return endpointConfigs, nil +} + +// parseEndpointRPCType parses the endpoint RPC type into a sharedtypes.RPCType +func parseEndpointRPCType(endpoint YAMLServiceEndpoint) (sharedtypes.RPCType, error) { + switch endpoint.RPCType { + case "json_rpc": + return sharedtypes.RPCType_JSON_RPC, nil + default: + return sharedtypes.RPCType_UNKNOWN_RPC, ErrSupplierConfigInvalidRPCType.Wrapf("%s", endpoint.RPCType) + } +} diff --git a/x/supplier/config/supplier_configs_reader_test.go b/x/supplier/config/supplier_configs_reader_test.go new file mode 100644 index 000000000..d912156be --- /dev/null +++ b/x/supplier/config/supplier_configs_reader_test.go @@ -0,0 +1 @@ +package config diff --git a/x/supplier/keeper/keeper.go b/x/supplier/keeper/keeper.go new file mode 100644 index 000000000..ef87b8f4d --- /dev/null +++ b/x/supplier/keeper/keeper.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + bankKeeper types.BankKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + bankKeeper: bankKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/supplier/keeper/msg_server.go b/x/supplier/keeper/msg_server.go new file mode 100644 index 000000000..83879071c --- /dev/null +++ b/x/supplier/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/supplier/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go new file mode 100644 index 000000000..d99447da1 --- /dev/null +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -0,0 +1,103 @@ +package keeper + +import ( + "context" + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "StakeSupplier") + logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) + return nil, err + } + + // Check if the supplier already exists or not + var err error + var coinsToDelegate sdk.Coin + supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) + if !isSupplierFound { + logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) + supplier = k.createSupplier(ctx, msg) + coinsToDelegate = *msg.Stake + } else { + logger.Info(fmt.Sprintf("Supplier found. Updating supplier for address %s", msg.Address)) + currSupplierStake := *supplier.Stake + if err = k.updateSupplier(ctx, &supplier, msg); err != nil { + return nil, err + } + coinsToDelegate = (*msg.Stake).Sub(currSupplierStake) + } + + // Retrieve the address of the supplier + supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? + // Send the coins from the supplier to the staked supplier pool + err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, supplierAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, supplierAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Supplier in the store + k.SetSupplier(ctx, supplier) + logger.Info(fmt.Sprintf("Successfully updated supplier stake for supplier: %+v", supplier)) + + return &types.MsgStakeSupplierResponse{}, nil +} + +func (k msgServer) createSupplier( + ctx sdk.Context, + msg *types.MsgStakeSupplier, +) sharedtypes.Supplier { + return sharedtypes.Supplier{ + Address: msg.Address, + Stake: msg.Stake, + Services: msg.Services, + } +} + +func (k msgServer) updateSupplier( + ctx sdk.Context, + supplier *sharedtypes.Supplier, + msg *types.MsgStakeSupplier, +) error { + // Checks if the the msg address is the same as the current owner + if msg.Address != supplier.Address { + return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) + } + + // Validate that the stake is not being lowered + if msg.Stake == nil { + return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") + } + if msg.Stake.IsLTE(*supplier.Stake) { + + return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) + } + supplier.Stake = msg.Stake + + // Validate that the service configs maintain at least one service. + // Additional validation is done in `msg.ValidateBasic` above. + if len(msg.Services) == 0 { + return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") + } + supplier.Services = msg.Services + + return nil +} diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go new file mode 100644 index 000000000..c97ee5558 --- /dev/null +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -0,0 +1,235 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) + wctx := sdk.WrapSDKContext(ctx) + + // Generate an address for the supplier + addr := sample.AccAddress() + + // Verify that the supplier does not exist yet + _, isSupplierFound := k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) + + // Prepare the stakeMsg + stakeMsg := &types.MsgStakeSupplier{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } + + // Stake the supplier + _, err := srv.StakeSupplier(wctx, stakeMsg) + require.NoError(t, err) + + // Verify that the supplier exists + supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + require.Equal(t, addr, supplierFound.Address) + require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) + require.Len(t, supplierFound.Services, 1) + require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) + require.Len(t, supplierFound.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) + + // Prepare an updated supplier with a higher stake and a different URL for the service + updateMsg := &types.MsgStakeSupplier{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } + + // Update the staked supplier + _, err = srv.StakeSupplier(wctx, updateMsg) + require.NoError(t, err) + supplierFound, isSupplierFound = k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + require.Equal(t, int64(200), supplierFound.Stake.Amount.Int64()) + require.Len(t, supplierFound.Services, 1) + require.Equal(t, "svcId2", supplierFound.Services[0].Service.Id) + require.Len(t, supplierFound.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8082", supplierFound.Services[0].Endpoints[0].Url) +} + +func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + supplierAddr := sample.AccAddress() + + // Prepare the supplier stake message + stakeMsg := &types.MsgStakeSupplier{ + Address: supplierAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } + + // Stake the supplier + _, err := srv.StakeSupplier(ctx, stakeMsg) + require.NoError(t, err) + + // Prepare the supplier stake message without any service endpoints + updateStakeMsg := &types.MsgStakeSupplier{ + Address: supplierAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svcId"}, + Endpoints: []*sharedtypes.SupplierEndpoint{}, + }, + }, + } + + // Fail updating the supplier when the list of service endpoints is empty + _, err = srv.StakeSupplier(ctx, updateStakeMsg) + require.Error(t, err) + + // Verify the supplierFound still exists and is staked for svc1 + supplierFound, isSupplierFound := k.GetSupplier(ctx, supplierAddr) + require.True(t, isSupplierFound) + require.Equal(t, supplierAddr, supplierFound.Address) + require.Len(t, supplierFound.Services, 1) + require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) + require.Len(t, supplierFound.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) + + // Prepare the supplier stake message with an invalid service ID + updateStakeMsg = &types.MsgStakeSupplier{ + Address: supplierAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, + }, + }, + } + + // Fail updating the supplier when the list of services is empty + _, err = srv.StakeSupplier(ctx, updateStakeMsg) + require.Error(t, err) + + // Verify the supplier still exists and is staked for svc1 + supplierFound, isSupplierFound = k.GetSupplier(ctx, supplierAddr) + require.True(t, isSupplierFound) + require.Equal(t, supplierAddr, supplierFound.Address) + require.Len(t, supplierFound.Services, 1) + require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) + require.Len(t, supplierFound.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) +} + +func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Prepare the supplier + addr := sample.AccAddress() + stakeMsg := &types.MsgStakeSupplier{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } + + // Stake the supplier & verify that the supplier exists + _, err := srv.StakeSupplier(ctx, stakeMsg) + require.NoError(t, err) + _, isSupplierFound := k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + + // Prepare an updated supplier with a lower stake + updateMsg := &types.MsgStakeSupplier{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } + + // Verify that it fails + _, err = srv.StakeSupplier(ctx, updateMsg) + require.Error(t, err) + + // Verify that the supplier stake is unchanged + supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) + require.Len(t, supplierFound.Services, 1) +} diff --git a/x/supplier/keeper/msg_server_test.go b/x/supplier/keeper/msg_server_test.go new file mode 100644 index 000000000..480dd0262 --- /dev/null +++ b/x/supplier/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.SupplierKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go new file mode 100644 index 000000000..41f3de736 --- /dev/null +++ b/x/supplier/keeper/msg_server_unstake_supplier.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func (k msgServer) UnstakeSupplier( + goCtx context.Context, + msg *types.MsgUnstakeSupplier, +) (*types.MsgUnstakeSupplierResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + logger := k.Logger().With("method", "UnstakeSupplier") + logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // Check if the supplier already exists or not + supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) + if !isSupplierFound { + logger.Info(fmt.Sprintf("Supplier not found. Cannot unstake address %s", msg.Address)) + return nil, types.ErrSupplierNotFound + } + logger.Info(fmt.Sprintf("Supplier found. Unstaking supplier for address %s", msg.Address)) + + // Retrieve the address of the supplier + supplierAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // Send the coins from the supplier pool back to the supplier + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", supplier.Stake, supplierAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Supplier in the store + k.RemoveSupplier(ctx, supplierAddress.String()) + logger.Info(fmt.Sprintf("Successfully removed the supplier: %+v", supplier)) + return &types.MsgUnstakeSupplierResponse{}, nil + +} diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go new file mode 100644 index 000000000..c3b9d9144 --- /dev/null +++ b/x/supplier/keeper/msg_server_unstake_supplier_test.go @@ -0,0 +1,89 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the supplier + addr := sample.AccAddress() + + // Verify that the supplier does not exist yet + _, isSupplierFound := k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) + + // Prepare the supplier + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + stakeMsg := &types.MsgStakeSupplier{ + Address: addr, + Stake: &initialStake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + } + + // Stake the supplier + _, err := srv.StakeSupplier(ctx, stakeMsg) + require.NoError(t, err) + + // Verify that the supplier exists + foundSupplier, isSupplierFound := k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + require.Equal(t, addr, foundSupplier.Address) + require.Equal(t, initialStake.Amount, foundSupplier.Stake.Amount) + require.Len(t, foundSupplier.Services, 1) + + // Unstake the supplier + unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} + _, err = srv.UnstakeSupplier(ctx, unstakeMsg) + require.NoError(t, err) + + // Make sure the supplier can no longer be found after unstaking + _, isSupplierFound = k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) +} + +func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the supplier + addr := sample.AccAddress() + + // Verify that the supplier does not exist yet + _, isSupplierFound := k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) + + // Unstake the supplier + unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} + _, err := srv.UnstakeSupplier(ctx, unstakeMsg) + require.Error(t, err) + require.ErrorIs(t, err, types.ErrSupplierNotFound) + + _, isSupplierFound = k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) +} diff --git a/x/supplier/keeper/msg_update_params.go b/x/supplier/keeper/msg_update_params.go new file mode 100644 index 000000000..01aaace7c --- /dev/null +++ b/x/supplier/keeper/msg_update_params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/supplier/keeper/msg_update_params_test.go b/x/supplier/keeper/msg_update_params_test.go new file mode 100644 index 000000000..2e179b220 --- /dev/null +++ b/x/supplier/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/supplier/keeper/params.go b/x/supplier/keeper/params.go new file mode 100644 index 000000000..6e3162e05 --- /dev/null +++ b/x/supplier/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go new file mode 100644 index 000000000..dac4b01a1 --- /dev/null +++ b/x/supplier/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/supplier/keeper/query.go b/x/supplier/keeper/query.go new file mode 100644 index 000000000..2d1d5c18e --- /dev/null +++ b/x/supplier/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/supplier/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/supplier/keeper/query_params.go b/x/supplier/keeper/query_params.go new file mode 100644 index 000000000..67e2a17f4 --- /dev/null +++ b/x/supplier/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/supplier/keeper/query_params_test.go b/x/supplier/keeper/query_params_test.go new file mode 100644 index 000000000..e9014f7b7 --- /dev/null +++ b/x/supplier/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := keepertest.SupplierKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go new file mode 100644 index 000000000..d364ede93 --- /dev/null +++ b/x/supplier/keeper/query_supplier.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRequest) (*types.QueryAllSuppliersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var suppliers []sharedtypes.Supplier + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) + + pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { + var supplier sharedtypes.Supplier + if err := k.cdc.Unmarshal(value, &supplier); err != nil { + return err + } + + suppliers = append(suppliers, supplier) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllSuppliersResponse{Supplier: suppliers, Pagination: pageRes}, nil +} + +func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + supplier, found := k.GetSupplier( + ctx, + req.Address, + ) + if !found { + // TODO_TECHDEBT(#181): conform to logging conventions once established + msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) + return nil, status.Error(codes.NotFound, msg) + } + + return &types.QueryGetSupplierResponse{Supplier: supplier}, nil +} diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go new file mode 100644 index 000000000..ca80180c3 --- /dev/null +++ b/x/supplier/keeper/query_supplier_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestSupplierQuerySingle(t *testing.T) { + keeper, ctx := keepertest.SupplierKeeper(t) + suppliers := createNSupplier(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetSupplierRequest + response *types.QueryGetSupplierResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetSupplierRequest{ + Address: suppliers[0].Address, + }, + response: &types.QueryGetSupplierResponse{Supplier: suppliers[0]}, + }, + { + desc: "Second", + request: &types.QueryGetSupplierRequest{ + Address: suppliers[1].Address, + }, + response: &types.QueryGetSupplierResponse{Supplier: suppliers[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetSupplierRequest{ + Address: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "supplier with address \"100000\""), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Supplier(ctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestSupplierQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.SupplierKeeper(t) + msgs := createNSupplier(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSuppliersRequest { + return &types.QueryAllSuppliersRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.AllSuppliers(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Supplier), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Supplier), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.AllSuppliers(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Supplier), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Supplier), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.AllSuppliers(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Supplier), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.AllSuppliers(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go new file mode 100644 index 000000000..9f2ba9eb3 --- /dev/null +++ b/x/supplier/keeper/supplier.go @@ -0,0 +1,72 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// SetSupplier set a specific supplier in the store from its index +func (k Keeper) SetSupplier(ctx context.Context, supplier sharedtypes.Supplier) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) + supplierBz := k.cdc.MustMarshal(&supplier) + store.Set(types.SupplierKey( + supplier.Address, + ), supplierBz) +} + +// GetSupplier returns a supplier from its index +func (k Keeper) GetSupplier( + ctx context.Context, + address string, + +) (supplier sharedtypes.Supplier, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) + + supplierBz := store.Get(types.SupplierKey( + address, + )) + if supplierBz == nil { + return supplier, false + } + + k.cdc.MustUnmarshal(supplierBz, &supplier) + return supplier, true +} + +// RemoveSupplier removes a supplier from the store +func (k Keeper) RemoveSupplier( + ctx context.Context, + address string, + +) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) + store.Delete(types.SupplierKey( + address, + )) +} + +// GetAllSupplier returns all supplier +func (k Keeper) GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Supplier) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var supplier sharedtypes.Supplier + k.cdc.MustUnmarshal(iterator.Value(), &supplier) + suppliers = append(suppliers, supplier) + } + + return +} diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go new file mode 100644 index 000000000..28e324e07 --- /dev/null +++ b/x/supplier/keeper/supplier_test.go @@ -0,0 +1,97 @@ +package keeper_test + +import ( + "context" + "fmt" + "strconv" + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func init() { + cmd.InitSDKConfig() +} + +func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Supplier { + suppliers := make([]sharedtypes.Supplier, n) + for i := range suppliers { + supplier := &suppliers[i] + supplier.Address = sample.AccAddress() + supplier.Stake = &sdk.Coin{Denom: "upokt", Amount: math.NewInt(int64(i))} + supplier.Services = []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{Id: fmt.Sprintf("svc%d", i)}, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: fmt.Sprintf("http://localhost:%d", i), + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + } + keeper.SetSupplier(ctx, *supplier) + } + + return suppliers +} + +func TestSupplierGet(t *testing.T) { + keeper, ctx := keepertest.SupplierKeeper(t) + suppliers := createNSupplier(keeper, ctx, 10) + for _, supplier := range suppliers { + supplierFound, isSupplierFound := keeper.GetSupplier(ctx, + supplier.Address, + ) + require.True(t, isSupplierFound) + require.Equal(t, + nullify.Fill(&supplier), + nullify.Fill(&supplierFound), + ) + } +} + +func TestSupplierRemove(t *testing.T) { + keeper, ctx := keepertest.SupplierKeeper(t) + suppliers := createNSupplier(keeper, ctx, 10) + for _, supplier := range suppliers { + keeper.RemoveSupplier(ctx, + supplier.Address, + ) + _, isSupplierFound := keeper.GetSupplier(ctx, + supplier.Address, + ) + require.False(t, isSupplierFound) + } +} + +func TestSupplierGetAll(t *testing.T) { + keeper, ctx := keepertest.SupplierKeeper(t) + suppliers := createNSupplier(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(suppliers), + nullify.Fill(keeper.GetAllSupplier(ctx)), + ) +} + +// The application module address is derived off of its semantic name. +// This test is a helper for us to easily identify the underlying address. +func TestApplicationModuleAddress(t *testing.T) { + moduleAddress := authtypes.NewModuleAddress(types.ModuleName) + require.Equal(t, "pokt1j40dzzmn6cn9kxku7a5tjnud6hv37vesr5ccaa", moduleAddress.String()) +} diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go new file mode 100644 index 000000000..ec75e7031 --- /dev/null +++ b/x/supplier/module/autocli.go @@ -0,0 +1,58 @@ +package supplier + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/supplier" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + { + RpcMethod: "AllSuppliers", + Use: "list-supplier", + Short: "List all supplier", + }, + { + RpcMethod: "Supplier", + Use: "show-supplier [id]", + Short: "Shows a supplier", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + { + RpcMethod: "StakeSupplier", + Use: "stake-supplier [stake] [services]", + Short: "Send a stake-supplier tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, + }, + { + RpcMethod: "UnstakeSupplier", + Use: "unstake-supplier", + Short: "Send a unstake-supplier tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/supplier/module/genesis.go b/x/supplier/module/genesis.go new file mode 100644 index 000000000..f0a857fe4 --- /dev/null +++ b/x/supplier/module/genesis.go @@ -0,0 +1,29 @@ +package supplier + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the supplier + for _, elem := range genState.SupplierList { + k.SetSupplier(ctx, elem) + } + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.SupplierList = k.GetAllSupplier(ctx) + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/supplier/module/genesis_test.go b/x/supplier/module/genesis_test.go new file mode 100644 index 000000000..408ac8710 --- /dev/null +++ b/x/supplier/module/genesis_test.go @@ -0,0 +1,72 @@ +package supplier_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + SupplierList: []sharedtypes.Supplier{ + { + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + { + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + }, + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.SupplierKeeper(t) + supplier.InitGenesis(ctx, k, genesisState) + got := supplier.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.SupplierList, got.SupplierList) + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/supplier/module/helpers_test.go b/x/supplier/module/helpers_test.go new file mode 100644 index 000000000..19f64b683 --- /dev/null +++ b/x/supplier/module/helpers_test.go @@ -0,0 +1,28 @@ +package supplier_test + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/network" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// networkWithSupplierObjects creates a new network with a given number of supplier objects. +// It returns the network and a slice of the created supplier objects. +func networkWithSupplierObjects(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier) { + t.Helper() + + cfg := network.DefaultConfig() + supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) + buf, err := cfg.Codec.MarshalJSON(supplierGenesisState) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), supplierGenesisState.SupplierList +} diff --git a/x/supplier/module/module.go b/x/supplier/module/module.go new file mode 100644 index 000000000..6cb134ae6 --- /dev/null +++ b/x/supplier/module/module.go @@ -0,0 +1,215 @@ +package supplier + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper +} + +type ModuleOutputs struct { + depinject.Out + + SupplierKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{SupplierKeeper: k, Module: m} +} diff --git a/x/supplier/module/query.go b/x/supplier/module/query.go new file mode 100644 index 000000000..5fbb0b8f9 --- /dev/null +++ b/x/supplier/module/query.go @@ -0,0 +1,29 @@ +package supplier + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd() *cobra.Command { + // Group supplier queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdListSupplier()) + cmd.AddCommand(CmdShowSupplier()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/supplier/module/query_params.go b/x/supplier/module/query_params.go new file mode 100644 index 000000000..13fc6f77f --- /dev/null +++ b/x/supplier/module/query_params.go @@ -0,0 +1,36 @@ +package supplier + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/supplier/module/query_supplier.go b/x/supplier/module/query_supplier.go new file mode 100644 index 000000000..4ddaefabd --- /dev/null +++ b/x/supplier/module/query_supplier.go @@ -0,0 +1,78 @@ +package supplier + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func CmdListSupplier() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-supplier", + Short: "list all supplier", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllSuppliersRequest{ + Pagination: pageReq, + } + + res, err := queryClient.AllSuppliers(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowSupplier() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-supplier ", + Short: "shows a supplier", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + argAddress := args[0] + + params := &types.QueryGetSupplierRequest{ + Address: argAddress, + } + + res, err := queryClient.Supplier(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/supplier/module/query_supplier_test.go b/x/supplier/module/query_supplier_test.go new file mode 100644 index 000000000..1cca10675 --- /dev/null +++ b/x/supplier/module/query_supplier_test.go @@ -0,0 +1,141 @@ +package supplier_test + +import ( + "fmt" + "strconv" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/nullify" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestShowSupplier(t *testing.T) { + net, suppliers := networkWithSupplierObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idAddress string + + args []string + err error + obj sharedtypes.Supplier + }{ + { + desc: "supplier found", + idAddress: suppliers[0].Address, + + args: common, + obj: suppliers[0], + }, + { + desc: "supplier not found", + idAddress: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idAddress, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdShowSupplier(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetSupplierResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.Supplier) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.Supplier), + ) + } + }) + } +} + +func TestListSupplier(t *testing.T) { + net, suppliers := networkWithSupplierObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(suppliers); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSupplier(), args) + require.NoError(t, err) + var resp types.QueryAllSuppliersResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Supplier), step) + require.Subset(t, + nullify.Fill(suppliers), + nullify.Fill(resp.Supplier), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(suppliers); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSupplier(), args) + require.NoError(t, err) + var resp types.QueryAllSuppliersResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Supplier), step) + require.Subset(t, + nullify.Fill(suppliers), + nullify.Fill(resp.Supplier), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(suppliers)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSupplier(), args) + require.NoError(t, err) + var resp types.QueryAllSuppliersResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(suppliers), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(suppliers), + nullify.Fill(resp.Supplier), + ) + }) +} diff --git a/x/supplier/module/simulation.go b/x/supplier/module/simulation.go new file mode 100644 index 000000000..0d735d61f --- /dev/null +++ b/x/supplier/module/simulation.go @@ -0,0 +1,110 @@ +package supplier + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + suppliersimulation "github.com/pokt-network/poktroll/x/supplier/simulation" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +// avoid unused import issue +var ( + _ = suppliersimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( + opWeightMsgStakeSupplier = "op_weight_msg_stake_supplier" + // TODO: Determine the simulation weight value + defaultWeightMsgStakeSupplier int = 100 + + opWeightMsgUnstakeSupplier = "op_weight_msg_unstake_supplier" + // TODO: Determine the simulation weight value + defaultWeightMsgUnstakeSupplier int = 100 + + // this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + supplierGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&supplierGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + var weightMsgStakeSupplier int + simState.AppParams.GetOrGenerate(opWeightMsgStakeSupplier, &weightMsgStakeSupplier, nil, + func(_ *rand.Rand) { + weightMsgStakeSupplier = defaultWeightMsgStakeSupplier + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgStakeSupplier, + suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgUnstakeSupplier int + simState.AppParams.GetOrGenerate(opWeightMsgUnstakeSupplier, &weightMsgUnstakeSupplier, nil, + func(_ *rand.Rand) { + weightMsgUnstakeSupplier = defaultWeightMsgUnstakeSupplier + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnstakeSupplier, + suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgStakeSupplier, + defaultWeightMsgStakeSupplier, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + suppliersimulation.SimulateMsgStakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + simulation.NewWeightedProposalMsg( + opWeightMsgUnstakeSupplier, + defaultWeightMsgUnstakeSupplier, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/supplier/module/tx.go b/x/supplier/module/tx.go new file mode 100644 index 000000000..86a9438ae --- /dev/null +++ b/x/supplier/module/tx.go @@ -0,0 +1,37 @@ +package supplier + +import ( + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdStakeSupplier()) + cmd.AddCommand(CmdUnstakeSupplier()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/supplier/module/tx_stake_supplier.go b/x/supplier/module/tx_stake_supplier.go new file mode 100644 index 000000000..5923e06ec --- /dev/null +++ b/x/supplier/module/tx_stake_supplier.go @@ -0,0 +1,67 @@ +package supplier + +import ( + "os" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/config" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +var ( + flagStakeConfig string + _ = strconv.Itoa(0) // Part of the default ignite imports +) + +func CmdStakeSupplier() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "stake-supplier --config ", + Short: "Stake a supplier", + Long: `Stake an supplier with the provided parameters. This is a broadcast operation that +will stake the tokens and associate them with the supplier specified by the 'from' address. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, + + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, _ []string) (err error) { + configContent, err := os.ReadFile(flagStakeConfig) + if err != nil { + return err + } + + supplierStakeConfigs, err := config.ParseSupplierConfigs(configContent) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgStakeSupplier( + clientCtx.GetFromAddress().String(), + supplierStakeConfigs.StakeAmount, + supplierStakeConfigs.Services, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/supplier/module/tx_stake_supplier_test.go b/x/supplier/module/tx_stake_supplier_test.go new file mode 100644 index 000000000..e7423b0d9 --- /dev/null +++ b/x/supplier/module/tx_stake_supplier_test.go @@ -0,0 +1,297 @@ +package supplier_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/testutil/yaml" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestCLI_StakeSupplier(t *testing.T) { + net, _ := networkWithSupplierObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the supplier to be staked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + supplierAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + defaultConfig := ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + ` + + tests := []struct { + desc string + address string + config string + err *sdkerrors.Error + }{ + // Happy Paths + { + desc: "stake supplier: valid", + address: supplierAccount.Address.String(), + config: defaultConfig, + }, + + // Error Paths - Address Related + { + desc: "stake supplier: missing address", + // address: "explicitly missing", + err: types.ErrSupplierInvalidAddress, + config: defaultConfig, + }, + { + desc: "stake supplier: invalid address", + address: "invalid", + err: types.ErrSupplierInvalidAddress, + config: defaultConfig, + }, + + // Error Paths - Stake Related + { + desc: "stake supplier: missing stake", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + # explicitly omitted stake + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + { + desc: "stake supplier: invalid stake denom", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + stake_amount: 1000invalid + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + { + desc: "stake supplier: invalid stake amount (zero)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + stake_amount: 0upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + { + desc: "stake supplier: invalid stake amount (negative)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidStake, + config: ` + stake_amount: -1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + `, + }, + + // Happy Paths - Service Related + { + desc: "services_test: valid multiple services", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network:8081 + rpc_type: json_rpc + - service_id: svc2 + endpoints: + - url: http://pokt.network:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: valid localhost", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://127.0.0.1:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: valid loopback", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://localhost:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: valid without a pork", + address: supplierAccount.Address.String(), + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: http://pokt.network + rpc_type: json_rpc + `, + }, + + // Error Paths - Service Related + { + desc: "services_test: invalid services (missing argument)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + // servicesString: "explicitly omitted", + config: ` + stake_amount: 1000upokt + `, + }, + { + desc: "services_test: invalid services (empty string)", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + `, + }, + { + desc: "services_test: invalid URL", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: bad_url + rpc_type: json_rpc + `, + }, + { + desc: "services_test: missing URLs", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + - service_id: svc2 + `, + }, + { + desc: "services_test: missing service IDs", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - endpoints: + - url: localhost:8081 + rpc_type: json_rpc + - endpoints: + - url: localhost:8082 + rpc_type: json_rpc + `, + }, + { + desc: "services_test: missing rpc type", + address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidServiceConfig, + config: ` + stake_amount: 1000upokt + services: + - service_id: svc1 + endpoints: + - url: localhost:8082 + `, + }, + } + + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // write the stake config to a file + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.config)).Name() + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--config=%s", configPath), + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outStake, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdStakeSupplier(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/supplier/module/tx_unstake_supplier.go b/x/supplier/module/tx_unstake_supplier.go new file mode 100644 index 000000000..9c5fa8633 --- /dev/null +++ b/x/supplier/module/tx_unstake_supplier.go @@ -0,0 +1,42 @@ +package supplier + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func CmdUnstakeSupplier() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "unstake-supplier", + Short: "Unstake a supplier", + Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUnstakeSupplier( + clientCtx.GetFromAddress().String(), + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/supplier/module/tx_unstake_supplier_test.go b/x/supplier/module/tx_unstake_supplier_test.go new file mode 100644 index 000000000..75644f58f --- /dev/null +++ b/x/supplier/module/tx_unstake_supplier_test.go @@ -0,0 +1,97 @@ +package supplier_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + supplier "github.com/pokt-network/poktroll/x/supplier/module" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestCLI_UnstakeSupplier(t *testing.T) { + net, _ := networkWithSupplierObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the supplier to be unstaked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + supplierAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + address string + err *sdkerrors.Error + }{ + { + desc: "unstake supplier: valid", + address: supplierAccount.Address.String(), + }, + { + desc: "unstake supplier: missing address", + // address: supplierAccount.Address.String(), + err: types.ErrSupplierInvalidAddress, + }, + { + desc: "unstake supplier: invalid address", + address: "invalid", + err: types.ErrSupplierInvalidAddress, + }, + } + + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outUnstake, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdUnstakeSupplier(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/supplier/simulation/helpers.go b/x/supplier/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/supplier/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/supplier/simulation/stake_supplier.go b/x/supplier/simulation/stake_supplier.go new file mode 100644 index 000000000..a6f79739c --- /dev/null +++ b/x/supplier/simulation/stake_supplier.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func SimulateMsgStakeSupplier( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgStakeSupplier{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the StakeSupplier simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "StakeSupplier simulation not implemented"), nil, nil + } +} diff --git a/x/supplier/simulation/unstake_supplier.go b/x/supplier/simulation/unstake_supplier.go new file mode 100644 index 000000000..377b74176 --- /dev/null +++ b/x/supplier/simulation/unstake_supplier.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func SimulateMsgUnstakeSupplier( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgUnstakeSupplier{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the UnstakeSupplier simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UnstakeSupplier simulation not implemented"), nil, nil + } +} diff --git a/x/supplier/types/codec.go b/x/supplier/types/codec.go new file mode 100644 index 000000000..9ecbe1202 --- /dev/null +++ b/x/supplier/types/codec.go @@ -0,0 +1,23 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgStakeSupplier{}, + ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnstakeSupplier{}, + ) + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go new file mode 100644 index 000000000..b6424cc9f --- /dev/null +++ b/x/supplier/types/errors.go @@ -0,0 +1,27 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/supplier module sentinel errors +var ( + ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") + ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") + ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") + ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") + ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") + ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") + ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") + ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") + ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") + ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") + ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") + ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") + ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") + ErrSupplierInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") + ErrSupplierInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") +) diff --git a/x/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go new file mode 100644 index 000000000..6680b26e0 --- /dev/null +++ b/x/supplier/types/expected_keepers.go @@ -0,0 +1,27 @@ +//go:generate mockgen -destination ../../../testutil/supplier/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper + +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go new file mode 100644 index 000000000..9d06b42ff --- /dev/null +++ b/x/supplier/types/genesis.go @@ -0,0 +1,67 @@ +package types + +import ( + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + SupplierList: []sharedtypes.Supplier{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in supplier + supplierIndexMap := make(map[string]struct{}) + for _, supplier := range gs.SupplierList { + index := string(SupplierKey(supplier.Address)) + if _, ok := supplierIndexMap[index]; ok { + return fmt.Errorf("duplicated index for supplier") + } + supplierIndexMap[index] = struct{}{} + } + + // Check that the stake value for the suppliers is valid + for _, supplier := range gs.SupplierList { + // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, + // similar to how we have `ValidateAppServiceConfigs` below + if supplier.Stake == nil { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") + } + stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) + } + + // Validate the application service configs + if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { + return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) + } + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go new file mode 100644 index 000000000..282c2b01d --- /dev/null +++ b/x/supplier/types/genesis_test.go @@ -0,0 +1,314 @@ +package types_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", math.NewInt(100)) + serviceConfig1 := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + } + serviceList1 := []*sharedtypes.SupplierServiceConfig{serviceConfig1} + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", math.NewInt(100)) + serviceConfig2 := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + } + serviceList2 := []*sharedtypes.SupplierServiceConfig{serviceConfig2} + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + Services: serviceList2, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid - zero supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to duplicated supplier address", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr1, + Stake: &stake2, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to nil supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: nil, + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - due to missing supplier stake", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + // Explicitly missing stake + Services: serviceList2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing services list", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + // Services: intentionally omitted + }, + }, + }, + valid: false, + }, + { + desc: "invalid - empty services list", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + Services: []*sharedtypes.SupplierServiceConfig{}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - invalid URL", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "invalid URL", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - invalid RPC Type", + genState: &types.GenesisState{ + SupplierList: []sharedtypes.Supplier{ + { + Address: addr1, + Stake: &stake1, + Services: serviceList1, + }, + { + Address: addr2, + Stake: &stake2, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_UNKNOWN_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + }, + }, + valid: false, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/supplier/types/key_supplier.go b/x/supplier/types/key_supplier.go new file mode 100644 index 000000000..e91fd76e4 --- /dev/null +++ b/x/supplier/types/key_supplier.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // SupplierKeyPrefix is the prefix to retrieve all Supplier + SupplierKeyPrefix = "Supplier/value/" +) + +// SupplierKey returns the store key to retrieve a Supplier from the index fields +func SupplierKey( + index string, +) []byte { + var key []byte + + indexBytes := []byte(index) + key = append(key, indexBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/supplier/types/keys.go b/x/supplier/types/keys.go new file mode 100644 index 000000000..fe2ebecc7 --- /dev/null +++ b/x/supplier/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "supplier" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_supplier" +) + +var ( + ParamsKey = []byte("p_supplier") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go new file mode 100644 index 000000000..44589187d --- /dev/null +++ b/x/supplier/types/message_stake_supplier.go @@ -0,0 +1,57 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +const TypeMsgStakeSupplier = "stake_supplier" + +var _ sdk.Msg = &MsgStakeSupplier{} + +func NewMsgStakeSupplier( + address string, + stake sdk.Coin, + services []*sharedtypes.SupplierServiceConfig, +) *MsgStakeSupplier { + return &MsgStakeSupplier{ + Address: address, + Stake: &stake, + Services: services, + } +} + +func (msg *MsgStakeSupplier) ValidateBasic() error { + // Validate the address + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return ErrSupplierInvalidAddress.Wrapf("invalid supplier address %s; (%v)", msg.Address, err) + } + + // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code + // Validate the stake amount + if msg.Stake == nil { + return ErrSupplierInvalidStake.Wrap("nil supplier stake") + } + stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) + if !stake.IsValid() { + return ErrSupplierInvalidStake.Wrapf("invalid supplier stake %v; (%v)", msg.Stake, stake.Validate()) + } + if err != nil { + return ErrSupplierInvalidStake.Wrapf("cannot parse supplier stake %v; (%v)", msg.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return ErrSupplierInvalidStake.Wrapf("invalid stake amount for supplier: %v <= 0", msg.Stake) + } + if stake.Denom != "upokt" { + return ErrSupplierInvalidStake.Wrapf("invalid stake amount denom for supplier %v", msg.Stake) + } + + // Validate the supplier service configs + if err := servicehelpers.ValidateSupplierServiceConfigs(msg.Services); err != nil { + return ErrSupplierInvalidServiceConfig.Wrapf(err.Error()) + } + + return nil +} diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go new file mode 100644 index 000000000..76798c98a --- /dev/null +++ b/x/supplier/types/message_stake_supplier_test.go @@ -0,0 +1,297 @@ +package types + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/testutil/sample" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + + "github.com/stretchr/testify/require" +) + +func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { + defaultServicesList := []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }} + + tests := []struct { + name string + msg MsgStakeSupplier + err error + }{ + // address related tests + { + name: "invalid address - nil stake", + msg: MsgStakeSupplier{ + Address: "invalid_address", + // Stake explicitly nil + Services: defaultServicesList, + }, + err: ErrSupplierInvalidAddress, + }, + + // stake related tests + { + name: "valid address - nil stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + // Stake explicitly nil + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - valid stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: defaultServicesList, + }, + }, { + name: "valid address - zero stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - negative stake", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - invalid stake denom", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, { + name: "valid address - invalid stake missing denom", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + Services: defaultServicesList, + }, + err: ErrSupplierInvalidStake, + }, + + // service related tests + { + name: "valid service configs - multiple services", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId1", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8081", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + { + Service: &sharedtypes.Service{ + Id: "svcId2", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8082", + RpcType: sharedtypes.RPCType_GRPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + }, + { + name: "invalid service configs - omitted", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + // Services: intentionally omitted + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - empty", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{}, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid service ID that's too long", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "123456790", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid service Name that's too long", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "123", + Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid service ID that contains invalid characters", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "12 45 !", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - missing url", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + Name: "name", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + // Url: intentionally omitted + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - invalid url", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + Name: "name", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "I am not a valid URL", + RpcType: sharedtypes.RPCType_JSON_RPC, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + { + name: "invalid service configs - missing rpc type", + msg: MsgStakeSupplier{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Services: []*sharedtypes.SupplierServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svcId", + Name: "name", + }, + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://localhost:8080", + // RpcType: intentionally omitted, + Configs: make([]*sharedtypes.ConfigOption, 0), + }, + }, + }, + }, + }, + err: ErrSupplierInvalidServiceConfig, + }, + // TODO_TEST: Need to add more tests around config types + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go new file mode 100644 index 000000000..4a5226ee5 --- /dev/null +++ b/x/supplier/types/message_unstake_supplier.go @@ -0,0 +1,22 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgUnstakeSupplier = "unstake_supplier" + +var _ sdk.Msg = &MsgUnstakeSupplier{} + +func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { + return &MsgUnstakeSupplier{ + Address: address, + } +} + +func (msg *MsgUnstakeSupplier) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return ErrSupplierInvalidAddress.Wrapf("invalid address address (%s)", err) + } + return nil +} diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go new file mode 100644 index 000000000..b447397ed --- /dev/null +++ b/x/supplier/types/message_unstake_supplier_test.go @@ -0,0 +1,44 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUnstakeSupplier + err error + }{ + { + name: "invalid address", + msg: MsgUnstakeSupplier{ + Address: "invalid_address", + }, + err: ErrSupplierInvalidAddress, + }, { + name: "missing address", + msg: MsgUnstakeSupplier{}, + err: ErrSupplierInvalidAddress, + }, { + name: "valid address", + msg: MsgUnstakeSupplier{ + Address: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/supplier/types/msg_update_params.go b/x/supplier/types/msg_update_params.go new file mode 100644 index 000000000..e36d023de --- /dev/null +++ b/x/supplier/types/msg_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go new file mode 100644 index 000000000..4f3215e35 --- /dev/null +++ b/x/supplier/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/supplier/types/types.go b/x/supplier/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/supplier/types/types.go @@ -0,0 +1 @@ +package types diff --git a/x/tokenomics/keeper/keeper.go b/x/tokenomics/keeper/keeper.go new file mode 100644 index 000000000..caa9f572b --- /dev/null +++ b/x/tokenomics/keeper/keeper.go @@ -0,0 +1,72 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// Keeper is the structure that implements the `KeeperI` interface. + +// TODO_TECHDEBT(#240): See `x/nft/keeper.keeper.go` in the Cosmos SDK on how +// we should refactor all our keepers. This keeper has started following a small +// subset of those patterns. +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + bankKeeper types.BankKeeper + accountKeeper types.AccountKeeper + applicationKeeper types.ApplicationKeeper + supplierKeeper types.SupplierKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, + accountKeeper types.AccountKeeper, + applicationKeeper types.ApplicationKeeper, + supplierKeeper types.SupplierKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + bankKeeper: bankKeeper, + accountKeeper: accountKeeper, + applicationKeeper: applicationKeeper, + supplierKeeper: supplierKeeper, + } +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +// GetAuthority returns the x/tokenomics module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/tokenomics/keeper/msg_server.go b/x/tokenomics/keeper/msg_server.go new file mode 100644 index 000000000..ab7353c82 --- /dev/null +++ b/x/tokenomics/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/tokenomics/keeper/msg_server_test.go b/x/tokenomics/keeper/msg_server_test.go new file mode 100644 index 000000000..0a6b2a26d --- /dev/null +++ b/x/tokenomics/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/tokenomics/keeper/msg_update_params.go b/x/tokenomics/keeper/msg_update_params.go new file mode 100644 index 000000000..3133d83f1 --- /dev/null +++ b/x/tokenomics/keeper/msg_update_params.go @@ -0,0 +1,42 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + logger := k.Logger() + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // TODO_BLOCKER(@Olshansk): How do we validate this is the same address that signed the request? + // Do we have to use `msg.GetSigners()` explicitly during the check/validation or + // does the `cosmos.msg.v1.signer` tag in the protobuf definition enforce + // this somewhere in the Cosmos SDK? + if msg.Authority != k.GetAuthority() { + return nil, types.ErrTokenomicsAuthorityAddressMismatch + } + + prevParams := k.GetParams(ctx) + logger.Info("About to update params from [%v] to [%v]", prevParams, msg.Params) + + if err := k.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + + logger.Info("Done updating params") + + return &types.MsgUpdateParamsResponse{}, nil +} + +// ComputeUnitsToTokensMultiplier returns the ComputeUnitsToTokensMultiplier param +func (k Keeper) ComputeUnitsToTokensMultiplier(ctx context.Context) (param uint64) { + return k.GetParams(ctx).ComputeUnitsToTokensMultiplier +} diff --git a/x/tokenomics/keeper/msg_update_params_test.go b/x/tokenomics/keeper/msg_update_params_test.go new file mode 100644 index 000000000..d1a334cc1 --- /dev/null +++ b/x/tokenomics/keeper/msg_update_params_test.go @@ -0,0 +1,136 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func TestMsgUpdateParams(t *testing.T) { + tokenomicsKeeper, srv, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, tokenomicsKeeper.SetParams(ctx, params)) + + tests := []struct { + desc string + + req *types.MsgUpdateParams + + expectErr bool + expectedPanic bool + expErrMsg string + }{ + { + desc: "invalid authority address", + + req: &types.MsgUpdateParams{ + Authority: "invalid", + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 1, + }, + }, + + expectErr: true, + expectedPanic: false, + expErrMsg: "invalid authority", + }, + { + desc: "incorrect authority address", + + req: &types.MsgUpdateParams{ + Authority: sample.AccAddress(), + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 1, + }, + }, + + expectErr: true, + expectedPanic: false, + expErrMsg: "the provided authority address does not match the on-chain governance address", + }, + { + desc: "invalid ComputeUnitsToTokensMultiplier", + + req: &types.MsgUpdateParams{ + Authority: tokenomicsKeeper.GetAuthority(), + + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 0, + }, + }, + + expectErr: true, + expectedPanic: true, + expErrMsg: "invalid compute to tokens multiplier", + }, + { + desc: "successful param update", + + req: &types.MsgUpdateParams{ + Authority: tokenomicsKeeper.GetAuthority(), + + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 1000000, + }, + }, + + expectedPanic: false, + expectErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + if tt.expectedPanic { + defer func() { + if r := recover(); r != nil { + _, err := srv.UpdateParams(ctx, tt.req) + require.Error(t, err) + } + }() + return + } + _, err := srv.UpdateParams(ctx, tt.req) + if tt.expectErr { + require.Error(t, err) + require.ErrorContains(t, err, tt.expErrMsg) + } else { + require.Nil(t, err) + } + }) + } +} + +func TestUpdateParams_ComputeUnitsToTokensMultiplier(t *testing.T) { + tokenomicsKeeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + srv := keeper.NewMsgServerImpl(tokenomicsKeeper) + + // Set the default params + tokenomicsKeeper.SetParams(ctx, types.DefaultParams()) + + // Verify the default value for ComputeUnitsToTokensMultiplier + getParamsReq := &types.QueryParamsRequest{} + getParamsRes, err := tokenomicsKeeper.Params(ctx, getParamsReq) + require.Nil(t, err) + require.Equal(t, uint64(42), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) + + // Update the value for ComputeUnitsToTokensMultiplier + updateParamsReq := &types.MsgUpdateParams{ + Authority: tokenomicsKeeper.GetAuthority(), + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 69, + }, + } + _, err = srv.UpdateParams(ctx, updateParamsReq) + require.Nil(t, err) + + // Verify that ComputeUnitsToTokensMultiplier was updated + getParamsRes, err = tokenomicsKeeper.Params(ctx, getParamsReq) + require.Nil(t, err) + require.Equal(t, uint64(69), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) +} diff --git a/x/tokenomics/keeper/params.go b/x/tokenomics/keeper/params.go new file mode 100644 index 000000000..5b900da9f --- /dev/null +++ b/x/tokenomics/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/tokenomics/keeper/query.go b/x/tokenomics/keeper/query.go new file mode 100644 index 000000000..bb812a52f --- /dev/null +++ b/x/tokenomics/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/tokenomics/keeper/query_params.go b/x/tokenomics/keeper/query_params.go new file mode 100644 index 000000000..f8a4d0dc4 --- /dev/null +++ b/x/tokenomics/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/tokenomics/keeper/query_params_test.go b/x/tokenomics/keeper/query_params_test.go new file mode 100644 index 000000000..d10caf4f5 --- /dev/null +++ b/x/tokenomics/keeper/query_params_test.go @@ -0,0 +1,30 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func TestGetParams(t *testing.T) { + k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + params := types.DefaultParams() + + k.SetParams(ctx, params) + + require.EqualValues(t, params, k.GetParams(ctx)) + require.EqualValues(t, params.ComputeUnitsToTokensMultiplier, k.ComputeUnitsToTokensMultiplier(ctx)) +} + +func TestParamsQuery(t *testing.T) { + keeper, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/tokenomics/keeper/settle_session_accounting.go b/x/tokenomics/keeper/settle_session_accounting.go new file mode 100644 index 000000000..e80fed043 --- /dev/null +++ b/x/tokenomics/keeper/settle_session_accounting.go @@ -0,0 +1,160 @@ +package keeper + +import ( + "context" + "fmt" + + math "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/smt" + + apptypes "github.com/pokt-network/poktroll/x/application/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +const ( + // TODO_TECHDEBT: Retrieve this from the SMT package + // The number of bytes expected to be contained in the root hash being + // claimed in order to represent both the digest and the sum. + smstRootSize = 40 +) + +// atomic.if this function is not atomic. + +// SettleSessionAccounting is responsible for all of the post-session accounting +// necessary to burn, mint or transfer tokens depending on the amount of work +// done. The amount of "work done" complete is dictated by `sum` of `root`. +// +// ASSUMPTION: It is assumed the caller of this function validated the claim +// against a proof BEFORE calling this function. +// +// TODO_BLOCKER(@Olshansk): Is there a way to limit who can call this function? +func (k Keeper) SettleSessionAccounting( + goCtx context.Context, + claim *prooftypes.Claim, +) error { + // Parse the context + ctx := sdk.UnwrapSDKContext(goCtx) + logger := k.Logger().With("method", "SettleSessionAccounting") + + if claim == nil { + logger.Error("received a nil claim") + return types.ErrTokenomicsClaimNil + } + + // Make sure the session header is not nil + sessionHeader := claim.SessionHeader + if sessionHeader == nil { + logger.Error("received a nil session header") + return types.ErrTokenomicsSessionHeaderNil + } + + // Validate the session header + if err := sessionHeader.ValidateBasic(); err != nil { + logger.Error("received an invalid session header", "error", err) + return types.ErrTokenomicsSessionHeaderInvalid + } + + // Decompose the claim into its constituent parts for readability + supplierAddress, err := sdk.AccAddressFromBech32(claim.SupplierAddress) + if err != nil { + return types.ErrTokenomicsSupplierAddressInvalid + } + applicationAddress, err := sdk.AccAddressFromBech32(claim.SessionHeader.ApplicationAddress) + if err != nil { + return types.ErrTokenomicsApplicationAddressInvalid + } + root := (smt.MerkleRoot)(claim.RootHash) + + if len(root) != smstRootSize { + logger.Error(fmt.Sprintf("received an invalid root hash of size: %d", len(root))) + return types.ErrTokenomicsRootHashInvalid + } + + // Retrieve the application + application, found := k.applicationKeeper.GetApplication(ctx, applicationAddress.String()) + if !found { + logger.Error(fmt.Sprintf("application for claim with address %s not found", applicationAddress)) + return types.ErrTokenomicsApplicationNotFound + } + + // Retrieve the sum of the root as a proxy into the amount of work done + claimComputeUnits := root.Sum() + + logger.Info(fmt.Sprintf("About to start settling claim for %d compute units", claimComputeUnits)) + + // Retrieve the existing tokenomics params + params := k.GetParams(ctx) + + // Calculate the amount of tokens to mint & burn + upokt := math.NewInt(int64(claimComputeUnits * params.ComputeUnitsToTokensMultiplier)) + upoktCoin := sdk.NewCoin("upokt", upokt) + upoktCoins := sdk.NewCoins(upoktCoin) + + logger.Info(fmt.Sprintf("%d compute units equate to %d uPOKT for session %s", claimComputeUnits, upokt, sessionHeader.SessionId)) + + // NB: We are doing a mint & burn + transfer, instead of a simple transfer + // of funds from the supplier to the application in order to enable second + // order economic effects with more optionality. This could include funds + // going to pnf, delegators, enabling bonuses/rebates, etc... + + // Mint uPOKT to the supplier module account + if err := k.bankKeeper.MintCoins(ctx, suppliertypes.ModuleName, upoktCoins); err != nil { + return types.ErrTokenomicsApplicationModuleFeeFailed + } + + logger.Info(fmt.Sprintf("minted %d uPOKT in the supplier module", upokt)) + + // Sent the minted coins to the supplier + if err := k.bankKeeper.SendCoinsFromModuleToAccount( + ctx, suppliertypes.ModuleName, supplierAddress, upoktCoins, + ); err != nil { + return types.ErrTokenomicsApplicationModuleFeeFailed + } + + logger.Info(fmt.Sprintf("sent %d uPOKT to supplier with address %s", upokt, supplierAddress)) + + // Verify that the application has enough uPOKT to pay for the services it consumed + if application.Stake.IsLT(upoktCoin) { + logger.Error(fmt.Sprintf("THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", applicationAddress, upoktCoins, application.Stake)) + // TODO_BLOCKER(@Olshansk, @RawthiL): The application was over-serviced in the last session so it basically + // goes "into debt". Need to design a way to handle this when we implement + // probabilistic proofs and add all the parameter logic. Do we touch the application balance? + // Do we just let it go into debt? Do we penalize the application? Do we unstake it? Etc... + upoktCoins = sdk.NewCoins(*application.Stake) + } + + // Undelegate the amount of coins that need to be burnt from the application stake. + // Since the application commits a certain amount of stake to the network to be able + // to pay for relay mining, this stake is taken from the funds "in escrow" rather + // than its balance. + if err := k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, apptypes.ModuleName, applicationAddress, upoktCoins); err != nil { + logger.Error(fmt.Sprintf("THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", applicationAddress, upoktCoins, application.Stake)) + + } + + // Send coins from the application to the application module account + if err := k.bankKeeper.SendCoinsFromAccountToModule( + ctx, applicationAddress, apptypes.ModuleName, upoktCoins, + ); err != nil { + return types.ErrTokenomicsApplicationModuleFeeFailed + } + + logger.Info(fmt.Sprintf("took %d uPOKT from application with address %s", upokt, applicationAddress)) + + // Burn uPOKT from the application module account + if err := k.bankKeeper.BurnCoins(ctx, apptypes.ModuleName, upoktCoins); err != nil { + return types.ErrTokenomicsApplicationModuleBurn + } + + logger.Info(fmt.Sprintf("burned %d uPOKT in the application module", upokt)) + + // Update the application's on-chain stake + newAppStake := (*application.Stake).Sub(upoktCoin) + application.Stake = &newAppStake + k.applicationKeeper.SetApplication(ctx, application) + + return nil +} diff --git a/x/tokenomics/keeper/settle_session_accounting_test.go b/x/tokenomics/keeper/settle_session_accounting_test.go index 355e91559..368c7cba5 100644 --- a/x/tokenomics/keeper/settle_session_accounting_test.go +++ b/x/tokenomics/keeper/settle_session_accounting_test.go @@ -5,15 +5,14 @@ import ( "fmt" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/smt" "github.com/stretchr/testify/require" testkeeper "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" "github.com/pokt-network/poktroll/x/tokenomics/types" ) @@ -39,10 +38,9 @@ func TestSettleSessionAccounting_AppStakeTooLow(t *testing.T) { func TestSettleSessionAccounting_AppNotFound(t *testing.T) { keeper, ctx, _, supplierAddr := testkeeper.TokenomicsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) // The base claim whose root will be customized for testing purposes - claim := suppliertypes.Claim{ + claim := prooftypes.Claim{ SupplierAddress: supplierAddr, SessionHeader: &sessiontypes.SessionHeader{ ApplicationAddress: sample.AccAddress(), // Random address @@ -57,14 +55,13 @@ func TestSettleSessionAccounting_AppNotFound(t *testing.T) { RootHash: smstRootWithSum(42), } - err := keeper.SettleSessionAccounting(wctx, &claim) + err := keeper.SettleSessionAccounting(ctx, &claim) require.Error(t, err) require.ErrorIs(t, err, types.ErrTokenomicsApplicationNotFound) } func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) // Define test cases testCases := []struct { @@ -135,7 +132,7 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { err = fmt.Errorf("panic occurred: %v", r) } }() - return keeper.SettleSessionAccounting(wctx, &claim) + return keeper.SettleSessionAccounting(ctx, &claim) }() // Assert the error @@ -150,19 +147,18 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) // Define test cases testCases := []struct { desc string - claim *suppliertypes.Claim + claim *prooftypes.Claim errExpected bool expectErr error }{ { desc: "Valid Claim", - claim: func() *suppliertypes.Claim { + claim: func() *prooftypes.Claim { claim := baseClaim(appAddr, supplierAddr, 42) return &claim }(), @@ -176,7 +172,7 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { }, { desc: "Claim with nil session header", - claim: func() *suppliertypes.Claim { + claim: func() *prooftypes.Claim { claim := baseClaim(appAddr, supplierAddr, 42) claim.SessionHeader = nil return &claim @@ -186,7 +182,7 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { }, { desc: "Claim with invalid session id", - claim: func() *suppliertypes.Claim { + claim: func() *prooftypes.Claim { claim := baseClaim(appAddr, supplierAddr, 42) claim.SessionHeader.SessionId = "" return &claim @@ -196,7 +192,7 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { }, { desc: "Claim with invalid application address", - claim: func() *suppliertypes.Claim { + claim: func() *prooftypes.Claim { claim := baseClaim(appAddr, supplierAddr, 42) claim.SessionHeader.ApplicationAddress = "invalid address" return &claim @@ -206,7 +202,7 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { }, { desc: "Claim with invalid supplier address", - claim: func() *suppliertypes.Claim { + claim: func() *prooftypes.Claim { claim := baseClaim(appAddr, supplierAddr, 42) claim.SupplierAddress = "invalid address" return &claim @@ -233,7 +229,7 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { err = fmt.Errorf("panic occurred: %v", r) } }() - return keeper.SettleSessionAccounting(wctx, tc.claim) + return keeper.SettleSessionAccounting(ctx, tc.claim) }() // Assert the error @@ -247,8 +243,8 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { } } -func baseClaim(appAddr, supplierAddr string, sum uint64) suppliertypes.Claim { - return suppliertypes.Claim{ +func baseClaim(appAddr, supplierAddr string, sum uint64) prooftypes.Claim { + return prooftypes.Claim{ SupplierAddress: supplierAddr, SessionHeader: &sessiontypes.SessionHeader{ ApplicationAddress: appAddr, diff --git a/x/tokenomics/module/autocli.go b/x/tokenomics/module/autocli.go new file mode 100644 index 000000000..62c6428a6 --- /dev/null +++ b/x/tokenomics/module/autocli.go @@ -0,0 +1,39 @@ +package tokenomics + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/tokenomics" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + Long: `Shows all the parameters related to the tokenomics module. + +Example: +$ poktrolld q tokenomics params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/tokenomics/module/genesis.go b/x/tokenomics/module/genesis.go new file mode 100644 index 000000000..54e5be9cd --- /dev/null +++ b/x/tokenomics/module/genesis.go @@ -0,0 +1,24 @@ +package tokenomics + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/tokenomics/module/genesis_test.go b/x/tokenomics/module/genesis_test.go new file mode 100644 index 000000000..16db5e9da --- /dev/null +++ b/x/tokenomics/module/genesis_test.go @@ -0,0 +1,29 @@ +package tokenomics_test + +import ( + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + tokenomics "github.com/pokt-network/poktroll/x/tokenomics/module" + "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx, _, _ := keepertest.TokenomicsKeeper(t) + tokenomics.InitGenesis(ctx, k, genesisState) + got := tokenomics.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/tokenomics/module/helpers_test.go b/x/tokenomics/module/helpers_test.go new file mode 100644 index 000000000..66df2797b --- /dev/null +++ b/x/tokenomics/module/helpers_test.go @@ -0,0 +1,32 @@ +// Package cli_test provides unit tests for the CLI functionality. +package tokenomics_test + +import ( + "strconv" + "testing" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/stretchr/testify/require" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +func init() { + cmd.InitSDKConfig() +} + +// networkWithDefaultConfig is a helper function to create a network for testing +// with a default tokenomics genesis state. +func networkWithDefaultConfig(t *testing.T) *network.Network { + t.Helper() + cfg := network.DefaultConfig() + tokenomicsGenesisState := network.DefaultTokenomicsModuleGenesisState(t) + buf, err := cfg.Codec.MarshalJSON(tokenomicsGenesisState) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg) +} diff --git a/x/tokenomics/module/module.go b/x/tokenomics/module/module.go new file mode 100644 index 000000000..597d97eb4 --- /dev/null +++ b/x/tokenomics/module/module.go @@ -0,0 +1,220 @@ +package tokenomics + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "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" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/tokenomics/module" + "github.com/pokt-network/poktroll/x/tokenomics/keeper" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper + ApplicationKeeper types.ApplicationKeeper + SupplierKeeper types.SupplierKeeper +} + +type ModuleOutputs struct { + depinject.Out + + TokenomicsKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + in.AccountKeeper, + in.ApplicationKeeper, + in.SupplierKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{TokenomicsKeeper: k, Module: m} +} diff --git a/x/tokenomics/module/query.go b/x/tokenomics/module/query.go new file mode 100644 index 000000000..b4c8ae79b --- /dev/null +++ b/x/tokenomics/module/query.go @@ -0,0 +1,28 @@ +package tokenomics + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd() *cobra.Command { + // Group tokenomics queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/tokenomics/module/query_params.go b/x/tokenomics/module/query_params.go new file mode 100644 index 000000000..33899a227 --- /dev/null +++ b/x/tokenomics/module/query_params.go @@ -0,0 +1,36 @@ +package tokenomics + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tokenomics/module/simulation.go b/x/tokenomics/module/simulation.go new file mode 100644 index 000000000..535c67ff0 --- /dev/null +++ b/x/tokenomics/module/simulation.go @@ -0,0 +1,64 @@ +package tokenomics + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + tokenomicssimulation "github.com/pokt-network/poktroll/x/tokenomics/simulation" + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// avoid unused import issue +var ( + _ = tokenomicssimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( +// this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + tokenomicsGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&tokenomicsGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/tokenomics/module/tx.go b/x/tokenomics/module/tx.go new file mode 100644 index 000000000..8e3ccc2b0 --- /dev/null +++ b/x/tokenomics/module/tx.go @@ -0,0 +1,26 @@ +package tokenomics + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdUpdateParams()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/tokenomics/module/tx_update_params.go b/x/tokenomics/module/tx_update_params.go new file mode 100644 index 000000000..0668900ab --- /dev/null +++ b/x/tokenomics/module/tx_update_params.go @@ -0,0 +1,59 @@ +package tokenomics + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/tokenomics/types" +) + +var _ = strconv.Itoa(0) + +// TODO_BLOCKER(#322): Update the CLI once we determine settle on how to maintain and update parameters. +// TODO_TECHDEBT(@red-0ne): Add a config file for on-chain parameters. +func CmdUpdateParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-params ", + Short: "Update the parameters of the tokenomics module", + Long: `Update the parameters in the tokenomics module.", + +All parameters must be provided when updating. + +Example: +$ poktrolld tx tokenomics update-params --from pnf --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + // Parse computeUnitsToTokensMultiplier + computeUnitsToTokensMultiplier, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + + // Get client context + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + // Create update params message + msg := types.NewMsgUpdateParams( + clientCtx.GetFromAddress().String(), + computeUnitsToTokensMultiplier, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + res := tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + return res + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tokenomics/module/tx_update_params_test.go b/x/tokenomics/module/tx_update_params_test.go new file mode 100644 index 000000000..0efd17413 --- /dev/null +++ b/x/tokenomics/module/tx_update_params_test.go @@ -0,0 +1,68 @@ +package tokenomics_test + +import ( + "fmt" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/gogo/status" + "github.com/pokt-network/poktroll/testutil/network" + tokenomics "github.com/pokt-network/poktroll/x/tokenomics/module" + "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/stretchr/testify/require" +) + +func TestCLI_UpdateParams(t *testing.T) { + net := networkWithDefaultConfig(t) + ctx := net.Validators[0].ClientCtx + + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + fmt.Sprintf("--%s=%s", flags.FlagFrom, net.Validators[0].Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, network.NewBondDenomCoins(t, net, 10)), + } + + tests := []struct { + desc string + args []string + expectedErr error + expectedExtraErrMsg string + }{ + { + desc: "valid update of all params", + args: []string{"42"}, + expectedErr: nil, + }, + { + desc: "invalid compute_units_to_tokens_multiplier update", + args: []string{"0"}, + expectedErr: types.ErrTokenomicsParamsInvalid, + expectedExtraErrMsg: "invalid ComputeUnitsToTokensMultiplier", + }, + } + + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := append(common, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, tokenomics.CmdUpdateParams(), args) + if tc.expectedErr != nil { + _, ok := status.FromError(tc.expectedErr) + require.True(t, ok) + require.ErrorIs(t, err, tc.expectedErr) + require.Contains(t, err.Error(), tc.expectedExtraErrMsg) + } else { + require.NoError(t, err) + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + } + }) + } +} diff --git a/x/tokenomics/simulation/helpers.go b/x/tokenomics/simulation/helpers.go new file mode 100644 index 000000000..c260f2fcd --- /dev/null +++ b/x/tokenomics/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + addr, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, addr) +} diff --git a/x/tokenomics/types/codec.go b/x/tokenomics/types/codec.go new file mode 100644 index 000000000..ac5526374 --- /dev/null +++ b/x/tokenomics/types/codec.go @@ -0,0 +1,17 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go new file mode 100644 index 000000000..ec63e3c08 --- /dev/null +++ b/x/tokenomics/types/errors.go @@ -0,0 +1,28 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/tokenomics module sentinel errors +var ( + ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrTokenomicsSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrTokenomicsAuthorityAddressInvalid = sdkerrors.Register(ModuleName, 1102, "the provided authority address is not a valid bech32 address") + ErrTokenomicsAuthorityAddressMismatch = sdkerrors.Register(ModuleName, 1103, "the provided authority address does not match the on-chain governance address") + ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1104, "provided claim is nil") + ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1105, "provided claim's session header is nil") + ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1106, "provided claim's session header is invalid") + ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1107, "failed to mint uPOKT to supplier module account") + ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 1108, "failed to send uPOKT from supplier module account to supplier") + ErrTokenomicsSupplierAddressInvalid = sdkerrors.Register(ModuleName, 1109, "the supplier address in the claim is not a valid bech32 address") + ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1110, "application not found") + ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1111, "failed to burn uPOKT from application module account") + ErrTokenomicsApplicationModuleFeeFailed = sdkerrors.Register(ModuleName, 1112, "failed to send uPOKT from application module account to application") + ErrTokenomicsApplicationUndelegationFailed = sdkerrors.Register(ModuleName, 1113, "failed to undelegate uPOKT from the application module to the application account") + ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1114, "the application address in the claim is not a valid bech32 address") + ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1115, "provided params are invalid") + ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1116, "the root hash in the claim is invalid") +) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go new file mode 100644 index 000000000..e67c4ef41 --- /dev/null +++ b/x/tokenomics/types/expected_keepers.go @@ -0,0 +1,42 @@ +package types + +//go:generate mockgen -destination ../../../testutil/tokenomics/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + apptypes "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +type ApplicationKeeper interface { + GetApplication(ctx context.Context, appAddr string) (app apptypes.Application, found bool) + SetApplication(ctx context.Context, app apptypes.Application) +} + +type SupplierKeeper interface { + GetSupplier(ctx context.Context, suppAddr string) (supplier sharedtypes.Supplier, found bool) +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/tokenomics/types/genesis.go b/x/tokenomics/types/genesis.go new file mode 100644 index 000000000..0af9b4416 --- /dev/null +++ b/x/tokenomics/types/genesis.go @@ -0,0 +1,24 @@ +package types + +import ( +// this line is used by starport scaffolding # genesis/types/import +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go new file mode 100644 index 000000000..ad3aaa914 --- /dev/null +++ b/x/tokenomics/types/genesis_test.go @@ -0,0 +1,53 @@ +package types_test + +import ( + "testing" + + "github.com/pokt-network/poktroll/x/tokenomics/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 1, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid genesis state - ComputeUnitsToTokensMultiplier is 0", + genState: &types.GenesisState{ + Params: types.Params{ + ComputeUnitsToTokensMultiplier: 0, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: false, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/tokenomics/types/keys.go b/x/tokenomics/types/keys.go new file mode 100644 index 000000000..0b22810d7 --- /dev/null +++ b/x/tokenomics/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "tokenomics" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_tokenomics" +) + +var ( + ParamsKey = []byte("p_tokenomics") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/tokenomics/types/message_update_params.go b/x/tokenomics/types/message_update_params.go new file mode 100644 index 000000000..f82f1d44d --- /dev/null +++ b/x/tokenomics/types/message_update_params.go @@ -0,0 +1,44 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParams)(nil) + +func NewMsgUpdateParams( + authority string, + compute_units_to_tokens_multiplier uint64, +) *MsgUpdateParams { + return &MsgUpdateParams{ + Authority: authority, + Params: Params{ + ComputeUnitsToTokensMultiplier: compute_units_to_tokens_multiplier, + }, + } +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + // Validate the address + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return sdkerrors.Wrapf(ErrTokenomicsAuthorityAddressInvalid, "invalid authority address %s; (%v)", msg.Authority, err) + } + + // Validate the params + if err := msg.Params.ValidateBasic(); err != nil { + return err + } + + return nil +} + +func (params *Params) ValidateBasic() error { + // Validate the ComputeUnitsToTokensMultiplier + if params.ComputeUnitsToTokensMultiplier == 0 { + return sdkerrors.Wrapf(ErrTokenomicsParamsInvalid, "invalid ComputeUnitsToTokensMultiplier; (%v)", params.ComputeUnitsToTokensMultiplier) + } + return nil +} diff --git a/x/tokenomics/types/message_update_params_test.go b/x/tokenomics/types/message_update_params_test.go new file mode 100644 index 000000000..0ac9863b7 --- /dev/null +++ b/x/tokenomics/types/message_update_params_test.go @@ -0,0 +1,56 @@ +package types + +import ( + "testing" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgUpdateParams_ValidateBasic(t *testing.T) { + tests := []struct { + desc string + + msg MsgUpdateParams + + expectedErr error + }{ + { + desc: "invalid authority address", + msg: MsgUpdateParams{ + Authority: "invalid_address", + Params: Params{ + ComputeUnitsToTokensMultiplier: 1, + }, + }, + expectedErr: ErrTokenomicsAuthorityAddressInvalid, + }, { + desc: "valid address", + msg: MsgUpdateParams{ + Authority: sample.AccAddress(), + Params: Params{ + ComputeUnitsToTokensMultiplier: 1, + }, + }, + }, { + desc: "invalid ComputeUnitsToTokensMultiplier", + msg: MsgUpdateParams{ + Authority: sample.AccAddress(), + Params: Params{ + ComputeUnitsToTokensMultiplier: 0, + }, + }, + expectedErr: ErrTokenomicsParamsInvalid, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.expectedErr != nil { + require.ErrorIs(t, err, tt.expectedErr) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/tokenomics/types/params.go b/x/tokenomics/types/params.go new file mode 100644 index 000000000..e8b7b6c98 --- /dev/null +++ b/x/tokenomics/types/params.go @@ -0,0 +1,66 @@ +package types + +import ( + "fmt" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + KeyComputeUnitsToTokensMultiplier = []byte("ComputeUnitsToTokensMultiplier") + // TODO: Determine the default value + DefaultComputeUnitsToTokensMultiplier uint64 = 42 +) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + computeUnitsToTokensMultiplier uint64, +) Params { + return Params{ + ComputeUnitsToTokensMultiplier: computeUnitsToTokensMultiplier, + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams( + DefaultComputeUnitsToTokensMultiplier, + ) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyComputeUnitsToTokensMultiplier, &p.ComputeUnitsToTokensMultiplier, validateComputeUnitsToTokensMultiplier), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + if err := validateComputeUnitsToTokensMultiplier(p.ComputeUnitsToTokensMultiplier); err != nil { + return err + } + + return nil +} + +// validateComputeUnitsToTokensMultiplier validates the ComputeUnitsToTokensMultiplier param +func validateComputeUnitsToTokensMultiplier(v interface{}) error { + computeUnitsToTokensMultiplier, ok := v.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + if computeUnitsToTokensMultiplier <= 0 { + return fmt.Errorf("invalid compute to tokens multiplier: %d", computeUnitsToTokensMultiplier) + } + + return nil +} diff --git a/x/tokenomics/types/types.go b/x/tokenomics/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/tokenomics/types/types.go @@ -0,0 +1 @@ +package types From 2ff5aeb45033f7e1e56ff9b1e288baf7885b0d4d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 10:50:32 +0100 Subject: [PATCH 19/54] restore: pkg/* --- pkg/appgateserver/cmd/cmd.go | 200 +++ .../config/appgate_configs_reader.go | 106 ++ .../config/appgate_configs_reader_test.go | 176 +++ pkg/appgateserver/config/errors.go | 13 + pkg/appgateserver/endpoint_selector.go | 35 + pkg/appgateserver/error_reply.go | 33 + pkg/appgateserver/errors.go | 12 + pkg/appgateserver/options.go | 19 + pkg/appgateserver/server.go | 266 ++++ pkg/appgateserver/synchronous.go | 60 + pkg/client/block/block.go | 48 + pkg/client/block/client.go | 77 + pkg/client/block/client_integration_test.go | 79 + pkg/client/block/client_test.go | 130 ++ pkg/client/block/godoc.go | 5 + pkg/client/delegation/client.go | 89 ++ .../delegation/client_integration_test.go | 171 +++ pkg/client/delegation/client_test.go | 100 ++ pkg/client/delegation/godoc.go | 5 + pkg/client/delegation/redelegation.go | 99 ++ pkg/client/events/errors.go | 15 + pkg/client/events/godoc.go | 12 + pkg/client/events/options.go | 11 + pkg/client/events/query_client.go | 293 ++++ .../events/query_client_integration_test.go | 60 + pkg/client/events/query_client_test.go | 392 +++++ pkg/client/events/replay_client.go | 302 ++++ .../events/replay_client_example_test.go | 105 ++ .../events/replay_client_integration_test.go | 146 ++ pkg/client/events/websocket/connection.go | 35 + pkg/client/events/websocket/dialer.go | 35 + pkg/client/events/websocket/errors.go | 11 + pkg/client/events/websocket/godoc.go | 3 + pkg/client/godoc.go | 12 + pkg/client/interface.go | 264 ++++ pkg/client/keyring/errors.go | 19 + pkg/client/keyring/keyring.go | 29 + pkg/client/query/accquerier.go | 58 + pkg/client/query/appquerier.go | 64 + pkg/client/query/codec.go | 20 + pkg/client/query/errors.go | 12 + pkg/client/query/godoc.go | 4 + pkg/client/query/sessionquerier.go | 66 + pkg/client/query/supplierquerier.go | 56 + pkg/client/query/types/context.go | 12 + pkg/client/services.go | 19 + pkg/client/supplier/client.go | 151 ++ .../supplier/client_integration_test.go | 36 + pkg/client/supplier/client_test.go | 201 +++ pkg/client/supplier/options.go | 14 + pkg/client/tx/client.go | 506 +++++++ pkg/client/tx/client_integration_test.go | 67 + pkg/client/tx/client_test.go | 423 ++++++ pkg/client/tx/context.go | 100 ++ pkg/client/tx/encoding.go | 18 + pkg/client/tx/errors.go | 41 + pkg/client/tx/options.go | 22 + pkg/client/tx/types/context.go | 12 + pkg/crypto/godoc.go | 5 + pkg/crypto/interface.go | 30 + pkg/crypto/rings/cache.go | 278 ++++ pkg/crypto/rings/cache_test.go | 307 ++++ pkg/crypto/rings/errors.go | 10 + pkg/crypto/rings/godoc.go | 6 + pkg/deps/config/godoc.go | 5 + pkg/deps/config/suppliers.go | 363 +++++ pkg/either/either.go | 43 + pkg/either/errors.go | 35 + pkg/either/types.go | 12 + pkg/observable/channel/collect.go | 34 + pkg/observable/channel/map.go | 130 ++ pkg/observable/channel/map_test.go | 109 ++ pkg/observable/channel/observable.go | 101 ++ pkg/observable/channel/observable_test.go | 371 +++++ pkg/observable/channel/observation_test.go | 52 + pkg/observable/channel/observer.go | 152 ++ pkg/observable/channel/observer_manager.go | 152 ++ pkg/observable/channel/observer_test.go | 89 ++ pkg/observable/channel/replay.go | 243 ++++ pkg/observable/channel/replay_test.go | 240 ++++ pkg/observable/errors.go | 8 + pkg/observable/filter/either.go | 62 + pkg/observable/interface.go | 41 + pkg/observable/logging/logging.go | 22 + pkg/observable/types.go | 5 + pkg/partials/errors.go | 11 + pkg/partials/interface.go | 32 + pkg/partials/partial.go | 71 + pkg/partials/partials_test.go | 87 ++ pkg/partials/payloads/godoc.go | 8 + pkg/partials/payloads/jsonrpc.go | 82 ++ pkg/partials/payloads/rest.go | 51 + pkg/relayer/cmd/cmd.go | 345 +++++ pkg/relayer/config/errors.go | 14 + .../config/pocket_node_config_hydrator.go | 56 + pkg/relayer/config/proxies_config_hydrator.go | 63 + .../config/proxy_http_config_parser.go | 73 + .../config/relayminer_configs_reader.go | 84 ++ .../config/relayminer_configs_reader_test.go | 1265 +++++++++++++++++ pkg/relayer/config/supplier_hydrator.go | 82 ++ .../config/suppliers_config_hydrator.go | 51 + pkg/relayer/config/types.go | 163 +++ pkg/relayer/interface.go | 151 ++ pkg/relayer/miner/gen/gen_fixtures.go | 304 ++++ pkg/relayer/miner/gen/template.go | 37 + pkg/relayer/miner/miner.go | 137 ++ pkg/relayer/miner/miner_test.go | 145 ++ pkg/relayer/miner/options.go | 11 + pkg/relayer/miner/relay_fixtures_test.go | 33 + pkg/relayer/protocol/block_heights.go | 68 + pkg/relayer/protocol/difficulty.go | 42 + pkg/relayer/protocol/difficulty_test.go | 56 + pkg/relayer/protocol/errors.go | 8 + pkg/relayer/proxy/error_reply.go | 46 + pkg/relayer/proxy/errors.go | 20 + pkg/relayer/proxy/options.go | 21 + pkg/relayer/proxy/proxy.go | 172 +++ pkg/relayer/proxy/proxy_test.go | 765 ++++++++++ pkg/relayer/proxy/relay_builders.go | 53 + pkg/relayer/proxy/relay_signer.go | 34 + pkg/relayer/proxy/relay_verifier.go | 168 +++ pkg/relayer/proxy/server_builder.go | 109 ++ pkg/relayer/proxy/synchronous.go | 285 ++++ pkg/relayer/relayminer.go | 98 ++ pkg/relayer/relayminer_test.go | 59 + pkg/relayer/session/claim.go | 140 ++ pkg/relayer/session/errors.go | 13 + pkg/relayer/session/options.go | 13 + pkg/relayer/session/proof.go | 120 ++ pkg/relayer/session/session.go | 274 ++++ pkg/relayer/session/session_test.go | 86 ++ pkg/relayer/session/sessiontree.go | 225 +++ pkg/relayer/session/sessiontree_test.go | 3 + pkg/relayer/types.go | 10 + pkg/retry/retry.go | 77 + pkg/retry/retry_test.go | 337 +++++ pkg/sdk/deps_builder.go | 94 ++ pkg/sdk/errors.go | 17 + pkg/sdk/interface.go | 32 + pkg/sdk/relay_verifier.go | 82 ++ pkg/sdk/sdk.go | 115 ++ pkg/sdk/send_relay.go | 109 ++ pkg/sdk/session.go | 114 ++ pkg/sdk/urls.go | 10 + pkg/signer/interface.go | 9 + pkg/signer/ring_signer.go | 34 + pkg/signer/simple_signer.go | 23 + 147 files changed, 15571 insertions(+) create mode 100644 pkg/appgateserver/cmd/cmd.go create mode 100644 pkg/appgateserver/config/appgate_configs_reader.go create mode 100644 pkg/appgateserver/config/appgate_configs_reader_test.go create mode 100644 pkg/appgateserver/config/errors.go create mode 100644 pkg/appgateserver/endpoint_selector.go create mode 100644 pkg/appgateserver/error_reply.go create mode 100644 pkg/appgateserver/errors.go create mode 100644 pkg/appgateserver/options.go create mode 100644 pkg/appgateserver/server.go create mode 100644 pkg/appgateserver/synchronous.go create mode 100644 pkg/client/block/block.go create mode 100644 pkg/client/block/client.go create mode 100644 pkg/client/block/client_integration_test.go create mode 100644 pkg/client/block/client_test.go create mode 100644 pkg/client/block/godoc.go create mode 100644 pkg/client/delegation/client.go create mode 100644 pkg/client/delegation/client_integration_test.go create mode 100644 pkg/client/delegation/client_test.go create mode 100644 pkg/client/delegation/godoc.go create mode 100644 pkg/client/delegation/redelegation.go create mode 100644 pkg/client/events/errors.go create mode 100644 pkg/client/events/godoc.go create mode 100644 pkg/client/events/options.go create mode 100644 pkg/client/events/query_client.go create mode 100644 pkg/client/events/query_client_integration_test.go create mode 100644 pkg/client/events/query_client_test.go create mode 100644 pkg/client/events/replay_client.go create mode 100644 pkg/client/events/replay_client_example_test.go create mode 100644 pkg/client/events/replay_client_integration_test.go create mode 100644 pkg/client/events/websocket/connection.go create mode 100644 pkg/client/events/websocket/dialer.go create mode 100644 pkg/client/events/websocket/errors.go create mode 100644 pkg/client/events/websocket/godoc.go create mode 100644 pkg/client/godoc.go create mode 100644 pkg/client/interface.go create mode 100644 pkg/client/keyring/errors.go create mode 100644 pkg/client/keyring/keyring.go create mode 100644 pkg/client/query/accquerier.go create mode 100644 pkg/client/query/appquerier.go create mode 100644 pkg/client/query/codec.go create mode 100644 pkg/client/query/errors.go create mode 100644 pkg/client/query/godoc.go create mode 100644 pkg/client/query/sessionquerier.go create mode 100644 pkg/client/query/supplierquerier.go create mode 100644 pkg/client/query/types/context.go create mode 100644 pkg/client/services.go create mode 100644 pkg/client/supplier/client.go create mode 100644 pkg/client/supplier/client_integration_test.go create mode 100644 pkg/client/supplier/client_test.go create mode 100644 pkg/client/supplier/options.go create mode 100644 pkg/client/tx/client.go create mode 100644 pkg/client/tx/client_integration_test.go create mode 100644 pkg/client/tx/client_test.go create mode 100644 pkg/client/tx/context.go create mode 100644 pkg/client/tx/encoding.go create mode 100644 pkg/client/tx/errors.go create mode 100644 pkg/client/tx/options.go create mode 100644 pkg/client/tx/types/context.go create mode 100644 pkg/crypto/godoc.go create mode 100644 pkg/crypto/interface.go create mode 100644 pkg/crypto/rings/cache.go create mode 100644 pkg/crypto/rings/cache_test.go create mode 100644 pkg/crypto/rings/errors.go create mode 100644 pkg/crypto/rings/godoc.go create mode 100644 pkg/deps/config/godoc.go create mode 100644 pkg/deps/config/suppliers.go create mode 100644 pkg/either/either.go create mode 100644 pkg/either/errors.go create mode 100644 pkg/either/types.go create mode 100644 pkg/observable/channel/collect.go create mode 100644 pkg/observable/channel/map.go create mode 100644 pkg/observable/channel/map_test.go create mode 100644 pkg/observable/channel/observable.go create mode 100644 pkg/observable/channel/observable_test.go create mode 100644 pkg/observable/channel/observation_test.go create mode 100644 pkg/observable/channel/observer.go create mode 100644 pkg/observable/channel/observer_manager.go create mode 100644 pkg/observable/channel/observer_test.go create mode 100644 pkg/observable/channel/replay.go create mode 100644 pkg/observable/channel/replay_test.go create mode 100644 pkg/observable/errors.go create mode 100644 pkg/observable/filter/either.go create mode 100644 pkg/observable/interface.go create mode 100644 pkg/observable/logging/logging.go create mode 100644 pkg/observable/types.go create mode 100644 pkg/partials/errors.go create mode 100644 pkg/partials/interface.go create mode 100644 pkg/partials/partial.go create mode 100644 pkg/partials/partials_test.go create mode 100644 pkg/partials/payloads/godoc.go create mode 100644 pkg/partials/payloads/jsonrpc.go create mode 100644 pkg/partials/payloads/rest.go create mode 100644 pkg/relayer/cmd/cmd.go create mode 100644 pkg/relayer/config/errors.go create mode 100644 pkg/relayer/config/pocket_node_config_hydrator.go create mode 100644 pkg/relayer/config/proxies_config_hydrator.go create mode 100644 pkg/relayer/config/proxy_http_config_parser.go create mode 100644 pkg/relayer/config/relayminer_configs_reader.go create mode 100644 pkg/relayer/config/relayminer_configs_reader_test.go create mode 100644 pkg/relayer/config/supplier_hydrator.go create mode 100644 pkg/relayer/config/suppliers_config_hydrator.go create mode 100644 pkg/relayer/config/types.go create mode 100644 pkg/relayer/interface.go create mode 100644 pkg/relayer/miner/gen/gen_fixtures.go create mode 100644 pkg/relayer/miner/gen/template.go create mode 100644 pkg/relayer/miner/miner.go create mode 100644 pkg/relayer/miner/miner_test.go create mode 100644 pkg/relayer/miner/options.go create mode 100644 pkg/relayer/miner/relay_fixtures_test.go create mode 100644 pkg/relayer/protocol/block_heights.go create mode 100644 pkg/relayer/protocol/difficulty.go create mode 100644 pkg/relayer/protocol/difficulty_test.go create mode 100644 pkg/relayer/protocol/errors.go create mode 100644 pkg/relayer/proxy/error_reply.go create mode 100644 pkg/relayer/proxy/errors.go create mode 100644 pkg/relayer/proxy/options.go create mode 100644 pkg/relayer/proxy/proxy.go create mode 100644 pkg/relayer/proxy/proxy_test.go create mode 100644 pkg/relayer/proxy/relay_builders.go create mode 100644 pkg/relayer/proxy/relay_signer.go create mode 100644 pkg/relayer/proxy/relay_verifier.go create mode 100644 pkg/relayer/proxy/server_builder.go create mode 100644 pkg/relayer/proxy/synchronous.go create mode 100644 pkg/relayer/relayminer.go create mode 100644 pkg/relayer/relayminer_test.go create mode 100644 pkg/relayer/session/claim.go create mode 100644 pkg/relayer/session/errors.go create mode 100644 pkg/relayer/session/options.go create mode 100644 pkg/relayer/session/proof.go create mode 100644 pkg/relayer/session/session.go create mode 100644 pkg/relayer/session/session_test.go create mode 100644 pkg/relayer/session/sessiontree.go create mode 100644 pkg/relayer/session/sessiontree_test.go create mode 100644 pkg/relayer/types.go create mode 100644 pkg/retry/retry.go create mode 100644 pkg/retry/retry_test.go create mode 100644 pkg/sdk/deps_builder.go create mode 100644 pkg/sdk/errors.go create mode 100644 pkg/sdk/interface.go create mode 100644 pkg/sdk/relay_verifier.go create mode 100644 pkg/sdk/sdk.go create mode 100644 pkg/sdk/send_relay.go create mode 100644 pkg/sdk/session.go create mode 100644 pkg/sdk/urls.go create mode 100644 pkg/signer/interface.go create mode 100644 pkg/signer/ring_signer.go create mode 100644 pkg/signer/simple_signer.go diff --git a/pkg/appgateserver/cmd/cmd.go b/pkg/appgateserver/cmd/cmd.go new file mode 100644 index 000000000..f8a439716 --- /dev/null +++ b/pkg/appgateserver/cmd/cmd.go @@ -0,0 +1,200 @@ +package cmd + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "os" + + "cosmossdk.io/depinject" + cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/rs/zerolog" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/cmd/signals" + "github.com/pokt-network/poktroll/pkg/appgateserver" + appgateconfig "github.com/pokt-network/poktroll/pkg/appgateserver/config" + "github.com/pokt-network/poktroll/pkg/deps/config" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +) + +// We're `explicitly omitting default` so that the appgateserver crashes if these aren't specified. +const omittedDefaultFlagValue = "explicitly omitting default" + +var ( + // flagAppGateConfig is the variable containing the AppGate config filepath + // sourced from the `--config` flag. + flagAppGateConfig string + // flagNodeRPCURL is the variable containing the Cosmos node RPC URL flag value. + flagNodeRPCURL string + // flagNodeGRPCURL is the variable containing the Cosmos node GRPC URL flag value. + flagNodeGRPCURL string +) + +// AppGateServerCmd returns the Cobra command for running the AppGate server. +func AppGateServerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "appgate-server", + Short: "Starts the AppGate server", + Long: `Starts the AppGate server that listens for incoming relay requests and handles +the necessary on-chain interactions (sessions, suppliers, etc) to receive the +respective relay response. + +-- App Mode -- +If the server is started with a defined 'self-signing' configuration directive, +it will behave as an Application. Any incoming requests will be signed by using +the private key and ring associated with the 'signing_key' configuration directive. + +-- Gateway Mode -- +If the 'self_signing' configuration directive is not provided, the server will +behave as a Gateway. +It will sign relays on behalf of any Application sending it relays, provided +that the address associated with 'signing_key' has been delegated to. This is +necessary for the application<->gateway ring signature to function. + +-- App Mode (HTTP) -- +If an application doesn't provide the 'self_signing' configuration directive, +it can still send relays to the AppGate server and function as an Application, +provided that: +1. Each request contains the '?applicationAddr=[address]' query parameter +2. The key associated with the 'signing_key' configuration directive belongs + to the address provided in the request, otherwise the ring signature will not be valid.`, + Args: cobra.NoArgs, + RunE: runAppGateServer, + } + + // Custom flags + cmd.Flags().StringVar(&flagAppGateConfig, "config", "", "The path to the appgate config file") + + // Cosmos flags + // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. + cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") + cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query context correctly. It can be used to override the `QueryNodeUrl` field in the config file if specified.") + cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCUrl` field in the config file if specified.") + cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") + + return cmd +} + +func runAppGateServer(cmd *cobra.Command, _ []string) error { + // Create a context that is canceled when the command is interrupted + ctx, cancelCtx := context.WithCancel(cmd.Context()) + defer cancelCtx() + + // Handle interrupt and kill signals asynchronously. + signals.GoOnExitSignal(cancelCtx) + + configContent, err := os.ReadFile(flagAppGateConfig) + if err != nil { + return err + } + + // TODO_TECHDEBT: add logger level and output options to the config. + appGateConfigs, err := appgateconfig.ParseAppGateServerConfigs(configContent) + if err != nil { + return err + } + + // TODO_TECHDEBT: populate logger from the config (ideally, from viper). + loggerOpts := []polylog.LoggerOption{ + polyzero.WithLevel(zerolog.DebugLevel), + polyzero.WithOutput(os.Stderr), + } + + // Construct a logger and associate it with the command context. + logger := polyzero.NewLogger(loggerOpts...) + ctx = logger.WithContext(ctx) + cmd.SetContext(ctx) + + // Setup the AppGate server dependencies. + appGateServerDeps, err := setupAppGateServerDependencies(ctx, cmd, appGateConfigs) + if err != nil { + return fmt.Errorf("failed to setup AppGate server dependencies: %w", err) + } + + logger.Info().Msg("Creating AppGate server...") + + // Create the AppGate server. + appGateServer, err := appgateserver.NewAppGateServer( + appGateServerDeps, + appgateserver.WithSigningInformation(&appgateserver.SigningInformation{ + // provide the name of the key to use for signing all incoming requests + SigningKeyName: appGateConfigs.SigningKey, + // provide whether the appgate server should sign all incoming requests + // with its own ring (for applications) or not (for gateways) + SelfSigning: appGateConfigs.SelfSigning, + }), + appgateserver.WithListeningUrl(appGateConfigs.ListeningEndpoint), + ) + if err != nil { + return fmt.Errorf("failed to create AppGate server: %w", err) + } + + logger.Info(). + Str("listening_endpoint", appGateConfigs.ListeningEndpoint.String()). + Msg("Starting AppGate server...") + + if appGateConfigs.Metrics.Enabled { + err = appGateServer.ServeMetrics(appGateConfigs.Metrics.Addr) + if err != nil { + return fmt.Errorf("failed to start metrics endpoint: %w", err) + } + } + + // Start the AppGate server. + if err := appGateServer.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) { + return fmt.Errorf("failed to start app gate server: %w", err) + } else if errors.Is(err, http.ErrServerClosed) { + logger.Info().Msg("AppGate server stopped") + } + + return nil +} + +func setupAppGateServerDependencies( + ctx context.Context, + cmd *cobra.Command, + appGateConfig *appgateconfig.AppGateServerConfig, +) (_ depinject.Config, err error) { + queryNodeRPCURL := appGateConfig.QueryNodeRPCUrl + queryNodeGRPCURL := appGateConfig.QueryNodeGRPCUrl + + // Override the config file's `QueryNodeGRPCUrl` field + // with the `--grpc-addr` flag if it was specified. + // TODO_TECHDEBT(#223) Remove this check once viper is used as SoT for overridable config values. + if flagNodeGRPCURL != omittedDefaultFlagValue { + queryNodeGRPCURL, err = url.Parse(flagNodeGRPCURL) + if err != nil { + return nil, fmt.Errorf("failed to parse grpc query URL: %w", err) + } + } + + // Override the config file's `QueryNodeRPCURL` field + // with the `--node` flag if it was specified. + // TODO_TECHDEBT(#223) Remove this check once viper is used as SoT for overridable config values. + if flagNodeRPCURL != omittedDefaultFlagValue { + queryNodeRPCURL, err = url.Parse(flagNodeRPCURL) + if err != nil { + return nil, fmt.Errorf("failed to parse rpc query URL: %w", err) + } + } + + supplierFuncs := []config.SupplierFn{ + config.NewSupplyLoggerFromCtx(ctx), + config.NewSupplyEventsQueryClientFn(queryNodeRPCURL), // leaf + config.NewSupplyBlockClientFn(), // leaf + config.NewSupplyQueryClientContextFn(queryNodeGRPCURL), // leaf + config.NewSupplyDelegationClientFn(), // leaf + config.NewSupplyAccountQuerierFn(), // leaf + config.NewSupplyApplicationQuerierFn(), // leaf + config.NewSupplySessionQuerierFn(), // leaf + config.NewSupplyRingCacheFn(), + + config.NewSupplyPOKTRollSDKFn(appGateConfig.SigningKey), + } + + return config.SupplyConfig(ctx, cmd, supplierFuncs) +} diff --git a/pkg/appgateserver/config/appgate_configs_reader.go b/pkg/appgateserver/config/appgate_configs_reader.go new file mode 100644 index 000000000..5d59c9e52 --- /dev/null +++ b/pkg/appgateserver/config/appgate_configs_reader.go @@ -0,0 +1,106 @@ +package config + +import ( + "net/url" + + "gopkg.in/yaml.v2" +) + +// YAMLAppGateServerConfig is the structure used to unmarshal the AppGateServer config file +// TODO_DOCUMENT(@red-0ne): Add proper README documentation for yaml config files. +type YAMLAppGateServerConfig struct { + ListeningEndpoint string `yaml:"listening_endpoint"` + Metrics YAMLAppGateServerMetricsConfig `yaml:"metrics"` + QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` + QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` + SelfSigning bool `yaml:"self_signing"` + SigningKey string `yaml:"signing_key"` +} + +// YAMLAppGateServerMetricsConfig is the structure used to unmarshal the metrics +// section of the AppGateServer config file +type YAMLAppGateServerMetricsConfig struct { + Enabled bool `yaml:"enabled"` + Addr string `yaml:"addr"` +} + +// AppGateServerConfig is the structure describing the AppGateServer config +type AppGateServerConfig struct { + ListeningEndpoint *url.URL + Metrics *AppGateServerMetricsConfig + QueryNodeGRPCUrl *url.URL + QueryNodeRPCUrl *url.URL + SelfSigning bool + SigningKey string +} + +// AppGateServerMetricsConfig is the structure resulting from parsing the metrics +// section of the AppGateServer config file +type AppGateServerMetricsConfig struct { + Enabled bool + Addr string +} + +// ParseAppGateServerConfigs parses the stake config file into a AppGateConfig +// NOTE: If SelfSigning is not defined in the config file, it will default to false +func ParseAppGateServerConfigs(configContent []byte) (*AppGateServerConfig, error) { + var yamlAppGateServerConfig YAMLAppGateServerConfig + + if len(configContent) == 0 { + return nil, ErrAppGateConfigEmpty + } + + // Unmarshal the stake config file into a yamlAppGateConfig + if err := yaml.Unmarshal(configContent, &yamlAppGateServerConfig); err != nil { + return nil, ErrAppGateConfigUnmarshalYAML.Wrap(err.Error()) + } + + if len(yamlAppGateServerConfig.SigningKey) == 0 { + return nil, ErrAppGateConfigEmptySigningKey + } + + if len(yamlAppGateServerConfig.ListeningEndpoint) == 0 { + return nil, ErrAppGateConfigInvalidListeningEndpoint + } + + listeningEndpoint, err := url.Parse(yamlAppGateServerConfig.ListeningEndpoint) + if err != nil { + return nil, ErrAppGateConfigInvalidListeningEndpoint.Wrap(err.Error()) + } + + if len(yamlAppGateServerConfig.QueryNodeGRPCUrl) == 0 { + return nil, ErrAppGateConfigInvalidQueryNodeGRPCUrl + } + + queryNodeGRPCUrl, err := url.Parse(yamlAppGateServerConfig.QueryNodeGRPCUrl) + if err != nil { + return nil, ErrAppGateConfigInvalidQueryNodeGRPCUrl.Wrap(err.Error()) + } + + if len(yamlAppGateServerConfig.QueryNodeRPCUrl) == 0 { + return nil, ErrAppGateConfigInvalidQueryNodeRPCUrl + } + + queryNodeRPCUrl, err := url.Parse(yamlAppGateServerConfig.QueryNodeRPCUrl) + if err != nil { + return nil, ErrAppGateConfigInvalidQueryNodeRPCUrl.Wrap(err.Error()) + } + + // Populate the appGateServerConfig with the values from the yamlAppGateServerConfig + appGateServerConfig := &AppGateServerConfig{ + QueryNodeRPCUrl: queryNodeRPCUrl, + QueryNodeGRPCUrl: queryNodeGRPCUrl, + SigningKey: yamlAppGateServerConfig.SigningKey, + SelfSigning: yamlAppGateServerConfig.SelfSigning, + ListeningEndpoint: listeningEndpoint, + } + + // Not doing additinal validation on metrics, as the server would not start if the value is invalid, + // providing the user with a descriptive error message. + appGateServerConfig.Metrics = &AppGateServerMetricsConfig{ + Enabled: yamlAppGateServerConfig.Metrics.Enabled, + Addr: yamlAppGateServerConfig.Metrics.Addr, + } + + return appGateServerConfig, nil +} diff --git a/pkg/appgateserver/config/appgate_configs_reader_test.go b/pkg/appgateserver/config/appgate_configs_reader_test.go new file mode 100644 index 000000000..82ee6e53f --- /dev/null +++ b/pkg/appgateserver/config/appgate_configs_reader_test.go @@ -0,0 +1,176 @@ +package config_test + +import ( + "net/url" + "testing" + + sdkerrors "cosmossdk.io/errors" + "github.com/gogo/status" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/appgateserver/config" + "github.com/pokt-network/poktroll/testutil/yaml" +) + +func Test_ParseAppGateConfigs(t *testing.T) { + tests := []struct { + desc string + + inputConfigYAML string + + expectedError *sdkerrors.Error + expectedConfig *config.AppGateServerConfig + }{ + // Valid Configs + { + desc: "valid: AppGateServer config", + + inputConfigYAML: ` + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + signing_key: app1 + self_signing: true + listening_endpoint: http://localhost:42069 + `, + + expectedError: nil, + expectedConfig: &config.AppGateServerConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + SigningKey: "app1", + SelfSigning: true, + ListeningEndpoint: &url.URL{Scheme: "http", Host: "localhost:42069"}, + }, + }, + { + desc: "valid: AppGateServer config with undefined self signing", + + inputConfigYAML: ` + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + signing_key: app1 + listening_endpoint: http://localhost:42069 + `, + + expectedError: nil, + expectedConfig: &config.AppGateServerConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + SigningKey: "app1", + SelfSigning: false, + ListeningEndpoint: &url.URL{Scheme: "http", Host: "localhost:42069"}, + }, + }, + // Invalid Configs + { + desc: "invalid: empty AppGateServer config", + + inputConfigYAML: ``, + + expectedError: config.ErrAppGateConfigEmpty, + }, + { + desc: "invalid: no signing key", + + inputConfigYAML: ` + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + # NB: explicitly missing signing key + self_signing: true + listening_endpoint: http://localhost:42069 + `, + + expectedError: config.ErrAppGateConfigEmptySigningKey, + }, + { + desc: "invalid: invalid listening endpoint", + + inputConfigYAML: ` + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + signing_key: app1 + self_signing: true + listening_endpoint: l&ocalhost:42069 + `, + + expectedError: config.ErrAppGateConfigInvalidListeningEndpoint, + }, + { + desc: "invalid: invalid query node grpc url", + + inputConfigYAML: ` + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: 1&27.0.0.1:36658 + signing_key: app1 + self_signing: true + listening_endpoint: http://localhost:42069 + `, + + expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, + }, + { + desc: "invalid: missing query node grpc url", + + inputConfigYAML: ` + query_node_rpc_url: tcp://127.0.0.1:36657 + # NB: explicitly missing query_node_grpc_url + signing_key: app1 + self_signing: true + listening_endpoint: http://localhost:42069 + `, + + expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, + }, + { + desc: "invalid: invalid query node rpc url", + + inputConfigYAML: ` + query_node_rpc_url: 1&27.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + signing_key: app1 + self_signing: true + listening_endpoint: http://localhost:42069 + `, + + expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, + }, + { + desc: "invalid: missing query node rpc url", + + inputConfigYAML: ` + # NB: explicitly missing query_node_rpc_url + query_node_grpc_url: tcp://127.0.0.1:36658 + signing_key: app1 + self_signing: true + listening_endpoint: http://localhost:42069 + `, + + expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) + config, err := config.ParseAppGateServerConfigs([]byte(normalizedConfig)) + + if tt.expectedError != nil { + require.ErrorIs(t, err, tt.expectedError) + require.Nil(t, config) + stat, ok := status.FromError(tt.expectedError) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Nil(t, config) + return + } + + require.NoError(t, err) + + require.Equal(t, tt.expectedConfig.SelfSigning, config.SelfSigning) + require.Equal(t, tt.expectedConfig.SigningKey, config.SigningKey) + require.Equal(t, tt.expectedConfig.ListeningEndpoint.String(), config.ListeningEndpoint.String()) + require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) + require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) + }) + } +} diff --git a/pkg/appgateserver/config/errors.go b/pkg/appgateserver/config/errors.go new file mode 100644 index 000000000..450c75378 --- /dev/null +++ b/pkg/appgateserver/config/errors.go @@ -0,0 +1,13 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "appgate_config" + ErrAppGateConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") + ErrAppGateConfigEmptySigningKey = sdkerrors.Register(codespace, 2, "empty signing key in AppGateServer config") + ErrAppGateConfigInvalidListeningEndpoint = sdkerrors.Register(codespace, 3, "invalid listening endpoint in AppGateServer config") + ErrAppGateConfigInvalidQueryNodeGRPCUrl = sdkerrors.Register(codespace, 4, "invalid query node grpc url in AppGateServer config") + ErrAppGateConfigInvalidQueryNodeRPCUrl = sdkerrors.Register(codespace, 5, "invalid query node rpc url in AppGateServer config") + ErrAppGateConfigEmpty = sdkerrors.Register(codespace, 6, "empty AppGateServer config") +) diff --git a/pkg/appgateserver/endpoint_selector.go b/pkg/appgateserver/endpoint_selector.go new file mode 100644 index 000000000..821b18018 --- /dev/null +++ b/pkg/appgateserver/endpoint_selector.go @@ -0,0 +1,35 @@ +package appgateserver + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/sdk" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// TODO_IMPROVE: This implements a naive greedy approach that defaults to the +// first available supplier. +// Future optimizations (e.g. Quality-of-Service) can be introduced here. +// TODO(@h5law): Look into different endpoint selection depending on their suitability. +// getRelayerUrl gets the URL of the relayer for the given service. +func (app *appGateServer) getRelayerUrl( + ctx context.Context, + serviceId string, + rpcType sharedtypes.RPCType, + supplierEndpoints []*sdk.SingleSupplierEndpoint, +) (supplierEndpoint *sdk.SingleSupplierEndpoint, err error) { + for _, supplierEndpoint := range supplierEndpoints { + // Skip services that don't match the requested serviceId. + if supplierEndpoint.Header.Service.Id != serviceId { + continue + } + + // Return the first endpoint url that matches the request's RpcType. + if supplierEndpoint.RpcType == rpcType { + return supplierEndpoint, nil + } + } + + // Return an error if no relayer endpoints were found. + return nil, ErrAppGateNoRelayEndpoints +} diff --git a/pkg/appgateserver/error_reply.go b/pkg/appgateserver/error_reply.go new file mode 100644 index 000000000..bac599f3d --- /dev/null +++ b/pkg/appgateserver/error_reply.go @@ -0,0 +1,33 @@ +package appgateserver + +import ( + "context" + "net/http" + + "github.com/pokt-network/poktroll/pkg/partials" +) + +// replyWithError replies to the application with an error response and writes +// it to the writer provided. +// NOTE: This method is used to reply with an "internal" error that is related +// to the appgateserver itself and not to the relay request. +func (app *appGateServer) replyWithError( + ctx context.Context, + payloadBz []byte, + writer http.ResponseWriter, + serviceId string, + requestType string, + err error, +) { + relaysErrorsTotal.With("service_id", serviceId, "request_type", requestType).Add(1) + responseBz, err := partials.GetErrorReply(ctx, payloadBz, err) + if err != nil { + app.logger.Error().Err(err).Str("service_id", serviceId).Msg("failed getting error reply") + return + } + + if _, err = writer.Write(responseBz); err != nil { + app.logger.Error().Err(err).Str("service_id", serviceId).Msg("failed writing relay response") + return + } +} diff --git a/pkg/appgateserver/errors.go b/pkg/appgateserver/errors.go new file mode 100644 index 000000000..17f5456d6 --- /dev/null +++ b/pkg/appgateserver/errors.go @@ -0,0 +1,12 @@ +package appgateserver + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "appgateserver" + ErrAppGateNoRelayEndpoints = sdkerrors.Register(codespace, 1, "no relay endpoints found") + ErrAppGateMissingAppAddress = sdkerrors.Register(codespace, 2, "missing application address") + ErrAppGateMissingSigningInformation = sdkerrors.Register(codespace, 3, "missing app client signing information") + ErrAppGateMissingListeningEndpoint = sdkerrors.Register(codespace, 4, "missing app client listening endpoint") + ErrAppGateHandleRelay = sdkerrors.Register(codespace, 5, "internal error handling relay request") +) diff --git a/pkg/appgateserver/options.go b/pkg/appgateserver/options.go new file mode 100644 index 000000000..fb164029b --- /dev/null +++ b/pkg/appgateserver/options.go @@ -0,0 +1,19 @@ +package appgateserver + +import ( + "net/url" +) + +// WithSigningInformation sets the signing information for the appgate server. +func WithSigningInformation(signingInfo *SigningInformation) appGateServerOption { + return func(appGateServer *appGateServer) { + appGateServer.signingInformation = signingInfo + } +} + +// WithListeningUrl sets the listening URL for the appgate server. +func WithListeningUrl(listeningUrl *url.URL) appGateServerOption { + return func(appGateServer *appGateServer) { + appGateServer.listeningEndpoint = listeningUrl + } +} diff --git a/pkg/appgateserver/server.go b/pkg/appgateserver/server.go new file mode 100644 index 000000000..5befd5dda --- /dev/null +++ b/pkg/appgateserver/server.go @@ -0,0 +1,266 @@ +package appgateserver + +import ( + "bytes" + "context" + "fmt" + "io" + "net" + "net/http" + "net/url" + "strings" + + "cosmossdk.io/depinject" + "github.com/prometheus/client_golang/prometheus/promhttp" + metrics "github.com/slok/go-http-metrics/metrics/prometheus" + metricsmiddleware "github.com/slok/go-http-metrics/middleware" + middlewarestd "github.com/slok/go-http-metrics/middleware/std" + + querytypes "github.com/pokt-network/poktroll/pkg/client/query/types" + "github.com/pokt-network/poktroll/pkg/partials" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/sdk" +) + +// SigningInformation is a struct that holds information related to the signing +// of relay requests, used by the appGateServer to determine how they will sign +// relay requests (with either their own ring or the rign of the application). +type SigningInformation struct { + // SelfSigning indicates whether the server is running in self-signing mode + SelfSigning bool + + // SigningKeyName is the name of the key in the keyring that corresponds to the + // private key used to sign relay requests. + SigningKeyName string + + // AppAddress is the address of the application that the server is serving if + // If it is nil, then the application address must be included in each request via a query parameter. + AppAddress string +} + +// appGateServer is the server that listens for application requests and relays them to the supplier. +// It is responsible for maintaining the current session for the application, signing the requests, +// and verifying the response signatures. +// The appGateServer is the basis for both applications and gateways, depending on whether the application +// is running their own instance of the appGateServer or they are sending requests to a gateway running an +// instance of the appGateServer, they will need to either include the application address in the request or not. +type appGateServer struct { + logger polylog.Logger + + // signing information holds the signing key and application address for the server + signingInformation *SigningInformation + + // clientCtx is the client context for the application. + // It is used to query for the application's account to unmarshal the supplier's account + // and get the public key to verify the relay response signature. + clientCtx querytypes.Context + + // sdk is the POKTRollSDK that the appGateServer uses to query for the current session + // and send relay requests to the supplier. + sdk sdk.POKTRollSDK + + // listeningEndpoint is the endpoint that the appGateServer will listen on. + listeningEndpoint *url.URL + + // server is the HTTP server that will be used capture application requests + // so that they can be signed and relayed to the supplier. + server *http.Server +} + +// NewAppGateServer creates a new appGateServer instance with the given dependencies. +// +// Required dependencies: +// - polylog.Logger +// - sdkclient.Context +// - client.BlockClient +// - client.AccountQueryClient +// - crypto.RingCache +func NewAppGateServer( + deps depinject.Config, + opts ...appGateServerOption, +) (*appGateServer, error) { + app := &appGateServer{} + + if err := depinject.Inject( + deps, + &app.logger, + &app.clientCtx, + &app.sdk, + ); err != nil { + return nil, err + } + + for _, opt := range opts { + opt(app) + } + + if err := app.validateConfig(); err != nil { + return nil, err + } + + keyRecord, err := app.clientCtx.Keyring.Key(app.signingInformation.SigningKeyName) + if err != nil { + return nil, fmt.Errorf("failed to get key from keyring: %w", err) + } + + appAddress, err := keyRecord.GetAddress() + if err != nil { + return nil, fmt.Errorf("failed to get address from key: %w", err) + } + if app.signingInformation.SelfSigning { + app.signingInformation.AppAddress = appAddress.String() + } + + // TODO_CONSIDERATION: Use app.listeningEndpoint scheme to determine which + // kind of server to create (HTTP, HTTPS, TCP, UNIX, etc...) + app.server = &http.Server{Addr: app.listeningEndpoint.Host} + + return app, nil +} + +// Start starts the appgate server and blocks until the context is done +// or the server returns an error. +func (app *appGateServer) Start(ctx context.Context) error { + // Shutdown the HTTP server when the context is done. + go func() { + <-ctx.Done() + app.server.Shutdown(ctx) + }() + + // This hooks https://github.com/slok/go-http-metrics to the appgate server HTTP server. + mm := metricsmiddleware.New(metricsmiddleware.Config{ + Recorder: metrics.NewRecorder(metrics.Config{}), + }) + + // Set the HTTP handler. + app.server.Handler = middlewarestd.Handler("", mm, app) + + // Start the HTTP server. + return app.server.ListenAndServe() +} + +// Stop stops the appgate server and returns any error that occurred. +func (app *appGateServer) Stop(ctx context.Context) error { + return app.server.Shutdown(ctx) +} + +// ServeHTTP is the HTTP handler for the appgate server. +// It captures the application request, signs it, and sends it to the supplier. +// After receiving the response from the supplier, it verifies the response signature +// before returning the response to the application. +// The serviceId is extracted from the request path. +// The request's path should be of the form: +// +// "://host:port/serviceId[/other/path/segments]?applicationAddr=" +// +// where the serviceId is the id of the service that the application is requesting +// and the other (possible) path segments are the JSON RPC request path. +// TODO_TECHDEBT: Revisit the requestPath above based on the SDK that'll be exposed in the future. +func (app *appGateServer) ServeHTTP(writer http.ResponseWriter, request *http.Request) { + ctx := app.logger.WithContext(request.Context()) + + // Extract the serviceId from the request path. + path := request.URL.Path + serviceId := strings.Split(path, "/")[1] + + // Read the request body bytes. + requestPayloadBz, err := io.ReadAll(request.Body) + if err != nil { + app.replyWithError( + ctx, + requestPayloadBz, + writer, + serviceId, + "unknown", + ErrAppGateHandleRelay.Wrapf("reading relay request body: %s", err), + ) + // TODO_IMPROVE: log additional info? + app.logger.Error().Err(err).Msg("failed reading relay request body") + + return + } + app.logger.Debug(). + Str("service_id", serviceId). + Str("payload", string(requestPayloadBz)). + Msg("handling relay") + + // TODO_IMPROVE: log additional info? + app.logger.Debug().Msg("determining request type") + + // Get the type of the request by doing a partial unmarshal of the payload + requestType, err := partials.GetRequestType(ctx, requestPayloadBz) + if err != nil { + app.replyWithError(ctx, requestPayloadBz, writer, serviceId, "unknown", ErrAppGateHandleRelay) + // TODO_IMPROVE: log additional info? + app.logger.Error().Err(err).Msg("failed getting request type") + + return + } + + // Determine the application address. + appAddress := app.signingInformation.AppAddress + if appAddress == "" { + appAddress = request.URL.Query().Get("applicationAddr") + } + if appAddress == "" { + app.replyWithError(ctx, requestPayloadBz, writer, serviceId, requestType.String(), ErrAppGateMissingAppAddress) + // TODO_IMPROVE: log additional info? + app.logger.Error().Msg("no application address provided") + + return + } + + // Put the request body bytes back into the request body. + request.Body = io.NopCloser(bytes.NewBuffer(requestPayloadBz)) + + // TODO(@h5law, @red0ne): Add support for asynchronous relays, and switch on + // the request type here. + // TODO_RESEARCH: Should this be started in a goroutine, to allow for + // concurrent requests from numerous applications? + if err := app.handleSynchronousRelay( + ctx, appAddress, serviceId, requestPayloadBz, requestType, request, writer); err != nil { + + // Reply with an error response if there was an error handling the relay. + app.replyWithError(ctx, requestPayloadBz, writer, serviceId, requestType.String(), err) + // TODO_IMPROVE: log additional info? + app.logger.Error().Err(err).Msg("failed handling relay") + + return + } + + // TODO_IMPROVE: log additional info? + app.logger.Info().Msg("request serviced successfully") +} + +// validateConfig validates the appGateServer configuration. +func (app *appGateServer) validateConfig() error { + if app.signingInformation == nil { + return ErrAppGateMissingSigningInformation + } + if app.listeningEndpoint == nil { + return ErrAppGateMissingListeningEndpoint + } + return nil +} + +// Starts a metrics server on the given address. +func (app *appGateServer) ServeMetrics(addr string) error { + ln, err := net.Listen("tcp", addr) + if err != nil { + app.logger.Error().Err(err).Msg("failed to listen on address for metrics") + return err + } + + // If no error, start the server in a new goroutine + go func() { + app.logger.Info().Str("endpoint", addr).Msg("serving metrics") + if err := http.Serve(ln, promhttp.Handler()); err != nil { + app.logger.Error().Err(err).Msg("metrics server failed") + return + } + }() + + return nil +} + +type appGateServerOption func(*appGateServer) diff --git a/pkg/appgateserver/synchronous.go b/pkg/appgateserver/synchronous.go new file mode 100644 index 000000000..e0b2f5d10 --- /dev/null +++ b/pkg/appgateserver/synchronous.go @@ -0,0 +1,60 @@ +package appgateserver + +import ( + "context" + "net/http" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// handleSynchronousRelay handles relay requests for synchronous protocols, where +// there is a one-to-one correspondance between the request and response. +// It does everything from preparing, signing and sending the request. +// It then blocks on the response to come back and forward it to the provided writer. +func (app *appGateServer) handleSynchronousRelay( + ctx context.Context, + appAddress, serviceId string, + payloadBz []byte, + requestType sharedtypes.RPCType, + request *http.Request, + writer http.ResponseWriter, +) error { + relaysTotal.With("service_id", serviceId, "request_type", requestType.String()).Add(1) + + // TODO_IMPROVE: log additional info? + app.logger.Debug(). + Str("request_type", requestType.String()). + Msg("got request type") + + sessionSuppliers, err := app.sdk.GetSessionSupplierEndpoints(ctx, appAddress, serviceId) + if err != nil { + return ErrAppGateHandleRelay.Wrapf("getting current session: %s", err) + } + + // Get a supplier URL and address for the given service and session. + supplierEndpoint, err := app.getRelayerUrl( + ctx, + serviceId, + requestType, + sessionSuppliers.SuppliersEndpoints, + ) + if err != nil { + return ErrAppGateHandleRelay.Wrapf("getting supplier URL: %s", err) + } + + relayResponse, err := app.sdk.SendRelay(ctx, supplierEndpoint, request) + if err != nil { + return err + } + + app.logger.Debug(). + Str("relay_response_payload", string(relayResponse.Payload)). + Msg("writing relay response payload") + + // Reply with the RelayResponse payload. + if _, err := writer.Write(relayResponse.Payload); err != nil { + return ErrAppGateHandleRelay.Wrapf("writing relay response payload: %s", err) + } + + return nil +} diff --git a/pkg/client/block/block.go b/pkg/client/block/block.go new file mode 100644 index 000000000..82c34aa2b --- /dev/null +++ b/pkg/client/block/block.go @@ -0,0 +1,48 @@ +package block + +import ( + "encoding/json" + + "github.com/cometbft/cometbft/types" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" +) + +// cometBlockEvent is used to deserialize incoming committed block event messages +// from the respective events query subscription. It implements the client.Block +// interface by loosely wrapping cometbft's block type, into which messages are +// deserialized. +type cometBlockEvent struct { + Block types.Block `json:"block"` +} + +// Height returns the block's height. +func (blockEvent *cometBlockEvent) Height() int64 { + return blockEvent.Block.Height +} + +// Hash returns the binary representation of the block's hash as a byte slice. +func (blockEvent *cometBlockEvent) Hash() []byte { + return blockEvent.Block.LastBlockID.Hash.Bytes() +} + +// newCometBlockEvent is a function that attempts to deserialize the given bytes +// into a comet block. If the resulting block has a height of zero, assume the event +// was not a block event and return an ErrUnmarshalBlockEvent error. +func newCometBlockEvent(blockMsgBz []byte) (client.Block, error) { + blockMsg := new(cometBlockEvent) + if err := json.Unmarshal(blockMsgBz, blockMsg); err != nil { + return nil, err + } + + // The header height should never be zero. If it is, it means that blockMsg + // does not match the expected format which led unmarshaling to fail, + // and blockHeader.height to have a default value. + if blockMsg.Block.Header.Height == 0 { + return nil, events.ErrEventsUnmarshalEvent. + Wrapf("with block data: %s", string(blockMsgBz)) + } + + return blockMsg, nil +} diff --git a/pkg/client/block/client.go b/pkg/client/block/client.go new file mode 100644 index 000000000..1e3bd21ea --- /dev/null +++ b/pkg/client/block/client.go @@ -0,0 +1,77 @@ +package block + +import ( + "context" + + "cosmossdk.io/depinject" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" +) + +const ( + // committedBlocksQuery is the query used to subscribe to new committed block + // events used by the EventsQueryClient to subscribe to new block events from + // the chain. + // See: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events + committedBlocksQuery = "tm.event='NewBlock'" + + // defaultBlocksReplayLimit is the number of blocks that the replay + // observable returned by LastNBlocks() will be able to replay. + // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient + // struct that defaults to this but can be overridden via an option. + defaultBlocksReplayLimit = 100 +) + +// NewBlockClient creates a new block client from the given dependencies and +// cometWebsocketURL. It uses a pre-defined committedBlocksQuery to subscribe to +// newly committed block events which are mapped to Block objects. +// +// This lightly wraps the EventsReplayClient[Block] generic to correctly mock +// the interface. +// +// Required dependencies: +// - client.EventsQueryClient +func NewBlockClient( + ctx context.Context, + deps depinject.Config, +) (client.BlockClient, error) { + client, err := events.NewEventsReplayClient[client.Block]( + ctx, + deps, + committedBlocksQuery, + newCometBlockEvent, + defaultBlocksReplayLimit, + ) + if err != nil { + return nil, err + } + return &blockClient{eventsReplayClient: client}, nil +} + +// blockClient is a wrapper around an EventsReplayClient that implements the +// BlockClient interface for use with cosmos-sdk networks. +type blockClient struct { + // eventsReplayClient is the underlying EventsReplayClient that is used to + // subscribe to new committed block events. It uses both the Block type + // and the BlockReplayObservable type as its generic types. + // These enable the EventsReplayClient to correctly map the raw event bytes + // to Block objects and to correctly return a BlockReplayObservable + eventsReplayClient client.EventsReplayClient[client.Block] +} + +// CommittedBlocksSequence returns a replay observable of new block events. +func (b *blockClient) CommittedBlocksSequence(ctx context.Context) client.BlockReplayObservable { + return b.eventsReplayClient.EventsSequence(ctx) +} + +// LatestsNBlocks returns the last n blocks observed by the BockClient. +func (b *blockClient) LastNBlocks(ctx context.Context, n int) []client.Block { + return b.eventsReplayClient.LastNEvents(ctx, n) +} + +// Close closes the underlying websocket connection for the EventsQueryClient +// and closes all downstream connections. +func (b *blockClient) Close() { + b.eventsReplayClient.Close() +} diff --git a/pkg/client/block/client_integration_test.go b/pkg/client/block/client_integration_test.go new file mode 100644 index 000000000..375142f36 --- /dev/null +++ b/pkg/client/block/client_integration_test.go @@ -0,0 +1,79 @@ +package block_test + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/testutil/testclient/testblock" +) + +// TODO(#255): Refactor this integration test to use an in-memory simulated network + +const blockIntegrationSubTimeout = 5 * time.Second + +func TestBlockClient_LastNBlocks(t *testing.T) { + t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") + ctx := context.Background() + + blockClient := testblock.NewLocalnetClient(ctx, t) + require.NotNil(t, blockClient) + + block := blockClient.LastNBlocks(ctx, 1) + require.NotEmpty(t, block) +} + +func TestBlockClient_BlocksObservable(t *testing.T) { + t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") + ctx := context.Background() + + blockClient := testblock.NewLocalnetClient(ctx, t) + require.NotNil(t, blockClient) + + blockSub := blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx) + + var ( + blockMu sync.Mutex + blockCounter int + blocksToRecv = 2 + errCh = make(chan error, 1) + ) + go func() { + var previousBlock client.Block + for block := range blockSub.Ch() { + if previousBlock != nil { + if !assert.Equal(t, previousBlock.Height()+1, block.Height()) { + errCh <- fmt.Errorf("expected block height %d, got %d", previousBlock.Height()+1, block.Height()) + return + } + } + previousBlock = block + + require.NotEmpty(t, block) + blockMu.Lock() + blockCounter++ + if blockCounter >= blocksToRecv { + errCh <- nil + return + } + blockMu.Unlock() + } + }() + + select { + case err := <-errCh: + require.NoError(t, err) + require.Equal(t, blocksToRecv, blockCounter) + case <-time.After(blockIntegrationSubTimeout): + t.Fatalf( + "timed out waiting for block subscription; expected %d blocks, got %d", + blocksToRecv, blockCounter, + ) + } +} diff --git a/pkg/client/block/client_test.go b/pkg/client/block/client_test.go new file mode 100644 index 000000000..e44c8f32f --- /dev/null +++ b/pkg/client/block/client_test.go @@ -0,0 +1,130 @@ +package block_test + +import ( + "context" + "encoding/json" + "testing" + "time" + + "cosmossdk.io/depinject" + comettypes "github.com/cometbft/cometbft/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/block" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +const ( + testTimeoutDuration = 100 * time.Millisecond + + // duplicates pkg/client/block/client.go's committedBlocksQuery for testing purposes + committedBlocksQuery = "tm.event='NewBlock'" +) + +func TestBlockClient(t *testing.T) { + var ( + expectedHeight = int64(1) + expectedHash = []byte("test_hash") + expectedBlockEvent = &testBlockEvent{ + Block: comettypes.Block{ + Header: comettypes.Header{ + Height: 1, + Time: time.Now(), + LastBlockID: comettypes.BlockID{ + Hash: expectedHash, + }, + }, + }, + } + ctx = context.Background() + ) + + expectedEventBz, err := json.Marshal(expectedBlockEvent) + require.NoError(t, err) + + eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( + ctx, t, + committedBlocksQuery, + expectedEventBz, + ) + + deps := depinject.Supply(eventsQueryClient) + + // Set up block client. + blockClient, err := block.NewBlockClient(ctx, deps) + require.NoError(t, err) + require.NotNil(t, blockClient) + + tests := []struct { + name string + fn func() client.Block + }{ + { + name: "LastNBlocks(1) successfully returns latest block", + fn: func() client.Block { + lastBlock := blockClient.LastNBlocks(ctx, 1)[0] + return lastBlock + }, + }, + { + name: "CommittedBlocksSequence successfully returns latest block", + fn: func() client.Block { + blockObservable := blockClient.CommittedBlocksSequence(ctx) + require.NotNil(t, blockObservable) + + // Ensure that the observable is replayable via Last. + lastBlock := blockObservable.Last(ctx, 1)[0] + require.Equal(t, expectedHeight, lastBlock.Height()) + require.Equal(t, expectedHash, lastBlock.Hash()) + + return lastBlock + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + actualBlockCh := make(chan client.Block, 10) + + // Run test functions asynchronously because they can block, leading + // to an unresponsive test. If any of the methods under test hang, + // the test will time out in the select statement that follows. + go func(fn func() client.Block) { + actualBlockCh <- fn() + close(actualBlockCh) + }(tt.fn) + + select { + case actualBlock := <-actualBlockCh: + require.Equal(t, expectedHeight, actualBlock.Height()) + require.Equal(t, expectedHash, actualBlock.Hash()) + case <-time.After(testTimeoutDuration): + t.Fatal("timed out waiting for block event") + } + }) + } + + blockClient.Close() +} + +/* +TODO_TECHDEBT/TODO_CONSIDERATION(#XXX): this duplicates the unexported block event + +type from pkg/client/block/block.go. We seem to have some conflicting preferences +which result in the need for this duplication until a preferred direction is +identified: + + - We should prefer tests being in their own pkgs (e.g. block_test) + - this would resolve if this test were in the block package instead. + - We should prefer to not export types which don't require exporting for API + consumption. + - This test is the only external (to the block pkg) dependency of cometBlockEvent. + - We could use the //go:build test constraint on a new file which exports it + for testing purposes. + - This would imply that we also add -tags=test to all applicable tooling + and add a test which fails if the tag is absent. +*/ +type testBlockEvent struct { + Block comettypes.Block `json:"block"` +} diff --git a/pkg/client/block/godoc.go b/pkg/client/block/godoc.go new file mode 100644 index 000000000..01d829f2e --- /dev/null +++ b/pkg/client/block/godoc.go @@ -0,0 +1,5 @@ +// Package block contains a light wrapper of the EventsReplayClient[Block] +// generic which listens for committed block events on chain and emits them +// through a ReplayObservable. This enables consumers to listen for newly +// committed blocks and react to them asynchronously. +package block diff --git a/pkg/client/delegation/client.go b/pkg/client/delegation/client.go new file mode 100644 index 000000000..013b094df --- /dev/null +++ b/pkg/client/delegation/client.go @@ -0,0 +1,89 @@ +package delegation + +import ( + "context" + + "cosmossdk.io/depinject" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" +) + +const ( + // delegationEventQuery is the query used by the EventsQueryClient to subscribe + // to all application module events in order to filter for redelegation events. + // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events + // And: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events + // TODO_HACK(#280): Instead of listening to all events and doing a verbose + // filter, we should subscribe to both MsgDelegateToGateway and MsgUndelegateFromGateway + // messages directly, and filter those for the EventRedelegation event types. + // This would save the delegation client from listening to a lot of unnecessary + // events, that it filters out. + // NB: This is not currently possible because the observer pattern does not + // support multiplexing multiple observables into a single observable, that + // can supply the EventsReplayClient with both the MsgDelegateToGateway and + // MsgUndelegateFromGateway events. + delegationEventQuery = "tm.event='Tx' AND message.module='application'" + + // defaultRedelegationsReplayLimit is the number of redelegations that the + // replay observable returned by LastNRedelegations() will be able to replay. + // TODO_TECHDEBT/TODO_FUTURE: add a `redelegationsReplayLimit` field to the + // delegation client struct that defaults to this but can be overridden via + // an option in future work. + defaultRedelegationsReplayLimit = 100 +) + +// NewDelegationClient creates a new delegation client from the given +// dependencies and cometWebsocketURL. It uses a pre-defined delegationEventQuery +// to subscribe to newly emitted redelegation events which are mapped to +// Redelegation objects. +// +// This lightly wraps the EventsReplayClient[Redelegation] generic to +// correctly mock the interface. +// +// Required dependencies: +// - client.EventsQueryClient +func NewDelegationClient( + ctx context.Context, + deps depinject.Config, +) (client.DelegationClient, error) { + client, err := events.NewEventsReplayClient[client.Redelegation]( + ctx, + deps, + delegationEventQuery, + newRedelegationEventFactoryFn(), + defaultRedelegationsReplayLimit, + ) + if err != nil { + return nil, err + } + return &delegationClient{eventsReplayClient: client}, nil +} + +// delegationClient is a wrapper around an EventsReplayClient that implements +// the DelegationClient interface for use with cosmos-sdk networks. +type delegationClient struct { + // eventsReplayClient is the underlying EventsReplayClient that is used to + // subscribe to new delegation events. It uses both the Redelegation type + // and the RedelegationReplayObservable type as its generic types. + // These enable the EventsReplayClient to correctly map the raw event bytes + // to Redelegation objects and to correctly return a RedelegationReplayObservable + eventsReplayClient client.EventsReplayClient[client.Redelegation] +} + +// RedelegationsSequence returns a replay observable of Redelgation events +// observed by the DelegationClient. +func (b *delegationClient) RedelegationsSequence(ctx context.Context) client.RedelegationReplayObservable { + return b.eventsReplayClient.EventsSequence(ctx) +} + +// LastNRedelegations returns the latest n redelegation events from the DelegationClient. +func (b *delegationClient) LastNRedelegations(ctx context.Context, n int) []client.Redelegation { + return b.eventsReplayClient.LastNEvents(ctx, n) +} + +// Close closes the underlying websocket connection for the EventsQueryClient +// and closes all downstream connections. +func (b *delegationClient) Close() { + b.eventsReplayClient.Close() +} diff --git a/pkg/client/delegation/client_integration_test.go b/pkg/client/delegation/client_integration_test.go new file mode 100644 index 000000000..1ea3cbaec --- /dev/null +++ b/pkg/client/delegation/client_integration_test.go @@ -0,0 +1,171 @@ +package delegation_test + +// TODO(@h5law): Figure out how to use real components of the localnet +// - Create app and gateway actors +// - Stake them +// - Delegate to the gateway +// - Undelegate from the gateway +// Currently this test doesn't work, because (I think) it is using a mock +// keeper etc and this isn't actually interacting with the localnet where +// the DelegationClient is listening for events from. + +import ( + "context" + "sync" + "testing" + "time" + + "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/testutil" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/delegation" + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/testutil/network" + apptypes "github.com/pokt-network/poktroll/x/application/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" +) + +const ( + delegationIntegrationSubTimeout = 180 * time.Second +) + +// TODO_UPNEXT(@h5law): Figure out the correct way to subscribe to events on the +// simulated localnet. Currently this test doesn't work. Although the delegation +// client subscribes it doesn't receive any events. +func TestDelegationClient_RedelegationsObservables(t *testing.T) { + t.Skip("TODO(@h5law): Figure out how to subscribe to events on the simulated localnet") + // Create the network with 2 applications and 1 gateway + net, appAddresses, gatewayAddr := createNetworkWithApplicationsAndGateways(t) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + // Create the delegation client + evtQueryClient := events.NewEventsQueryClient("ws://localhost:26657/websocket") + deps := depinject.Supply(evtQueryClient) + delegationClient, err := delegation.NewDelegationClient(ctx, deps) + require.NoError(t, err) + require.NotNil(t, delegationClient) + t.Cleanup(func() { + delegationClient.Close() + }) + + // Subscribe to the delegation events + delegationSub := delegationClient.RedelegationsSequence(ctx).Subscribe(ctx) + + var ( + delegationMu = sync.Mutex{} // mutext to protect delegationChangeCounter + delegationChangeCounter int // counter to keep track of the number of delegation changes + expectedChanges = 4 // expected number of delegation changes + errCh = make(chan error, 1) // channel to signal the test to stop + ) + go func() { + // The test will delegate from app1 to gateway, then from app2 to gateway + // and then undelegate app1 from gateway and then undelegate app2 from gateway + // We expect to receive 4 delegation changes where the address of the + // Redelegation event alternates between app1 and app2 + var previousRedelegation client.Redelegation + for change := range delegationSub.Ch() { + t.Logf("received delegation change: %+v", change) + // Verify that the Redelegation event is valid and that the address + // of the Redelegation event alternates between app1 and app2 + if previousRedelegation != nil { + require.NotEqual(t, previousRedelegation.GetAppAddress(), change.GetAppAddress()) + if previousRedelegation.GetAppAddress() == appAddresses[0] { + require.Equal(t, appAddresses[1], change.GetAppAddress()) + } else { + require.Equal(t, appAddresses[0], change.GetAppAddress()) + } + } + previousRedelegation = change + + require.NotEmpty(t, change) + delegationMu.Lock() + delegationChangeCounter++ + if delegationChangeCounter >= expectedChanges { + errCh <- nil + return + } + delegationMu.Unlock() + } + }() + + // Delegate from app1 to gateway + t.Log(time.Now().String()) + t.Logf("delegating from app %s to gateway %s", appAddresses[0], gatewayAddr) + network.DelegateAppToGateway(t, net, appAddresses[0], gatewayAddr) + // need to wait for the account to be initialized in the next block + require.NoError(t, net.WaitForNextBlock()) + // Delegate from app2 to gateway + t.Logf("delegating from app %s to gateway %s", appAddresses[1], gatewayAddr) + network.DelegateAppToGateway(t, net, appAddresses[1], gatewayAddr) + // need to wait for the account to be initialized in the next block + require.NoError(t, net.WaitForNextBlock()) + // Undelegate from app1 to gateway + t.Logf("undelegating from app %s to gateway %s", appAddresses[0], gatewayAddr) + network.UndelegateAppFromGateway(t, net, appAddresses[0], gatewayAddr) + // need to wait for the account to be initialized in the next block + require.NoError(t, net.WaitForNextBlock()) + // Undelegate from app2 to gateway + t.Logf("undelegating from app %s to gateway %s", appAddresses[1], gatewayAddr) + network.UndelegateAppFromGateway(t, net, appAddresses[1], gatewayAddr) + // need to wait for the account to be initialized in the next block + require.NoError(t, net.WaitForNextBlock()) + + select { + case err := <-errCh: + require.NoError(t, err) + require.Equal(t, expectedChanges, delegationChangeCounter) + case <-time.After(delegationIntegrationSubTimeout): + t.Log(time.Now().String()) + t.Fatalf( + "timed out waiting for delegation subscription; expected %d delegation events, got %d", + expectedChanges, delegationChangeCounter, + ) + } +} + +// createNetworkWithApplicationsAndGateways creates a network with 2 applications +// and 1 gateway. It returns the network with all accounts initialized via a +// transaction from the first validator. +func createNetworkWithApplicationsAndGateways( + t *testing.T, +) (net *network.Network, appAddresses []string, gatewayAddress string) { + // Prepare the network + cfg := network.DefaultConfig() + net = network.New(t, cfg) + ctx := net.Validators[0].ClientCtx + + // Prepare the keyring for the 2 applications and 1 gateway account + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 3) + ctx = ctx.WithKeyring(kr) + + // Initialize all the accounts + for i, account := range accounts { + signatureSequenceNumber := i + 1 + network.InitAccountWithSequence(t, net, account.Address, signatureSequenceNumber) + } + // need to wait for the account to be initialized in the next block + require.NoError(t, net.WaitForNextBlock()) + + addresses := make([]string, len(accounts)) + for i, account := range accounts { + addresses[i] = account.Address.String() + } + + // Create two applications + appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, addresses[0:2]) + buf, err := cfg.Codec.MarshalJSON(appGenesisState) + require.NoError(t, err) + cfg.GenesisState[apptypes.ModuleName] = buf + + // Create a single gateway + gatewayGenesisState := network.GatewayModuleGenesisStateWithAddresses(t, addresses[2:3]) + buf, err = cfg.Codec.MarshalJSON(gatewayGenesisState) + require.NoError(t, err) + cfg.GenesisState[gatewaytypes.ModuleName] = buf + + return net, addresses[0:2], addresses[2] +} diff --git a/pkg/client/delegation/client_test.go b/pkg/client/delegation/client_test.go new file mode 100644 index 000000000..f9b82ffb5 --- /dev/null +++ b/pkg/client/delegation/client_test.go @@ -0,0 +1,100 @@ +package delegation_test + +import ( + "context" + "testing" + "time" + + "cosmossdk.io/depinject" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/delegation" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +const ( + testTimeoutDuration = 100 * time.Millisecond + + // duplicates pkg/client/delegation/client.go's delegationEventQuery for testing purposes. + delegationEventQuery = "tm.event='Tx' AND message.module='application'" +) + +func TestDelegationClient(t *testing.T) { + var ( + expectedAppAddress = sample.AccAddress() + expectedGatewayAddress = sample.AccAddress() + ctx = context.Background() + ) + + expectedEventBz := testdelegation.NewRedelegationEventBytes(t, expectedAppAddress, expectedGatewayAddress) + + eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( + ctx, t, + delegationEventQuery, + expectedEventBz, + ) + + deps := depinject.Supply(eventsQueryClient) + + // Set up delegation client. + // NB: the URL passed to `NewDelegationClient` is irrelevant here because `eventsQueryClient` is a mock. + delegationClient, err := delegation.NewDelegationClient(ctx, deps) + require.NoError(t, err) + require.NotNil(t, delegationClient) + + tests := []struct { + name string + fn func() client.Redelegation + }{ + { + name: "LastNRedelegations successfully returns latest redelegation", + fn: func() client.Redelegation { + lastRedelegation := delegationClient.LastNRedelegations(ctx, 1)[0] + require.Equal(t, expectedAppAddress, lastRedelegation.GetAppAddress()) + require.Equal(t, expectedGatewayAddress, lastRedelegation.GetGatewayAddress()) + return lastRedelegation + }, + }, + { + name: "RedelegationsSequence successfully returns latest redelegation", + fn: func() client.Redelegation { + redelegationObs := delegationClient.RedelegationsSequence(ctx) + require.NotNil(t, redelegationObs) + + // Ensure that the observable is replayable via Last. + lastRedelegation := redelegationObs.Last(ctx, 1)[0] + require.Equal(t, expectedAppAddress, lastRedelegation.GetAppAddress()) + require.Equal(t, expectedGatewayAddress, lastRedelegation.GetGatewayAddress()) + + return lastRedelegation + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + actualRedelegationCh := make(chan client.Redelegation, 10) + + // Run test functions asynchronously because they can block, leading + // to an unresponsive test. If any of the methods under test hang, + // the test will time out in the select statement that follows. + go func(fn func() client.Redelegation) { + actualRedelegationCh <- fn() + close(actualRedelegationCh) + }(tt.fn) + + select { + case actualRedelegation := <-actualRedelegationCh: + require.Equal(t, expectedAppAddress, actualRedelegation.GetAppAddress()) + require.Equal(t, expectedGatewayAddress, actualRedelegation.GetGatewayAddress()) + case <-time.After(testTimeoutDuration): + t.Fatal("timed out waiting for redelegation event") + } + }) + } + + delegationClient.Close() +} diff --git a/pkg/client/delegation/godoc.go b/pkg/client/delegation/godoc.go new file mode 100644 index 000000000..1d5b00139 --- /dev/null +++ b/pkg/client/delegation/godoc.go @@ -0,0 +1,5 @@ +// Package delegation contains a light wrapper of the EventsReplayClient[Redelegation] +// generic which listens for redelegation events on chain and emits them +// through a ReplayObservable. This enables consumers to listen for on-chain +// application redelegation events and react to them asynchronously. +package delegation diff --git a/pkg/client/delegation/redelegation.go b/pkg/client/delegation/redelegation.go new file mode 100644 index 000000000..86af6906f --- /dev/null +++ b/pkg/client/delegation/redelegation.go @@ -0,0 +1,99 @@ +package delegation + +// TODO_TECHDEBT(#280): Refactor to use merged observables and subscribe to +// MsgDelegateToGateway and MsgUndelegateFromGateway messages directly, instead +// of listening to all events and doing a verbose filter. + +import ( + "encoding/json" + "strconv" + + "cosmossdk.io/api/tendermint/abci" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" +) + +// redelegationEventType is the type of the EventRedelegation event emitted by +// both the MsgDelegateToGateway and MsgUndelegateFromGateway messages. +const redelegationEventType = "pocket.application.EventRedelegation" + +var _ client.Redelegation = (*redelegation)(nil) + +// TxEvent is an alias for the CometBFT TxResult type used to decode the +// response bytes from the EventsQueryClient's subscription +type TxEvent = abci.TxResult + +// redelegation wraps the EventRedelegation event emitted by the application +// module, for use in the observable, it is one of the log entries embedded +// within the log field of the response struct from the app module's query. +type redelegation struct { + AppAddress string `json:"app_address"` + GatewayAddress string `json:"gateway_address"` +} + +// GetAppAddress returns the application address of the redelegation event +func (d redelegation) GetAppAddress() string { + return d.AppAddress +} + +// GetGatewayAddress returns the gateway address of the redelegation event +func (d redelegation) GetGatewayAddress() string { + return d.GatewayAddress +} + +// newRedelegationEventFactoryFn is a factory function that returns a +// function that attempts to deserialize the given bytes into a redelegation +// struct. If the delegate struct has an empty app address then an +// ErrUnmarshalRedelegation error is returned. Otherwise if deserialisation +// fails then the error is returned. +func newRedelegationEventFactoryFn() events.NewEventsFn[client.Redelegation] { + return func(eventBz []byte) (client.Redelegation, error) { + txEvent := new(TxEvent) + // Try to deserialize the provided bytes into a TxEvent. + if err := json.Unmarshal(eventBz, txEvent); err != nil { + return nil, err + } + // Check if the TxEvent has empty transaction bytes, which indicates + // the message is probably not a valid transaction event. + if len(txEvent.Tx) == 0 { + return nil, events.ErrEventsUnmarshalEvent.Wrap("empty transaction bytes") + } + // Iterate through the log entries to find EventRedelegation + for _, event := range txEvent.Result.Events { + if event.GetType_() != redelegationEventType { + continue + } + var redelegationEvent redelegation + for _, attr := range event.Attributes { + switch attr.Key { + case "app_address": + appAddr, err := unescape(attr.Value) + if err != nil { + return nil, events.ErrEventsUnmarshalEvent.Wrapf("cannot retrieve app address: %v", err) + } + redelegationEvent.AppAddress = appAddr + case "gateway_address": + gatewayAddr, err := unescape(attr.Value) + if err != nil { + return nil, events.ErrEventsUnmarshalEvent.Wrapf("cannot retrieve gateway address: %v", err) + } + redelegationEvent.GatewayAddress = gatewayAddr + default: + return nil, events.ErrEventsUnmarshalEvent.Wrapf("unknown attribute key: %s", attr.Key) + } + } + // Handle the redelegation event + if redelegationEvent.AppAddress == "" || redelegationEvent.GatewayAddress == "" { + return nil, events.ErrEventsUnmarshalEvent. + Wrapf("empty redelegation event: %s", string(eventBz)) + } + return redelegationEvent, nil + } + return nil, events.ErrEventsUnmarshalEvent.Wrap("no redelegation event found") + } +} + +func unescape(s string) (string, error) { + return strconv.Unquote(s) +} diff --git a/pkg/client/events/errors.go b/pkg/client/events/errors.go new file mode 100644 index 000000000..838b9dbec --- /dev/null +++ b/pkg/client/events/errors.go @@ -0,0 +1,15 @@ +package events + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + codespace = "events" + + ErrEventsDial = sdkerrors.Register(codespace, 1, "dialing for connection failed") + ErrEventsConnClosed = sdkerrors.Register(codespace, 2, "connection closed") + ErrEventsSubscribe = sdkerrors.Register(codespace, 3, "failed to subscribe to events") + ErrEventsUnmarshalEvent = sdkerrors.Register(codespace, 4, "failed to unmarshal event bytes") + ErrEventsConsClosed = sdkerrors.Register(codespace, 5, "eventsqueryclient connection closed") +) diff --git a/pkg/client/events/godoc.go b/pkg/client/events/godoc.go new file mode 100644 index 000000000..b5bbf685f --- /dev/null +++ b/pkg/client/events/godoc.go @@ -0,0 +1,12 @@ +// Package events provides a generic client for subscribing to on-chain events +// via an EventsQueryClient and transforming the received events into the type +// defined by the EventsReplayClient's generic type parameter. +// +// The EventsQueryClient emits ReplayObservables which are of the type defined +// by the EventsReplayClient's generic type parameter. +// +// The usage of of ReplayObservables allows the EventsReplayClient to be always +// provide the latest event data to the caller, even if the connection to the +// EventsQueryClient is lost and re-established, without the caller having to +// re-subscribe to the EventsQueryClient. +package events diff --git a/pkg/client/events/options.go b/pkg/client/events/options.go new file mode 100644 index 000000000..41fca7548 --- /dev/null +++ b/pkg/client/events/options.go @@ -0,0 +1,11 @@ +package events + +import "github.com/pokt-network/poktroll/pkg/client" + +// WithDialer returns a client.EventsQueryClientOption which sets the given dialer on the +// resulting eventsQueryClient when passed to NewEventsQueryClient(). +func WithDialer(dialer client.Dialer) client.EventsQueryClientOption { + return func(evtClient client.EventsQueryClient) { + evtClient.(*eventsQueryClient).dialer = dialer + } +} diff --git a/pkg/client/events/query_client.go b/pkg/client/events/query_client.go new file mode 100644 index 000000000..5524f52dc --- /dev/null +++ b/pkg/client/events/query_client.go @@ -0,0 +1,293 @@ +package events + +import ( + "context" + "crypto/rand" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "sync" + + "go.uber.org/multierr" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events/websocket" + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" +) + +var _ client.EventsQueryClient = (*eventsQueryClient)(nil) + +// TODO_TECHDEBT: the cosmos-sdk CLI code seems to use a cometbft RPC client +// which includes a `#Subscribe()` method for a similar purpose. Perhaps we could +// replace this custom websocket client with that. +// See: +// - https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110 +// - https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L656 +// - https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114 +// - https://github.com/pokt-network/poktroll/pull/64#discussion_r1372378241 + +// eventsQueryClient implements the EventsQueryClient interface. +type eventsQueryClient struct { + // cometWebsocketURL is the websocket URL for the cometbft node. It is assigned + // in NewEventsQueryClient. + cometWebsocketURL string + // dialer is responsible for creating the connection instance which + // facilitates communication with the cometbft node via message passing. + dialer client.Dialer + // eventsBytesAndConnsMu protects the eventsBytesAndConns map. + eventsBytesAndConnsMu sync.RWMutex + // eventsBytesAndConns maps event subscription queries to their respective + // eventsBytes observable, connection, and isClosed status. + eventsBytesAndConns map[string]*eventsBytesAndConn +} + +// eventsBytesAndConn is a struct which holds an eventsBytes observable & the +// corresponding connection which produces its inputs. +type eventsBytesAndConn struct { + // eventsBytes is an observable which is notified about chain event messages + // matching the given query. It receives an either.Bytes which is + // either an error or the event message bytes. + eventsBytes observable.Observable[either.Bytes] + conn client.Connection + isClosed bool +} + +// Close unsubscribes all observers of eventsBytesAndConn's observable and also +// closes its connection. +func (ebc *eventsBytesAndConn) Close() { + ebc.eventsBytes.UnsubscribeAll() + _ = ebc.conn.Close() +} + +// NewEventsQueryClient returns a new events query client which is used to +// subscribe to on-chain events matching the given query. +// +// Available options: +// - WithDialer +func NewEventsQueryClient(cometWebsocketURL string, opts ...client.EventsQueryClientOption) client.EventsQueryClient { + evtClient := &eventsQueryClient{ + cometWebsocketURL: cometWebsocketURL, + eventsBytesAndConns: make(map[string]*eventsBytesAndConn), + } + + for _, opt := range opts { + opt(evtClient) + } + + if evtClient.dialer == nil { + // default to using the websocket dialer + evtClient.dialer = websocket.NewWebsocketDialer() + } + + return evtClient +} + +// EventsBytes returns an eventsBytes observable which is notified about chain +// event messages matching the given query. It receives an either.Bytes +// which is either an error or the event message bytes. +// (see: https://pkg.go.dev/github.com/cometbft/cometbft/types#pkg-constants) +// (see: https://docs.cosmos.network/v0.47/core/events#subscribing-to-events) +func (eqc *eventsQueryClient) EventsBytes( + ctx context.Context, + query string, +) (client.EventsBytesObservable, error) { + // Must (write) lock eventsBytesAndConnsMu so that we can safely check for + // existing subscriptions to the given query or add a new eventsBytes to the + // observableConns map. + // The lock must be held for both checking and adding to prevent concurrent + // calls to this function from racing. + eqc.eventsBytesAndConnsMu.Lock() + // Deferred (write) unlock. + defer eqc.eventsBytesAndConnsMu.Unlock() + + // Check if an event subscription already exists for the given query. + if eventsBzConn := eqc.eventsBytesAndConns[query]; eventsBzConn != nil { + // If found it is returned. + return eventsBzConn.eventsBytes, nil + } + + // Otherwise, create a new event subscription for the given query. + eventsBzConn, err := eqc.newEventsBytesAndConn(ctx, query) + if err != nil { + return nil, err + } + + // Insert the new eventsBytes into the eventsBytesAndConns map. + eqc.eventsBytesAndConns[query] = eventsBzConn + + // Unsubscribe from the eventsBytes when the context is done. + go eqc.goUnsubscribeOnDone(ctx, query) + + // Return the new eventsBytes observable for the given query. + return eventsBzConn.eventsBytes, nil +} + +// Close unsubscribes all observers from all event subscription observables. +func (eqc *eventsQueryClient) Close() { + eqc.close() +} + +// close unsubscribes all observers from all event subscription observables. +func (eqc *eventsQueryClient) close() { + eqc.eventsBytesAndConnsMu.Lock() + defer eqc.eventsBytesAndConnsMu.Unlock() + + for query, eventsBzConn := range eqc.eventsBytesAndConns { + // Unsubscribe all observers of the eventsBzConn observable and close the + // connection for the given query. + eventsBzConn.Close() + // remove isClosed eventsBytesAndConns + delete(eqc.eventsBytesAndConns, query) + } +} + +// newEventwsBzAndConn creates a new eventsBytes and connection for the given query. +func (eqc *eventsQueryClient) newEventsBytesAndConn( + ctx context.Context, + query string, +) (*eventsBytesAndConn, error) { + // Get a connection for the query. + conn, err := eqc.openEventsBytesAndConn(ctx, query) + if err != nil { + return nil, err + } + + // Construct an eventsBytes for the given query. + eventsBzObservable, eventsBzPublishCh := channel.NewObservable[either.Bytes]() + + // Publish either events bytes or an error received from the connection to + // the eventsBz observable. + // NB: intentionally not retrying on error, leaving that to the caller. + // (see: https://github.com/pokt-network/poktroll/pull/64#discussion_r1373826542) + go eqc.goPublishEventsBz(ctx, conn, eventsBzPublishCh) + + return &eventsBytesAndConn{ + eventsBytes: eventsBzObservable, + conn: conn, + }, nil +} + +// openEventsBytesAndConn gets a connection using the configured dialer and sends +// an event subscription request on it, returning the connection. +func (eqc *eventsQueryClient) openEventsBytesAndConn( + ctx context.Context, + query string, +) (client.Connection, error) { + // Get a request for subscribing to events matching the given query. + req, err := eqc.eventSubscriptionRequest(query) + if err != nil { + return nil, err + } + + // Get a connection from the dialer. + conn, err := eqc.dialer.DialContext(ctx, eqc.cometWebsocketURL) + if err != nil { + return nil, ErrEventsDial.Wrapf("%s", err) + } + + // Send the event subscription request on the connection. + if err := conn.Send(req); err != nil { + subscribeErr := ErrEventsSubscribe.Wrapf("%s", err) + // assume the connection is bad + closeErr := conn.Close() + return nil, multierr.Combine(subscribeErr, closeErr) + } + return conn, nil +} + +// goPublishEventsBz blocks on reading messages from a websocket connection. +// It is intended to be called from within a go routine. +func (eqc *eventsQueryClient) goPublishEventsBz( + ctx context.Context, + conn client.Connection, + eventsBzPublishCh chan<- either.Bytes, +) { + // Read and handle messages from the websocket. This loop will exit when the + // websocket connection is isClosed and/or returns an error. + for { + eventBz, err := conn.Receive() + if err != nil { + // TODO_CONSIDERATION: should we close the publish channel here too? + + // Stop this goroutine if there's an error. + // + // See gorilla websocket `Conn#NextReader()` docs: + // | Applications must break out of the application's read loop when this method + // | returns a non-nil error value. Errors returned from this method are + // | permanent. Once this method returns a non-nil error, all subsequent calls to + // | this method return the same error. + + // Only propagate error if it's not a context cancellation error. + if !errors.Is(ctx.Err(), context.Canceled) { + // Populate the error side (left) of the either and publish it. + eventsBzPublishCh <- either.Error[[]byte](err) + } + + eqc.close() + + return + } + + // Populate the []byte side (right) of the either and publish it. + eventsBzPublishCh <- either.Success(eventBz) + } +} + +// goUnsubscribeOnDone unsubscribes from the subscription when the context is done. +// It is intended to be called in a goroutine. +func (eqc *eventsQueryClient) goUnsubscribeOnDone( + ctx context.Context, + query string, +) { + // Wait for the context to be done. + <-ctx.Done() + // Only close the eventsBytes for the given query. + eqc.eventsBytesAndConnsMu.Lock() + defer eqc.eventsBytesAndConnsMu.Unlock() + + if eventsBzConn, ok := eqc.eventsBytesAndConns[query]; ok { + // Unsubscribe all observers of the given query's eventsBzConn's observable + // and close its connection. + eventsBzConn.Close() + // Remove the eventsBytesAndConn for the given query. + delete(eqc.eventsBytesAndConns, query) + } +} + +// eventSubscriptionRequest returns a JSON-RPC request for subscribing to events +// matching the given query. The request is serialized as JSON to a byte slice. +// (see: https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110) +// (see: https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114) +func (eqc *eventsQueryClient) eventSubscriptionRequest(query string) ([]byte, error) { + requestJson := map[string]any{ + "jsonrpc": "2.0", + "method": "subscribe", + "id": randRequestId(), + "params": map[string]interface{}{ + "query": query, + }, + } + requestBz, err := json.Marshal(requestJson) + if err != nil { + return nil, err + } + return requestBz, nil +} + +// randRequestId returns a random 8 byte, base64 request ID which is intended +// for in JSON-RPC requests to uniquely identify distinct RPC requests. +// These request IDs only need to be unique to the extent that they are useful +// to this client for identifying distinct RPC requests. Their size and keyspace +// are arbitrary. +func randRequestId() string { + requestIdBz := make([]byte, 8) // 8 bytes = 64 bits = uint64 + if _, err := rand.Read(requestIdBz); err != nil { + panic(fmt.Sprintf( + "failed to generate random request ID: %s", err, + )) + } + return base64.StdEncoding.EncodeToString(requestIdBz) +} diff --git a/pkg/client/events/query_client_integration_test.go b/pkg/client/events/query_client_integration_test.go new file mode 100644 index 000000000..cbd9c426b --- /dev/null +++ b/pkg/client/events/query_client_integration_test.go @@ -0,0 +1,60 @@ +//go:build integration + +package events_test + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +// The query use to subscribe for new block events on the websocket endpoint exposed by CometBFT nodes +const committedBlockEventsQuery = "tm.event='NewBlock'" + +func TestQueryClient_EventsObservable_Integration(t *testing.T) { + const ( + eventReceiveTimeout = 5 * time.Second + observedEventsLimit = 3 + ) + ctx := context.Background() + + queryClient := testeventsquery.NewLocalnetClient(t) + require.NotNil(t, queryClient) + + // Start a subscription to the committed block events query. This begins + // publishing events to the returned observable. + eventsObservable, err := queryClient.EventsBytes(ctx, committedBlockEventsQuery) + require.NoError(t, err) + + eventsObserver := eventsObservable.Subscribe(ctx) + + var ( + eventCounter int + done = make(chan struct{}, 1) + ) + go func() { + for range eventsObserver.Ch() { + eventCounter++ + + if eventCounter >= observedEventsLimit { + done <- struct{}{} + return + } + } + }() + + select { + case <-done: + require.NoError(t, err) + require.Equal(t, observedEventsLimit, eventCounter) + case <-time.After(eventReceiveTimeout): + t.Fatalf( + "timed out waiting for block subscription; expected %d blocks, got %d", + observedEventsLimit, eventCounter, + ) + } +} diff --git a/pkg/client/events/query_client_test.go b/pkg/client/events/query_client_test.go new file mode 100644 index 000000000..2c868ac42 --- /dev/null +++ b/pkg/client/events/query_client_test.go @@ -0,0 +1,392 @@ +package events_test + +import ( + "context" + "errors" + "fmt" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/client/events/websocket" + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testchannel" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" + "github.com/pokt-network/poktroll/testutil/testerrors" +) + +func TestEventsQueryClient_Subscribe_Succeeds(t *testing.T) { + var ( + readObserverEventsTimeout = time.Second + queryCounter int + queryLimit = 5 + connMocks = make([]*mockclient.MockConnection, queryLimit) + ctrl = gomock.NewController(t) + rootCtx, cancelRoot = context.WithCancel(context.Background()) + ) + t.Cleanup(cancelRoot) + + dialerMock := mockclient.NewMockDialer(ctrl) + // `Dialer#DialContext()` should be called once for each subscription (subtest). + dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). + DoAndReturn(func(_ context.Context, _ string) (*mockclient.MockConnection, error) { + // Return the connection mock for the subscription with the given query. + // It should've been created in the respective test function. + connMock := connMocks[queryCounter] + queryCounter++ + return connMock, nil + }). + Times(queryLimit) + + // Set up events query client. + dialerOpt := events.WithDialer(dialerMock) + queryClient := events.NewEventsQueryClient("", dialerOpt) + t.Cleanup(queryClient.Close) + + for queryIdx := 0; queryIdx < queryLimit; queryIdx++ { + t.Run(testQuery(queryIdx), func(t *testing.T) { + var ( + // ReadEventCounter is the number of eventsBytesAndConns which have been + // received from the connection since the subtest started. + readEventCounter int + // HandleEventsLimit is the total number of eventsBytesAndConns to send and + // receive through the query client's eventsBytes for this subtest. + handleEventsLimit = 250 + // delayFirstEvent runs once (per test case) to delay the first event + // published by the mocked connection's Receive method to give the test + // ample time to subscribe to the events bytes observable before it + // starts receiving events, otherwise they will be dropped. + delayFirstEvent sync.Once + connClosed atomic.Bool + queryCtx, cancelQuery = context.WithCancel(rootCtx) + ) + + // Must set up connection mock before calling EventsBytes() + connMock := mockclient.NewMockConnection(ctrl) + // `Connection#Close()` should be called once for each subscription. + connMock.EXPECT().Close(). + DoAndReturn(func() error { + // Simulate closing the connection. + connClosed.CompareAndSwap(false, true) + return nil + }). + Times(1) + // `Connection#Send()` should be called once for each subscription. + connMock.EXPECT().Send(gomock.Any()). + Return(nil). + Times(1) + // `Connection#Receive()` should be called once for each message plus + // one as it blocks in the loop which calls msgHandler after reading the + // last message. + connMock.EXPECT().Receive(). + DoAndReturn(func() (any, error) { + delayFirstEvent.Do(func() { time.Sleep(50 * time.Millisecond) }) + + // Simulate ErrConnClosed if connection is isClosed. + if connClosed.Load() { + return nil, events.ErrEventsConnClosed + } + + event := testEvent(int32(readEventCounter)) + readEventCounter++ + + // Simulate IO delay between sequential events. + time.Sleep(10 * time.Microsecond) + + return event, nil + }). + MinTimes(handleEventsLimit) + connMocks[queryIdx] = connMock + + // Set up events bytes observer for this query. + eventObservable, err := queryClient.EventsBytes(queryCtx, testQuery(queryIdx)) + require.NoError(t, err) + + eventObserver := eventObservable.Subscribe(queryCtx) + + onLimit := func() { + // Cancelling the context should close the connection. + cancelQuery() + // Closing the connection happens asynchronously, so we need to wait a bit + // for the connection to close to satisfy the connection mock expectations. + time.Sleep(10 * time.Millisecond) + + // Drain the observer channel and assert that it's isClosed. + err := testchannel.DrainChannel(eventObserver.Ch()) + require.NoError(t, err, "eventsBytesAndConns observer channel should be isClosed") + } + + // Concurrently consume eventsBytesAndConns from the observer channel. + behavesLikeEitherObserver( + t, eventObserver, + handleEventsLimit, + events.ErrEventsConnClosed, + readObserverEventsTimeout, + onLimit, + ) + }) + } +} + +func TestEventsQueryClient_Subscribe_Close(t *testing.T) { + var ( + firstEventDelay = 50 * time.Millisecond + readAllEventsTimeout = 50*time.Millisecond + firstEventDelay + handleEventsLimit = 10 + readEventCounter int + // delayFirstEvent runs once (per test case) to delay the first event + // published by the mocked connection's Receive method to give the test + // ample time to subscribe to the events bytes observable before it + // starts receiving events, otherwise they will be dropped. + delayFirstEvent sync.Once + connClosed atomic.Bool + ctx = context.Background() + ) + + connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) + connMock.EXPECT().Send(gomock.Any()).Return(nil). + Times(1) + connMock.EXPECT().Receive(). + DoAndReturn(func() (any, error) { + delayFirstEvent.Do(func() { time.Sleep(firstEventDelay) }) + + if connClosed.Load() { + return nil, events.ErrEventsConnClosed + } + + event := testEvent(int32(readEventCounter)) + readEventCounter++ + + // Simulate IO delay between sequential events. + time.Sleep(10 * time.Microsecond) + + return event, nil + }). + MinTimes(handleEventsLimit) + + dialerOpt := events.WithDialer(dialerMock) + queryClient := events.NewEventsQueryClient("", dialerOpt) + + // set up query observer + eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) + require.NoError(t, err) + + eventsObserver := eventsObservable.Subscribe(ctx) + + onLimit := func() { + // cancelling the context should close the connection + queryClient.Close() + // closing the connection happens asynchronously, so we need to wait a bit + // for the connection to close to satisfy the connection mock expectations. + time.Sleep(10 * time.Millisecond) + } + + // concurrently consume eventsBytesAndConns from the observer channel + behavesLikeEitherObserver( + t, eventsObserver, + handleEventsLimit, + events.ErrEventsConnClosed, + readAllEventsTimeout, + onLimit, + ) +} + +func TestEventsQueryClient_Subscribe_DialError(t *testing.T) { + ctx := context.Background() + + eitherErrDial := either.Error[*mockclient.MockConnection](events.ErrEventsDial) + dialerMock := testeventsquery.NewOneTimeMockDialer(t, eitherErrDial) + + dialerOpt := events.WithDialer(dialerMock) + queryClient := events.NewEventsQueryClient("", dialerOpt) + eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) + require.Nil(t, eventsObservable) + require.True(t, errors.Is(err, events.ErrEventsDial)) +} + +func TestEventsQueryClient_Subscribe_RequestError(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + + connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) + connMock.EXPECT().Send(gomock.Any()). + Return(fmt.Errorf("mock send error")). + Times(1) + + dialerOpt := events.WithDialer(dialerMock) + queryClient := events.NewEventsQueryClient("url_ignored", dialerOpt) + eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) + require.Nil(t, eventsObservable) + require.True(t, errors.Is(err, events.ErrEventsSubscribe)) + + // cancelling the context should close the connection + cancel() + // closing the connection happens asynchronously, so we need to wait a bit + // for the connection to close to satisfy the connection mock expectations. + time.Sleep(10 * time.Millisecond) +} + +// TODO_INVESTIGATE: why this test fails? +func TestEventsQueryClient_Subscribe_ReceiveError(t *testing.T) { + t.Skip("TODO_INVESTIGATE: why this test fails") + + var ( + handleEventLimit = 10 + readAllEventsTimeout = 100 * time.Millisecond + readEventCounter int + ) + + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + connMock, dialerMock := testeventsquery.NewOneTimeMockConnAndDialer(t) + connMock.EXPECT().Send(gomock.Any()).Return(nil). + Times(1) + connMock.EXPECT().Receive(). + DoAndReturn(func() (any, error) { + if readEventCounter >= handleEventLimit { + return nil, websocket.ErrEventsWebsocketReceive + } + + event := testEvent(int32(readEventCounter)) + readEventCounter++ + time.Sleep(10 * time.Microsecond) + + return event, nil + }). + MinTimes(handleEventLimit) + + dialerOpt := events.WithDialer(dialerMock) + queryClient := events.NewEventsQueryClient("", dialerOpt) + + // set up query observer + eventsObservable, err := queryClient.EventsBytes(ctx, testQuery(0)) + require.NoError(t, err) + + eventsObserver := eventsObservable.Subscribe(ctx) + // concurrently consume eventsBytesAndConns from the observer channel + behavesLikeEitherObserver( + t, eventsObserver, + handleEventLimit, + websocket.ErrEventsWebsocketReceive, + readAllEventsTimeout, + nil, + ) +} + +// TODO_TECHDEBT: add test coverage for multiple observers with distinct and overlapping queries +func TestEventsQueryClient_EventsBytes_MultipleObservers(t *testing.T) { + t.Skip("TODO_TECHDEBT: add test coverage for multiple observers with distinct and overlapping queries") +} + +// behavesLikeEitherObserver asserts that the given observer behaves like an +// observable.Observer[either.Either[V]] by consuming notifications from the +// observer channel and asserting that they match the expected notification. +// It also asserts that the observer channel is isClosed after the expected number +// of eventsBytes have been received. +// If onLimit is not nil, it is called when the expected number of events have +// been received. +// Otherwise, the observer channel is drained and the test fails if it is not +// isClosed after the timeout duration. +func behavesLikeEitherObserver[V any]( + t *testing.T, + observer observable.Observer[either.Either[V]], + notificationsLimit int, + expectedErr error, + timeout time.Duration, + onLimit func(), +) { + t.Helper() + + var ( + // eventsCounter is the number of events which have been received from the + // eventsBytes since this function was called. + eventsCounter int32 + // errCh is used to signal when the test completes and/or produces an error + errCh = make(chan error, 1) + ) + + go func() { + for eitherEvent := range observer.Ch() { + event, err := eitherEvent.ValueOrError() + if err != nil { + switch expectedErr { + case nil: + if !assert.NoError(t, err) { + errCh <- testerrors.ErrAsync + return + } + default: + if !assert.ErrorIs(t, err, expectedErr) { + errCh <- testerrors.ErrAsync + return + } + } + } + + currentEventCount := atomic.LoadInt32(&eventsCounter) + if int(currentEventCount) >= notificationsLimit { + // signal completion + errCh <- nil + return + } + + // TODO_IMPROVE: to make this test helper more generic, it should accept + // a generic function which generates the expected event for the given + // index. Perhaps this function could use an either type which could be + // used to consolidate the expectedErr and expectedEvent arguments. + expectedEvent := testEvent(currentEventCount) + // Require calls t.Fatal internally, which shouldn't happen in a + // goroutine other than the test function's. + // Use assert instead and stop the test by sending on errCh and + // returning. + if !assert.Equal(t, expectedEvent, event) { + errCh <- testerrors.ErrAsync + return + } + + atomic.AddInt32(&eventsCounter, 1) + + // unbounded consumption here can result in the condition below never + // being met due to the connection being isClosed before the "last" event + // is received + time.Sleep(10 * time.Microsecond) + } + }() + + select { + case err := <-errCh: + require.NoError(t, err) + require.Equal(t, notificationsLimit, int(atomic.LoadInt32(&eventsCounter))) + + // TODO_THIS_COMMIT: is this necessary? + time.Sleep(10 * time.Millisecond) + + if onLimit != nil { + onLimit() + } + case <-time.After(timeout): + t.Fatalf( + "timed out waiting for next event; expected %d events, got %d", + notificationsLimit, atomic.LoadInt32(&eventsCounter), + ) + } + + err := testchannel.DrainChannel(observer.Ch()) + require.NoError(t, err, "eventsBytesAndConns observer should be isClosed") +} + +func testEvent(idx int32) []byte { + return []byte(fmt.Sprintf("message_%d", idx)) +} + +func testQuery(idx int) string { + return fmt.Sprintf("query_%d", idx) +} diff --git a/pkg/client/events/replay_client.go b/pkg/client/events/replay_client.go new file mode 100644 index 000000000..4313213e5 --- /dev/null +++ b/pkg/client/events/replay_client.go @@ -0,0 +1,302 @@ +package events + +import ( + "context" + "fmt" + "time" + + "cosmossdk.io/depinject" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/retry" +) + +const ( + // eventsBytesRetryDelay is the delay between retry attempts when the events + // bytes observable returns an error. + eventsBytesRetryDelay = time.Second + // eventsBytesRetryLimit is the maximum number of times to attempt to + // re-establish the events query bytes subscription when the events bytes + // observable returns an error or closes. + eventsBytesRetryLimit = 10 + eventsBytesRetryResetTimeout = 10 * time.Second + // replayObsCacheBufferSize is the replay buffer size of the + // replayObsCache replay observable which is used to cache the replay + // observable that is notified of new events. + // It, replayObsCache, is updated with a new "active" observable when a new + // events query subscription is created, for example, after a non-persistent + // connection error. + replayObsCacheBufferSize = 1 +) + +// Enforce the EventsReplayClient interface is implemented by the replayClient type. +var _ client.EventsReplayClient[any] = (*replayClient[any])(nil) + +// NewEventsFn is a function that takes a byte slice and returns a new instance +// of the generic type T. +type NewEventsFn[T any] func([]byte) (T, error) + +// replayClient implements the EventsReplayClient interface for a generic type T, +// and replay observable for type T. +type replayClient[T any] struct { + // queryString is the query string used to subscribe to events of the + // desired type. + // See: https://docs.cosmos.network/main/learn/advanced/events#subscribing-to-events + // and: https://docs.cosmos.network/main/learn/advanced/events#default-events + queryString string + // eventsClient is the events query client which is used to subscribe to + // newly committed block events. It emits an either value which may contain + // an error, at most, once and closes immediately after if it does. + eventsClient client.EventsQueryClient + // eventDecoder is a function which decodes event subscription + // message bytes into the type defined by the EventsReplayClient's generic type + // parameter. + eventDecoder NewEventsFn[T] + // replayObsBufferSize is the buffer size for the replay observable returned + // by EventsSequence, this can be any integer and it refers to the number of + // notifications the replay observable will hold in its buffer, that can be + // replayed to new observers. + // NB: This is not the buffer size of the replayObsCache + replayObsBufferSize int + // replayObsCache is a replay observable with a buffer size of 1, which + // holds the "active latest replay observable" which is notified when new + // events are received by the events query client subscription created in + // goPublishEvents. This observable (and the one it emits) closes when the + // events bytes observable returns an error and is updated with a new + // "active" observable after a new events query subscription is created. + // + // TODO_REFACTOR(@h5law): Look into making this a regular observable as + // we may no longer depend on it being replayable. + replayObsCache observable.ReplayObservable[observable.ReplayObservable[T]] + // replayObsCachePublishCh is the publish channel for replayObsCache. + // It's used to set and subsequently update replayObsCache the events replay + // observable; + // For example when the connection is re-established after erroring. + replayObsCachePublishCh chan<- observable.ReplayObservable[T] +} + +// NewEventsReplayClient creates a new EventsReplayClient from the given +// dependencies, cometWebsocketURL and subscription query string. It requires a +// decoder function to be provided which decodes event subscription message +// bytes into the type defined by the EventsReplayClient's generic type parameter. +// The replayObsBufferSize is the replay buffer size of the replay observable +// which is notified of new events. +// +// Required dependencies: +// - client.EventsQueryClient +func NewEventsReplayClient[T any]( + ctx context.Context, + deps depinject.Config, + queryString string, + newEventFn NewEventsFn[T], + replayObsBufferSize int, +) (client.EventsReplayClient[T], error) { + // Initialize the replay client + rClient := &replayClient[T]{ + queryString: queryString, + eventDecoder: newEventFn, + replayObsBufferSize: replayObsBufferSize, + } + // TODO_REFACTOR(@h5law): Look into making this a regular observable as + // we may no longer depend on it being replayable. + replayObsCache, replayObsCachePublishCh := channel.NewReplayObservable[observable.ReplayObservable[T]]( + ctx, + // Buffer size of 1 as the cache only needs to hold the latest + // active replay observable. + replayObsCacheBufferSize, + ) + rClient.replayObsCache = replayObsCache + rClient.replayObsCachePublishCh = replayObsCachePublishCh + + // Inject dependencies + if err := depinject.Inject(deps, &rClient.eventsClient); err != nil { + return nil, err + } + + // Concurrently publish events to the observable emitted by replayObsCache. + go rClient.goPublishEvents(ctx) + + return rClient, nil +} + +// EventsSequence returns a new ReplayObservable, with the buffer size provided +// during the EventsReplayClient construction, which is notified when new +// events are received by the encapsulated EventsQueryClient. +func (rClient *replayClient[T]) EventsSequence(ctx context.Context) observable.ReplayObservable[T] { + // Create a new replay observable and publish channel for event type T with + // a buffer size matching that provided during the EventsReplayClient + // construction. + eventTypeObs, replayEventTypeObsPublishCh := channel.NewReplayObservable[T]( + ctx, + rClient.replayObsBufferSize, + ) + + // Ensure that the subscribers of the returned eventTypeObs receive + // notifications from the latest open replay observable. + go rClient.goRemapEventsSequence(ctx, replayEventTypeObsPublishCh) + + // Return the event type observable. + return eventTypeObs +} + +// goRemapEventsSequence publishes events observed by the most recent cached +// events type replay observable to the given publishCh +func (rClient *replayClient[T]) goRemapEventsSequence(ctx context.Context, publishCh chan<- T) { + var prevEventTypeObs observable.ReplayObservable[T] + channel.ForEach[observable.ReplayObservable[T]]( + ctx, + rClient.replayObsCache, + func(ctx context.Context, eventTypeObs observable.ReplayObservable[T]) { + if prevEventTypeObs != nil { + // Just in case the assumption that all transport errors are + // persistent (i.e. they occur once and do not repeat) does not + // hold, unsubscribe from the previous event type observable in + // order to prevent unexpected and/or duplicate notifications + // on the observable returned by this function. + prevEventTypeObs.UnsubscribeAll() + } else { + prevEventTypeObs = eventTypeObs + } + eventObserver := eventTypeObs.Subscribe(ctx) + for event := range eventObserver.Ch() { + publishCh <- event + } + }, + ) +} + +// LastNEvents returns the last N typed events that have been received by the +// corresponding events query subscription. +// It blocks until at least one event has been received. +func (rClient *replayClient[T]) LastNEvents(ctx context.Context, n int) []T { + return rClient.EventsSequence(ctx).Last(ctx, n) +} + +// Close unsubscribes all observers of the committed blocks sequence observable +// and closes the events query client. +func (rClient *replayClient[T]) Close() { + // Closing eventsClient will cascade unsubscribe and close downstream observers. + rClient.eventsClient.Close() +} + +// goPublishEvents runs the work function returned by retryPublishEventsFactory, +// re-invoking it according to the arguments to retry.OnError when the events bytes +// observable returns an asynchronous error. +// This function is intended to be called in a goroutine. +func (rClient *replayClient[T]) goPublishEvents(ctx context.Context) { + // React to errors by getting a new events bytes observable, re-mapping it, + // and send it to replayObsCachePublishCh such that + // replayObsCache.Last(ctx, 1) will return it. + publishError := retry.OnError( + ctx, + eventsBytesRetryLimit, + eventsBytesRetryDelay, + eventsBytesRetryResetTimeout, + "goPublishEvents", + rClient.retryPublishEventsFactory(ctx), + ) + + // If we get here, the retry limit was reached and the retry loop exited. + // Since this function runs in a goroutine, we can't return the error to the + // caller. Instead, we panic. + if publishError != nil { + panic(fmt.Errorf("EventsReplayClient[%T].goPublishEvents should never reach this spot: %w", *new(T), publishError)) + } +} + +// retryPublishEventsFactory returns a function which is intended to be passed +// to retry.OnError. The returned function pipes event bytes from the events +// query client, maps them to typed events, and publishes them to the +// replayObsCache replay observable. +func (rClient *replayClient[T]) retryPublishEventsFactory(ctx context.Context) func() chan error { + return func() chan error { + errCh := make(chan error, 1) + eventsBytesObs, err := rClient.eventsClient.EventsBytes(ctx, rClient.queryString) + if err != nil { + errCh <- err + return errCh + } + + // NB: must cast back to generic observable type to use with Map. + eventsBzObs := observable.Observable[either.Either[[]byte]](eventsBytesObs) + typedObs := channel.MapReplay( + ctx, + replayObsCacheBufferSize, + eventsBzObs, + rClient.newMapEventsBytesToTFn(errCh), + ) + + // Subscribe to the eventBzObs and block until the channel closes. + // Then pass this as an error to force the retry.OnError to resubscribe. + go func() { + eventsBzObserver := eventsBzObs.Subscribe(ctx) + for range eventsBzObserver.Ch() { + // Wait for the channel to close. + continue + } + // UnsubscribeAll downstream observers, as the source observable has + // closed and will not emit any more values. + typedObs.UnsubscribeAll() + // Publish an error to the error channel to initiate a retry + errCh <- ErrEventsConsClosed + }() + + // Initially set replayObsCache and update if after retrying on error. + rClient.replayObsCachePublishCh <- typedObs + + return errCh + } +} + +// newMapEventsBytesToTFn is a factory for a function which is intended +// to be used as a transformFn in a channel.Map() call. Since the map function +// is called asynchronously, this factory creates a closure around an error +// channel which can be used for asynchronous error signaling from within the +// map function, and handling from the Map call context. +// +// The map function itself attempts to deserialize the given byte slice as a +// the EventsReplayClient's generic typed event, using the decoder function provided. +// If the events bytes observable contained an error, this value is not emitted +// (skipped) on the destination observable of the map operation. +// +// If deserialisation failed because the event bytes were for a different event +// type, this value is also skipped. If deserialisation failed for some other +// reason, this function panics. +func (rClient *replayClient[T]) newMapEventsBytesToTFn(errCh chan<- error) func( + context.Context, + either.Bytes, +) (T, bool) { + return func( + _ context.Context, + eitherEventBz either.Bytes, + ) (_ T, skip bool) { + eventBz, err := eitherEventBz.ValueOrError() + if err != nil { + errCh <- err + // Don't publish (skip) if eitherEventBz contained an error. + // eitherEventBz should automatically close itself in this case. + // (i.e. no more values should be mapped to this transformFn's respective + // dstObservable). + return *new(T), true + } + + // attempt to decode the event bytes using the decoder function provided + // during the EventsReplayClient's construction. + event, err := rClient.eventDecoder(eventBz) + if err != nil { + if ErrEventsUnmarshalEvent.Is(err) { + // Don't publish (skip) if the message was not the correct event. + return *new(T), true + } + + panic(fmt.Sprintf( + "unexpected error deserialising event: %v; eventBz: %s", + err, string(eventBz), + )) + } + return event, false + } +} diff --git a/pkg/client/events/replay_client_example_test.go b/pkg/client/events/replay_client_example_test.go new file mode 100644 index 000000000..d11685de2 --- /dev/null +++ b/pkg/client/events/replay_client_example_test.go @@ -0,0 +1,105 @@ +package events_test + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/depinject" + + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +const ( + // Define a query string to provide to the EventsQueryClient + // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events + // And: https://docs.cosmos.network/v0.47/learn/advanced/events#default-events + eventQueryString = "message.action='messageActionName'" + // Define the websocket URL the EventsQueryClient will subscribe to + cometWebsocketURL = "ws://example.com:36657/websocket" + // the amount of events we want before they are emitted + replayObsBufferSize = 1 +) + +var _ EventType = (*eventType)(nil) + +// Define an interface to represent the onchain event +type EventType interface { + GetName() string // Illustrative only; arbitrary interfaces are supported. +} + +// Define the event type that implements the interface +type eventType struct { + Name string `json:"name"` +} + +// See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsFn +func eventTypeFactory(ctx context.Context) events.NewEventsFn[EventType] { + // Define a decoder function that can take the raw event bytes + // received from the EventsQueryClient and convert them into + // the desired type for the EventsReplayClient + return func(eventBz []byte) (EventType, error) { + eventMsg := new(eventType) + logger := polylog.Ctx(ctx) + + if err := json.Unmarshal(eventBz, eventMsg); err != nil { + return nil, err + } + + // Confirm the event is correct by checking its fields + if eventMsg.Name == "" { + logger.Error().Str("eventBz", string(eventBz)).Msg("event type is not correct") + return nil, events.ErrEventsUnmarshalEvent. + Wrapf("with eventType data: %s", string(eventBz)) + } + + return eventMsg, nil + } +} + +func (e *eventType) GetName() string { return e.Name } + +func ExampleNewEventsReplayClient() { + // Create the events query client and a depinject config to supply + // it into the EventsReplayClient + // See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsQueryClient + evtClient := events.NewEventsQueryClient(cometWebsocketURL) + depConfig := depinject.Supply(evtClient) + + // Create a context (this should be cancellable to close the EventsReplayClient) + ctx, cancel := context.WithCancel(context.Background()) + + // Create a new instance of the EventsReplayClient + // See: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client/events/#NewEventsReplayClient + client, err := events.NewEventsReplayClient[EventType]( + ctx, + depConfig, + eventQueryString, + eventTypeFactory(ctx), + replayObsBufferSize, + ) + if err != nil { + panic(fmt.Errorf("unable to create EventsReplayClient %v", err)) + } + + // Assume events the lastest event emitted of type EventType has the name "testEvent" + + // Retrieve the latest emitted event + lastEventType := client.LastNEvents(ctx, 1)[0] + fmt.Printf("Last Event: '%s'\n", lastEventType.GetName()) + + // Get the latest replay observable from the EventsReplayClient + // In order to get the latest events from the sequence + latestEventsObs := client.EventsSequence(ctx) + // Get the latest events from the sequence + lastEventType = latestEventsObs.Last(ctx, 1)[0] + fmt.Printf("Last Event: '%s'\n", lastEventType.GetName()) + + // Cancel the context which will call client.Close and close all + // subscriptions and the EventsQueryClient + cancel() + // Output + // Last Event: 'testEvent' + // Last Event: 'testEvent' +} diff --git a/pkg/client/events/replay_client_integration_test.go b/pkg/client/events/replay_client_integration_test.go new file mode 100644 index 000000000..30fe639be --- /dev/null +++ b/pkg/client/events/replay_client_integration_test.go @@ -0,0 +1,146 @@ +package events_test + +import ( + "context" + "encoding/json" + "fmt" + "sync/atomic" + "testing" + "time" + + "cosmossdk.io/depinject" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +// Create the generic event type and decoder for the replay client + +var _ messageEvent = (*tEvent)(nil) + +type messageEvent interface { + EventMessage() string +} + +type tEvent struct { + Message string `json:"message"` +} + +type messageEventReplayObs observable.ReplayObservable[messageEvent] + +func (t *tEvent) EventMessage() string { + return t.Message +} + +func newDecodeEventMessageFn() events.NewEventsFn[messageEvent] { + return func(eventBz []byte) (messageEvent, error) { + t := new(tEvent) + if err := json.Unmarshal(eventBz, t); err != nil { + return nil, err + } + if t.Message == "" { + return nil, events.ErrEventsUnmarshalEvent + } + return t, nil + } +} + +// newMessageEventBz returns a new message event in JSON format +func newMessageEventBz(eventNum int32) []byte { + return []byte(fmt.Sprintf(`{"message":"message_%d"}`, eventNum)) +} + +func TestReplayClient_Remapping(t *testing.T) { + var ( + ctx = context.Background() + connClosed atomic.Bool + firstEventDelayed atomic.Bool + readEventCounter atomic.Int32 + eventsReceived atomic.Int32 + eventsToRecv = int32(10) + errCh = make(chan error, 1) + timeoutAfter = 3 * time.Second // 1 second delay on retry.OnError + ) + + // Setup the mock connection and dialer + connMock, dialerMock := testeventsquery.NewNTimesReconnectMockConnAndDialer(t, 2, &connClosed, &firstEventDelayed) + // Mock the connection receiving events + connMock.EXPECT().Receive(). + // Receive is called in the tightest loop possible (max speed limited + // by a goroutine) and as such the sleep's within are used to slow down + // the time between events to prevent unexpected behavior. As in this + // test environment, there are no "real" delays between "#Receive" calls + // (events being emitted) and as such the sleep's enable the publishing + // of notifications to observers to occur in a flake-free manner. + DoAndReturn(func() (any, error) { + // Simulate ErrConnClosed if connection is isClosed. + if connClosed.Load() { + return nil, events.ErrEventsConnClosed + } + + // Delay the event if needed, this is to allow for the events query + // client to subscribe and receive the first event. + if !firstEventDelayed.CompareAndSwap(false, true) { + time.Sleep(50 * time.Millisecond) + } + + eventNum := readEventCounter.Add(1) - 1 + event := newMessageEventBz(eventNum) + // After an arbitrary number of events (2 in this case), simulate + // the connection closing so that the replay client can remap the + // events it receives without the caller having to resubscribe. + if eventNum == 2 { + // Simulate the connection closing + connMock.Close() + } + + // Simulate IO delay between sequential events. + time.Sleep(50 * time.Microsecond) + + return event, nil + }). + MinTimes(int(eventsToRecv)) + + // Setup the events query client dependency + dialerOpt := events.WithDialer(dialerMock) + queryClient := events.NewEventsQueryClient("", dialerOpt) + deps := depinject.Supply(queryClient) + + // Create the replay client + replayClient, err := events.NewEventsReplayClient[messageEvent]( + ctx, + deps, + "", // subscription query string + newDecodeEventMessageFn(), + 100, // replay buffer size + ) + require.NoError(t, err) + + channel.ForEach( + ctx, + observable.Observable[messageEvent](replayClient.EventsSequence(ctx)), + func(ctx context.Context, event messageEvent) { + require.NotEmpty(t, event) + received := eventsReceived.Add(1) + if received >= eventsToRecv { + errCh <- nil + return + } + }, + ) + + select { + case err := <-errCh: + require.NoError(t, err) + eventsRecv := eventsReceived.Load() + require.Equalf(t, eventsToRecv, eventsRecv, "received %d events, want: %d", eventsReceived.Load(), eventsRecv) + case <-time.After(timeoutAfter): + t.Fatalf( + "timed out waiting for events subscription; expected %d messages, got %d", + eventsToRecv, eventsReceived.Load(), + ) + } +} diff --git a/pkg/client/events/websocket/connection.go b/pkg/client/events/websocket/connection.go new file mode 100644 index 000000000..5f34aba4e --- /dev/null +++ b/pkg/client/events/websocket/connection.go @@ -0,0 +1,35 @@ +package websocket + +import ( + gorillaws "github.com/gorilla/websocket" + + "github.com/pokt-network/poktroll/pkg/client" +) + +var _ client.Connection = (*websocketConn)(nil) + +// websocketConn implements the Connection interface using the gorilla websocket +// transport implementation. +type websocketConn struct { + conn *gorillaws.Conn +} + +// Receive implements the respective interface method using the underlying websocket. +func (wsConn *websocketConn) Receive() ([]byte, error) { + _, msg, err := wsConn.conn.ReadMessage() + if err != nil { + return nil, ErrEventsWebsocketReceive.Wrapf("%s", err) + } + return msg, nil +} + +// Send implements the respective interface method using the underlying websocket. +func (wsConn *websocketConn) Send(msg []byte) error { + // Using the TextMessage message to indicate that msg is UTF-8 encoded. + return wsConn.conn.WriteMessage(gorillaws.TextMessage, msg) +} + +// Close implements the respective interface method using the underlying websocket. +func (wsConn *websocketConn) Close() error { + return wsConn.conn.Close() +} diff --git a/pkg/client/events/websocket/dialer.go b/pkg/client/events/websocket/dialer.go new file mode 100644 index 000000000..bd0597d03 --- /dev/null +++ b/pkg/client/events/websocket/dialer.go @@ -0,0 +1,35 @@ +package websocket + +import ( + "context" + + "github.com/gorilla/websocket" + + "github.com/pokt-network/poktroll/pkg/client" +) + +var _ client.Dialer = (*websocketDialer)(nil) + +// websocketDialer implements the Dialer interface using the gorilla websocket +// transport implementation. +type websocketDialer struct{} + +// NewWebsocketDialer creates a new websocketDialer. +func NewWebsocketDialer() client.Dialer { + return &websocketDialer{} +} + +// DialContext implements the respective interface method using the default gorilla +// websocket dialer. +func (wsDialer *websocketDialer) DialContext( + ctx context.Context, + urlString string, +) (client.Connection, error) { + // TODO_IMPROVE: check http response status and potential err + // TODO_TECHDEBT: add test coverage and ensure support for a 3xx responses + conn, _, err := websocket.DefaultDialer.DialContext(ctx, urlString, nil) + if err != nil { + return nil, err + } + return &websocketConn{conn: conn}, nil +} diff --git a/pkg/client/events/websocket/errors.go b/pkg/client/events/websocket/errors.go new file mode 100644 index 000000000..85f8953fd --- /dev/null +++ b/pkg/client/events/websocket/errors.go @@ -0,0 +1,11 @@ +package websocket + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + codespace = "events_query_client_websocket_connection" + + ErrEventsWebsocketReceive = sdkerrors.Register(codespace, 1, "failed to receive event over websocket connection to pocket node") +) diff --git a/pkg/client/events/websocket/godoc.go b/pkg/client/events/websocket/godoc.go new file mode 100644 index 000000000..6ac7e3f04 --- /dev/null +++ b/pkg/client/events/websocket/godoc.go @@ -0,0 +1,3 @@ +// Package websocket provides a websocket client used to connect to a cosmos-sdk +// based chain node and subscribe to events via the EventsQueryClient. +package websocket diff --git a/pkg/client/godoc.go b/pkg/client/godoc.go new file mode 100644 index 000000000..66da550dd --- /dev/null +++ b/pkg/client/godoc.go @@ -0,0 +1,12 @@ +// Package client defines interfaces and types that facilitate interactions +// with blockchain functionalities, both transactional and observational. It is +// built to provide an abstraction layer for sending, receiving, and querying +// blockchain data, thereby offering a standardized way of integrating with +// various blockchain platforms. +// +// The client package leverages external libraries like cosmos-sdk and cometbft, +// but there is a preference to minimize direct dependencies on these external +// libraries, when defining interfaces, aiming for a cleaner decoupling. +// It seeks to provide a flexible and comprehensive interface layer, adaptable to +// different blockchain configurations and requirements. +package client diff --git a/pkg/client/interface.go b/pkg/client/interface.go new file mode 100644 index 000000000..da18a8790 --- /dev/null +++ b/pkg/client/interface.go @@ -0,0 +1,264 @@ +//go:generate mockgen -destination=../../testutil/mockclient/events_query_client_mock.go -package=mockclient . Dialer,Connection,EventsQueryClient +//go:generate mockgen -destination=../../testutil/mockclient/block_client_mock.go -package=mockclient . Block,BlockClient +//go:generate mockgen -destination=../../testutil/mockclient/delegation_client_mock.go -package=mockclient . Redelegation,DelegationClient +//go:generate mockgen -destination=../../testutil/mockclient/tx_client_mock.go -package=mockclient . TxContext,TxClient +//go:generate mockgen -destination=../../testutil/mockclient/supplier_client_mock.go -package=mockclient . SupplierClient +//go:generate mockgen -destination=../../testutil/mockclient/account_query_client_mock.go -package=mockclient . AccountQueryClient +//go:generate mockgen -destination=../../testutil/mockclient/application_query_client_mock.go -package=mockclient . ApplicationQueryClient +//go:generate mockgen -destination=../../testutil/mockclient/supplier_query_client_mock.go -package=mockclient . SupplierQueryClient +//go:generate mockgen -destination=../../testutil/mockclient/session_query_client_mock.go -package=mockclient . SessionQueryClient +//go:generate mockgen -destination=../../testutil/mockclient/cosmos_tx_builder_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client TxBuilder +//go:generate mockgen -destination=../../testutil/mockclient/cosmos_keyring_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/crypto/keyring Keyring +//go:generate mockgen -destination=../../testutil/mockclient/cosmos_client_mock.go -package=mockclient github.com/cosmos/cosmos-sdk/client AccountRetriever + +package client + +import ( + "context" + + comettypes "github.com/cometbft/cometbft/rpc/core/types" + cosmosclient "github.com/cosmos/cosmos-sdk/client" + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/pokt-network/smt" + + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + apptypes "github.com/pokt-network/poktroll/x/application/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// SupplierClient is an interface for sufficient for a supplier operator to be +// able to construct blockchain transactions from pocket protocol-specific messages +// related to its role. +type SupplierClient interface { + // CreateClaim sends a claim message which creates an on-chain commitment by + // calling supplier to the given smt.SparseMerkleSumTree root hash of the given + // session's mined relays. + CreateClaim( + ctx context.Context, + sessionHeader sessiontypes.SessionHeader, + rootHash []byte, + ) error + // SubmitProof sends a proof message which contains the + // smt.SparseMerkleClosestProof, corresponding to some previously created claim + // for the same session. The proof is validated on-chain as part of the pocket + // protocol. + SubmitProof( + ctx context.Context, + sessionHeader sessiontypes.SessionHeader, + proof *smt.SparseMerkleClosestProof, + ) error +} + +// TxClient provides a synchronous interface initiating and waiting for transactions +// derived from cosmos-sdk messages, in a cosmos-sdk based blockchain network. +type TxClient interface { + SignAndBroadcast( + ctx context.Context, + msgs ...cosmostypes.Msg, + ) either.AsyncError +} + +// TxContext provides an interface which consolidates the operational dependencies +// required to facilitate the sender side of the transaction lifecycle: build, sign, +// encode, broadcast, and query (optional). +// +// TODO_IMPROVE: Avoid depending on cosmos-sdk structs or interfaces; add Pocket +// interface types to substitute: +// - ResultTx +// - TxResponse +// - Keyring +// - TxBuilder +type TxContext interface { + // GetKeyring returns the associated key management mechanism for the transaction context. + GetKeyring() cosmoskeyring.Keyring + + // NewTxBuilder creates and returns a new transaction builder instance. + NewTxBuilder() cosmosclient.TxBuilder + + // SignTx signs a transaction using the specified key name. It can operate in offline mode, + // and can overwrite any existing signatures based on the provided flags. + SignTx( + keyName string, + txBuilder cosmosclient.TxBuilder, + offline, overwriteSig bool, + ) error + + // EncodeTx takes a transaction builder and encodes it, returning its byte representation. + EncodeTx(txBuilder cosmosclient.TxBuilder) ([]byte, error) + + // BroadcastTx broadcasts the given transaction to the network. + BroadcastTx(txBytes []byte) (*cosmostypes.TxResponse, error) + + // QueryTx retrieves a transaction status based on its hash and optionally provides + // proof of the transaction. + QueryTx( + ctx context.Context, + txHash []byte, + prove bool, + ) (*comettypes.ResultTx, error) +} + +// Block is an interface which abstracts the details of a block to its minimal +// necessary components. +type Block interface { + Height() int64 + Hash() []byte +} + +// Redelegation is an interface which wraps the EventRedelegation event +// emitted by the application module. +// See: proto/pocket/application/types/event.proto#EventRedelegation +type Redelegation interface { + GetAppAddress() string + GetGatewayAddress() string +} + +// EventsObservable is a replay observable for events of some type T. +// NB: This cannot be an alias due to gomock's lack of support for generic types. +type EventsObservable[T any] observable.ReplayObservable[T] + +// EventsReplayClient is an interface which provides notifications about newly received +// events as well as direct access to the latest event via some blockchain API. +type EventsReplayClient[T any] interface { + // EventsSequence returns an observable which emits new events. + EventsSequence(context.Context) observable.ReplayObservable[T] + // LastNEvents returns the latest N events that has been received. + LastNEvents(ctx context.Context, n int) []T + // Close unsubscribes all observers of the events sequence observable + // and closes the events query client. + Close() +} + +// BlockReplayObservable is a defined type which is a replay observable of type Block. +// NB: This cannot be an alias due to gomock's lack of support for generic types. +type BlockReplayObservable EventsObservable[Block] + +// BlockClient is an interface that wraps the EventsReplayClient interface +// specific for the EventsReplayClient[Block] implementation +type BlockClient interface { + // CommittedBlocksSequence returns a BlockObservable that emits the + // latest blocks that have been committed to the chain. + CommittedBlocksSequence(context.Context) BlockReplayObservable + // LastNBlocks returns the latest N blocks that have been committed to + // the chain. + LastNBlocks(context.Context, int) []Block + // Close unsubscribes all observers of the committed block sequence + // observable and closes the events query client. + Close() +} + +// RedelegationReplayObservable is a defined type which is a replay observable +// of type Redelegation. +// NB: This cannot be an alias due to gomock's lack of support for generic types. +type RedelegationReplayObservable EventsObservable[Redelegation] + +// DelegationClient is an interface that wraps the EventsReplayClient interface +// specific for the EventsReplayClient[Redelegation] implementation +type DelegationClient interface { + // RedelegationsSequence returns a Observable of Redelegations that + // emits the latest redelegation events that have occurred on chain. + RedelegationsSequence(context.Context) RedelegationReplayObservable + // LastNRedelegations returns the latest N redelegation events that have + // occurred on chain. + LastNRedelegations(context.Context, int) []Redelegation + // Close unsubscribes all observers of the committed block sequence + // observable and closes the events query client. + Close() +} + +// EventsBytesObservable is an observable which is notified with an either +// value which contains either an error or the event message bytes. +// +// TODO_HACK: The purpose of this type is to work around gomock's lack of +// support for generic types. For the same reason, this type cannot be an +// alias (i.e. EventsBytesObservable = observable.Observable[either.Bytes]). +type EventsBytesObservable observable.Observable[either.Bytes] + +// EventsQueryClient is used to subscribe to chain event messages matching the given query, +// +// TODO_CONSIDERATION: the cosmos-sdk CLI code seems to use a cometbft RPC client +// which includes a `#Subscribe()` method for a similar purpose. Perhaps we could +// replace our custom implementation with one which wraps that. +// (see: https://github.com/cometbft/cometbft/blob/main/rpc/client/http/http.go#L110) +// (see: https://github.com/cosmos/cosmos-sdk/blob/main/client/rpc/tx.go#L114) +// +// NOTE: a branch which attempts this is available at: +// https://github.com/pokt-network/poktroll/pull/74 +type EventsQueryClient interface { + // EventsBytes returns an observable which is notified about chain event messages + // matching the given query. It receives an either value which contains either an + // error or the event message bytes. + EventsBytes( + ctx context.Context, + query string, + ) (EventsBytesObservable, error) + // Close unsubscribes all observers of each active query's events bytes + // observable and closes the connection. + Close() +} + +// Connection is a transport agnostic, bi-directional, message-passing interface. +type Connection interface { + // Receive blocks until a message is received or an error occurs. + Receive() (msg []byte, err error) + // Send sends a message and may return a synchronous error. + Send(msg []byte) error + // Close closes the connection. + Close() error +} + +// Dialer encapsulates the construction of connections. +type Dialer interface { + // DialContext constructs a connection to the given URL and returns it or + // potentially a synchronous error. + DialContext(ctx context.Context, urlStr string) (Connection, error) +} + +// EventsQueryClientOption defines a function type that modifies the EventsQueryClient. +type EventsQueryClientOption func(EventsQueryClient) + +// TxClientOption defines a function type that modifies the TxClient. +type TxClientOption func(TxClient) + +// SupplierClientOption defines a function type that modifies the SupplierClient. +type SupplierClientOption func(SupplierClient) + +// AccountQueryClient defines an interface that enables the querying of the +// on-chain account information +type AccountQueryClient interface { + // GetAccount queries the chain for the details of the account provided + GetAccount(ctx context.Context, address string) (accounttypes.AccountI, error) +} + +// ApplicationQueryClient defines an interface that enables the querying of the +// on-chain application information +type ApplicationQueryClient interface { + // GetApplication queries the chain for the details of the application provided + GetApplication(ctx context.Context, appAddress string) (apptypes.Application, error) + + // GetAllApplications queries all on-chain applications + GetAllApplications(ctx context.Context) ([]apptypes.Application, error) +} + +// SupplierQueryClient defines an interface that enables the querying of the +// on-chain supplier information +type SupplierQueryClient interface { + // GetSupplier queries the chain for the details of the supplier provided + GetSupplier(ctx context.Context, supplierAddress string) (sharedtypes.Supplier, error) +} + +// SessionQueryClient defines an interface that enables the querying of the +// on-chain session information +type SessionQueryClient interface { + // GetSession queries the chain for the details of the session provided + GetSession( + ctx context.Context, + appAddress string, + serviceId string, + blockHeight int64, + ) (*sessiontypes.Session, error) +} diff --git a/pkg/client/keyring/errors.go b/pkg/client/keyring/errors.go new file mode 100644 index 000000000..7be8a677a --- /dev/null +++ b/pkg/client/keyring/errors.go @@ -0,0 +1,19 @@ +package keyring + +import "cosmossdk.io/errors" + +var ( + // ErrEmptySigningKeyName represents an error which indicates that the + // provided signing key name is empty or unspecified. + ErrEmptySigningKeyName = errors.Register(codespace, 1, "empty signing key name") + + // ErrNoSuchSigningKey represents an error signifying that the requested + // signing key does not exist or could not be located. + ErrNoSuchSigningKey = errors.Register(codespace, 2, "signing key does not exist") + + // ErrSigningKeyAddr is raised when there's a failure in retrieving the + // associated address for the provided signing key. + ErrSigningKeyAddr = errors.Register(codespace, 3, "failed to get address for signing key") + + codespace = "keyring" +) diff --git a/pkg/client/keyring/keyring.go b/pkg/client/keyring/keyring.go new file mode 100644 index 000000000..a77d35b6e --- /dev/null +++ b/pkg/client/keyring/keyring.go @@ -0,0 +1,29 @@ +package keyring + +import ( + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + cosmostypes "github.com/cosmos/cosmos-sdk/types" +) + +// KeyNameToAddr attempts to retrieve the key with the given name from the +// given keyring and compute its address. +func KeyNameToAddr( + keyName string, + keyring cosmoskeyring.Keyring, +) (cosmostypes.AccAddress, error) { + if keyName == "" { + return nil, ErrEmptySigningKeyName + } + + keyRecord, err := keyring.Key(keyName) + if err != nil { + return nil, ErrNoSuchSigningKey.Wrapf("name %q: %s", keyName, err) + } + + signingAddr, err := keyRecord.GetAddress() + if err != nil { + return nil, ErrSigningKeyAddr.Wrapf("name %q: %s", keyName, err) + } + + return signingAddr, nil +} diff --git a/pkg/client/query/accquerier.go b/pkg/client/query/accquerier.go new file mode 100644 index 000000000..c61ec9760 --- /dev/null +++ b/pkg/client/query/accquerier.go @@ -0,0 +1,58 @@ +package query + +import ( + "context" + + "cosmossdk.io/depinject" + accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" + grpc "github.com/cosmos/gogoproto/grpc" + + "github.com/pokt-network/poktroll/pkg/client" +) + +var _ client.AccountQueryClient = (*accQuerier)(nil) + +// accQuerier is a wrapper around the accounttypes.QueryClient that enables the +// querying of on-chain account information through a single exposed method +// which returns an accounttypes.AccountI interface +type accQuerier struct { + clientConn grpc.ClientConn + accountQuerier accounttypes.QueryClient +} + +// NewAccountQuerier returns a new instance of a client.AccountQueryClient by +// injecting the dependecies provided by the depinject.Config. +// +// Required dependencies: +// - clientCtx +func NewAccountQuerier(deps depinject.Config) (client.AccountQueryClient, error) { + aq := &accQuerier{} + + if err := depinject.Inject( + deps, + &aq.clientConn, + ); err != nil { + return nil, err + } + + aq.accountQuerier = accounttypes.NewQueryClient(aq.clientConn) + + return aq, nil +} + +// GetAccount returns an accounttypes.AccountI interface for a given address +func (aq *accQuerier) GetAccount( + ctx context.Context, + address string, +) (accounttypes.AccountI, error) { + req := &accounttypes.QueryAccountRequest{Address: address} + res, err := aq.accountQuerier.Account(ctx, req) + if err != nil { + return nil, ErrQueryAccountNotFound.Wrapf("address: %s [%v]", address, err) + } + var acc accounttypes.AccountI + if err = queryCodec.UnpackAny(res.Account, &acc); err != nil { + return nil, ErrQueryUnableToDeserializeAccount.Wrapf("address: %s [%v]", address, err) + } + return acc, nil +} diff --git a/pkg/client/query/appquerier.go b/pkg/client/query/appquerier.go new file mode 100644 index 000000000..9998a64f7 --- /dev/null +++ b/pkg/client/query/appquerier.go @@ -0,0 +1,64 @@ +package query + +import ( + "context" + + "cosmossdk.io/depinject" + grpc "github.com/cosmos/gogoproto/grpc" + + "github.com/pokt-network/poktroll/pkg/client" + apptypes "github.com/pokt-network/poktroll/x/application/types" +) + +var _ client.ApplicationQueryClient = (*appQuerier)(nil) + +// appQuerier is a wrapper around the apptypes.QueryClient that enables the +// querying of on-chain application information through a single exposed method +// which returns an apptypes.Application interface +type appQuerier struct { + clientConn grpc.ClientConn + applicationQuerier apptypes.QueryClient +} + +// NewApplicationQuerier returns a new instance of a client.ApplicationQueryClient +// by injecting the dependecies provided by the depinject.Config +// +// Required dependencies: +// - clientCtx +func NewApplicationQuerier(deps depinject.Config) (client.ApplicationQueryClient, error) { + aq := &appQuerier{} + + if err := depinject.Inject( + deps, + &aq.clientConn, + ); err != nil { + return nil, err + } + + aq.applicationQuerier = apptypes.NewQueryClient(aq.clientConn) + + return aq, nil +} + +// GetApplication returns an apptypes.Application interface for a given address +func (aq *appQuerier) GetApplication( + ctx context.Context, + appAddress string, +) (apptypes.Application, error) { + req := apptypes.QueryGetApplicationRequest{Address: appAddress} + res, err := aq.applicationQuerier.Application(ctx, &req) + if err != nil { + return apptypes.Application{}, apptypes.ErrAppNotFound.Wrapf("app address: %s [%v]", appAddress, err) + } + return res.Application, nil +} + +// GetAllApplications returns all staked applications +func (aq *appQuerier) GetAllApplications(ctx context.Context) ([]apptypes.Application, error) { + req := apptypes.QueryAllApplicationRequest{} + res, err := aq.applicationQuerier.ApplicationAll(ctx, &req) + if err != nil { + return []apptypes.Application{}, err + } + return res.Application, nil +} diff --git a/pkg/client/query/codec.go b/pkg/client/query/codec.go new file mode 100644 index 000000000..536df1484 --- /dev/null +++ b/pkg/client/query/codec.go @@ -0,0 +1,20 @@ +package query + +import ( + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// queryCodec is a codec used to unmarshal the account interface returned by the +// account querier into the concrete account interface implementation registered +// in the interface registry of the auth module +var queryCodec *codec.ProtoCodec + +func init() { + reg := codectypes.NewInterfaceRegistry() + accounttypes.RegisterInterfaces(reg) + cryptocodec.RegisterInterfaces(reg) + queryCodec = codec.NewProtoCodec(reg) +} diff --git a/pkg/client/query/errors.go b/pkg/client/query/errors.go new file mode 100644 index 000000000..f395a9997 --- /dev/null +++ b/pkg/client/query/errors.go @@ -0,0 +1,12 @@ +package query + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + codespace = "query" + ErrQueryAccountNotFound = sdkerrors.Register(codespace, 1, "account not found") + ErrQueryUnableToDeserializeAccount = sdkerrors.Register(codespace, 2, "unable to deserialize account") + ErrQueryRetrieveSession = sdkerrors.Register(codespace, 3, "error while trying to retrieve a session") +) diff --git a/pkg/client/query/godoc.go b/pkg/client/query/godoc.go new file mode 100644 index 000000000..8cea857fd --- /dev/null +++ b/pkg/client/query/godoc.go @@ -0,0 +1,4 @@ +// Package query provides interfaces used to query the state of the blockchain. +// These interfaces abstract the underlying request/response types and provide +// a single method to query for a specific piece of information from the chain. +package query diff --git a/pkg/client/query/sessionquerier.go b/pkg/client/query/sessionquerier.go new file mode 100644 index 000000000..6a86205fe --- /dev/null +++ b/pkg/client/query/sessionquerier.go @@ -0,0 +1,66 @@ +package query + +import ( + "context" + + "cosmossdk.io/depinject" + grpc "github.com/cosmos/gogoproto/grpc" + + "github.com/pokt-network/poktroll/pkg/client" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +var _ client.SessionQueryClient = (*sessionQuerier)(nil) + +// sessionQuerier is a wrapper around the sessiontypes.QueryClient that enables the +// querying of on-chain session information through a single exposed method +// which returns an sessiontypes.Session struct +type sessionQuerier struct { + clientConn grpc.ClientConn + sessionQuerier sessiontypes.QueryClient +} + +// NewSessionQuerier returns a new instance of a client.SessionQueryClient by +// injecting the dependecies provided by the depinject.Config. +// +// Required dependencies: +// - clientCtx +func NewSessionQuerier(deps depinject.Config) (client.SessionQueryClient, error) { + sessq := &sessionQuerier{} + + if err := depinject.Inject( + deps, + &sessq.clientConn, + ); err != nil { + return nil, err + } + + sessq.sessionQuerier = sessiontypes.NewQueryClient(sessq.clientConn) + + return sessq, nil +} + +// GetSession returns an sessiontypes.Session struct for a given appAddress, +// serviceId and blockHeight. It implements the SessionQueryClient#GetSession function. +func (sessq *sessionQuerier) GetSession( + ctx context.Context, + appAddress string, + serviceId string, + blockHeight int64, +) (*sessiontypes.Session, error) { + service := &sharedtypes.Service{Id: serviceId} + req := &sessiontypes.QueryGetSessionRequest{ + ApplicationAddress: appAddress, + Service: service, + BlockHeight: blockHeight, + } + res, err := sessq.sessionQuerier.GetSession(ctx, req) + if err != nil { + return nil, ErrQueryRetrieveSession.Wrapf( + "address: %s; serviceId: %s; block height: %d; error: [%v]", + appAddress, serviceId, blockHeight, err, + ) + } + return res.Session, nil +} diff --git a/pkg/client/query/supplierquerier.go b/pkg/client/query/supplierquerier.go new file mode 100644 index 000000000..c622ad9e5 --- /dev/null +++ b/pkg/client/query/supplierquerier.go @@ -0,0 +1,56 @@ +package query + +import ( + "context" + + "cosmossdk.io/depinject" + "github.com/cosmos/gogoproto/grpc" + + "github.com/pokt-network/poktroll/pkg/client" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +// supplierQuerier is a wrapper around the suppliertypes.QueryClient that enables the +// querying of on-chain supplier information through a single exposed method +// which returns an sharedtypes.Supplier struct +type supplierQuerier struct { + clientConn grpc.ClientConn + supplierQuerier suppliertypes.QueryClient +} + +// NewSupplierQuerier returns a new instance of a client.SupplierQueryClient by +// injecting the dependecies provided by the depinject.Config. +// +// Required dependencies: +// - grpc.ClientConn +func NewSupplierQuerier(deps depinject.Config) (client.SupplierQueryClient, error) { + supq := &supplierQuerier{} + + if err := depinject.Inject( + deps, + &supq.clientConn, + ); err != nil { + return nil, err + } + + supq.supplierQuerier = suppliertypes.NewQueryClient(supq.clientConn) + + return supq, nil +} + +// GetSupplier returns an suppliertypes.Supplier struct for a given address +func (supq *supplierQuerier) GetSupplier( + ctx context.Context, + address string, +) (sharedtypes.Supplier, error) { + req := &suppliertypes.QueryGetSupplierRequest{Address: address} + res, err := supq.supplierQuerier.Supplier(ctx, req) + if err != nil { + return sharedtypes.Supplier{}, suppliertypes.ErrSupplierNotFound.Wrapf( + "address: %s [%v]", + address, err, + ) + } + return res.Supplier, nil +} diff --git a/pkg/client/query/types/context.go b/pkg/client/query/types/context.go new file mode 100644 index 000000000..d0f56fe6f --- /dev/null +++ b/pkg/client/query/types/context.go @@ -0,0 +1,12 @@ +package types + +import ( + cosmosclient "github.com/cosmos/cosmos-sdk/client" +) + +// Context is used to distinguish a cosmosclient.Context intended for use in +// queries from others. This is because the same cosmosclient.Context can be +// used for both queries and transactions (as they are generated identically). +// This type is intentionally not an alias in order to make this distinction +// clear to the dependency injector (i.e. querytypes.Context). +type Context cosmosclient.Context diff --git a/pkg/client/services.go b/pkg/client/services.go new file mode 100644 index 000000000..08fbaee03 --- /dev/null +++ b/pkg/client/services.go @@ -0,0 +1,19 @@ +package client + +import ( + "fmt" + + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// NewTestApplicationServiceConfig returns a slice of application service configs for testing. +func NewTestApplicationServiceConfig(prefix string, count int) []*sharedtypes.ApplicationServiceConfig { + appSvcCfg := make([]*sharedtypes.ApplicationServiceConfig, count) + for i := range appSvcCfg { + serviceId := fmt.Sprintf("%s%d", prefix, i) + appSvcCfg[i] = &sharedtypes.ApplicationServiceConfig{ + Service: &sharedtypes.Service{Id: serviceId}, + } + } + return appSvcCfg +} diff --git a/pkg/client/supplier/client.go b/pkg/client/supplier/client.go new file mode 100644 index 000000000..4bf4c0554 --- /dev/null +++ b/pkg/client/supplier/client.go @@ -0,0 +1,151 @@ +package supplier + +import ( + "context" + + "cosmossdk.io/depinject" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/smt" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/keyring" + "github.com/pokt-network/poktroll/pkg/polylog" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +var _ client.SupplierClient = (*supplierClient)(nil) + +// supplierClient +type supplierClient struct { + signingKeyName string + signingKeyAddr cosmostypes.AccAddress + + txClient client.TxClient + txCtx client.TxContext +} + +// NewSupplierClient constructs a new SupplierClient with the given dependencies +// and options. If a signingKeyName is not configured, an error will be returned. +// +// Required dependencies: +// - client.TxClient +// - client.TxContext +// +// Available options: +// - WithSigningKeyName +func NewSupplierClient( + deps depinject.Config, + opts ...client.SupplierClientOption, +) (*supplierClient, error) { + sClient := &supplierClient{} + + if err := depinject.Inject( + deps, + &sClient.txClient, + &sClient.txCtx, + ); err != nil { + return nil, err + } + + for _, opt := range opts { + opt(sClient) + } + + if err := sClient.validateConfigAndSetDefaults(); err != nil { + return nil, err + } + + return sClient, nil +} + +// SubmitProof constructs a submit proof message then signs and broadcasts it +// to the network via #txClient. It blocks until the transaction is included in +// a block or times out. +func (sClient *supplierClient) SubmitProof( + ctx context.Context, + sessionHeader sessiontypes.SessionHeader, + proof *smt.SparseMerkleClosestProof, +) error { + logger := polylog.Ctx(ctx) + + proofBz, err := proof.Marshal() + if err != nil { + return err + } + + msg := &suppliertypes.MsgSubmitProof{ + SupplierAddress: sClient.signingKeyAddr.String(), + SessionHeader: &sessionHeader, + Proof: proofBz, + } + eitherErr := sClient.txClient.SignAndBroadcast(ctx, msg) + err, errCh := eitherErr.SyncOrAsyncError() + if err != nil { + return err + } + + // TODO_IMPROVE: log details related to what & how much is being proven + logger.Info(). + Fields(map[string]any{ + "supplier_addr": sClient.signingKeyAddr.String(), + "app_addr": sessionHeader.ApplicationAddress, + "session_id": sessionHeader.SessionId, + "service": sessionHeader.Service.Id, + }). + Msg("submitted a new proof") + + return <-errCh +} + +// CreateClaim constructs a creates claim message then signs and broadcasts it +// to the network via #txClient. It blocks until the transaction is included in +// a block or times out. +func (sClient *supplierClient) CreateClaim( + ctx context.Context, + sessionHeader sessiontypes.SessionHeader, + rootHash []byte, +) error { + logger := polylog.Ctx(ctx) + + msg := &suppliertypes.MsgCreateClaim{ + SupplierAddress: sClient.signingKeyAddr.String(), + SessionHeader: &sessionHeader, + RootHash: rootHash, + } + eitherErr := sClient.txClient.SignAndBroadcast(ctx, msg) + err, errCh := eitherErr.SyncOrAsyncError() + if err != nil { + return err + } + + // TODO_IMPROVE: log details related to how much is claimed + logger.Info(). + Fields(map[string]any{ + "supplier_addr": sClient.signingKeyAddr.String(), + "app_addr": sessionHeader.ApplicationAddress, + "session_id": sessionHeader.SessionId, + "service": sessionHeader.Service.Id, + }). + Msg("created a new claim") + + return <-errCh +} + +// validateConfigAndSetDefaults attempts to get the address from the keyring +// corresponding to the key whose name matches the configured signingKeyName. +// If signingKeyName is empty or the keyring does not contain the corresponding +// key, an error is returned. +func (sClient *supplierClient) validateConfigAndSetDefaults() error { + signingAddr, err := keyring.KeyNameToAddr( + sClient.signingKeyName, + sClient.txCtx.GetKeyring(), + ) + if err != nil { + return err + } + + sClient.signingKeyAddr = signingAddr + + return nil +} diff --git a/pkg/client/supplier/client_integration_test.go b/pkg/client/supplier/client_integration_test.go new file mode 100644 index 000000000..f7ea11f56 --- /dev/null +++ b/pkg/client/supplier/client_integration_test.go @@ -0,0 +1,36 @@ +//go:build integration + +package supplier_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/testclient/testsupplier" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +func TestNewSupplierClient_Localnet(t *testing.T) { + t.Skip("TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services") + + var ( + signingKeyName = "app1" + ctx = context.Background() + ) + + supplierClient := testsupplier.NewLocalnetClient(t, signingKeyName) + require.NotNil(t, supplierClient) + + var rootHash []byte + sessionHeader := sessiontypes.SessionHeader{ + ApplicationAddress: "", + SessionStartBlockHeight: 0, + SessionId: "", + } + err := supplierClient.CreateClaim(ctx, sessionHeader, rootHash) + require.NoError(t, err) + + require.True(t, false) +} diff --git a/pkg/client/supplier/client_test.go b/pkg/client/supplier/client_test.go new file mode 100644 index 000000000..b40fc3430 --- /dev/null +++ b/pkg/client/supplier/client_test.go @@ -0,0 +1,201 @@ +package supplier_test + +import ( + "context" + "crypto/sha256" + "testing" + "time" + + "cosmossdk.io/depinject" + "github.com/golang/mock/gomock" + "github.com/pokt-network/smt" + "github.com/pokt-network/smt/kvstore/badger" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client/keyring" + "github.com/pokt-network/poktroll/pkg/client/supplier" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" + "github.com/pokt-network/poktroll/testutil/testclient/testtx" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +const ( + testSigningKeyName = "test_signer" + testService = "test_service" +) + +func TestNewSupplierClient(t *testing.T) { + ctrl := gomock.NewController(t) + + memKeyring, _ := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, memKeyring) + txClientMock := mockclient.NewMockTxClient(ctrl) + + deps := depinject.Supply( + txCtxMock, + txClientMock, + ) + + tests := []struct { + name string + signingKeyName string + expectedErr error + }{ + { + name: "valid signing key name", + signingKeyName: testSigningKeyName, + expectedErr: nil, + }, + { + name: "empty signing key name", + signingKeyName: "", + expectedErr: keyring.ErrEmptySigningKeyName, + }, + { + name: "no such signing key name", + signingKeyName: "nonexistent", + expectedErr: keyring.ErrNoSuchSigningKey, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + signingKeyOpt := supplier.WithSigningKeyName(tt.signingKeyName) + + supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) + if tt.expectedErr != nil { + require.ErrorIs(t, err, tt.expectedErr) + require.Nil(t, supplierClient) + } else { + require.NoError(t, err) + require.NotNil(t, supplierClient) + } + }) + } +} + +func TestSupplierClient_CreateClaim(t *testing.T) { + var ( + signAndBroadcastDelay = 50 * time.Millisecond + doneCh = make(chan struct{}, 1) + ctx = context.Background() + ) + + keyring, testAppKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + testAppAddr, err := testAppKey.GetAddress() + require.NoError(t, err) + + txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) + txClientMock := testtx.NewOneTimeDelayedSignAndBroadcastTxClient(t, ctx, signAndBroadcastDelay) + + signingKeyOpt := supplier.WithSigningKeyName(testAppKey.Name) + deps := depinject.Supply( + txCtxMock, + txClientMock, + ) + + supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) + require.NoError(t, err) + require.NotNil(t, supplierClient) + + var rootHash []byte + sessionHeader := sessiontypes.SessionHeader{ + ApplicationAddress: testAppAddr.String(), + SessionStartBlockHeight: 0, + SessionId: "", + Service: &sharedtypes.Service{ + Id: testService, + }, + } + + go func() { + err = supplierClient.CreateClaim(ctx, sessionHeader, rootHash) + require.NoError(t, err) + close(doneCh) + }() + + // TODO_IMPROVE: this could be rewritten to record the times at which + // things happen and then compare them to the expected times. + + select { + case <-doneCh: + t.Fatal("expected CreateClaim to block for signAndBroadcastDelay") + case <-time.After(signAndBroadcastDelay * 95 / 100): + t.Log("OK: CreateClaim blocked for at least 95% of signAndBroadcastDelay") + } + + select { + case <-time.After(signAndBroadcastDelay): + t.Fatal("expected CreateClaim to unblock after signAndBroadcastDelay") + case <-doneCh: + t.Log("OK: CreateClaim unblocked after signAndBroadcastDelay") + } +} + +func TestSupplierClient_SubmitProof(t *testing.T) { + var ( + signAndBroadcastDelay = 50 * time.Millisecond + doneCh = make(chan struct{}, 1) + ctx = context.Background() + ) + + keyring, testAppKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + testAppAddr, err := testAppKey.GetAddress() + require.NoError(t, err) + + txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) + txClientMock := testtx.NewOneTimeDelayedSignAndBroadcastTxClient(t, ctx, signAndBroadcastDelay) + + signingKeyOpt := supplier.WithSigningKeyName(testAppKey.Name) + deps := depinject.Supply( + txCtxMock, + txClientMock, + ) + + supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) + require.NoError(t, err) + require.NotNil(t, supplierClient) + + sessionHeader := sessiontypes.SessionHeader{ + ApplicationAddress: testAppAddr.String(), + SessionStartBlockHeight: 0, + SessionId: "", + Service: &sharedtypes.Service{ + Id: testService, + }, + } + + kvStore, err := badger.NewKVStore("") + require.NoError(t, err) + + tree := smt.NewSparseMerkleSumTrie(kvStore, sha256.New()) + proof, err := tree.ProveClosest([]byte{1}) + require.NoError(t, err) + + go func() { + err = supplierClient.SubmitProof(ctx, sessionHeader, proof) + require.NoError(t, err) + close(doneCh) + }() + + // TODO_IMPROVE: this could be rewritten to record the times at which + // things happen and then compare them to the expected times. + + select { + case <-doneCh: + t.Fatal("expected SubmitProof to block for signAndBroadcastDelay") + case <-time.After(signAndBroadcastDelay * 95 / 100): + t.Log("OK: SubmitProof blocked for at least 95% of signAndBroadcastDelay") + } + + select { + case <-time.After(signAndBroadcastDelay): + t.Fatal("expected SubmitProof to unblock after signAndBroadcastDelay") + case <-doneCh: + t.Log("OK: SubmitProof unblocked after signAndBroadcastDelay") + } +} diff --git a/pkg/client/supplier/options.go b/pkg/client/supplier/options.go new file mode 100644 index 000000000..f4460c8c9 --- /dev/null +++ b/pkg/client/supplier/options.go @@ -0,0 +1,14 @@ +package supplier + +import ( + "github.com/pokt-network/poktroll/pkg/client" +) + +// WithSigningKeyName sets the name of the key which the supplier client should +// retrieve from the keyring to use for authoring and signing CreateClaim and +// SubmitProof messages. +func WithSigningKeyName(keyName string) client.SupplierClientOption { + return func(sClient client.SupplierClient) { + sClient.(*supplierClient).signingKeyName = keyName + } +} diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go new file mode 100644 index 000000000..2149f383d --- /dev/null +++ b/pkg/client/tx/client.go @@ -0,0 +1,506 @@ +package tx + +import ( + "bytes" + "context" + "encoding/hex" + "encoding/json" + "fmt" + "sync" + + "cosmossdk.io/api/tendermint/abci" + "cosmossdk.io/depinject" + comettypes "github.com/cometbft/cometbft/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + "go.uber.org/multierr" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/client/keyring" + "github.com/pokt-network/poktroll/pkg/either" +) + +const ( + // DefaultCommitTimeoutHeightOffset is the default number of blocks after the + // latest block (when broadcasting) that a transactions should be considered + // errored if it has not been committed. + DefaultCommitTimeoutHeightOffset = 5 + + // defaultTxReplayLimit is the number of abci.TxResult events that the replay + // observable returned by LastNBlocks() will be able to replay. + // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient + // struct that defaults to this but can be overridden via an option. + defaultTxReplayLimit = 100 + + // txWithSenderAddrQueryFmt is the query used to subscribe to cometbft transactions + // events where the sender address matches the interpolated address. + // (see: https://docs.cosmos.network/v0.47/core/events#subscribing-to-events) + txWithSenderAddrQueryFmt = "tm.event='Tx' AND message.sender='%s'" +) + +// TODO_TECHDEBT(@bryanchriswhite/@h5law): Refactor this to use the EventsReplayClient +// In order to simplify the logic of the TxClient +var _ client.TxClient = (*txClient)(nil) + +// txClient orchestrates building, signing, broadcasting, and querying of +// transactions. It maintains a single events query subscription to its own +// transactions (via the EventsQueryClient) in order to receive notifications +// regarding their status. +// It also depends on the BlockClient as a timer, synchronized to block height, +// to facilitate transaction timeout logic. If a transaction doesn't appear to +// have been committed by commitTimeoutHeightOffset number of blocks have elapsed, +// it is considered as timed out. Upon timeout, the client queries the network for +// the last status of the transaction, which is used to derive the asynchronous +// error that's populated in the either.AsyncError. +type txClient struct { + // TODO_TECHDEBT: this should be configurable & integrated w/ viper, flags, etc. + // commitTimeoutHeightOffset is the number of blocks after the latest block + // that a transactions should be considered errored if it has not been committed. + commitTimeoutHeightOffset int64 + // signingKeyName is the name of the key in the keyring to use for signing + // transactions. + signingKeyName string + // signingAddr is the address of the signing key referenced by signingKeyName. + // It is hydrated from the keyring by calling Keyring#Key() with signingKeyName. + signingAddr cosmostypes.AccAddress + // txCtx is the transactions context which encapsulates transactions building, signing, + // broadcasting, and querying, as well as keyring access. + txCtx client.TxContext + // eventsReplayClient is the client used to subscribe to transactions events from this + // sender. It is used to receive notifications about transactions events corresponding + // to transactions which it has constructed, signed, and broadcast. + eventsReplayClient client.EventsReplayClient[*abci.TxResult] + // blockClient is the client used to query for the latest block height. + // It is used to implement timout logic for transactions which weren't committed. + blockClient client.BlockClient + + // txsMutex protects txErrorChans and txTimeoutPool maps. + txsMutex sync.Mutex + // txErrorChans maps tx_hash->channel which will receive an error or nil, + // and close, when the transactions with the given hash is committed. + txErrorChans txErrorChansByHash + // txTimeoutPool maps timeout_block_height->map_of_txsByHash. It + // is used to ensure that transactions error channels receive and close in the event + // that they have not already by the given timeout height. + txTimeoutPool txTimeoutPool +} + +type ( + txTimeoutPool map[height]txErrorChansByHash + txErrorChansByHash map[txHash]chan error + height = int64 + txHash = string +) + +// NewTxClient attempts to construct a new TxClient using the given dependencies +// and options. +// +// It performs the following steps: +// 1. Initializes a default txClient with the default commit timeout height +// offset, an empty error channel map, and an empty transaction timeout pool. +// 2. Injects the necessary dependencies using depinject. +// 3. Applies any provided options to customize the client. +// 4. Validates and sets any missing default configurations using the +// validateConfigAndSetDefaults method. +// 5. Subscribes the client to its own transactions. This step might be +// reconsidered for relocation to a potential Start() method in the future. +// +// Required dependencies: +// - client.TxContext +// - client.EventsQueryClient +// - client.BlockClient +// +// Available options: +// - WithSigningKeyName +// - WithCommitTimeoutHeightOffset +func NewTxClient( + ctx context.Context, + deps depinject.Config, + opts ...client.TxClientOption, +) (_ client.TxClient, err error) { + tClient := &txClient{ + commitTimeoutHeightOffset: DefaultCommitTimeoutHeightOffset, + txErrorChans: make(txErrorChansByHash), + txTimeoutPool: make(txTimeoutPool), + } + + if err = depinject.Inject( + deps, + &tClient.txCtx, + &tClient.blockClient, + ); err != nil { + return nil, err + } + + for _, opt := range opts { + opt(tClient) + } + + if err := tClient.validateConfigAndSetDefaults(); err != nil { + return nil, err + } + + // Form a query based on the client's signing address. + eventQuery := fmt.Sprintf(txWithSenderAddrQueryFmt, tClient.signingAddr) + + // Initialize and events replay client. + tClient.eventsReplayClient, err = events.NewEventsReplayClient[*abci.TxResult]( + ctx, + deps, + eventQuery, + unmarshalTxResult, + defaultTxReplayLimit, + ) + if err != nil { + return nil, err + } + + // Start an events query subscription for transactions originating from this + // client's signing address. + // TODO_CONSIDERATION: move this into a #Start() method + go tClient.goSubscribeToOwnTxs(ctx) + + // Launch a separate goroutine to handle transaction timeouts. + // TODO_CONSIDERATION: move this into a #Start() method + go tClient.goTimeoutPendingTransactions(ctx) + + return tClient, nil +} + +// SignAndBroadcast signs a set of Cosmos SDK messages, constructs a transaction, +// and broadcasts it to the network. The function performs several steps to +// ensure the messages and the resultant transaction are valid: +// +// 1. Validates each message in the provided set. +// 2. Constructs the transaction using the Cosmos SDK's transaction builder. +// 3. Calculates and sets the transaction's timeout height. +// 4. Sets a default gas limit (note: this will be made configurable in the future). +// 5. Signs the transaction. +// 6. Validates the constructed transaction. +// 7. Serializes and broadcasts the transaction. +// 8. Checks the broadcast response for errors. +// 9. If all the above steps are successful, the function registers the +// transaction as pending. +// +// If any step encounters an error, it returns an either.AsyncError populated with +// the synchronous error. If the function completes successfully, it returns an +// either.AsyncError populated with the error channel which will receive if the +// transaction results in an asynchronous error or times out. +func (tClient *txClient) SignAndBroadcast( + ctx context.Context, + msgs ...cosmostypes.Msg, +) either.AsyncError { + var validationErrs error + for i, msg := range msgs { + if err := msg.ValidateBasic(); err != nil { + validationErr := ErrInvalidMsg.Wrapf("in msg with index %d: %s", i, err) + validationErrs = multierr.Append(validationErrs, validationErr) + } + } + if validationErrs != nil { + return either.SyncErr(validationErrs) + } + + // Construct the transactions using cosmos' transactions builder. + txBuilder := tClient.txCtx.NewTxBuilder() + if err := txBuilder.SetMsgs(msgs...); err != nil { + // return synchronous error + return either.SyncErr(err) + } + + // Calculate timeout height + timeoutHeight := tClient.blockClient.LastNBlocks(ctx, 1)[0]. + Height() + tClient.commitTimeoutHeightOffset + + // TODO_TECHDEBT: this should be configurable + txBuilder.SetGasLimit(200000) + txBuilder.SetTimeoutHeight(uint64(timeoutHeight)) + + // sign transactions + err := tClient.txCtx.SignTx( + tClient.signingKeyName, + txBuilder, + false, false, + ) + if err != nil { + return either.SyncErr(err) + } + + // ensure transactions is valid + // NOTE: this makes the transactions valid; i.e. it is *REQUIRED* + if err := txBuilder.GetTx().ValidateBasic(); err != nil { + return either.SyncErr(err) + } + + // serialize transactions + txBz, err := tClient.txCtx.EncodeTx(txBuilder) + if err != nil { + return either.SyncErr(err) + } + + txResponse, err := tClient.txCtx.BroadcastTx(txBz) + if err != nil { + return either.SyncErr(err) + } + + if txResponse.Code != 0 { + return either.SyncErr(ErrCheckTx.Wrapf(txResponse.RawLog)) + } + + return tClient.addPendingTransactions(normalizeTxHashHex(txResponse.TxHash), timeoutHeight) +} + +// validateConfigAndSetDefaults ensures that the necessary configurations for the +// txClient are set, and populates any missing defaults. +// +// 1. It checks if the signing key name is set and returns an error if it's empty. +// 2. It then retrieves the key record from the keyring using the signing key name +// and checks its existence. +// 3. The address of the signing key is computed and assigned to txClient#signgingAddr. +// 4. Lastly, it ensures that commitTimeoutHeightOffset has a valid value, setting +// it to DefaultCommitTimeoutHeightOffset if it's zero or negative. +// +// Returns: +// - ErrEmptySigningKeyName if the signing key name is not provided. +// - ErrNoSuchSigningKey if the signing key is not found in the keyring. +// - ErrSigningKeyAddr if there's an issue retrieving the address for the signing key. +// - nil if validation is successful and defaults are set appropriately. +func (tClient *txClient) validateConfigAndSetDefaults() error { + signingAddr, err := keyring.KeyNameToAddr( + tClient.signingKeyName, + tClient.txCtx.GetKeyring(), + ) + if err != nil { + return err + } + + tClient.signingAddr = signingAddr + + if tClient.commitTimeoutHeightOffset <= 0 { + tClient.commitTimeoutHeightOffset = DefaultCommitTimeoutHeightOffset + } + return nil +} + +// addPendingTransactions registers a new pending transaction for monitoring and +// notification of asynchronous errors. It accomplishes the following: +// +// 1. Creates an error notification channel (if one doesn't already exist) and associates +// it with the provided transaction hash in the txErrorChans map. +// +// 2. Ensures that there's an initialized map of transactions by hash for the +// given timeout height in the txTimeoutPool. The same error notification channel +// is also associated with the transaction hash in this map. +// +// Both txErrorChans and txTimeoutPool store references to the same error notification +// channel for a given transaction hash. This ensures idempotency of error handling +// for any given transaction between asynchronous, transaction-specific errors and +// transaction timeout logic. +// +// Note: The error channels are buffered to prevent blocking on send operations and +// are intended to convey a single error event. +// +// Returns: +// - An either.AsyncError populated with the error notification channel for the +// provided transaction hash. +func (tClient *txClient) addPendingTransactions( + txHash string, + timeoutHeight int64, +) either.AsyncError { + tClient.txsMutex.Lock() + defer tClient.txsMutex.Unlock() + + // Initialize txTimeoutPool map if necessary. + txsByHash, ok := tClient.txTimeoutPool[timeoutHeight] + if !ok { + txsByHash = make(map[string]chan error) + tClient.txTimeoutPool[timeoutHeight] = txsByHash + } + + // Initialize txErrorChans map in txTimeoutPool map if necessary. + errCh, ok := txsByHash[txHash] + if !ok { + // NB: intentionally buffered to avoid blocking on send. Only intended + // to send/receive a single error. + errCh = make(chan error, 1) + txsByHash[txHash] = errCh + } + + // Initialize txErrorChans map if necessary. + if _, ok := tClient.txErrorChans[txHash]; !ok { + // NB: both maps hold a reference to the same channel so that we can check + // if the channel has already been closed when timing out. + tClient.txErrorChans[txHash] = errCh + } + + return either.AsyncErr(errCh) +} + +// goSubscribeToOwnTxs establishes an event query subscription to monitor transactions +// originating from this client's signing address, ranges over observed transaction events, +// and performs the following steps on each: +// +// 1. Normalize hexadeimal transaction hash. +// 2. Retrieves the transaction's error channel from txErrorChans. +// 3. Closes and removes it from txErrorChans. +// 4. Removes the transaction error channel from txTimeoutPool. +// +// It is intended to be called in a goroutine. +// +// Important considerations: +// There's uncertainty surrounding the potential for asynchronous errors post transaction broadcast. +// Current implementation and observations suggest that errors might be returned synchronously, +// even when using Cosmos' BroadcastTxAsync method. Further investigation is required. +// +// Parameters: +// - ctx: Context for managing the function's lifecycle and child operations. +func (tClient *txClient) goSubscribeToOwnTxs(ctx context.Context) { + txResultsObs := tClient.eventsReplayClient.EventsSequence(ctx) + txResultsCh := txResultsObs.Subscribe(ctx).Ch() + for txResult := range txResultsCh { + // Convert transaction hash into its normalized hex form. + txHashHex := txHashBytesToNormalizedHex(comettypes.Tx(txResult.Tx).Hash()) + + tClient.txsMutex.Lock() + + // Check for a corresponding error channel in the map. + txErrCh, ok := tClient.txErrorChans[txHashHex] + if !ok { + panic("Received tx event without an associated error channel.") + } + + // TODO_INVESTIGATE: it seems like it may not be possible for the + // txResult to represent an error. Cosmos' #BroadcastTxSync() is being + // called internally, which will return an error if the transaction + // is not accepted by the mempool. + // + // It's unclear if a cosmos chain is capable of returning an async + // error for a transaction at this point; even when substituting + // #BroadcastTxAsync(), the error is returned synchronously: + // + // > error in json rpc client, with http response metadata: (Status: + // > 200 OK, Protocol HTTP/1.1). RPC error -32000 - tx added to local + // > mempool but failed to gossip: validation failed + // + // Potential parse and send transaction error on txErrCh here. + + // Close and remove from txErrChans + close(txErrCh) + delete(tClient.txErrorChans, txHashHex) + + // Remove from the txTimeoutPool. + for timeoutHeight, txErrorChans := range tClient.txTimeoutPool { + // Handled transaction isn't in this timeout height. + if _, ok := txErrorChans[txHashHex]; !ok { + continue + } + + delete(txErrorChans, txHashHex) + if len(txErrorChans) == 0 { + delete(tClient.txTimeoutPool, timeoutHeight) + } + } + + tClient.txsMutex.Unlock() + } +} + +// goTimeoutPendingTransactions monitors blocks and handles transaction timeouts. +// For each block observed, it checks if there are transactions associated with that +// block's height in the txTimeoutPool. If transactions are found, the function +// evaluates whether they have already been processed by the transaction events +// query subscription logic. If not, a timeout error is generated and sent on the +// transaction's error channel. Finally, the error channel is closed and removed +// from the txTimeoutPool. +func (tClient *txClient) goTimeoutPendingTransactions(ctx context.Context) { + // Subscribe to a sequence of committed blocks. + blockCh := tClient.blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx).Ch() + + // Iterate over each incoming block. + for block := range blockCh { + select { + case <-ctx.Done(): + // Exit if the context signals done. + return + default: + } + + tClient.txsMutex.Lock() + + // Retrieve transactions associated with the current block's height. + txsByHash, ok := tClient.txTimeoutPool[block.Height()] + if !ok { + // If no transactions are found for the current block height, continue. + tClient.txsMutex.Unlock() + continue + } + + // Process each transaction for the current block height. + for txHash, txErrCh := range txsByHash { + select { + // Check if the transaction was processed by its subscription. + case err, ok := <-txErrCh: + if ok { + // Unexpected state: error channel should be closed after processing. + panic(fmt.Errorf("Expected txErrCh to be closed; received err: %w", err)) + } + // Remove the processed transaction. + delete(txsByHash, txHash) + tClient.txsMutex.Unlock() + continue + default: + } + + // Transaction was not processed by its subscription: handle timeout. + txErrCh <- tClient.getTxTimeoutError(ctx, txHash) // Send a timeout error. + close(txErrCh) // Close the error channel. + delete(txsByHash, txHash) // Remove the transaction. + } + + // Clean up the txTimeoutPool for the current block height. + delete(tClient.txTimeoutPool, block.Height()) + tClient.txsMutex.Unlock() + } +} + +// getTxTimeoutError checks if a transaction with the specified hash has timed out. +// The function decodes the provided hexadecimal hash into bytes and queries the +// transaction using the byte hash. If any error occurs during this process, +// appropriate wrapped errors are returned for easier debugging. +func (tClient *txClient) getTxTimeoutError(ctx context.Context, txHashHex string) error { + // Decode the provided hex hash into bytes. + txHash, err := hex.DecodeString(txHashHex) + if err != nil { + return ErrInvalidTxHash.Wrapf("%s", txHashHex) + } + + // Query the transaction using the decoded byte hash. + txResponse, err := tClient.txCtx.QueryTx(ctx, txHash, false) + if err != nil { + return ErrQueryTx.Wrapf("with hash: %s: %s", txHashHex, err) + } + + // Return a timeout error with details about the transaction. + return ErrTxTimeout.Wrapf("with hash %s: %s", txHashHex, txResponse.TxResult.Log) +} + +// unmarshalTxResult attempts to deserialize a slice of bytes into a TxResult +// It checks if the given bytes correspond to a valid transaction event. +// If the resulting TxResult has empty transaction bytes, it assumes that +// the message was not a transaction results and returns an error. +func unmarshalTxResult(txResultBz []byte) (*abci.TxResult, error) { + txResult := new(abci.TxResult) + + // Try to deserialize the provided bytes into a TxResult. + if err := json.Unmarshal(txResultBz, txResult); err != nil { + return nil, events.ErrEventsUnmarshalEvent.Wrap(err.Error()) + } + + // Check if the TxResult has empty transaction bytes, which indicates + // the message might not be a valid transaction event. + if bytes.Equal(txResult.Tx, []byte{}) { + return nil, events.ErrEventsUnmarshalEvent.Wrap("event bytes do not correspond to an abci.TxResult event") + } + + return txResult, nil +} diff --git a/pkg/client/tx/client_integration_test.go b/pkg/client/tx/client_integration_test.go new file mode 100644 index 000000000..67d4b71ef --- /dev/null +++ b/pkg/client/tx/client_integration_test.go @@ -0,0 +1,67 @@ +//go:build integration + +package tx_test + +import ( + "context" + "testing" + + "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/tx" + "github.com/pokt-network/poktroll/testutil/testclient/testblock" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" + "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" + "github.com/pokt-network/poktroll/testutil/testclient/testtx" + apptypes "github.com/pokt-network/poktroll/x/application/types" +) + +func TestTxClient_SignAndBroadcast_Integration(t *testing.T) { + t.Skip( + "TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services", + ) + + ctx := context.Background() + + keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + eventsQueryClient := testeventsquery.NewLocalnetClient(t) + + _, txCtx := testtx.NewAnyTimesTxTxContext(t, keyring) + + // Construct a new mock block client because it is a required dependency. Since + // we're not exercising transactions timeouts in this test, we don't need to set any + // particular expectations on it, nor do we care about the value of blockHash + // argument. + blockClientMock := testblock.NewLocalnetClient(ctx, t) + + // Construct a new depinject config with the mocks we created above. + txClientDeps := depinject.Supply( + eventsQueryClient, + txCtx, + blockClientMock, + ) + + // Construct the transaction client. + txClient, err := tx.NewTxClient(ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName)) + require.NoError(t, err) + + signingKeyAddr, err := signingKey.GetAddress() + require.NoError(t, err) + + // Construct a valid (arbitrary) message to sign, encode, and broadcast. + appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStakeMsg := &apptypes.MsgStakeApplication{ + Address: signingKeyAddr.String(), + Stake: &appStake, + Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), + } + + // Sign and broadcast the message. + eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) + err, _ = eitherErr.SyncOrAsyncError() + require.NoError(t, err) +} diff --git a/pkg/client/tx/client_test.go b/pkg/client/tx/client_test.go new file mode 100644 index 000000000..4de1b2f9a --- /dev/null +++ b/pkg/client/tx/client_test.go @@ -0,0 +1,423 @@ +package tx_test + +import ( + "context" + "encoding/json" + "sync" + "testing" + "time" + + "cosmossdk.io/depinject" + abci "github.com/cometbft/cometbft/abci/types" + cometbytes "github.com/cometbft/cometbft/libs/bytes" + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/keyring" + "github.com/pokt-network/poktroll/pkg/client/tx" + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient" + "github.com/pokt-network/poktroll/testutil/testclient/testblock" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" + "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" + "github.com/pokt-network/poktroll/testutil/testclient/testtx" + apptypes "github.com/pokt-network/poktroll/x/application/types" +) + +const ( + testSigningKeyName = "test_signer" + // NB: testServiceIdPrefix must not be longer than 7 characters due to + // maxServiceIdLen. + testServiceIdPrefix = "testsvc" + txCommitTimeout = 10 * time.Millisecond +) + +// TODO_TECHDEBT: add coverage for the transactions client handling an events bytes error either. + +func TestTxClient_SignAndBroadcast_Succeeds(t *testing.T) { + var ( + // expectedTx is the expected transactions bytes that will be signed and broadcast + // by the transaction client. It is computed and assigned in the + // testtx.NewOneTimeTxTxContext helper function. The same reference needs + // to be used across the expectations that are set on the transactions context mock. + expectedTx cometbytes.HexBytes + // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access + // as it is expected to be updated in a mock method but is also sent on in the test. + txResultsBzPublishChMu = new(sync.Mutex) + // txResultsBzPublishCh is the channel that the mock events query client + // will use to publish the transactions event bytes. It is used near the end of + // the test to mock the network signaling that the transactions was committed. + txResultsBzPublishCh chan<- either.Bytes + blocksPublishCh chan client.Block + ctx = context.Background() + ) + + keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( + ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, + ) + + txCtxMock := testtx.NewOneTimeTxTxContext( + t, keyring, + testSigningKeyName, + &expectedTx, + ) + + // Construct a new mock block client because it is a required dependency. + // Since we're not exercising transactions timeouts in this test, we don't need to + // set any particular expectations on it, nor do we care about the contents + // of the latest block. + blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( + t, blocksPublishCh, + ) + + // Construct a new depinject config with the mocks we created above. + txClientDeps := depinject.Supply( + eventsQueryClient, + txCtxMock, + blockClientMock, + ) + + // Construct the transaction client. + txClient, err := tx.NewTxClient( + ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), + ) + require.NoError(t, err) + + signingKeyAddr, err := signingKey.GetAddress() + require.NoError(t, err) + + // Construct a valid (arbitrary) message to sign, encode, and broadcast. + appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStakeMsg := &apptypes.MsgStakeApplication{ + Address: signingKeyAddr.String(), + Stake: &appStake, + Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), + } + + // Sign and broadcast the message. + eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) + err, errCh := eitherErr.SyncOrAsyncError() + require.NoError(t, err) + + // Construct the expected transaction event bytes from the expected transaction bytes. + txResultBz, err := json.Marshal(abci.TxResult{Tx: expectedTx}) + require.NoError(t, err) + + // Publish the transaction event bytes to the events query client so that the transaction client + // registers the transactions as committed (i.e. removes it from the timeout pool). + txResultsBzPublishChMu.Lock() + txResultsBzPublishCh <- either.Success[[]byte](txResultBz) + txResultsBzPublishChMu.Unlock() + + // Assert that the error channel was closed without receiving. + select { + case err, ok := <-errCh: + require.NoError(t, err) + require.Falsef(t, ok, "expected errCh to be closed") + case <-time.After(txCommitTimeout): + t.Fatal("test timed out waiting for errCh to receive") + } +} + +func TestTxClient_NewTxClient_Error(t *testing.T) { + // Construct an empty in-memory keyring. + memKeyring := cosmoskeyring.NewInMemory(testclient.EncodingConfig.Marshaler) + + tests := []struct { + name string + signingKeyName string + expectedErr error + }{ + { + name: "empty signing key name", + signingKeyName: "", + expectedErr: keyring.ErrEmptySigningKeyName, + }, + { + name: "signing key does not exist", + signingKeyName: "nonexistent", + expectedErr: keyring.ErrNoSuchSigningKey, + }, + // TODO_TECHDEBT: add coverage for this error case + // { + // name: "failed to get address", + // testSigningKeyName: "incompatible", + // expectedErr: tx.ErrSigningKeyAddr, + // }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var ( + ctrl = gomock.NewController(t) + ctx = context.Background() + ) + + // Construct a new mock events query client. Since we expect the + // NewTxClient call to fail, we don't need to set any expectations + // on this mock. + eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) + + // Construct a new mock transactions context. + txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, memKeyring) + + // Construct a new mock block client. Since we expect the NewTxClient + // call to fail, we don't need to set any expectations on this mock. + blockClientMock := mockclient.NewMockBlockClient(ctrl) + + // Construct a new depinject config with the mocks we created above. + txClientDeps := depinject.Supply( + eventsQueryClient, + txCtxMock, + blockClientMock, + ) + + // Construct a signing key option using the test signing key name. + signingKeyOpt := tx.WithSigningKeyName(tt.signingKeyName) + + // Attempt to create the transactions client. + txClient, err := tx.NewTxClient(ctx, txClientDeps, signingKeyOpt) + require.ErrorIs(t, err, tt.expectedErr) + require.Nil(t, txClient) + }) + } +} + +func TestTxClient_SignAndBroadcast_SyncError(t *testing.T) { + var ( + // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access + // as it is expected to be updated in a mock method but is also sent on in the test. + txResultsBzPublishChMu = new(sync.Mutex) + // txResultsBzPublishCh is the channel that the mock events query client + // will use to publish the transactions event bytes. It is not used in + // this test but is required to use the NewOneTimeTxEventsQueryClient + // helper. + txResultsBzPublishCh chan<- either.Bytes + // blocksPublishCh is the channel that the mock block client will use + // to publish the latest block. It is not used in this test but is + // required to use the NewOneTimeCommittedBlocksSequenceBlockClient + // helper. + blocksPublishCh chan client.Block + ctx = context.Background() + ) + + keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + // Construct a new mock events query client. Since we expect the + // NewTxClient call to fail, we don't need to set any expectations + // on this mock. + eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( + ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, + ) + + // Construct a new mock transaction context. + txCtxMock, _ := testtx.NewAnyTimesTxTxContext(t, keyring) + + // Construct a new mock block client because it is a required dependency. + // Since we're not exercising transactions timeouts in this test, we don't need to + // set any particular expectations on it, nor do we care about the contents + // of the latest block. + blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( + t, blocksPublishCh, + ) + + // Construct a new depinject config with the mocks we created above. + txClientDeps := depinject.Supply( + eventsQueryClient, + txCtxMock, + blockClientMock, + ) + + // Construct the transaction client. + txClient, err := tx.NewTxClient( + ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), + ) + require.NoError(t, err) + + // Construct an invalid (arbitrary) message to sign, encode, and broadcast. + signingAddr, err := signingKey.GetAddress() + require.NoError(t, err) + appStakeMsg := &apptypes.MsgStakeApplication{ + // Providing address to avoid panic from #GetSigners(). + Address: signingAddr.String(), + Stake: nil, + // NB: explicitly omitting required fields + } + + eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) + err, _ = eitherErr.SyncOrAsyncError() + require.ErrorIs(t, err, tx.ErrInvalidMsg) + + time.Sleep(10 * time.Millisecond) +} + +// TODO_INCOMPLETE: add coverage for async error; i.e. insufficient gas or on-chain error +func TestTxClient_SignAndBroadcast_CheckTxError(t *testing.T) { + var ( + // expectedErrMsg is the expected error message that will be returned + // by the transaction client. It is computed and assigned in the + // testtx.NewOneTimeErrCheckTxTxContext helper function. + expectedErrMsg string + // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access + // as it is expected to be updated in a mock method but is also sent on in the test. + txResultsBzPublishChMu = new(sync.Mutex) + // txResultsBzPublishCh is the channel that the mock events query client + // will use to publish the transactions event bytes. It is used near the end of + // the test to mock the network signaling that the transactions was committed. + txResultsBzPublishCh chan<- either.Bytes + blocksPublishCh chan client.Block + ctx = context.Background() + ) + + keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( + ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, + ) + + txCtxMock := testtx.NewOneTimeErrCheckTxTxContext( + t, keyring, + testSigningKeyName, + &expectedErrMsg, + ) + + // Construct a new mock block client because it is a required dependency. + // Since we're not exercising transactions timeouts in this test, we don't need to + // set any particular expectations on it, nor do we care about the contents + // of the latest block. + blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( + t, blocksPublishCh, + ) + + // Construct a new depinject config with the mocks we created above. + txClientDeps := depinject.Supply( + eventsQueryClient, + txCtxMock, + blockClientMock, + ) + + // Construct the transaction client. + txClient, err := tx.NewTxClient(ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName)) + require.NoError(t, err) + + signingKeyAddr, err := signingKey.GetAddress() + require.NoError(t, err) + + // Construct a valid (arbitrary) message to sign, encode, and broadcast. + appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStakeMsg := &apptypes.MsgStakeApplication{ + Address: signingKeyAddr.String(), + Stake: &appStake, + Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), + } + + // Sign and broadcast the message. + eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) + err, _ = eitherErr.SyncOrAsyncError() + require.ErrorIs(t, err, tx.ErrCheckTx) + require.ErrorContains(t, err, expectedErrMsg) +} + +func TestTxClient_SignAndBroadcast_Timeout(t *testing.T) { + var ( + // expectedErrMsg is the expected error message that will be returned + // by the transaction client. It is computed and assigned in the + // testtx.NewOneTimeErrCheckTxTxContext helper function. + expectedErrMsg string + // txResultsBzPublishChMu is a mutex that protects txResultsBzPublishCh from concurrent access + // as it is expected to be updated in a mock method but is also sent on in the test. + txResultsBzPublishChMu = new(sync.Mutex) + // txResultsBzPublishCh is the channel that the mock events query client + // will use to publish the transaction event bytes. It is used near the end of + // the test to mock the network signaling that the transaction was committed. + txResultsBzPublishCh chan<- either.Bytes + blocksPublishCh = make(chan client.Block, tx.DefaultCommitTimeoutHeightOffset) + ctx = context.Background() + ) + + keyring, signingKey := testkeyring.NewTestKeyringWithKey(t, testSigningKeyName) + + eventsQueryClient := testeventsquery.NewOneTimeTxEventsQueryClient( + ctx, t, signingKey, txResultsBzPublishChMu, &txResultsBzPublishCh, + ) + + txCtxMock := testtx.NewOneTimeErrTxTimeoutTxContext( + t, keyring, + testSigningKeyName, + &expectedErrMsg, + ) + + // Construct a new mock block client because it is a required dependency. + // Since we're not exercising transaction timeouts in this test, we don't need to + // set any particular expectations on it, nor do we care about the contents + // of the latest block. + blockClientMock := testblock.NewOneTimeCommittedBlocksSequenceBlockClient( + t, blocksPublishCh, + ) + + // Construct a new depinject config with the mocks we created above. + txClientDeps := depinject.Supply( + eventsQueryClient, + txCtxMock, + blockClientMock, + ) + + // Construct the transaction client. + txClient, err := tx.NewTxClient( + ctx, txClientDeps, tx.WithSigningKeyName(testSigningKeyName), + ) + require.NoError(t, err) + + signingKeyAddr, err := signingKey.GetAddress() + require.NoError(t, err) + + // Construct a valid (arbitrary) message to sign, encode, and broadcast. + appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStakeMsg := &apptypes.MsgStakeApplication{ + Address: signingKeyAddr.String(), + Stake: &appStake, + Services: client.NewTestApplicationServiceConfig(testServiceIdPrefix, 2), + } + + // Sign and broadcast the message in a transaction. + eitherErr := txClient.SignAndBroadcast(ctx, appStakeMsg) + err, errCh := eitherErr.SyncOrAsyncError() + require.NoError(t, err) + + for i := 0; i < tx.DefaultCommitTimeoutHeightOffset; i++ { + blocksPublishCh <- testblock.NewAnyTimesBlock(t, []byte{}, int64(i+1)) + } + + // Assert that we receive the expected error type & message. + select { + case err := <-errCh: + require.ErrorIs(t, err, tx.ErrTxTimeout) + require.ErrorContains(t, err, expectedErrMsg) + // NB: wait 110% of txCommitTimeout; a bit longer than strictly necessary in + // order to mitigate flakiness. + case <-time.After(txCommitTimeout * 110 / 100): + t.Fatal("test timed out waiting for errCh to receive") + } + + // Assert that the error channel was closed. + select { + case err, ok := <-errCh: + require.Falsef(t, ok, "expected errCh to be closed") + require.NoError(t, err) + // NB: Give the error channel some time to be ready to receive in order to + // mitigate flakiness. + case <-time.After(50 * time.Millisecond): + t.Fatal("expected errCh to be closed") + } +} + +// TODO_TECHDEBT: add coverage for sending multiple messages simultaneously +func TestTxClient_SignAndBroadcast_MultipleMsgs(t *testing.T) { + t.SkipNow() +} diff --git a/pkg/client/tx/context.go b/pkg/client/tx/context.go new file mode 100644 index 000000000..6ee1525cf --- /dev/null +++ b/pkg/client/tx/context.go @@ -0,0 +1,100 @@ +package tx + +import ( + "context" + + "cosmossdk.io/depinject" + cometrpctypes "github.com/cometbft/cometbft/rpc/core/types" + cosmosclient "github.com/cosmos/cosmos-sdk/client" + cosmostx "github.com/cosmos/cosmos-sdk/client/tx" + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + + "github.com/pokt-network/poktroll/pkg/client" + txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" +) + +var _ client.TxContext = (*cosmosTxContext)(nil) + +// cosmosTxContext is an internal implementation of the client.TxContext interface. +// It provides methods related to transaction context within the Cosmos SDK. +type cosmosTxContext struct { + // Holds cosmos-sdk client context. + // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/client#Context) + clientCtx txtypes.Context + // Holds the cosmos-sdk transaction factory. + // (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/client/tx#Factory) + txFactory cosmostx.Factory +} + +// NewTxContext initializes a new cosmosTxContext with the given dependencies. +// It uses depinject to populate its members and returns a client.TxContext +// interface type. +// +// Required dependencies: +// - cosmosclient.Context +// - cosmostx.Factory +func NewTxContext(deps depinject.Config) (client.TxContext, error) { + txCtx := cosmosTxContext{} + + if err := depinject.Inject( + deps, + &txCtx.clientCtx, + &txCtx.txFactory, + ); err != nil { + return nil, err + } + + return txCtx, nil +} + +// GetKeyring returns the cosmos-sdk client Keyring associated with the transaction factory. +func (txCtx cosmosTxContext) GetKeyring() cosmoskeyring.Keyring { + return txCtx.txFactory.Keybase() +} + +// SignTx signs the provided transaction using the given key name. It can operate in offline mode +// and can optionally overwrite any existing signatures. +// It is a proxy to the cosmos-sdk auth module client SignTx function. +// (see: https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.5/x/auth/client) +func (txCtx cosmosTxContext) SignTx( + signingKeyName string, + txBuilder cosmosclient.TxBuilder, + offline, overwriteSig bool, +) error { + return authclient.SignTx( + txCtx.txFactory, + cosmosclient.Context(txCtx.clientCtx), + signingKeyName, + txBuilder, + offline, overwriteSig, + ) +} + +// NewTxBuilder returns a new transaction builder instance using the cosmos-sdk client transaction config. +func (txCtx cosmosTxContext) NewTxBuilder() cosmosclient.TxBuilder { + return txCtx.clientCtx.TxConfig.NewTxBuilder() +} + +// EncodeTx encodes the provided tx and returns its bytes representation. +func (txCtx cosmosTxContext) EncodeTx(txBuilder cosmosclient.TxBuilder) ([]byte, error) { + return txCtx.clientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) +} + +// BroadcastTx broadcasts the given transaction to the network, blocking until the check-tx +// ABCI operation completes and returns a TxResponse of the transaction status at that point in time. +func (txCtx cosmosTxContext) BroadcastTx(txBytes []byte) (*cosmostypes.TxResponse, error) { + clientCtx := cosmosclient.Context(txCtx.clientCtx) + return clientCtx.BroadcastTxAsync(txBytes) +} + +// QueryTx queries the transaction based on its hash and optionally provides proof +// of the transaction. It returns the transaction query result. +func (txCtx cosmosTxContext) QueryTx( + ctx context.Context, + txHash []byte, + prove bool, +) (*cometrpctypes.ResultTx, error) { + return txCtx.clientCtx.Client.Tx(ctx, txHash, prove) +} diff --git a/pkg/client/tx/encoding.go b/pkg/client/tx/encoding.go new file mode 100644 index 000000000..78612e7b7 --- /dev/null +++ b/pkg/client/tx/encoding.go @@ -0,0 +1,18 @@ +package tx + +import ( + "fmt" + "strings" +) + +// normalizeTxHashHex defines canonical and unambiguous representation for a +// transaction hash hexadecimal string; lower-case. +func normalizeTxHashHex(txHash string) string { + return strings.ToLower(txHash) +} + +// txHashBytesToNormalizedHex converts a transaction hash bytes to a normalized +// hexadecimal string representation. +func txHashBytesToNormalizedHex(txHash []byte) string { + return normalizeTxHashHex(fmt.Sprintf("%x", txHash)) +} diff --git a/pkg/client/tx/errors.go b/pkg/client/tx/errors.go new file mode 100644 index 000000000..328d7a51d --- /dev/null +++ b/pkg/client/tx/errors.go @@ -0,0 +1,41 @@ +package tx + +import errorsmod "cosmossdk.io/errors" + +var ( + // ErrInvalidMsg signifies that there was an issue in validating the + // transaction message. This could be due to format, content, or other + // constraints imposed on the message. + ErrInvalidMsg = errorsmod.Register(codespace, 4, "failed to validate tx message") + + // ErrCheckTx indicates an error occurred during the ABCI check transaction + // process, which verifies the transaction's integrity before it is added + // to the mempool. + ErrCheckTx = errorsmod.Register(codespace, 5, "error during ABCI check tx") + + // ErrTxTimeout is raised when a transaction has taken too long to + // complete, surpassing a predefined threshold. + ErrTxTimeout = errorsmod.Register(codespace, 6, "tx timed out") + + // ErrQueryTx indicates an error occurred while trying to query for the status + // of a specific transaction, likely due to issues with the query parameters + // or the state of the blockchain network. + ErrQueryTx = errorsmod.Register(codespace, 7, "error encountered while querying for tx") + + // ErrInvalidTxHash represents an error which is triggered when the + // transaction hash provided does not adhere to the expected format or + // constraints, implying it may be corrupted or tampered with. + ErrInvalidTxHash = errorsmod.Register(codespace, 8, "invalid tx hash") + + // ErrNonTxEventBytes indicates an attempt to deserialize bytes that do not + // correspond to a transaction event. This error is triggered when the provided + // byte data isn't recognized as a valid transaction event representation. + ErrNonTxEventBytes = errorsmod.Register(codespace, 9, "attempted to deserialize non-tx event bytes") + + // ErrUnmarshalTx signals a failure in the unmarshaling process of a transaction. + // This error is triggered when the system encounters issues translating a set of + // bytes into the corresponding Tx structure or object. + ErrUnmarshalTx = errorsmod.Register(codespace, 10, "failed to unmarshal tx") + + codespace = "tx_client" +) diff --git a/pkg/client/tx/options.go b/pkg/client/tx/options.go new file mode 100644 index 000000000..34e782b6d --- /dev/null +++ b/pkg/client/tx/options.go @@ -0,0 +1,22 @@ +package tx + +import ( + "github.com/pokt-network/poktroll/pkg/client" +) + +// WithCommitTimeoutBlocks sets the timeout duration in terms of number of blocks +// for the client to wait for broadcast transactions to be committed before +// returning a timeout error. +func WithCommitTimeoutBlocks(timeout int64) client.TxClientOption { + return func(client client.TxClient) { + client.(*txClient).commitTimeoutHeightOffset = timeout + } +} + +// WithSigningKeyName sets the name of the key which should be retrieved from the +// keyring and used for signing transactions. +func WithSigningKeyName(keyName string) client.TxClientOption { + return func(client client.TxClient) { + client.(*txClient).signingKeyName = keyName + } +} diff --git a/pkg/client/tx/types/context.go b/pkg/client/tx/types/context.go new file mode 100644 index 000000000..7dd15cd7f --- /dev/null +++ b/pkg/client/tx/types/context.go @@ -0,0 +1,12 @@ +package types + +import ( + cosmosclient "github.com/cosmos/cosmos-sdk/client" +) + +// Context is used to distinguish a cosmosclient.Context intended for use in +// transactions from others. This is because the same cosmosclient.Context can +// be used for both queries and transactions (as they are generated identically). +// This type is intentionally not an alias in order to make this distinction +// clear to the dependency injector (i.e. txtypes.Context). +type Context cosmosclient.Context diff --git a/pkg/crypto/godoc.go b/pkg/crypto/godoc.go new file mode 100644 index 000000000..846f22de6 --- /dev/null +++ b/pkg/crypto/godoc.go @@ -0,0 +1,5 @@ +// Package crypto provides the cryptographic primitives used by the Pocket +// Network. This includes the RingCache used to build and cache rings used +// for signing relays, and may expand to include other cryptographic +// primitives in the future. +package crypto diff --git a/pkg/crypto/interface.go b/pkg/crypto/interface.go new file mode 100644 index 000000000..4298a9b6a --- /dev/null +++ b/pkg/crypto/interface.go @@ -0,0 +1,30 @@ +//go:generate mockgen -destination=../../testutil/mockcrypto/ring_cache_mock.go -package=mockcrypto . RingCache +package crypto + +import ( + "context" + + "github.com/noot/ring-go" +) + +// RingCache is used to store rings used for signing and verifying relay requests. +// It will cache rings for future use after querying the application module for +// the addresses of the gateways the application is delegated to, and converting +// them into their corresponding public key points on the secp256k1 curve. +type RingCache interface { + // Start starts the ring cache, it takes a cancellable context and, in a + // separate goroutine, listens for on-chain delegation events and invalidates + // the cache if the redelegation event's AppAddress is stored in the cache. + Start(ctx context.Context) + // GetCachedAddresses returns the addresses of the applications that are + // currently cached in the ring cache. + GetCachedAddresses() []string + // GetRingForAddress returns the ring for the given application address if + // it exists. If it does not exist in the cache, it follows a lazy approach + // of querying the on-chain state and creating it just-in-time, caching for + // future retrievals. + GetRingForAddress(ctx context.Context, appAddress string) (*ring.Ring, error) + // Stop stops the ring cache by unsubscribing from on-chain delegation events. + // And clears the cache, so that it no longer contains any rings, + Stop() +} diff --git a/pkg/crypto/rings/cache.go b/pkg/crypto/rings/cache.go new file mode 100644 index 000000000..e1a21ed50 --- /dev/null +++ b/pkg/crypto/rings/cache.go @@ -0,0 +1,278 @@ +package rings + +import ( + "context" + "fmt" + "sync" + + "cosmossdk.io/depinject" + ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" + ringtypes "github.com/athanorlabs/go-dleq/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/noot/ring-go" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/crypto" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +var _ crypto.RingCache = (*ringCache)(nil) + +type ringCache struct { + // logger is the logger for the ring cache. + logger polylog.Logger + + // ringPointsCache maintains a map of application addresses to the points + // on the secp256k1 curve that correspond to the public keys of the gateways + // the application is delegated to. These are used to build the app's ring. + ringPointsCache map[string][]ringtypes.Point + ringPointsMu *sync.RWMutex + + // delegationClient is used to listen for on-chain delegation events and + // invalidate cache entries for rings that have been updated on chain. + delegationClient client.DelegationClient + + // applicationQuerier is the querier for the application module, and is + // used to get the addresses of the gateways an application is delegated to. + applicationQuerier client.ApplicationQueryClient + + // accountQuerier is the querier for the account module, and is used to get + // the public keys of the application and its delegated gateways. + accountQuerier client.AccountQueryClient +} + +// NewRingCache returns a new RingCache instance. It requires a depinject.Config +// to be passed in, which is used to inject the dependencies of the RingCache. +// +// Required dependencies: +// - polylog.Logger +// - client.DelegationClient +// - client.ApplicationQueryClient +// - client.AccountQueryClient +func NewRingCache(deps depinject.Config) (crypto.RingCache, error) { + rc := &ringCache{ + ringPointsCache: make(map[string][]ringtypes.Point), + ringPointsMu: &sync.RWMutex{}, + } + + // Supply the account and application queriers to the RingCache. + if err := depinject.Inject( + deps, + &rc.logger, + &rc.delegationClient, + &rc.applicationQuerier, + &rc.accountQuerier, + ); err != nil { + return nil, err + } + + return rc, nil +} + +// Start starts the ring cache by subscribing to on-chain redelegation events. +func (rc *ringCache) Start(ctx context.Context) { + rc.logger.Info().Msg("starting ring cache") + // Listen for redelegation events and invalidate the cache if the + // redelegation event's address is stored in the cache. + go func() { + select { + case <-ctx.Done(): + // Stop the ring cache if the context is cancelled. + rc.Stop() + } + }() + go rc.goInvalidateCache(ctx) +} + +// goInvalidateCache listens for redelegation events and invalidates the +// cache if the app address in the redelegation event is stored in the cache. +// This function is intended to be run in a goroutine. +func (rc *ringCache) goInvalidateCache(ctx context.Context) { + // Get the latest redelegation replay observable. + redelegationObs := rc.delegationClient.RedelegationsSequence(ctx) + // For each redelegation event, check if the redelegation events' + // app address is in the cache. If it is, invalidate the cache entry. + channel.ForEach[client.Redelegation]( + ctx, redelegationObs, + func(ctx context.Context, redelegation client.Redelegation) { + // Lock the cache for writing. + rc.ringPointsMu.Lock() + defer rc.ringPointsMu.Unlock() + // Check if the redelegation event's app address is in the cache. + if _, ok := rc.ringPointsCache[redelegation.GetAppAddress()]; ok { + rc.logger.Debug(). + Str("app_address", redelegation.GetAppAddress()). + Msg("redelegation event received; invalidating cache entry") + // Invalidate the cache entry. + delete(rc.ringPointsCache, redelegation.GetAppAddress()) + } + }) +} + +// Stop stops the ring cache by unsubscribing from on-chain redelegation events. +func (rc *ringCache) Stop() { + // Clear the cache. + rc.ringPointsMu.Lock() + rc.ringPointsCache = make(map[string][]ringtypes.Point) + rc.ringPointsMu.Unlock() + // Close the delegation client. + rc.delegationClient.Close() +} + +// GetCachedAddresses returns the addresses of the applications that are +// currently cached in the ring cache. +func (rc *ringCache) GetCachedAddresses() []string { + rc.ringPointsMu.RLock() + defer rc.ringPointsMu.RUnlock() + keys := make([]string, 0, len(rc.ringPointsCache)) + for k := range rc.ringPointsCache { + keys = append(keys, k) + } + return keys +} + +// GetRingForAddress returns the ring for the address provided. If it does not +// exist in the cache, it will be created by querying the application module. +// and converting the addresses into their corresponding public key points on +// the secp256k1 curve. It will then be cached for future use. +func (rc *ringCache) GetRingForAddress( + ctx context.Context, + appAddress string, +) (*ring.Ring, error) { + var ( + ring *ring.Ring + err error + ) + + // Lock the cache for reading. + rc.ringPointsMu.RLock() + // Check if the ring is in the cache. + points, ok := rc.ringPointsCache[appAddress] + // Unlock the cache in case it was not cached. + rc.ringPointsMu.RUnlock() + + if !ok { + // If the ring is not in the cache, get it from the application module. + rc.logger.Debug(). + Str("app_address", appAddress). + Msg("ring cache miss; fetching from application module") + ring, err = rc.getRingForAppAddress(ctx, appAddress) + } else { + // If the ring is in the cache, create it from the points. + rc.logger.Debug(). + Str("app_address", appAddress). + Msg("ring cache hit; creating from points") + ring, err = newRingFromPoints(points) + } + if err != nil { + return nil, err + } + + // Return the ring. + return ring, nil +} + +// getRingForAppAddress returns the RingSinger used to sign relays. It does so by fetching +// the latest information from the application module and creating the correct ring. +// This method also caches the ring's public keys for future use. +func (rc *ringCache) getRingForAppAddress( + ctx context.Context, + appAddress string, +) (*ring.Ring, error) { + points, err := rc.getDelegatedPubKeysForAddress(ctx, appAddress) + if err != nil { + return nil, err + } + // Cache the ring's points for future use + rc.logger.Debug(). + Str("app_address", appAddress). + Msg("updating ring cache for app") + rc.ringPointsMu.Lock() + defer rc.ringPointsMu.Unlock() + rc.ringPointsCache[appAddress] = points + return newRingFromPoints(points) +} + +// newRingFromPoints creates a new ring from points on the secp256k1 curve +func newRingFromPoints(points []ringtypes.Point) (*ring.Ring, error) { + return ring.NewFixedKeyRingFromPublicKeys(ring_secp256k1.NewCurve(), points) +} + +// getDelegatedPubKeysForAddress returns the ring used to sign a message for +// the given application address, by querying the application module for it's +// delegated pubkeys and converting them to points on the secp256k1 curve in +// order to create the ring. +func (rc *ringCache) getDelegatedPubKeysForAddress( + ctx context.Context, + appAddress string, +) ([]ringtypes.Point, error) { + rc.ringPointsMu.Lock() + defer rc.ringPointsMu.Unlock() + + // Get the application's on chain state. + app, err := rc.applicationQuerier.GetApplication(ctx, appAddress) + if err != nil { + return nil, err + } + + // Create a slice of addresses for the ring. + ringAddresses := make([]string, 0) + ringAddresses = append(ringAddresses, appAddress) // app address is index 0 + if len(app.DelegateeGatewayAddresses) == 0 { + // add app address twice to make the ring size of mininmum 2 + // TODO_HACK: We are adding the appAddress twice because a ring + // signature requires AT LEAST two pubKeys. When the Application has + // not delegated to any gateways, we add the application's own address + // twice. This is a HACK and should be investigated as to what is the + // best approach to take in this situation. + ringAddresses = append(ringAddresses, appAddress) + } else { + // add the delegatee gateway addresses + ringAddresses = append(ringAddresses, app.DelegateeGatewayAddresses...) + } + + // Get the points on the secp256k1 curve for the addresses. + points, err := rc.addressesToPoints(ctx, ringAddresses) + if err != nil { + return nil, err + } + + // Return the public key points on the secp256k1 curve. + return points, nil +} + +// addressesToPoints converts a slice of addresses to a slice of points on the +// secp256k1 curve, by querying the account module for the public key for each +// address and converting them to the corresponding points on the secp256k1 curve +func (rc *ringCache) addressesToPoints( + ctx context.Context, + addresses []string, +) ([]ringtypes.Point, error) { + curve := ring_secp256k1.NewCurve() + points := make([]ringtypes.Point, len(addresses)) + rc.logger.Debug(). + // TODO_TECHDEBT: implement and use `polylog.Event#Strs([]string)` instead of formatting here. + Str("addresses", fmt.Sprintf("%v", addresses)). + Msg("converting addresses to points") + for i, addr := range addresses { + // Retrieve the account from the auth module + acc, err := rc.accountQuerier.GetAccount(ctx, addr) + if err != nil { + return nil, err + } + key := acc.GetPubKey() + // Check if the key is a secp256k1 public key + if _, ok := key.(*secp256k1.PubKey); !ok { + return nil, ErrRingsNotSecp256k1Curve.Wrapf("got %T", key) + } + // Convert the public key to the point on the secp256k1 curve + point, err := curve.DecodeToPoint(key.Bytes()) + if err != nil { + return nil, err + } + // Insert the point into the slice of points + points[i] = point + } + return points, nil +} diff --git a/pkg/crypto/rings/cache_test.go b/pkg/crypto/rings/cache_test.go new file mode 100644 index 000000000..8505fa3dd --- /dev/null +++ b/pkg/crypto/rings/cache_test.go @@ -0,0 +1,307 @@ +package rings_test + +import ( + "context" + "errors" + "testing" + "time" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/crypto" + "github.com/pokt-network/poktroll/pkg/crypto/rings" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" + "github.com/pokt-network/poktroll/testutil/testclient/testqueryclients" + testrings "github.com/pokt-network/poktroll/testutil/testcrypto/rings" + apptypes "github.com/pokt-network/poktroll/x/application/types" +) + +const noDelegateesRingSize = 2 + +// account is an internal struct used to define an (address, public_key) pairing +type account struct { + address string + pubKey cryptotypes.PubKey +} + +// newAccount creates a new account for testing purposes on the desired curve +func newAccount(curve string) account { + var addr string + var pubkey cryptotypes.PubKey + switch curve { + case "ed25519": + addr, pubkey = sample.AccAddressAndPubKeyEdd2519() + case "secp256k1": + addr, pubkey = sample.AccAddressAndPubKey() + } + return account{ + address: addr, + pubKey: pubkey, + } +} + +func TestRingCache_BuildRing_Uncached(t *testing.T) { + // Create and start the ring cache + ctx, cancelCtx := context.WithCancel(context.Background()) + defer cancelCtx() + rc, _ := createRingCache(ctx, t, "") + rc.Start(ctx) + t.Cleanup(rc.Stop) + + tests := []struct { + desc string + appAddrIndex int + appAccount account + delegateeAccounts []account + expectedRingSize int + expectedErr error + }{ + { + desc: "success: un-cached application without delegated gateways", + appAddrIndex: 1, + appAccount: newAccount("secp256k1"), + delegateeAccounts: []account{}, + expectedRingSize: noDelegateesRingSize, + expectedErr: nil, + }, + { + desc: "success: un-cached application with delegated gateways", + appAddrIndex: 2, + appAccount: newAccount("secp256k1"), + delegateeAccounts: []account{newAccount("secp256k1"), newAccount("secp256k1")}, + expectedRingSize: 3, + expectedErr: nil, + }, + { + desc: "failure: app pubkey uses wrong curve", + appAccount: newAccount("ed25519"), + delegateeAccounts: []account{newAccount("secp256k1"), newAccount("secp256k1")}, + expectedRingSize: 0, + expectedErr: rings.ErrRingsNotSecp256k1Curve, + }, + { + desc: "failure: gateway pubkey uses wrong curve", + appAccount: newAccount("secp256k1"), + delegateeAccounts: []account{newAccount("ed25519"), newAccount("ed25519")}, + expectedRingSize: 0, + expectedErr: rings.ErrRingsNotSecp256k1Curve, + }, + { + desc: "failure: application not found", + appAccount: newAccount("secp256k1"), + delegateeAccounts: []account{newAccount("secp256k1")}, + expectedRingSize: 0, + expectedErr: apptypes.ErrAppNotFound, + }, + } + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + // If we expect the application to exist then add it to the test + // application map with the number of delegated gateways it is + // supposed to have so it can be retrieved from the mock + if !errors.As(test.expectedErr, &apptypes.ErrAppNotFound) { + accMap := make(map[string]cryptotypes.PubKey) + for _, delegateeAcc := range test.delegateeAccounts { + accMap[delegateeAcc.address] = delegateeAcc.pubKey + } + // add the application's account and the accounts of all its + // delegated gateways to the testing state + testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, accMap) + } + // Attempt to retrieve the ring for the address + ring, err := rc.GetRingForAddress(ctx, test.appAccount.address) + if test.expectedErr != nil { + require.ErrorAs(t, err, &test.expectedErr) + return + } + require.NoError(t, err) + // Ensure the ring is the correct size. + require.Equal(t, test.expectedRingSize, ring.Size()) + require.Equal(t, test.appAddrIndex, len(rc.GetCachedAddresses())) + }) + } +} + +func TestRingCache_BuildRing_Cached(t *testing.T) { + tests := []struct { + desc string + appAccount account + expectedRingSize int + expectedErr error + }{ + { + desc: "success: cached application without delegated gateways", + appAccount: newAccount("secp256k1"), + expectedRingSize: noDelegateesRingSize, + expectedErr: nil, + }, + { + desc: "success: cached application with delegated gateways", + appAccount: newAccount("secp256k1"), + expectedRingSize: 3, + expectedErr: nil, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + // Create and start the ring cache + ctx, cancelCtx := context.WithCancel(context.Background()) + defer cancelCtx() + rc, pubCh := createRingCache(ctx, t, test.appAccount.address) + rc.Start(ctx) + t.Cleanup(rc.Stop) + + // Check that the ring cache is empty + require.Equal(t, 0, len(rc.GetCachedAddresses())) + + // add the application's account with no delegated gateways to the + // testing state + testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, nil) + + // Attempt to retrieve the ring for the address and cache it + ring1, err := rc.GetRingForAddress(ctx, test.appAccount.address) + require.NoError(t, err) + require.Equal(t, noDelegateesRingSize, ring1.Size()) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + accMap := make(map[string]cryptotypes.PubKey) + // if the test expects a ring > 2 we have delegated gateways + if test.expectedRingSize != noDelegateesRingSize { + // create accounts for all the expected delegated gateways + // and add them to the map + for i := 0; i < test.expectedRingSize-1; i++ { + gatewayAcc := newAccount("secp256k1") + accMap[gatewayAcc.address] = gatewayAcc.pubKey + } + } + + // add the application's account and the accounts of all its + // delegated gateways to the testing state simulating a change + testqueryclients.AddAddressToApplicationMap(t, test.appAccount.address, test.appAccount.pubKey, accMap) + for k := range accMap { + t.Log(accMap) + // publish a redelegation event + pubCh <- testdelegation.NewAnyTimesRedelegation(t, test.appAccount.address, k) + } + + // Wait a tick to allow the ring cache to process asynchronously. + // It should have invalidated the cache for the ring, if changed. + time.Sleep(15 * time.Millisecond) + + // Attempt to retrieve the ring for the address and cache it if + // the ring was updated + ring2, err := rc.GetRingForAddress(ctx, test.appAccount.address) + require.NoError(t, err) + // If the ring was updated then the rings should not be equal + if test.expectedRingSize != noDelegateesRingSize { + require.False(t, ring1.Equals(ring2)) + } else { + require.True(t, ring1.Equals(ring2)) + } + require.Equal(t, test.expectedRingSize, ring2.Size()) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + // Attempt to retrieve the ring for the address after its been cached + ring3, err := rc.GetRingForAddress(ctx, test.appAccount.address) + require.NoError(t, err) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + // Ensure the rings are the same and have the same size + require.True(t, ring2.Equals(ring3)) + require.Equal(t, test.expectedRingSize, ring3.Size()) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + }) + } +} + +func TestRingCache_Stop(t *testing.T) { + // Create and start the ring cache + ctx, cancelCtx := context.WithCancel(context.Background()) + t.Cleanup(cancelCtx) + rc, _ := createRingCache(ctx, t, "") + rc.Start(ctx) + + // Insert an application into the testing state + appAccount := newAccount("secp256k1") + gatewayAccount := newAccount("secp256k1") + testqueryclients.AddAddressToApplicationMap( + t, appAccount.address, + appAccount.pubKey, + map[string]cryptotypes.PubKey{ + gatewayAccount.address: gatewayAccount.pubKey, + }) + + // Attempt to retrieve the ring for the address and cache it + ring1, err := rc.GetRingForAddress(ctx, appAccount.address) + require.NoError(t, err) + require.Equal(t, 2, ring1.Size()) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + // Retrieve the cached ring + ring2, err := rc.GetRingForAddress(ctx, appAccount.address) + require.NoError(t, err) + require.True(t, ring1.Equals(ring2)) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + // Stop the ring cache + rc.Stop() + + // Retrieve the ring again + require.Equal(t, 0, len(rc.GetCachedAddresses())) +} + +func TestRingCache_CancelContext(t *testing.T) { + // Create and start the ring cache + ctx, cancelCtx := context.WithCancel(context.Background()) + rc, _ := createRingCache(ctx, t, "") + rc.Start(ctx) + + // Insert an application into the testing state + appAccount := newAccount("secp256k1") + gatewayAccount := newAccount("secp256k1") + testqueryclients.AddAddressToApplicationMap( + t, + appAccount.address, appAccount.pubKey, + map[string]cryptotypes.PubKey{ + gatewayAccount.address: gatewayAccount.pubKey, + }) + + // Attempt to retrieve the ring for the address and cache it + ring1, err := rc.GetRingForAddress(ctx, appAccount.address) + require.NoError(t, err) + require.Equal(t, 2, ring1.Size()) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + // Retrieve the cached ring + ring2, err := rc.GetRingForAddress(ctx, appAccount.address) + require.NoError(t, err) + require.True(t, ring1.Equals(ring2)) + require.Equal(t, 1, len(rc.GetCachedAddresses())) + + // Cancel the context + cancelCtx() + + // Wait a tick to allow the ring cache to process asynchronously. + time.Sleep(15 * time.Millisecond) + + // Retrieve the ring again + require.Equal(t, 0, len(rc.GetCachedAddresses())) +} + +// createRingCache creates the RingCache using mocked AccountQueryClient and +// ApplicatioQueryClient instances and returns the RingCache and the delegatee +// change replay observable. +func createRingCache(ctx context.Context, t *testing.T, appAddress string) (crypto.RingCache, chan<- client.Redelegation) { + t.Helper() + redelegationObs, redelegationPublishCh := channel.NewReplayObservable[client.Redelegation](ctx, 1) + delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(ctx, t, appAddress, redelegationObs) + accQuerier := testqueryclients.NewTestAccountQueryClient(t) + appQuerier := testqueryclients.NewTestApplicationQueryClient(t) + rc := testrings.NewRingCacheWithMockDependencies(ctx, t, accQuerier, appQuerier, delegationClient) + return rc, redelegationPublishCh +} diff --git a/pkg/crypto/rings/errors.go b/pkg/crypto/rings/errors.go new file mode 100644 index 000000000..8aae1ad9d --- /dev/null +++ b/pkg/crypto/rings/errors.go @@ -0,0 +1,10 @@ +package rings + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + codespace = "rings" + ErrRingsNotSecp256k1Curve = sdkerrors.Register(codespace, 1, "key is not a secp256k1 public key") +) diff --git a/pkg/crypto/rings/godoc.go b/pkg/crypto/rings/godoc.go new file mode 100644 index 000000000..522a7719b --- /dev/null +++ b/pkg/crypto/rings/godoc.go @@ -0,0 +1,6 @@ +// Package rings provides the RingCache interface that is used to build rings +// for applications by either the application itself or a gateway. This ring +// is used to sign the relay requests. +// The RingCache is responsible for caching the rings for future use and +// invalidating the cache when the application's delegated gateways change. +package rings diff --git a/pkg/deps/config/godoc.go b/pkg/deps/config/godoc.go new file mode 100644 index 000000000..e5d9b15a5 --- /dev/null +++ b/pkg/deps/config/godoc.go @@ -0,0 +1,5 @@ +// Package config provides a method by which dependencies can be injected into +// dependency chains, via the use of SupplierFn functions. These functions +// return functions that can be used in CLI code to chain the dependencies +// required to start a service into a single depinject.Config. +package config diff --git a/pkg/deps/config/suppliers.go b/pkg/deps/config/suppliers.go new file mode 100644 index 000000000..7c9f4dd21 --- /dev/null +++ b/pkg/deps/config/suppliers.go @@ -0,0 +1,363 @@ +package config + +import ( + "context" + "net/url" + + "cosmossdk.io/depinject" + cosmosclient "github.com/cosmos/cosmos-sdk/client" + cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + grpc "github.com/cosmos/gogoproto/grpc" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/pkg/client/block" + "github.com/pokt-network/poktroll/pkg/client/delegation" + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/client/query" + querytypes "github.com/pokt-network/poktroll/pkg/client/query/types" + txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" + "github.com/pokt-network/poktroll/pkg/crypto/rings" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/sdk" +) + +// SupplierFn is a function that is used to supply a depinject config. +type SupplierFn func( + context.Context, + depinject.Config, + *cobra.Command, +) (depinject.Config, error) + +// SupplyConfig supplies a depinject config by calling each of the supplied +// supplier functions in order and passing the result of each supplier to the +// next supplier, chaining them together. +func SupplyConfig( + ctx context.Context, + cmd *cobra.Command, + suppliers []SupplierFn, +) (deps depinject.Config, err error) { + // Initialize deps to with empty depinject config. + deps = depinject.Configs() + for _, supplyFn := range suppliers { + deps, err = supplyFn(ctx, deps, cmd) + if err != nil { + return nil, err + } + } + return deps, nil +} + +// NewSupplyLoggerFromCtx supplies a depinject config with a polylog.Logger instance +// populated from the given context. +func NewSupplyLoggerFromCtx(ctx context.Context) SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + return depinject.Configs(deps, depinject.Supply(polylog.Ctx(ctx))), nil + } +} + +// NewSupplyEventsQueryClientFn supplies a depinject config with an +// EventsQueryClient from the given queryNodeRPCURL. +func NewSupplyEventsQueryClientFn(queryNodeRPCURL *url.URL) SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Convert the host to a websocket URL + queryNodeWebsocketURL := sdk.HostToWebsocketURL(queryNodeRPCURL.Host) + eventsQueryClient := events.NewEventsQueryClient(queryNodeWebsocketURL) + + return depinject.Configs(deps, depinject.Supply(eventsQueryClient)), nil + } +} + +// NewSupplyBlockClientFn supplies a depinject config with a blockClient. +func NewSupplyBlockClientFn() SupplierFn { + return func( + ctx context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Requires a query client to be supplied to the deps + blockClient, err := block.NewBlockClient(ctx, deps) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(blockClient)), nil + } +} + +// NewSupplyDelegationClientFn returns a function which constructs a +// DelegationClient instance and returns a new depinject.Config which is +// supplied with the given deps and the new DelegationClient. +func NewSupplyDelegationClientFn() SupplierFn { + return func( + ctx context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Requires a query client to be supplied to the deps + delegationClient, err := delegation.NewDelegationClient(ctx, deps) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(delegationClient)), nil + } +} + +// NewSupplyQueryClientContextFn supplies a depinject config with a query +// +// ClientContext, a GRPC client connection, and a keyring from the given queryNodeGRPCURL. +func NewSupplyQueryClientContextFn(queryNodeGRPCURL *url.URL) SupplierFn { + return func(_ context.Context, + deps depinject.Config, + cmd *cobra.Command, + ) (depinject.Config, error) { + // Temporarily store the flag's current value to be restored later, after + // the client context has been created with queryNodeGRPCURL. + // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. + tmpGRPC, err := cmd.Flags().GetString(cosmosflags.FlagGRPC) + if err != nil { + return nil, err + } + + // Set --grpc-addr flag to the pocketQueryNodeURL for the client context + // This flag is read by cosmosclient.GetClientQueryContext. + // Cosmos-SDK is expecting a GRPC address formatted as [:], + // so we only need to set the Host parameter of the URL to cosmosflags.FlagGRPC value. + if err := cmd.Flags().Set(cosmosflags.FlagGRPC, queryNodeGRPCURL.Host); err != nil { + return nil, err + } + + // NB: Currently, the implementations of GetClientTxContext() and + // GetClientQueryContext() are identical, allowing for their interchangeable + // use in both querying and transaction operations. However, in order to support + // independent configuration of client contexts for distinct querying and + // transacting purposes. E.g.: transactions are dispatched to the sequencer + // while queries are handled by a trusted full-node. + queryClientCtx, err := cosmosclient.GetClientQueryContext(cmd) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply( + querytypes.Context(queryClientCtx), + grpc.ClientConn(queryClientCtx), + queryClientCtx.Keyring, + )) + + // Restore the flag's original value in order for other components + // to use the flag as expected. + if err := cmd.Flags().Set(cosmosflags.FlagGRPC, tmpGRPC); err != nil { + return nil, err + } + + return deps, nil + } +} + +// NewSupplyTxClientContextFn supplies a depinject config with a TxClientContext +// from the given txNodeGRPCURL. +// TODO_TECHDEBT(#256): Remove this function once the as we may no longer +// need to supply a TxClientContext to the RelayMiner. +func NewSupplyTxClientContextFn( + queryNodeGRPCURL *url.URL, + txNodeRPCURL *url.URL, +) SupplierFn { + return func(_ context.Context, + deps depinject.Config, + cmd *cobra.Command, + ) (depinject.Config, error) { + // Temporarily store the flag's current value to be restored later, after + // the client context has been created with txNodeRPCURL. + // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. + tmpNode, err := cmd.Flags().GetString(cosmosflags.FlagNode) + if err != nil { + return nil, err + } + + // Temporarily store the flag's current value to be restored later, after + // the client context has been created with queryNodeGRPCURL. + // TODO_TECHDEBT(#223) Retrieve value from viper instead, once integrated. + tmpGRPC, err := cmd.Flags().GetString(cosmosflags.FlagGRPC) + if err != nil { + return nil, err + } + + // Set --node flag to the txNodeRPCURL for the client context + // This flag is read by cosmosclient.GetClientTxContext. + if err := cmd.Flags().Set(cosmosflags.FlagNode, txNodeRPCURL.String()); err != nil { + return nil, err + } + + // Set --grpc-addr flag to the queryNodeGRPCURL for the client context + // This flag is read by cosmosclient.GetClientTxContext to query accounts + // for transaction signing. + // Cosmos-SDK is expecting a GRPC address formatted as [:], + // so we only need to set the Host parameter of the URL to cosmosflags.FlagGRPC value. + if err := cmd.Flags().Set(cosmosflags.FlagGRPC, queryNodeGRPCURL.Host); err != nil { + return nil, err + } + + // NB: Currently, the implementations of GetClientTxContext() and + // GetClientQueryContext() are identical, allowing for their interchangeable + // use in both querying and transaction operations. However, in order to support + // independent configuration of client contexts for distinct querying and + // transacting purposes. E.g.: transactions are dispatched to the sequencer + // while queries are handled by a trusted full-node. + txClientCtx, err := cosmosclient.GetClientTxContext(cmd) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply( + txtypes.Context(txClientCtx), + )) + + // Restore the flag's original value in order for other components + // to use the flag as expected. + if err := cmd.Flags().Set(cosmosflags.FlagGRPC, tmpGRPC); err != nil { + return nil, err + } + + // Restore the flag's original value in order for other components + // to use the flag as expected. + if err := cmd.Flags().Set(cosmosflags.FlagNode, tmpNode); err != nil { + return nil, err + } + + return deps, nil + } +} + +// NewSupplyAccountQuerierFn supplies a depinject config with an AccountQuerier. +func NewSupplyAccountQuerierFn() SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Create the account querier. + accountQuerier, err := query.NewAccountQuerier(deps) + if err != nil { + return nil, err + } + + // Supply the account querier to the provided deps + return depinject.Configs(deps, depinject.Supply(accountQuerier)), nil + } +} + +// NewSupplyApplicationQuerierFn supplies a depinject config with an ApplicationQuerier. +func NewSupplyApplicationQuerierFn() SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Create the application querier. + applicationQuerier, err := query.NewApplicationQuerier(deps) + if err != nil { + return nil, err + } + + // Supply the application querier to the provided deps + return depinject.Configs(deps, depinject.Supply(applicationQuerier)), nil + } +} + +// NewSupplySessionQuerierFn supplies a depinject config with a SessionQuerier. +func NewSupplySessionQuerierFn() SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Create the session querier. + sessionQuerier, err := query.NewSessionQuerier(deps) + if err != nil { + return nil, err + } + + // Supply the session querier to the provided deps + return depinject.Configs(deps, depinject.Supply(sessionQuerier)), nil + } +} + +// NewSupplySupplierQuerierFn supplies a depinject config with a SupplierQuerier. +func NewSupplySupplierQuerierFn() SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Create the supplier querier. + supplierQuerier, err := query.NewSupplierQuerier(deps) + if err != nil { + return nil, err + } + + // Supply the supplier querier to the provided deps + return depinject.Configs(deps, depinject.Supply(supplierQuerier)), nil + } +} + +// NewSupplyRingCacheFn supplies a depinject config with a RingCache. +func NewSupplyRingCacheFn() SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + // Create the ring cache. + ringCache, err := rings.NewRingCache(deps) + if err != nil { + return nil, err + } + + // Supply the ring cache to the provided deps + return depinject.Configs(deps, depinject.Supply(ringCache)), nil + } +} + +// NewSupplyPOKTRollSDKFn supplies a depinject config with a POKTRollSDK given +// the signing key name. +func NewSupplyPOKTRollSDKFn(signingKeyName string) SupplierFn { + return func( + ctx context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + var clientCtx cosmosclient.Context + + // On a Cosmos environment we get the private key from the keyring + // Inject the client context, get the keyring from it then get the private key + if err := depinject.Inject(deps, &clientCtx); err != nil { + return nil, err + } + + keyRecord, err := clientCtx.Keyring.Key(signingKeyName) + if err != nil { + return nil, err + } + + privateKey, ok := keyRecord.GetLocal().PrivKey.GetCachedValue().(cryptotypes.PrivKey) + if !ok { + return nil, err + } + + config := &sdk.POKTRollSDKConfig{PrivateKey: privateKey, Deps: deps} + poktrollSDK, err := sdk.NewPOKTRollSDK(ctx, config) + if err != nil { + return nil, err + } + + // Supply the session querier to the provided deps + return depinject.Configs(deps, depinject.Supply(poktrollSDK)), nil + } +} diff --git a/pkg/either/either.go b/pkg/either/either.go new file mode 100644 index 000000000..2febbb412 --- /dev/null +++ b/pkg/either/either.go @@ -0,0 +1,43 @@ +package either + +// Either represents a type that can hold either a value of type T or an error. +// It's commonly used in functional programming to encapsulate functions that might fail. +// This way, instead of returning a value and an error separately, both are combined into a single type. +type Either[R any] struct { + right R // holds the success value + left error // holds the error, if any +} + +func NewEither[R any](right R, left error) Either[R] { + return Either[R]{right: right, left: left} +} + +// Success creates a successful Either value. +func Success[T any](value T) Either[T] { + return Either[T]{right: value, left: nil} +} + +// Error creates an error Either value. +func Error[T any](err error) Either[T] { + return Either[T]{right: zeroValue[T](), left: err} +} + +// IsSuccess checks if the Either contains a success value. +func (m Either[T]) IsSuccess() bool { + return m.left == nil +} + +// IsError checks if the Either contains an error. +func (m Either[T]) IsError() bool { + return m.left != nil +} + +// ValueOrError unpacks the Either value. +func (m Either[T]) ValueOrError() (T, error) { + return m.right, m.left +} + +// Helper function to get the zero value for any type. +func zeroValue[T any]() (zero T) { + return zero +} diff --git a/pkg/either/errors.go b/pkg/either/errors.go new file mode 100644 index 000000000..f464b8886 --- /dev/null +++ b/pkg/either/errors.go @@ -0,0 +1,35 @@ +package either + +// SyncErr creates an AsyncError either from a synchronous error. +// It wraps the Error into the left field (conventionally associated with the +// error value in the Either pattern) of the Either type. It casts the result +// to the AsyncError type. +func SyncErr(err error) AsyncError { + return AsyncError(Error[chan error](err)) +} + +// AsyncErr creates an AsyncError from an error channel. +// It wraps the error channel into the right field (conventionally associated with +// successful values in the Either pattern) of the Either type. +func AsyncErr(errCh chan error) AsyncError { + return AsyncError(Success[chan error](errCh)) +} + +// SyncOrAsyncError decomposes the AsyncError into its components, returning +// a synchronous error and an error channel. If the AsyncError represents a +// synchronous error, the error channel will be nil and vice versa. +func (soaErr AsyncError) SyncOrAsyncError() (error, chan error) { + errCh, err := Either[chan error](soaErr).ValueOrError() + return err, errCh +} + +// IsSyncError checks if the AsyncError represents a synchronous error. +func (soaErr AsyncError) IsSyncError() bool { + return Either[chan error](soaErr).IsError() +} + +// IsAsyncError checks if the AsyncError represents an asynchronous error +// (sent through a channel). +func (soaErr AsyncError) IsAsyncError() bool { + return Either[chan error](soaErr).IsSuccess() +} diff --git a/pkg/either/types.go b/pkg/either/types.go new file mode 100644 index 000000000..4f5f53f00 --- /dev/null +++ b/pkg/either/types.go @@ -0,0 +1,12 @@ +package either + +import "github.com/pokt-network/poktroll/pkg/relayer" + +type ( + // AsyncError represents a value which could either be a synchronous error or + // an asynchronous error (sent through a channel). It wraps the more generic + // `Either` type specific for error channels. + AsyncError Either[chan error] + Bytes = Either[[]byte] + SessionTree = Either[relayer.SessionTree] +) diff --git a/pkg/observable/channel/collect.go b/pkg/observable/channel/collect.go new file mode 100644 index 000000000..edbc545cb --- /dev/null +++ b/pkg/observable/channel/collect.go @@ -0,0 +1,34 @@ +package channel + +import ( + "context" + "sync" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +// Collect collects all notifications received from the observable and returns +// them as a slice. ctx MUST be canceled, after some finite duration as it blocks +// until either srcObservable is closed OR ctx is canceled. Collect is a terminal +// observable operator. +func Collect[V any]( + ctx context.Context, + srcObservable observable.Observable[V], +) (dstCollection []V) { + var dstCollectionMu sync.Mutex + // Defer unlocking as lock is acquired immediately before returning. + defer dstCollectionMu.Unlock() + + ForEach(ctx, srcObservable, func(ctx context.Context, src V) { + dstCollectionMu.Lock() + dstCollection = append(dstCollection, src) + dstCollectionMu.Unlock() + }) + + // Wait for context to be done before returning. + <-ctx.Done() + + // Lock to read from dstCollection in return. + dstCollectionMu.Lock() + return dstCollection +} diff --git a/pkg/observable/channel/map.go b/pkg/observable/channel/map.go new file mode 100644 index 000000000..d6053aefa --- /dev/null +++ b/pkg/observable/channel/map.go @@ -0,0 +1,130 @@ +package channel + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +type MapFn[S, D any] func(ctx context.Context, src S) (dst D, skip bool) +type ForEachFn[V any] func(ctx context.Context, src V) + +// Map transforms the given observable by applying the given transformFn to each +// notification received from the observable. If the transformFn returns a skip +// bool of true, the notification is skipped and not emitted to the resulting +// observable. +func Map[S, D any]( + ctx context.Context, + srcObservable observable.Observable[S], + transformFn MapFn[S, D], +) observable.Observable[D] { + dstObservable, dstProducer := NewObservable[D]() + srcObserver := srcObservable.Subscribe(ctx) + + go goMapTransformNotification( + ctx, + srcObserver, + transformFn, + func(dstNotification D) { + dstProducer <- dstNotification + }, + ) + + return dstObservable +} + +// MapExpand transforms the given observable by applying the given transformFn to +// each notification received from the observable, similar to Map; however, the +// transformFn returns a slice of output notifications for each input notification. +func MapExpand[S, D any]( + ctx context.Context, + srcObservable observable.Observable[S], + transformFn MapFn[S, []D], +) observable.Observable[D] { + dstObservable, dstPublishCh := NewObservable[D]() + srcObserver := srcObservable.Subscribe(ctx) + + go goMapTransformNotification( + ctx, + srcObserver, + transformFn, + func(dstNotifications []D) { + for _, dstNotification := range dstNotifications { + dstPublishCh <- dstNotification + } + }, + ) + + return dstObservable +} + +// MapReplay transforms the given observable by applying the given transformFn to +// each notification received from the observable. If the transformFn returns a +// skip bool of true, the notification is skipped and not emitted to the resulting +// observable. +// The resulting observable will receive the last replayBufferSize +// number of values published to the source observable before receiving new values. +func MapReplay[S, D any]( + ctx context.Context, + replayBufferSize int, + srcObservable observable.Observable[S], + transformFn MapFn[S, D], +) observable.ReplayObservable[D] { + dstObservable, dstProducer := NewReplayObservable[D](ctx, replayBufferSize) + srcObserver := srcObservable.Subscribe(ctx) + + go goMapTransformNotification( + ctx, + srcObserver, + transformFn, + func(dstNotification D) { + dstProducer <- dstNotification + }, + ) + + return dstObservable +} + +// ForEach applies the given forEachFn to each notification received from the +// observable, similar to Map; however, ForEach does not publish to a destination +// observable. ForEach is useful for side effects and is a terminal observable +// operator. +func ForEach[V any]( + ctx context.Context, + srcObservable observable.Observable[V], + forEachFn ForEachFn[V], +) { + Map( + ctx, srcObservable, + func(ctx context.Context, src V) (dst V, skip bool) { + forEachFn(ctx, src) + + // No downstream observers; SHOULD always skip. + return zeroValue[V](), true + }, + ) +} + +// goMapTransformNotification transforms, optionally skips, and publishes +// notifications via the given publishFn. +func goMapTransformNotification[S, D any]( + ctx context.Context, + srcObserver observable.Observer[S], + transformFn MapFn[S, D], + publishFn func(dstNotifications D), +) { + for srcNotification := range srcObserver.Ch() { + dstNotifications, skip := transformFn(ctx, srcNotification) + if skip { + continue + } + + publishFn(dstNotifications) + } + +} + +// zeroValue is a generic helper which returns the zero value of the given type. +func zeroValue[T any]() (zero T) { + return zero +} diff --git a/pkg/observable/channel/map_test.go b/pkg/observable/channel/map_test.go new file mode 100644 index 000000000..aa7507a71 --- /dev/null +++ b/pkg/observable/channel/map_test.go @@ -0,0 +1,109 @@ +package channel_test + +import ( + "context" + "sync/atomic" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/observable/channel" +) + +func TestMap_Word_BytesToPalindrome(t *testing.T) { + tests := []struct { + name string + wordBz []byte + isValid bool + }{ + { + name: "valid palindrome", + wordBz: []byte("rotator"), + isValid: true, + }, + { + name: "invalid palindrome", + wordBz: []byte("spinner"), + isValid: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var ( + wordCounter int32 + ctx, cancel = context.WithCancel(context.Background()) + ) + t.Cleanup(cancel) + + // set up source bytes observable + bzObservable, bzPublishCh := channel.NewObservable[[]byte]() + + // map bytes observable to palindrome observable + palindromeObservable := channel.Map(ctx, bzObservable, bytesToPalindrome) + palindromeObserver := palindromeObservable.Subscribe(ctx) + + // publish a word in bytes + bzPublishCh <- tt.wordBz + + // concurrently consume the palindrome observer's channel + go func() { + for word := range palindromeObserver.Ch() { + atomic.AddInt32(&wordCounter, 1) + + // word.forwards should always match the original word + require.Equal(t, string(tt.wordBz), word.forwards) + + if tt.isValid { + require.Equal(t, string(tt.wordBz), word.backwards) + require.Truef(t, word.IsValid(), "palindrome should be valid") + } else { + require.NotEmptyf(t, string(tt.wordBz), word.backwards) + require.Falsef(t, word.IsValid(), "palindrome should be invalid") + } + } + }() + + // wait a tick for the observer to receive the word + time.Sleep(10 * time.Millisecond) + + // ensure that the observer received the word + require.Equal(t, int32(1), atomic.LoadInt32(&wordCounter)) + }) + } +} + +// Palindrome is a word that is spelled the same forwards and backwards. +// It's used as an example of a type that can be mapped from one observable +// and has no real utility outside of this test. +type palindrome struct { + forwards string + backwards string +} + +func newPalindrome(word string) palindrome { + return palindrome{ + forwards: word, + backwards: reverseString(word), + } +} + +// IsValid returns true if the word actually is a palindrome. +func (p *palindrome) IsValid() bool { + return p.forwards == (p.backwards) +} + +func bytesToPalindrome(_ context.Context, wordBz []byte) (palindrome, bool) { + return newPalindrome(string(wordBz)), false +} + +// reverseString reverses a string, character-by-character. +func reverseString(s string) string { + runes := []rune(s) + // use i & j as cursors to iteratively swap values on symmetrical indexes + for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { + runes[i], runes[j] = runes[j], runes[i] + } + return string(runes) +} diff --git a/pkg/observable/channel/observable.go b/pkg/observable/channel/observable.go new file mode 100644 index 000000000..fa898200f --- /dev/null +++ b/pkg/observable/channel/observable.go @@ -0,0 +1,101 @@ +package channel + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +// TODO_DISCUSS: what should this be? should it be configurable? It seems to be most +// relevant in the context of the behavior of the observable when it has multiple +// observers which consume at different rates. +// defaultSubscribeBufferSize is the buffer size of a observable's publish channel. +const defaultPublishBufferSize = 50 + +var ( + _ observable.Observable[any] = (*channelObservable[any])(nil) + _ observerManager[any] = (*channelObservable[any])(nil) +) + +// option is a function which receives and can modify the channelObservable state. +type option[V any] func(obs *channelObservable[V]) + +// channelObservable implements the observable.Observable interface and can be notified +// by sending on its corresponding publishCh channel. +type channelObservable[V any] struct { + // embed observerManager to encapsulate concurrent-safe read/write access to + // observers. This also allows higher-level objects to wrap this observable + // without knowing its specific type by asserting that it implements the + // observerManager interface. + observerManager[V] + // publishCh is an observable-wide channel that is used to receive values + // which are subsequently fanned out to observers. + publishCh chan V +} + +// NewObservable creates a new observable which is notified when the publishCh +// channel receives a value. +func NewObservable[V any](opts ...option[V]) (observable.Observable[V], chan<- V) { + // initialize an observable that publishes messages from 1 publishCh to N observers + obs := &channelObservable[V]{ + observerManager: newObserverManager[V](), + } + + for _, opt := range opts { + opt(obs) + } + + // If the caller does not provide a publishCh, create a new one using the + // defaultPublishBuffer size and return it. + if obs.publishCh == nil { + obs.publishCh = make(chan V, defaultPublishBufferSize) + } + + // start listening to the publishCh and emit values to observers + go obs.goPublish() + + return obs, obs.publishCh +} + +// WithPublisher returns an option function which sets the given publishCh of the +// resulting observable when passed to NewObservable(). +func WithPublisher[V any](publishCh chan V) option[V] { + return func(obs *channelObservable[V]) { + obs.publishCh = publishCh + } +} + +// Subscribe returns an observer which is notified when the publishCh channel +// receives a value. +func (obs *channelObservable[V]) Subscribe(ctx context.Context) observable.Observer[V] { + // Create a new observer and add it to the list of observers to be notified + // when publishCh receives a new value. + observer := NewObserver[V](ctx, obs.observerManager.remove) + obs.observerManager.add(observer) + + // caller can rely on context cancelation or call UnsubscribeAll() to unsubscribe + // active observers + if ctx != nil { + // asynchronously wait for the context to be done and then unsubscribe + // this observer. + go obs.observerManager.goUnsubscribeOnDone(ctx, observer) + } + return observer +} + +// UnsubscribeAll unsubscribes and removes all observers from the observable. +func (obs *channelObservable[V]) UnsubscribeAll() { + obs.observerManager.removeAll() +} + +// goPublish to the publishCh and notify observers when values are received. +// This function is blocking and should be run in a goroutine. +func (obs *channelObservable[V]) goPublish() { + for notification := range obs.publishCh { + obs.observerManager.notifyAll(notification) + } + + // Here we know that the publisher channel has been closed. + // Unsubscribe all observers as they can no longer receive notifications. + obs.observerManager.removeAll() +} diff --git a/pkg/observable/channel/observable_test.go b/pkg/observable/channel/observable_test.go new file mode 100644 index 000000000..b278546fc --- /dev/null +++ b/pkg/observable/channel/observable_test.go @@ -0,0 +1,371 @@ +package channel_test + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/sync/errgroup" + + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/testchannel" + "github.com/pokt-network/poktroll/testutil/testerrors" +) + +const ( + publishDelay = time.Millisecond + notifyTimeout = 50 * time.Millisecond + cancelUnsubscribeDelay = publishDelay * 2 +) + +func TestChannelObservable_NotifyObservers(t *testing.T) { + type test struct { + name string + publishCh chan int + inputs []int + expectedOutputs []int + setupFn func(t test) + } + + inputs := []int{123, 456, 789} + // NB: see TODO_INCOMPLETE comment below + //fullBlockingPublisher := make(chan *int) + //fullBufferedPublisher := make(chan *int, 1) + + tests := []test{ + { + name: "nil publisher (default buffer size)", + publishCh: nil, + inputs: inputs, + expectedOutputs: inputs, + }, + { + name: "empty non-buffered publisher", + publishCh: make(chan int), + inputs: inputs, + expectedOutputs: inputs, + }, + { + name: "empty buffered len 1 publisher", + publishCh: make(chan int, 1), + inputs: inputs, + expectedOutputs: inputs, + }, + { + name: "empty buffered len 1000 publisher", + publishCh: make(chan int, 1000), + inputs: inputs, + expectedOutputs: inputs, + }, + // TODO_INCOMPLETE(#81): publisher channels which are full are proving harder to test + // robustly (no flakiness); perhaps it has to do with the lack of some + // kind of guarantee about the receiver order on the consumer side. + // + // The following scenarios should generally pass but are flaky: + // (see: docs/pkg/observable/README.md regarding synchronization and buffering) + // + // { + // name: "full non-buffered publisher", + // publishCh: fullBlockingPublisher, + // inputs: inputs[1:], + // expectedOutputs: inputs, + // setupFn: func(t test) { + // go func() { + // // blocking send + // t.publishCh <- &inputs[0] + // }() + // }, + // }, + // { + // name: "full buffered len 1 publisher", + // publishCh: fullBufferedPublisher, + // inputs: inputs[1:], + // expectedOutputs: inputs, + // setupFn: func(t test) { + // // non-blocking send + // t.publishCh <- &inputs[0] + // }, + // }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.setupFn != nil { + tt.setupFn(tt) + } + + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + obsvbl, publishCh := channel.NewObservable[int]( + channel.WithPublisher(tt.publishCh), + ) + require.NotNil(t, obsvbl) + require.NotNil(t, publishCh) + + // construct 3 distinct observers, each with its own channel + observers := make([]observable.Observer[int], 1) + for i := range observers { + observers[i] = obsvbl.Subscribe(ctx) + } + + group, ctx := errgroup.WithContext(ctx) + + // ensure all observer channels are notified + for obsvrIdx, obsvr := range observers { + // onNext is called for each notification received by the observer + onNext := func(outputIndex int, output int) error { + // obsvr channel should receive notified input + if !assert.Equalf( + t, tt.expectedOutputs[outputIndex], + output, + "obsvr Idx: %d", obsvrIdx, + ) { + return testerrors.ErrAsync + } + return nil + } + + // onDone is called when the observer channel closes + onDone := func(outputs []int) error { + if !assert.ElementsMatch( + t, tt.expectedOutputs, outputs, + "obsvr addr: %p", obsvr, + ) { + return testerrors.ErrAsync + } + return nil + } + + // concurrently await notification or timeout to avoid blocking on + // empty and/or non-buffered publishers. + group.Go(goNotifiedOrTimedOutFactory(obsvr, onNext, onDone, notifyTimeout)) + } + + // notify with test input + publish := delayedPublishFactory(publishCh, publishDelay) + for _, input := range tt.inputs { + // simulating IO delay in sequential message publishing + publish(input) + } + + // Finished sending values, close publishCh to unsubscribe all observers + // and close all fan-out channels. + close(publishCh) + + // wait for obsvbl to be notified or timeout + err := group.Wait() + require.NoError(t, err) + + // closing publishCh should unsubscribe all observers, causing them + // to close their channels. + for _, observer := range observers { + // must drain the channel first to ensure it is isClosed + err := testchannel.DrainChannel(observer.Ch()) + require.NoError(t, err) + } + }) + } +} + +func TestChannelObservable_UnsubscribeObservers(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + obsvbl, publishCh := channel.NewObservable[int]() + require.NotNil(t, obsvbl) + require.NotNil(t, publishCh) + + type test struct { + name string + lifecycleFn func() observable.Observer[int] + } + + tests := []test{ + { + name: "nil context", + lifecycleFn: func() observable.Observer[int] { + observer := obsvbl.Subscribe(nil) + observer.Unsubscribe() + return observer + }, + }, + { + name: "only unsubscribe", + lifecycleFn: func() observable.Observer[int] { + observer := obsvbl.Subscribe(ctx) + observer.Unsubscribe() + return observer + }, + }, + { + name: "only cancel", + lifecycleFn: func() observable.Observer[int] { + observer := obsvbl.Subscribe(ctx) + cancel() + return observer + }, + }, + { + // NOTE: this will log a warning that can be ignored: + // > redundant unsubscribe: observer is closed + name: "cancel then unsubscribe", + lifecycleFn: func() observable.Observer[int] { + observer := obsvbl.Subscribe(ctx) + cancel() + time.Sleep(cancelUnsubscribeDelay) + observer.Unsubscribe() + return observer + }, + }, + { + // NOTE: this will log a warning that can be ignored: + // > redundant unsubscribe: observer is closed + name: "unsubscribe then cancel", + lifecycleFn: func() observable.Observer[int] { + observer := obsvbl.Subscribe(ctx) + observer.Unsubscribe() + time.Sleep(cancelUnsubscribeDelay) + cancel() + return observer + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + observer := tt.lifecycleFn() + + select { + case value, ok := <-observer.Ch(): + require.Empty(t, value) + require.False(t, ok) + case <-time.After(notifyTimeout): + t.Fatal("observer channel left open") + } + }) + } +} + +// TODO_INCOMPLETE/TODO_TECHDEBT: Implement `TestChannelObservable_ConcurrentSubUnSub` +func TestChannelObservable_ConcurrentSubUnSub(t *testing.T) { + t.Skip("add coverage: subscribing and unsubscribing concurrently should not race") +} + +func TestChannelObservable_SequentialPublishAndUnsubscription(t *testing.T) { + observations := new([]*observation[int]) + expectedNotifications := [][]int{ + {123, 456, 789}, + {456, 789, 987}, + {789, 987, 654}, + {987, 654, 321}, + } + + obsvbl, publishCh := channel.NewObservable[int]() + require.NotNil(t, obsvbl) + require.NotNil(t, publishCh) + // simulate IO delay in sequential message publishing + publish := delayedPublishFactory(publishCh, publishDelay) + + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + observation0 := newObservation(ctx, obsvbl) + *observations = append(*observations, observation0) + go goReceiveNotifications(observation0) + publish(123) + + observation1 := newObservation(ctx, obsvbl) + *observations = append(*observations, observation1) + go goReceiveNotifications(observation1) + publish(456) + + observation2 := newObservation(ctx, obsvbl) + *observations = append(*observations, observation2) + go goReceiveNotifications(observation2) + publish(789) + + observation3 := newObservation(ctx, obsvbl) + *observations = append(*observations, observation3) + go goReceiveNotifications(observation3) + + observation0.Unsubscribe() + publish(987) + + observation1.Unsubscribe() + publish(654) + + observation2.Unsubscribe() + publish(321) + + observation3.Unsubscribe() + + for obsnIdx, obsrvn := range *observations { + t.Run(fmt.Sprintf("observation%d", obsnIdx), func(t *testing.T) { + msg := "observer %d channel left open" + select { + case _, ok := <-obsrvn.Ch(): + require.Falsef(t, ok, msg, obsnIdx) + default: + t.Fatalf(msg, obsnIdx) + } + + obsrvn.Lock() + defer obsrvn.Unlock() + + require.EqualValuesf( + t, expectedNotifications[obsnIdx], obsrvn.Notifications, + "observation index: %d", obsnIdx, + ) + }) + } +} + +// TODO_TECHDEBT/TODO_INCOMPLETE: add coverage for active observers closing when publishCh closes. +func TestChannelObservable_ObserversCloseOnPublishChannelClose(t *testing.T) { + t.Skip("add coverage: all observers should unsubscribe when publishCh closes") +} + +func delayedPublishFactory[V any](publishCh chan<- V, delay time.Duration) func(value V) { + return func(value V) { + publishCh <- value + // simulate IO delay in sequential message publishing + // NB: this make the test code safer as concurrent operations have more + // time to react; i.e. interact with the test harness. + time.Sleep(delay) + } +} + +func goNotifiedOrTimedOutFactory[V any]( + obsvr observable.Observer[V], + onNext func(index int, output V) error, + onDone func(outputs []V) error, + timeoutDuration time.Duration, +) func() error { + var ( + outputIndex int + outputs []V + ) + return func() error { + for { + select { + case output, ok := <-obsvr.Ch(): + if !ok { + return onDone(outputs) + } + + if err := onNext(outputIndex, output); err != nil { + return err + } + + outputs = append(outputs, output) + outputIndex++ + continue + case <-time.After(timeoutDuration): + return fmt.Errorf("timed out waiting for observer to be notified") + } + } + } +} diff --git a/pkg/observable/channel/observation_test.go b/pkg/observable/channel/observation_test.go new file mode 100644 index 000000000..71a3aa098 --- /dev/null +++ b/pkg/observable/channel/observation_test.go @@ -0,0 +1,52 @@ +package channel_test + +import ( + "context" + "sync" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +// NOTE: this file does not contain any tests, only test helpers. + +// observation is a data structure that embeds an observer +// and keeps track of the received notifications. +// It uses generics with type parameter V. +type observation[V any] struct { + // Embeds a mutex for thread-safe operations + sync.Mutex + // Embeds an Observer of type V + observable.Observer[V] + // Notifications is a slice of type V to store received notifications + Notifications []V +} + +// newObservation is a constructor function that returns +// a new observation instance. It subscribes to the provided observable. +func newObservation[V any]( + ctx context.Context, + observable observable.Observable[V], +) *observation[V] { + return &observation[V]{ + Observer: observable.Subscribe(ctx), + Notifications: []V{}, + } +} + +// notify is a method on observation that safely +// appends a received value to the Notifications slice. +func (o *observation[V]) notify(value V) { + o.Lock() // Locks the mutex to prevent concurrent write access + defer o.Unlock() // Unlocks the mutex when the method returns + + o.Notifications = append(o.Notifications, value) // Appends the received value to the Notifications slice +} + +// goReceiveNotifications is a function that listens for +// notifications from the observer's channel and notifies +// the observation instance for each received value. +func goReceiveNotifications[V any](obsvn *observation[V]) { + for notification := range obsvn.Ch() { // Listens for notifications on the channel + obsvn.notify(notification) // Notifies the observation instance with the received value + } +} diff --git a/pkg/observable/channel/observer.go b/pkg/observable/channel/observer.go new file mode 100644 index 000000000..98f43a99b --- /dev/null +++ b/pkg/observable/channel/observer.go @@ -0,0 +1,152 @@ +package channel + +import ( + "context" + "sync" + "time" + + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/polylog" + _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" +) + +const ( + // TODO_DISCUSS: what should this be? should it be configurable? It seems to be most + // relevant in the context of the behavior of the observable when it has multiple + // observers which consume at different rates. + // defaultSubscribeBufferSize is the buffer size of a channelObserver's channel. + defaultSubscribeBufferSize = 50 + // sendRetryInterval is the duration between attempts to send on the observer's + // channel in the event that it's full. It facilitates a branch in a for loop + // which unlocks the observer's mutex and tries again. + // NOTE: setting this too low can cause the send retry loop to "slip", giving + // up on a send attempt before the channel is ready to receive for multiple + // iterations of the loop. + sendRetryInterval = 100 * time.Millisecond +) + +var _ observable.Observer[any] = (*channelObserver[any])(nil) + +// channelObserver implements the observable.Observer interface. +type channelObserver[V any] struct { + ctx context.Context + // onUnsubscribe is called in Observer#Unsubscribe, closing this observer's + // channel and removing it from the respective obervable's observers list + // in a concurrency-safe manner. + onUnsubscribe func(toRemove observable.Observer[V]) + // observerMu protects the observerCh and isClosed fields. + observerMu *sync.RWMutex + // observerCh is the channel that is used to emit values to the observer. + // I.e. on the "N" side of the 1:N relationship between observable and + // observer. + observerCh chan V + // isClosed indicates whether the observer has been isClosed. It's set in + // unsubscribe; isClosed observers can't be reused. + isClosed bool +} + +type UnsubscribeFunc[V any] func(toRemove observable.Observer[V]) + +func NewObserver[V any]( + ctx context.Context, + onUnsubscribe UnsubscribeFunc[V], +) *channelObserver[V] { + // Create a channel for the observer and append it to the observers list + return &channelObserver[V]{ + ctx: ctx, + observerMu: new(sync.RWMutex), + observerCh: make(chan V, defaultSubscribeBufferSize), + onUnsubscribe: onUnsubscribe, + } +} + +// Unsubscribe closes the subscription channel and removes the subscription from +// the observable. +func (obsvr *channelObserver[V]) Unsubscribe() { + obsvr.unsubscribe() +} + +// Ch returns a receive-only subscription channel. +func (obsvr *channelObserver[V]) Ch() <-chan V { + return obsvr.observerCh +} + +// IsClosed returns true if the observer has been unsubscribed. +// A closed observer cannot be reused. +func (obsvr *channelObserver[V]) IsClosed() bool { + obsvr.observerMu.Lock() + defer obsvr.observerMu.Unlock() + + return obsvr.isClosed +} + +// unsubscribe closes the subscription channel, marks the observer as isClosed, and +// removes the subscription from its observable's observers list via onUnsubscribe. +func (obsvr *channelObserver[V]) unsubscribe() { + obsvr.observerMu.Lock() + defer obsvr.observerMu.Unlock() + + if obsvr.isClosed { + // Get a context, eihter from the observer or from the background to get + // a reference to the logger. + ctx := obsvr.ctx + if ctx == nil { + ctx = context.Background() + } + logger := polylog.Ctx(ctx) + + // log the fact that this case was encountered such that an extreme change + // in its frequency would be obvious. + logger.Warn().Err(observable.ErrObserverClosed).Msg("redundant unsubscribe") + return + } + + close(obsvr.observerCh) + obsvr.isClosed = true + obsvr.onUnsubscribe(obsvr) +} + +// notify is called by observable to send a msg on the observer's channel. +// We can't use channelObserver#Ch because it's intended to be a +// receive-only channel. The channel will block if it is full (determined by the buffer +// size) +// if the channel's buffer is full, we will retry after sendRetryInterval/s. +// The other half is spent holding the read-lock and waiting for the (full) channel +// to be ready to receive. +func (obsvr *channelObserver[V]) notify(value V) { + defer obsvr.observerMu.RUnlock() // defer releasing a read lock + + sendRetryTicker := time.NewTicker(sendRetryInterval) + for { + // observerMu must remain read-locked until the value is sent on observerCh + // in the event that it would be isClosed concurrently (i.e. this observer + // unsubscribes), which could cause a "send on isClosed channel" error. + if !obsvr.observerMu.TryRLock() { + continue + } + if obsvr.isClosed { + return + } + + select { + case <-obsvr.ctx.Done(): + // if the context is done just release the read-lock (deferred) + return + case obsvr.observerCh <- value: + // if observerCh has space in its buffer, the value is written to it + return + // if the context isn't done and channel is full (i.e. blocking), + // release the read-lock to give write-lockers a turn. This case + // continues the loop, re-read-locking and trying again. + case <-sendRetryTicker.C: + // TODO_IMPROVE/TODO_CONSIDERATION: this is where we would implement + // some backpressure strategy. It would be good to have a simple fail- + // safe strategy that can be used by default; e.g. dropping the oldest + // value if its buffer is full. + + // This case implies that the (read) lock was acquired, so it must + // be unlocked before continuing the send retry loop. + obsvr.observerMu.RUnlock() + } + } +} diff --git a/pkg/observable/channel/observer_manager.go b/pkg/observable/channel/observer_manager.go new file mode 100644 index 000000000..65acca5bc --- /dev/null +++ b/pkg/observable/channel/observer_manager.go @@ -0,0 +1,152 @@ +package channel + +import ( + "context" + "sync" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +var _ observerManager[any] = (*channelObserverManager[any])(nil) + +// observerManager is an interface intended to be used between an observable and some +// higher-level abstraction and/or observable implementation which would embed it. +// Embedding this interface rather than a channelObservable directly allows for +// more transparency and flexibility in higher-level code. +// NOTE: this interface MUST be used with a common concrete Observer type. +// TODO_CONSIDERATION: Consider whether `observerManager` and `Observable` should remain as separate +// types after some more time and experience using both. +type observerManager[V any] interface { + notifyAll(notification V) + add(toAdd observable.Observer[V]) + remove(toRemove observable.Observer[V]) + removeAll() + goUnsubscribeOnDone(ctx context.Context, observer observable.Observer[V]) +} + +// TODO_CONSIDERATION: if this were a generic implementation, we wouldn't need +// to cast `toAdd` to a channelObserver in add. There are two things +// currently preventing a generic observerManager implementation: +// 1. channelObserver#notify() is not part of the observable.Observer interface +// and is therefore not accessible here. If we move everything into the +// `observable` pkg so that the unexported member is in scope, then the channel +// pkg can't implement it for the same reason, it's an unexported method defined +// in a different pkg. +// 2. == is not defined for a generic Observer type. We would have to add an Equals() +// to the Observer interface. + +// channelObserverManager implements the observerManager interface using +// channelObservers. +type channelObserverManager[V any] struct { + // observersMu protects observers from concurrent access/updates + observersMu *sync.RWMutex + // observers is a list of channelObservers that will be notified when new value + // are received. + observers []*channelObserver[V] +} + +func newObserverManager[V any]() *channelObserverManager[V] { + return &channelObserverManager[V]{ + observersMu: &sync.RWMutex{}, + observers: make([]*channelObserver[V], 0), + } +} + +func (com *channelObserverManager[V]) notifyAll(notification V) { + // Copy currentObservers to avoid holding the lock while notifying them. + // New or existing Observers may (un)subscribe while this notification + // is being fanned out. + // The observers at the time of locking, prior to copying, are the canonical + // set of observers which receive this notification. + currentObservers := com.copyObservers() + for _, obsvr := range currentObservers { + // TODO_TECHDEBT: since this synchronously notifies all observers in a loop, + // it is possible to block here, part-way through notifying all observers, + // on a slow observer consumer (i.e. full buffer). Instead, we should notify + // observers with some limited concurrency of "worker" goroutines. + // The storj/common repo contains such a `Limiter` implementation, see: + // https://github.com/storj/common/blob/main/sync2/limiter.go. + obsvr.notify(notification) + } +} + +// addObserver implements the respective member of observerManager. It is used +// by the channelObservable implementation as well as embedders of observerManager +// (e.g. replayObservable). +// It panics if toAdd is not a channelObserver. +func (com *channelObserverManager[V]) add(toAdd observable.Observer[V]) { + // must (write) lock observersMu so that we can safely append to the observers list + com.observersMu.Lock() + defer com.observersMu.Unlock() + + com.observers = append(com.observers, toAdd.(*channelObserver[V])) +} + +// remove removes a given observer from the observable's list of observers. +// It implements the respective member of observerManager and is used by +// the channelObservable implementation as well as embedders of observerManager +// (e.g. replayObservable). +func (com *channelObserverManager[V]) remove(toRemove observable.Observer[V]) { + // must (write) lock to iterate over and modify the observers list + com.observersMu.Lock() + defer com.observersMu.Unlock() + + for i, observer := range com.observers { + if observer == toRemove { + com.observers = append((com.observers)[:i], (com.observers)[i+1:]...) + break + } + } +} + +// removeAll unsubscribes and removes all observers from the observable. +// It implements the respective member of observerManager and is used by +// the channelObservable implementation as well as embedders of observerManager +// (e.g. replayObservable). +func (com *channelObserverManager[V]) removeAll() { + // Copy currentObservers to avoid holding the lock while unsubscribing them. + // The observers at the time of locking, prior to copying, are the canonical + // set of observers which are unsubscribed. + // New or existing Observers may (un)subscribe while the observable is closing. + // Any such observers won't be isClosed but will also stop receiving notifications + // immediately (if they receive any at all). + currentObservers := com.copyObservers() + for _, observer := range currentObservers { + observer.Unsubscribe() + } + + // Reset observers to an empty list. This purges any observers which might have + // subscribed while the observable was closing. + com.observersMu.Lock() + com.observers = []*channelObserver[V]{} + com.observersMu.Unlock() +} + +// goUnsubscribeOnDone unsubscribes from the subscription when the context is done. +// It is a blocking function and intended to be called in a goroutine. +func (com *channelObserverManager[V]) goUnsubscribeOnDone( + ctx context.Context, + observer observable.Observer[V], +) { + <-ctx.Done() + if observer.IsClosed() { + return + } + observer.Unsubscribe() +} + +// copyObservers returns a copy of the current observers list. It is safe to +// call concurrently. Notably, it is not part of the observerManager interface. +func (com *channelObserverManager[V]) copyObservers() (observers []*channelObserver[V]) { + defer com.observersMu.RUnlock() + + // This loop blocks on acquiring a read lock on observersMu. If TryRLock + // fails, the loop continues until it succeeds. This is intended to give + // callers a guarantee that this copy operation won't contribute to a deadlock. + com.observersMu.RLock() + + observers = make([]*channelObserver[V], len(com.observers)) + copy(observers, com.observers) + + return observers +} diff --git a/pkg/observable/channel/observer_test.go b/pkg/observable/channel/observer_test.go new file mode 100644 index 000000000..034541c85 --- /dev/null +++ b/pkg/observable/channel/observer_test.go @@ -0,0 +1,89 @@ +package channel + +import ( + "context" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +func TestObserver_Unsubscribe(t *testing.T) { + var ( + publishCh = make(chan int, 1) + onUnsubscribeCalled = false + onUnsubscribe = func(toRemove observable.Observer[int]) { + onUnsubscribeCalled = true + } + ) + obsvr := &channelObserver[int]{ + observerMu: &sync.RWMutex{}, + // using a buffered channel to keep the test synchronous + observerCh: publishCh, + onUnsubscribe: onUnsubscribe, + } + + // should initially be open + require.Equal(t, false, obsvr.isClosed) + + publishCh <- 1 + require.Equal(t, false, obsvr.isClosed) + + obsvr.Unsubscribe() + // should be isClosed after `#Unsubscribe()` + require.Equal(t, true, obsvr.isClosed) + require.True(t, onUnsubscribeCalled) +} + +func TestObserver_ConcurrentUnsubscribe(t *testing.T) { + var ( + publishCh = make(chan int, 1) + onUnsubscribeCalled = false + onUnsubscribe = func(toRemove observable.Observer[int]) { + onUnsubscribeCalled = true + } + ) + + obsvr := &channelObserver[int]{ + ctx: context.Background(), + observerMu: &sync.RWMutex{}, + // using a buffered channel to keep the test synchronous + observerCh: publishCh, + onUnsubscribe: onUnsubscribe, + } + + require.Equal(t, false, obsvr.isClosed, "observer channel should initially be open") + + // concurrently & continuously publish until the test cleanup runs + done := make(chan struct{}, 1) + go func() { + for idx := 0; ; idx++ { + // return when done receives; otherwise, + select { + case <-done: + return + default: + } + + // publish a value + obsvr.notify(idx) + + // Slow this loop to prevent bogging the test down. + time.Sleep(10 * time.Microsecond) + } + }() + // send on done when the test cleans up + t.Cleanup(func() { done <- struct{}{} }) + + // it should still be open after a bit of inactivity + time.Sleep(time.Millisecond) + require.Equal(t, false, obsvr.isClosed) + + obsvr.Unsubscribe() + // should be isClosed after `#Unsubscribe()` + require.Equal(t, true, obsvr.isClosed) + require.True(t, onUnsubscribeCalled) +} diff --git a/pkg/observable/channel/replay.go b/pkg/observable/channel/replay.go new file mode 100644 index 000000000..6f3284089 --- /dev/null +++ b/pkg/observable/channel/replay.go @@ -0,0 +1,243 @@ +package channel + +import ( + "context" + "sync" + "time" + + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// replayPartialBufferTimeout is the duration to wait for the replay buffer to +// accumulate at least 1 value before returning the accumulated values. +// TODO_CONSIDERATION: perhaps this should be parameterized. +const replayPartialBufferTimeout = 100 * time.Millisecond + +var ( + _ observable.ReplayObservable[any] = (*replayObservable[any])(nil) + _ observable.Observable[any] = (*replayObservable[any])(nil) +) + +type replayObservable[V any] struct { + // embed observerManager to encapsulate concurrent-safe read/write access to + // observers. This also allows higher-level objects to wrap this observable + // without knowing its specific type by asserting that it implements the + // observerManager interface. + observerManager[V] + // replayBufferSize is the number of notifications to buffer so that they + // can be replayed to new observers. + replayBufferSize int + // replayBufferMu protects replayBuffer from concurrent access/updates. + replayBufferMu sync.RWMutex + // replayBuffer holds the last relayBufferSize number of notifications received + // by this observable. This buffer is replayed to new observers, on subscribing, + // prior to any new notifications being propagated. + replayBuffer []V +} + +// NewReplayObservable returns a new ReplayObservable with the given replay buffer +// replayBufferSize and the corresponding publish channel to notify it of new values. +func NewReplayObservable[V any]( + ctx context.Context, + replayBufferSize int, + opts ...option[V], +) (observable.ReplayObservable[V], chan<- V) { + obsvbl, publishCh := NewObservable[V](opts...) + return ToReplayObservable[V](ctx, replayBufferSize, obsvbl), publishCh +} + +// ToReplayObservable returns an observable which replays the last replayBufferSize +// number of values published to the source observable to new observers, before +// publishing new values. +// It panics if srcObservable does not implement the observerManager interface. +// It should only be used with a srcObservable which contains channelObservers +// (i.e. channelObservable or similar). +func ToReplayObservable[V any]( + ctx context.Context, + replayBufferSize int, + srcObsvbl observable.Observable[V], +) observable.ReplayObservable[V] { + // Assert that the source observable implements the observerMngr required + // to embed and wrap it. + observerMngr := srcObsvbl.(observerManager[V]) + + replayObsvbl := &replayObservable[V]{ + observerManager: observerMngr, + replayBufferSize: replayBufferSize, + replayBuffer: make([]V, 0, replayBufferSize), + } + + srcObserver := srcObsvbl.Subscribe(ctx) + go replayObsvbl.goBufferReplayNotifications(srcObserver) + + return replayObsvbl +} + +// Last synchronously returns the last n values from the replay buffer. It blocks +// until at least 1 notification has been accumulated, then waits replayPartialBufferTimeout +// duration before returning all notifications accumulated notifications by that time. +// If the replay buffer contains at least n notifications, this function will only +// block as long as it takes to accumulate and return them. +// If n is greater than the replay buffer size, the entire replay buffer is returned. +func (ro *replayObservable[V]) Last(ctx context.Context, n int) []V { + logger := polylog.Ctx(ctx) + + // Use a temporary observer to accumulate replay values. + // Subscribe will always start with the replay buffer, so we can safely + // leverage it here for synchronization (i.e. blocking until at least 1 + // notification has been accumulated). This also eliminates the need for + // locking and/or copying the replay buffer. + tempObserver := ro.Subscribe(ctx) + defer tempObserver.Unsubscribe() + + // If n is greater than the replay buffer size, return the entire replay buffer. + if n > ro.replayBufferSize { + n = ro.replayBufferSize + logger.Warn(). + Int("requested_replay_buffer_size", n). + Int("replay_buffer_capacity", cap(ro.replayBuffer)). + Msg("requested replay buffer size is greater than replay buffer capacity; returning entire replay buffer") + } + + // accumulateReplayValues works concurrently and returns a context and cancellation + // function for signaling completion. + return accumulateReplayValues(tempObserver, n) +} + +// Subscribe returns an observer which is notified when the publishCh channel +// receives a value. +func (ro *replayObservable[V]) Subscribe(ctx context.Context) observable.Observer[V] { + ro.replayBufferMu.RLock() + defer ro.replayBufferMu.RUnlock() + + observer := NewObserver[V](ctx, ro.observerManager.remove) + + // Replay all buffered replayBuffer to the observer channel buffer before + // any new values have an opportunity to send on observerCh (i.e. appending + // observer to ro.observers). + // + // TODO_IMPROVE: this assumes that the observer channel buffer is large enough + // to hold all replay (buffered) notifications. + for _, notification := range ro.replayBuffer { + observer.notify(notification) + } + + ro.observerManager.add(observer) + + // caller can rely on context cancellation or call UnsubscribeAll() to unsubscribe + // active observers + if ctx != nil { + // asynchronously wait for the context to be done and then unsubscribe + // this observer. + go ro.observerManager.goUnsubscribeOnDone(ctx, observer) + } + + return observer +} + +// UnsubscribeAll unsubscribes and removes all observers from the observable. +func (ro *replayObservable[V]) UnsubscribeAll() { + ro.observerManager.removeAll() +} + +// goBufferReplayNotifications buffers the last n notifications from a source +// observer. It is intended to be run in a goroutine. +func (ro *replayObservable[V]) goBufferReplayNotifications(srcObserver observable.Observer[V]) { + for notification := range srcObserver.Ch() { + ro.replayBufferMu.Lock() + // Add the notification to the buffer. + if len(ro.replayBuffer) < ro.replayBufferSize { + ro.replayBuffer = append(ro.replayBuffer, notification) + } else { + // buffer full, make room for the new notification by removing the + // oldest notification. + ro.replayBuffer = append(ro.replayBuffer[1:], notification) + } + ro.replayBufferMu.Unlock() + } +} + +// accumulateReplayValues synchronously (but concurrently) accumulates n values +// from the observer channel into the slice pointed to by accValues and then returns +// said slice. It cancels the context either when n values have been accumulated +// or when at least 1 value has been accumulated and replayPartialBufferTimeout +// has elapsed. +func accumulateReplayValues[V any](observer observable.Observer[V], n int) []V { + var ( + // accValuesMu protects accValues from concurrent access. + accValuesMu sync.Mutex + // Accumulate replay values in a new slice to avoid (read) locking replayBufferMu. + accValues = new([]V) + // canceling the context will cause the loop in the goroutine to exit. + ctx, cancel = context.WithCancel(context.Background()) + ) + + // Concurrently accumulate n values from the observer channel. + go func() { + // Defer canceling the context and unlocking accValuesMu. The function + // assumes that the mutex is locked when it gets execution control back + // from the loop. + defer func() { + cancel() + accValuesMu.Unlock() + }() + for { + // Lock the mutex to read accValues here and potentially write in + // the first case branch in the select below. + accValuesMu.Lock() + + // The context was canceled since the last iteration. + if ctx.Err() != nil { + return + } + + // We've accumulated n values. + if len(*accValues) >= n { + return + } + + // Receive from the observer's channel if we can, otherwise let + // the loop run. + select { + // Receiving from the observer channel blocks if replayBuffer is empty. + case value, ok := <-observer.Ch(): + // tempObserver was closed concurrently. + if !ok { + return + } + + // Update the accumulated values pointed to by accValues. + *accValues = append(*accValues, value) + default: + // If we can't receive from the observer channel immediately, + // let the loop run. + } + + // Unlock accValuesMu so that the select below gets a chance to check + // the length of *accValues to decide whether to cancel, and it can + // be relocked at the top of the loop as it must be locked when the + // loop exits. + accValuesMu.Unlock() + // Wait a tick before continuing the loop. + time.Sleep(time.Millisecond) + } + }() + + // Wait for N values to be accumulated or timeout. When timing out, if we + // have at least 1 value, we can return it. Otherwise, we need to wait for + // the next value to be published (i.e. continue the loop). + for { + select { + case <-ctx.Done(): + return *accValues + case <-time.After(replayPartialBufferTimeout): + accValuesMu.Lock() + if len(*accValues) > 1 { + cancel() + return *accValues + } + accValuesMu.Unlock() + } + } +} diff --git a/pkg/observable/channel/replay_test.go b/pkg/observable/channel/replay_test.go new file mode 100644 index 000000000..6e01f123e --- /dev/null +++ b/pkg/observable/channel/replay_test.go @@ -0,0 +1,240 @@ +package channel_test + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/testerrors" +) + +func TestReplayObservable(t *testing.T) { + var ( + replayBufferSize = 3 + values = []int{1, 2, 3, 4, 5} + // the replay buffer is full and has shifted out values with index < + // len(values)-replayBufferSize so Last should return values starting + // from there. + expectedValues = values[len(values)-replayBufferSize:] + errCh = make(chan error, 1) + ctx, cancel = context.WithCancel(context.Background()) + ) + t.Cleanup(cancel) + + // NB: intentionally not using NewReplayObservable() to test ToReplayObservable() directly + // and to retain a reference to the wrapped observable for testing. + obsvbl, publishCh := channel.NewObservable[int]() + replayObsvbl := channel.ToReplayObservable[int](ctx, replayBufferSize, obsvbl) + + // vanilla observer, should be able to receive all values published after subscribing + observer := obsvbl.Subscribe(ctx) + go func() { + for _, expected := range values { + select { + case v := <-observer.Ch(): + if !assert.Equal(t, expected, v) { + errCh <- testerrors.ErrAsync + return + } + case <-time.After(1 * time.Second): + t.Errorf("Did not receive expected value %d in time", expected) + errCh <- testerrors.ErrAsync + return + } + } + }() + + // send all values to the observable's publish channel + for _, value := range values { + time.Sleep(10 * time.Microsecond) + publishCh <- value + time.Sleep(10 * time.Microsecond) + } + + // allow some time for values to be buffered by the replay observable + time.Sleep(time.Millisecond) + + // replay observer, should receive the last lastN values published prior to + // subscribing followed by subsequently published values + replayObserver := replayObsvbl.Subscribe(ctx) + + // Collect values from replayObserver. + var actualValues []int + for _, expected := range expectedValues { + select { + case v := <-replayObserver.Ch(): + actualValues = append(actualValues, v) + case <-time.After(1 * time.Second): + t.Fatalf("Did not receive expected value %d in time", expected) + } + } + + require.EqualValues(t, expectedValues, actualValues) + + // Second replay observer, should receive the same values as the first + // even though it subscribed after all values were published and the + // values were already replayed by the first. + replayObserver2 := replayObsvbl.Subscribe(ctx) + + // Collect values from replayObserver2. + var actualValues2 []int + for _, expected := range expectedValues { + select { + case v := <-replayObserver2.Ch(): + actualValues2 = append(actualValues2, v) + case <-time.After(1 * time.Second): + t.Fatalf("Did not receive expected value %d in time", expected) + } + } + + require.EqualValues(t, expectedValues, actualValues) +} + +func TestReplayObservable_Last_Full_ReplayBuffer(t *testing.T) { + values := []int{1, 2, 3, 4, 5} + tests := []struct { + name string + replayBufferSize int + // lastN is the number of values to return from the replay buffer + lastN int + expectedValues []int + }{ + { + name: "n < replayBufferSize", + replayBufferSize: 5, + lastN: 3, + // the replay buffer is not full so Last should return values + // starting from the first published value. + expectedValues: values[:3], // []int{1, 2, 3}, + }, + { + name: "n = replayBufferSize", + replayBufferSize: 5, + lastN: 5, + expectedValues: values, + }, + { + name: "n > replayBufferSize", + replayBufferSize: 3, + lastN: 5, + // the replay buffer is full so Last should return values starting + // from lastN - replayBufferSize. + expectedValues: values[2:], // []int{3, 4, 5}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var ctx = context.Background() + + replayObsvbl, publishCh := + channel.NewReplayObservable[int](ctx, tt.replayBufferSize) + + for _, value := range values { + publishCh <- value + time.Sleep(time.Millisecond) + } + + actualValues := replayObsvbl.Last(ctx, tt.lastN) + require.ElementsMatch(t, tt.expectedValues, actualValues) + }) + } +} + +func TestReplayObservable_Last_Blocks_And_Times_Out(t *testing.T) { + var ( + replayBufferSize = 5 + lastN = 5 + // splitIdx is the index at which this test splits the set of values. + // The two groups of values are published at different points in the + // test to test the behavior of Last under different conditions. + splitIdx = 3 + values = []int{1, 2, 3, 4, 5} + ctx = context.Background() + ) + + replayObsvbl, publishCh := channel.NewReplayObservable[int](ctx, replayBufferSize) + + // getLastValues is a helper function which returns a channel that will + // receive the result of a call to Last, the method under test. + getLastValues := func() chan []int { + lastValuesCh := make(chan []int, 1) + go func() { + // Last should block until lastN values have been published. + // NOTE: this will produce a warning log which can safely be ignored: + // > WARN: requested replay buffer size 3 is greater than replay buffer + // > capacity 3; returning entire replay buffer + lastValuesCh <- replayObsvbl.Last(ctx, lastN) + }() + return lastValuesCh + } + + // Ensure that last blocks when the replay buffer is empty + select { + case actualValues := <-getLastValues(): + t.Fatalf( + "Last should block until at lest 1 value has been published; actualValues: %v", + actualValues, + ) + case <-time.After(10 * time.Millisecond): + } + + // Publish some values (up to splitIdx). + for _, value := range values[:splitIdx] { + publishCh <- value + time.Sleep(time.Millisecond) + } + + // Ensure Last works as expected when n <= len(published_values). + require.ElementsMatch(t, []int{1}, replayObsvbl.Last(ctx, 1)) + require.ElementsMatch(t, []int{1, 2}, replayObsvbl.Last(ctx, 2)) + require.ElementsMatch(t, []int{1, 2, 3}, replayObsvbl.Last(ctx, 3)) + + // Ensure that Last blocks when n > len(published_values) and the replay + // buffer is not full. + select { + case actualValues := <-getLastValues(): + t.Fatalf( + "Last should block until replayPartialBufferTimeout has elapsed; received values: %v", + actualValues, + ) + default: + t.Log("OK: Last is blocking, as expected") + } + + // Ensure that Last returns the correct values when n > len(published_values) + // and the replay buffer is not full. + select { + case actualValues := <-getLastValues(): + require.ElementsMatch(t, values[:splitIdx], actualValues) + case <-time.After(250 * time.Millisecond): + t.Fatal("timed out waiting for Last to return") + } + + // Publish the rest of the values (from splitIdx on). + for _, value := range values[splitIdx:] { + publishCh <- value + time.Sleep(time.Millisecond) + } + + // Ensure that Last doesn't block when n = len(published_values) and the + // replay buffer is full. + select { + case actualValues := <-getLastValues(): + require.Len(t, actualValues, lastN) + require.ElementsMatch(t, values, actualValues) + case <-time.After(50 * time.Millisecond): + t.Fatal("timed out waiting for Last to return") + } + + // Ensure that Last still works as expected when n <= len(published_values). + require.ElementsMatch(t, []int{1}, replayObsvbl.Last(ctx, 1)) + require.ElementsMatch(t, []int{1, 2}, replayObsvbl.Last(ctx, 2)) + require.ElementsMatch(t, []int{1, 2, 3}, replayObsvbl.Last(ctx, 3)) + require.ElementsMatch(t, []int{1, 2, 3, 4}, replayObsvbl.Last(ctx, 4)) + require.ElementsMatch(t, []int{1, 2, 3, 4, 5}, replayObsvbl.Last(ctx, 5)) +} diff --git a/pkg/observable/errors.go b/pkg/observable/errors.go new file mode 100644 index 000000000..c34f2f7d6 --- /dev/null +++ b/pkg/observable/errors.go @@ -0,0 +1,8 @@ +package observable + +import errorsmod "cosmossdk.io/errors" + +var ( + ErrObserverClosed = errorsmod.Register(codespace, 1, "observer is closed") + codespace = "observable" +) diff --git a/pkg/observable/filter/either.go b/pkg/observable/filter/either.go new file mode 100644 index 000000000..86e3d57ab --- /dev/null +++ b/pkg/observable/filter/either.go @@ -0,0 +1,62 @@ +package filter + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" +) + +// EitherError operates on an observable of an either type. It filters for all +// eithers which are not populated with errors, and maps them to their errors +// (publishes errors to the resulting observable). +func EitherError[T any]( + ctx context.Context, + eitherObservable observable.Observable[either.Either[T]], +) observable.Observable[error] { + return channel.Map( + ctx, + eitherObservable, + mapEitherError[T], + ) +} + +// EitherSuccess operates on an observable of an either type. It filters for all +// eithers which are not populated with values, and maps them to their values +// (publishes values to the resulting observable). +func EitherSuccess[T any]( + ctx context.Context, + eitherObservable observable.Observable[either.Either[T]], +) observable.Observable[T] { + return channel.Map( + ctx, + eitherObservable, + mapEitherSuccess[T], + ) +} + +// mapEitherError is a MapFn that maps an either to its error. It skips the +// notification if the either is populated with a value. +func mapEitherError[T any]( + _ context.Context, + inputEither either.Either[T], +) (_ error, skip bool) { + if _, err := inputEither.ValueOrError(); err != nil { + return err, false + } + return nil, true +} + +// mapEitherSuccess is a MapFn that maps an either to its value. It skips the +// notification if the either is populated with an error. +func mapEitherSuccess[T any]( + _ context.Context, + inputEither either.Either[T], +) (_ T, skip bool) { + value, err := inputEither.ValueOrError() + if err != nil { + return value, true + } + return value, false +} diff --git a/pkg/observable/interface.go b/pkg/observable/interface.go new file mode 100644 index 000000000..d86da414f --- /dev/null +++ b/pkg/observable/interface.go @@ -0,0 +1,41 @@ +package observable + +import "context" + +// NOTE: We explicitly decided to write a small and custom notifications package +// to keep logic simple and minimal. If the needs & requirements of this library ever +// grow, other packages (e.g. https://github.com/ReactiveX/RxGo) can be considered. +// (see: https://github.com/ReactiveX/RxGo/pull/377) + +// ReplayObservable is an observable which replays the last n values published +// to new observers, before publishing new values to observers. +type ReplayObservable[V any] interface { + Observable[V] + // Last synchronously returns the last n values from the replay buffer. + Last(ctx context.Context, n int) []V +} + +// Observable is a generic interface that allows multiple subscribers to be +// notified of new values asynchronously. +// It is analogous to a publisher in a "Fan-Out" system design. +type Observable[V any] interface { + // Subscribe returns an observer which is notified when the publishCh channel + // receives a value. + Subscribe(context.Context) Observer[V] + // UnsubscribeAll unsubscribes and removes all observers from the observable. + UnsubscribeAll() +} + +// Observer is a generic interface that provides access to the notified +// channel and allows unsubscribing from an Observable. +// It is analogous to a subscriber in a "Fan-Out" system design. +type Observer[V any] interface { + // Unsubscribe closes the subscription channel and removes the subscription from + // the observable. + Unsubscribe() + // Ch returns a receive-only subscription channel. + Ch() <-chan V + // IsClosed returns true if the observer has been unsubscribed. + // A closed observer cannot be reused. + IsClosed() bool +} diff --git a/pkg/observable/logging/logging.go b/pkg/observable/logging/logging.go new file mode 100644 index 000000000..97f7e6c1b --- /dev/null +++ b/pkg/observable/logging/logging.go @@ -0,0 +1,22 @@ +package logging + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// LogErrors operates on an observable of errors. It logs all errors received +// from the observable. +func LogErrors(ctx context.Context, errs observable.Observable[error]) { + channel.ForEach(ctx, errs, forEachErrorLogError) +} + +// forEachErrorLogError is a ForEachFn that logs the given error. +func forEachErrorLogError(ctx context.Context, err error) { + logger := polylog.Ctx(ctx) + // Logging the error and flushing (i.e. sending) the log message to stdout + logger.Error().Err(err).Send() +} diff --git a/pkg/observable/types.go b/pkg/observable/types.go new file mode 100644 index 000000000..04df98201 --- /dev/null +++ b/pkg/observable/types.go @@ -0,0 +1,5 @@ +package observable + +type ( + Error = Observable[error] +) diff --git a/pkg/partials/errors.go b/pkg/partials/errors.go new file mode 100644 index 000000000..8f3d84885 --- /dev/null +++ b/pkg/partials/errors.go @@ -0,0 +1,11 @@ +package partials + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + codespace = "partial" + ErrPartialInvalidPayload = sdkerrors.Register(codespace, 1, "invalid partial payload") + ErrPartialUnrecognisedRequestFormat = sdkerrors.Register(codespace, 2, "unrecognised request format in partial payload") +) diff --git a/pkg/partials/interface.go b/pkg/partials/interface.go new file mode 100644 index 000000000..6a014ad98 --- /dev/null +++ b/pkg/partials/interface.go @@ -0,0 +1,32 @@ +package partials + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/partials/payloads" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +var ( + _ PartialPayload = (*payloads.PartialJSONPayload)(nil) + _ PartialPayload = (*payloads.PartialRESTPayload)(nil) +) + +// PartialPayload defines an interface for partial RPC payloads that enables the +// transparent relaying of RPC requests from applications to suppliers. In order +// for this to occur we must be able to infer its format. This requires the RPC +// payload to be partially decoded, extracting the required fields, currently +// limited for the purpose of determine the RPC type, compute units and error +// generation, but may be used for other logic in the future +type PartialPayload interface { + // GetRPCType returns the request type for the given payload. + GetRPCType() sharedtypes.RPCType + // GenerateErrorPayload creates an error message from the provided error + // compatible with the protocol of this RPC type. + GenerateErrorPayload(err error) ([]byte, error) + // GetRPCComputeUnits returns the compute units for the RPC request + GetRPCComputeUnits(ctx context.Context) (uint64, error) + // ValidateBasic ensures that all the required fields are set in the partial + // payload. + ValidateBasic(ctx context.Context) error +} diff --git a/pkg/partials/partial.go b/pkg/partials/partial.go new file mode 100644 index 000000000..1e699c1b4 --- /dev/null +++ b/pkg/partials/partial.go @@ -0,0 +1,71 @@ +package partials + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/partials/payloads" + "github.com/pokt-network/poktroll/pkg/polylog" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// GetRequestType returns the request type for the given payload. +func GetRequestType(ctx context.Context, payloadBz []byte) (sharedtypes.RPCType, error) { + partialRequest, err := PartiallyUnmarshalRequest(ctx, payloadBz) + if err != nil { + return sharedtypes.RPCType_UNKNOWN_RPC, err + } + // if the request has missing fields return an error detailing which fields + // are missing as they are required + if err := partialRequest.ValidateBasic(ctx); err != nil { + return partialRequest.GetRPCType(), + ErrPartialInvalidPayload.Wrapf("payload: %s [%v]", string(payloadBz), err) + } + return partialRequest.GetRPCType(), nil +} + +// GetErrorReply returns an error reply for the given payload and error, +// in the correct format required by the request type. +func GetErrorReply(ctx context.Context, payloadBz []byte, err error) ([]byte, error) { + partialRequest, er := PartiallyUnmarshalRequest(ctx, payloadBz) + if er != nil { + return nil, er + } + return partialRequest.GenerateErrorPayload(err) +} + +// GetComputeUnits returns the compute units for the RPC request provided +func GetComputeUnits(ctx context.Context, payloadBz []byte) (uint64, error) { + partialRequest, err := PartiallyUnmarshalRequest(ctx, payloadBz) + if err != nil { + return 0, err + } + // if the request has missing fields return an error detailing + // which fields are missing + if err := partialRequest.ValidateBasic(ctx); err != nil { + return 0, ErrPartialInvalidPayload.Wrapf("payload: %s [%v]", string(payloadBz), err) + } + return partialRequest.GetRPCComputeUnits(ctx) +} + +// TODO_BLOCKER(@h5law): This function currently only supports JSON-RPC and must +// be extended to other request types. +// PartiallyUnmarshalRequest unmarshals the payload into a partial request +// that contains only the fields necessary to generate an error response and +// handle accounting for the request's method. +func PartiallyUnmarshalRequest(ctx context.Context, payloadBz []byte) (PartialPayload, error) { + logger := polylog.Ctx(ctx) + logger.Debug(). + Str("payload", string(payloadBz)). + Msg("partially Unmarshalling request") + // First attempt to unmarshal the payload into a partial JSON-RPC request + + jsonPayload, err := payloads.PartiallyUnmarshalJSONPayload(payloadBz) + if err != nil { + return nil, ErrPartialInvalidPayload.Wrapf("json payload: %s [%v]", string(payloadBz), err) + } + if jsonPayload != nil { + return jsonPayload, nil + } + // TODO(@h5law): Handle other request types + return nil, ErrPartialUnrecognisedRequestFormat.Wrapf("got: %s", string(payloadBz)) +} diff --git a/pkg/partials/partials_test.go b/pkg/partials/partials_test.go new file mode 100644 index 000000000..84c749b2a --- /dev/null +++ b/pkg/partials/partials_test.go @@ -0,0 +1,87 @@ +package partials + +import ( + "context" + "encoding/json" + "errors" + "testing" + + sdkerror "cosmossdk.io/errors" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/testutil/testpolylog" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// TODO(@h5law): Expand coverage with more test cases when more request types +// are implemented in the partials package. +func TestPartials_GetErrorReply(t *testing.T) { + _, logCtx := testpolylog.NewLoggerWithCtx( + context.Background(), + polyzero.DebugLevel, + ) + + tests := []struct { + name string + err error + payload []byte + expectedReply []byte + expectedErr *sdkerror.Error + }{ + { + name: "valid json - properly formatted payload", + err: errors.New("test error"), + payload: []byte( + `{"id":1,"jsonrpc":"2.0","method":"eth_getBlockNumber","params":{"these":"are","ignored":0}}`, + ), + expectedReply: []byte( + `{"id":1,"jsonrpc":"2.0","error":{"code":-32000,"data":null,"message":"test error"}}`, + ), + expectedErr: nil, + }, + { + name: "invalid json - unrecognised payload", + err: errors.New("test error"), + payload: []byte(`{"invalid": "payload"}`), + expectedReply: nil, + expectedErr: ErrPartialUnrecognisedRequestFormat, + }, + { + name: "invalid - unrecognised payload", + err: errors.New("test error"), + payload: []byte("invalid payload"), + expectedReply: nil, + expectedErr: ErrPartialUnrecognisedRequestFormat, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + // Generate the error reply + replyBz, err := GetErrorReply(logCtx, test.payload, test.err) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) + return + } + require.NoError(t, err) + // Unmarshal the payload to test reply equality + partialReq, err := PartiallyUnmarshalRequest(logCtx, test.payload) + require.NoError(t, err) + require.NotNil(t, partialReq) + switch partialReq.GetRPCType() { + case sharedtypes.RPCType_JSON_RPC: + reply := make(map[string]any) + err = json.Unmarshal(replyBz, &reply) + require.NoError(t, err) + expectedReply := make(map[string]any) + err = json.Unmarshal(test.expectedReply, &expectedReply) + require.NoError(t, err) + for k, v := range expectedReply { + require.Equal(t, v, reply[k]) + } + require.Equal(t, len(reply), len(expectedReply)) + } + }) + } +} diff --git a/pkg/partials/payloads/godoc.go b/pkg/partials/payloads/godoc.go new file mode 100644 index 000000000..fe74c19a4 --- /dev/null +++ b/pkg/partials/payloads/godoc.go @@ -0,0 +1,8 @@ +// Package payloads contains the different types of RPC payloads the partials +// package supports. The structs defined here are used to partially unmarshal +// the payload and extract the minimal fields required to: generate error +// responses, retrieve RPC request type, determine request compute units, etc... +// This is done through partially unmarshalling the payload into the minimum +// required set of pre-defined fields that need to be explicitly determined for +// each RPC type supported. +package payloads diff --git a/pkg/partials/payloads/jsonrpc.go b/pkg/partials/payloads/jsonrpc.go new file mode 100644 index 000000000..284a6f40c --- /dev/null +++ b/pkg/partials/payloads/jsonrpc.go @@ -0,0 +1,82 @@ +package payloads + +import ( + "context" + "encoding/json" + "errors" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/x/shared/types" +) + +// PartialJSONPayload is a partial representation of a JSON-RPC request payload +// that contains the minimal fields necessary for basic business logic such as +// generating an error response, handling request account, etc... +type PartialJSONPayload struct { + Id uint64 `json:"id"` + JsonRPC string `json:"jsonrpc"` + Method string `json:"method"` +} + +// ValidateBasic ensures that all the required fields are set in the partial +// JSON payload. +// It uses a non-pointer receiver to ensure the default values of unset fields +// are present +func (j PartialJSONPayload) ValidateBasic(ctx context.Context) error { + logger := polylog.Ctx(ctx) + + var err error + if j.Id == 0 { + err = errors.Join(err, errors.New("id field is zero")) + } + if j.JsonRPC == "" { + err = errors.Join(err, errors.New("jsonrpc version field is empty")) + } + if j.Method == "" { + err = errors.Join(err, errors.New("method field is empty")) + } + logger.Debug().Err(err).Msg("Validating basic JSON payload") + return err +} + +// PartiallyUnmarshalJSONPayload receives a serialized payload and attempts to +// unmarshal it into the PartialJSONPayload struct. If successful this struct +// is returned, if however the struct does not contain all the required fields +// an error is returned detailing what was missing. +// If the payload is not a JSON request this function will return nil, nil +func PartiallyUnmarshalJSONPayload(payloadBz []byte) (*PartialJSONPayload, error) { + var jsonPayload PartialJSONPayload + err := json.Unmarshal(payloadBz, &jsonPayload) + // Check if we can unmarshal if we cannot return nil, nil + if err != nil || jsonPayload == (PartialJSONPayload{}) { + return nil, nil + } + // return the partial json request + return &jsonPayload, nil +} + +// GetRPCType returns the request type for the given payload. +func (j *PartialJSONPayload) GetRPCType() types.RPCType { + return types.RPCType_JSON_RPC +} + +// GenerateErrorPayload creates a JSON-RPC error payload from the provided +// error with the macthing json-rpc and id fields from the request payload. +func (j *PartialJSONPayload) GenerateErrorPayload(err error) ([]byte, error) { + reply := map[string]any{ + "jsonrpc": j.JsonRPC, + "id": j.Id, + "error": map[string]any{ + "code": -32000, + "message": err.Error(), + "data": nil, + }, + } + return json.Marshal(reply) +} + +// GetRPCComputeUnits returns the compute units for the RPC request +func (j *PartialJSONPayload) GetRPCComputeUnits(ctx context.Context) (uint64, error) { + // TODO(@h5law): Implement this method + return 0, nil +} diff --git a/pkg/partials/payloads/rest.go b/pkg/partials/payloads/rest.go new file mode 100644 index 000000000..273139280 --- /dev/null +++ b/pkg/partials/payloads/rest.go @@ -0,0 +1,51 @@ +package payloads + +import ( + "context" + + "github.com/pokt-network/poktroll/x/shared/types" +) + +// PartialRESTPayload is a partial representation of a REST request payload +// that contains the minimal fields necessary for basic business logic such as +// generating an error response, handling request account, etc... +type PartialRESTPayload struct { + Headers map[string]string `json:"headers"` +} + +// PartiallyUnmarshalRESTPayload receives a serialized payload and attempts to +// unmarshal it into the PartialRESTPayload struct. If successful this struct +// is returned, if however the struct does not contain all the required fields +// the success return value is false and a nil payload is returned. +func PartiallyUnmarshalRESTPayload(payloadBz []byte) (restPayload *PartialRESTPayload, success bool) { + // TODO(@h5law): Implement this function + return nil, false +} + +// ValidateBasic ensures that all the required fields are set in the partial +// REST payload. +// It uses a non-pointer receiver to ensure the default values of unset fields +// are present +func (r PartialRESTPayload) ValidateBasic(ctx context.Context) error { + // TODO(@h5law): Implement this function + var err error + return err +} + +// GetRPCType returns the request type for the given payload. +func (r *PartialRESTPayload) GetRPCType() types.RPCType { + return types.RPCType_REST +} + +// GenerateErrorPayload creates a REST error payload using the headers from the +// request payload. +func (r *PartialRESTPayload) GenerateErrorPayload(err error) ([]byte, error) { + // TODO(@h5law): Implement this method + return nil, nil +} + +// GetRPCComputeUnits returns the compute units for the RPC request +func (r *PartialRESTPayload) GetRPCComputeUnits(ctx context.Context) (uint64, error) { + // TODO(@h5law): Implement this method + return 0, nil +} diff --git a/pkg/relayer/cmd/cmd.go b/pkg/relayer/cmd/cmd.go new file mode 100644 index 000000000..7c758303c --- /dev/null +++ b/pkg/relayer/cmd/cmd.go @@ -0,0 +1,345 @@ +package cmd + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "os" + + "cosmossdk.io/depinject" + cosmosclient "github.com/cosmos/cosmos-sdk/client" + cosmosflags "github.com/cosmos/cosmos-sdk/client/flags" + cosmostx "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/rs/zerolog" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/cmd/signals" + "github.com/pokt-network/poktroll/pkg/client/supplier" + "github.com/pokt-network/poktroll/pkg/client/tx" + txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" + "github.com/pokt-network/poktroll/pkg/deps/config" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/pkg/relayer" + relayerconfig "github.com/pokt-network/poktroll/pkg/relayer/config" + "github.com/pokt-network/poktroll/pkg/relayer/miner" + "github.com/pokt-network/poktroll/pkg/relayer/proxy" + "github.com/pokt-network/poktroll/pkg/relayer/session" +) + +// We're `explicitly omitting default` so the relayer crashes if these aren't specified. +const omittedDefaultFlagValue = "explicitly omitting default" + +// TODO_CONSIDERATION: Consider moving all flags defined in `/pkg` to a `flags.go` file. +var ( + // flagRelayMinerConfig is the variable containing the relay miner config filepath + // sourced from the `--config` flag. + flagRelayMinerConfig string + // flagNodeRPCURL is the variable containing the Cosmos node RPC URL flag value. + flagNodeRPCURL string + // flagNodeGRPCURL is the variable containing the Cosmos node GRPC URL flag value. + flagNodeGRPCURL string +) + +// RelayerCmd returns the Cobra command for running the relay miner. +func RelayerCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "relayminer", + Short: "Run a relay miner", + Long: `Run a relay miner. The relay miner process configures and starts +relay servers for each service the supplier actor identified by --signing-key is +staked for (configured on-chain). + +Relay requests received by the relay servers are validated and proxied to their +respective service endpoints, maintained by the relayer off-chain. The responses +are then signed and sent back to the requesting application. + +For each successfully served relay, the miner will hash and compare its difficulty +against an on-chain threshold. If the difficulty is sufficient, it is applicable +to relay volume and therefore rewards. Such relays are inserted into and persisted +via an SMT KV store. The miner will monitor the current block height and periodically +submit claim and proof messages according to the protocol as sessions become eligible +for such operations.`, + RunE: runRelayer, + } + // Custom flags + cmd.Flags().StringVar(&flagRelayMinerConfig, "config", "", "The path to the relayminer config file") + + // Cosmos flags + // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. + cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") + cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query and tx contexts correctly. It can be used to override the `QueryNodeRPCURL` and `TxNodeRPCURL` fields in the config file if specified.") + cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCURL` field in the config file if specified.") + cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") + + return cmd +} + +func runRelayer(cmd *cobra.Command, _ []string) error { + ctx, cancelCtx := context.WithCancel(cmd.Context()) + // Ensure context cancellation. + defer cancelCtx() + + // Handle interrupt and kill signals asynchronously. + signals.GoOnExitSignal(cancelCtx) + + configContent, err := os.ReadFile(flagRelayMinerConfig) + if err != nil { + return err + } + + // TODO_TECHDEBT: add logger level and output options to the config. + relayMinerConfig, err := relayerconfig.ParseRelayMinerConfigs(configContent) + if err != nil { + return err + } + + // TODO_TECHDEBT: populate logger from the config (ideally, from viper). + loggerOpts := []polylog.LoggerOption{ + polyzero.WithLevel(zerolog.DebugLevel), + polyzero.WithOutput(os.Stderr), + } + + // Construct a logger and associate it with the command context. + logger := polyzero.NewLogger(loggerOpts...) + ctx = logger.WithContext(ctx) + cmd.SetContext(ctx) + + // Sets up the following dependencies: + // Miner, EventsQueryClient, BlockClient, cosmosclient.Context, TxFactory, + // TxContext, TxClient, SupplierClient, RelayerProxy, RelayerSessionsManager. + deps, err := setupRelayerDependencies(ctx, cmd, relayMinerConfig) + if err != nil { + return err + } + + relayMiner, err := relayer.NewRelayMiner(ctx, deps) + if err != nil { + return err + } + + // Serve metrics. + if relayMinerConfig.Metrics.Enabled { + err = relayMiner.ServeMetrics(relayMinerConfig.Metrics.Addr) + if err != nil { + return fmt.Errorf("failed to start metrics endpoint: %w", err) + } + } + + // Start the relay miner + logger.Info().Msg("Starting relay miner...") + if err := relayMiner.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) { + return fmt.Errorf("failed to start relay miner: %w", err) + } else if errors.Is(err, http.ErrServerClosed) { + logger.Info().Msg("Relay miner stopped; exiting") + } + return nil +} + +// setupRelayerDependencies sets up all the dependencies the relay miner needs +// to run by building the dependency tree from the leaves up, incrementally +// supplying each component to an accumulating depinject.Config: +// Miner, EventsQueryClient, BlockClient, cosmosclient.Context, TxFactory, TxContext, +// TxClient, SupplierClient, RelayerProxy, RelayerSessionsManager. +func setupRelayerDependencies( + ctx context.Context, + cmd *cobra.Command, + relayMinerConfig *relayerconfig.RelayMinerConfig, +) (deps depinject.Config, err error) { + queryNodeRPCUrl := relayMinerConfig.PocketNode.QueryNodeRPCUrl + queryNodeGRPCUrl := relayMinerConfig.PocketNode.QueryNodeGRPCUrl + txNodeRPCUrl := relayMinerConfig.PocketNode.TxNodeRPCUrl + + // Override the config file's `QueryNodeGRPCUrl` fields + // with the `--grpc-addr` flag if it was specified. + // TODO(#223) Remove this check once viper is used as SoT for overridable config values. + if flagNodeGRPCURL != omittedDefaultFlagValue { + parsedFlagNodeGRPCUrl, err := url.Parse(flagNodeGRPCURL) + if err != nil { + return nil, fmt.Errorf("failed to parse grpc query URL: %w", err) + } + queryNodeGRPCUrl = parsedFlagNodeGRPCUrl + } + + // Override the config file's `QueryNodeUrl` and `txNodeRPCUrl` fields + // with the `--node` flag if it was specified. + // TODO(#223) Remove this check once viper is used as SoT for overridable config values. + if flagNodeRPCURL != omittedDefaultFlagValue { + parsedFlagNodeRPCUrl, err := url.Parse(flagNodeRPCURL) + if err != nil { + return nil, fmt.Errorf("failed to parse rpc query URL: %w", err) + } + queryNodeRPCUrl = parsedFlagNodeRPCUrl + txNodeRPCUrl = parsedFlagNodeRPCUrl + } + + signingKeyName := relayMinerConfig.SigningKeyName + proxiedServiceEndpoints := relayMinerConfig.Proxies + smtStorePath := relayMinerConfig.SmtStorePath + + supplierFuncs := []config.SupplierFn{ + config.NewSupplyLoggerFromCtx(ctx), + config.NewSupplyEventsQueryClientFn(queryNodeRPCUrl), // leaf + config.NewSupplyBlockClientFn(), // leaf + config.NewSupplyQueryClientContextFn(queryNodeGRPCUrl), // leaf + supplyMiner, // leaf + config.NewSupplyTxClientContextFn(queryNodeGRPCUrl, txNodeRPCUrl), // leaf + config.NewSupplyDelegationClientFn(), // leaf + config.NewSupplyAccountQuerierFn(), + config.NewSupplyApplicationQuerierFn(), + config.NewSupplySupplierQuerierFn(), + config.NewSupplySessionQuerierFn(), + config.NewSupplyRingCacheFn(), + supplyTxFactory, + supplyTxContext, + newSupplyTxClientFn(signingKeyName), + newSupplySupplierClientFn(signingKeyName), + newSupplyRelayerProxyFn(signingKeyName, proxiedServiceEndpoints), + newSupplyRelayerSessionsManagerFn(smtStorePath), + } + + return config.SupplyConfig(ctx, cmd, supplierFuncs) +} + +// supplyMiner constructs a Miner instance and returns a new depinject.Config +// which is supplied with the given deps and the new Miner. +func supplyMiner( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, +) (depinject.Config, error) { + mnr, err := miner.NewMiner() + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(mnr)), nil +} + +// supplyTxFactory constructs a cosmostx.Factory instance and returns a new +// depinject.Config which is supplied with the given deps and the new +// cosmostx.Factory. +func supplyTxFactory( + _ context.Context, + deps depinject.Config, + cmd *cobra.Command, +) (depinject.Config, error) { + var txClientCtx txtypes.Context + if err := depinject.Inject(deps, &txClientCtx); err != nil { + return nil, err + } + + clientCtx := cosmosclient.Context(txClientCtx) + clientFactory, err := cosmostx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(clientFactory)), nil +} + +func supplyTxContext( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, +) (depinject.Config, error) { + txContext, err := tx.NewTxContext(deps) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(txContext)), nil +} + +// newSupplyTxClientFn returns a function which constructs a TxClient +// instance and returns a new depinject.Config which is supplied with +// the given deps and the new TxClient. +func newSupplyTxClientFn(signingKeyName string) config.SupplierFn { + return func( + ctx context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + txClient, err := tx.NewTxClient( + ctx, + deps, + tx.WithSigningKeyName(signingKeyName), + // TODO_TECHDEBT: populate this from some config. + tx.WithCommitTimeoutBlocks(tx.DefaultCommitTimeoutHeightOffset), + ) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(txClient)), nil + } +} + +// newSupplySupplierClientFn returns a function which constructs a +// SupplierClient instance and returns a new depinject.Config which is +// supplied with the given deps and the new SupplierClient. +func newSupplySupplierClientFn(signingKeyName string) config.SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + supplierClient, err := supplier.NewSupplierClient( + deps, + supplier.WithSigningKeyName(signingKeyName), + ) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(supplierClient)), nil + } +} + +// newSupplyRelayerProxyFn returns a function which constructs a +// RelayerProxy instance and returns a new depinject.Config which +// is supplied with the given deps and the new RelayerProxy. +func newSupplyRelayerProxyFn( + signingKeyName string, + proxiedServiceEndpoints map[string]*relayerconfig.RelayMinerProxyConfig, +) config.SupplierFn { + return func( + _ context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + relayerProxy, err := proxy.NewRelayerProxy( + deps, + proxy.WithSigningKeyName(signingKeyName), + proxy.WithProxiedServicesEndpoints(proxiedServiceEndpoints), + ) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(relayerProxy)), nil + } +} + +// newSupplyRelayerSessionsManagerFn returns a function which constructs a +// RelayerSessionsManager instance and returns a new depinject.Config which +// is supplied with the given deps and the new RelayerSessionsManager. +func newSupplyRelayerSessionsManagerFn(smtStorePath string) config.SupplierFn { + return func( + ctx context.Context, + deps depinject.Config, + _ *cobra.Command, + ) (depinject.Config, error) { + relayerSessionsManager, err := session.NewRelayerSessions( + ctx, deps, + session.WithStoresDirectory(smtStorePath), + ) + if err != nil { + return nil, err + } + + return depinject.Configs(deps, depinject.Supply(relayerSessionsManager)), nil + } +} diff --git a/pkg/relayer/config/errors.go b/pkg/relayer/config/errors.go new file mode 100644 index 000000000..eace596e3 --- /dev/null +++ b/pkg/relayer/config/errors.go @@ -0,0 +1,14 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "relayminer_config" + ErrRelayMinerConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") + ErrRelayMinerConfigInvalidNodeUrl = sdkerrors.Register(codespace, 2, "invalid node url in RelayMiner config") + ErrRelayMinerConfigInvalidSigningKeyName = sdkerrors.Register(codespace, 3, "invalid signing key name in RelayMiner config") + ErrRelayMinerConfigInvalidSmtStorePath = sdkerrors.Register(codespace, 4, "invalid smt store path in RelayMiner config") + ErrRelayMinerConfigEmpty = sdkerrors.Register(codespace, 5, "empty RelayMiner config") + ErrRelayMinerConfigInvalidSupplier = sdkerrors.Register(codespace, 6, "invalid supplier in RelayMiner config") + ErrRelayMinerConfigInvalidProxy = sdkerrors.Register(codespace, 7, "invalid proxy in RelayMiner config") +) diff --git a/pkg/relayer/config/pocket_node_config_hydrator.go b/pkg/relayer/config/pocket_node_config_hydrator.go new file mode 100644 index 000000000..88a57fa85 --- /dev/null +++ b/pkg/relayer/config/pocket_node_config_hydrator.go @@ -0,0 +1,56 @@ +package config + +import "net/url" + +// HydratePocketNodeUrls populates the pocket node fields of the RelayMinerConfig +// that are relevant to the "pocket_node" section in the config file. +func (relayMinerConfig *RelayMinerConfig) HydratePocketNodeUrls( + yamlPocketNodeConfig *YAMLRelayMinerPocketNodeConfig, +) error { + relayMinerConfig.PocketNode = &RelayMinerPocketNodeConfig{} + + if len(yamlPocketNodeConfig.TxNodeRPCUrl) == 0 { + return ErrRelayMinerConfigInvalidNodeUrl.Wrap("tx node rpc url is required") + } + + // Check if the pocket node rpc url is a valid URL + txNodeRPCUrl, err := url.Parse(yamlPocketNodeConfig.TxNodeRPCUrl) + if err != nil { + return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( + "invalid tx node rpc url %s", + err.Error(), + ) + } + relayMinerConfig.PocketNode.TxNodeRPCUrl = txNodeRPCUrl + + // If the query node rpc url is empty, use the tx node rpc url + if len(yamlPocketNodeConfig.QueryNodeRPCUrl) == 0 { + relayMinerConfig.PocketNode.QueryNodeRPCUrl = relayMinerConfig.PocketNode.TxNodeRPCUrl + } else { + // If the query node rpc url is not empty, make sure it is a valid URL + queryNodeRPCUrl, err := url.Parse(yamlPocketNodeConfig.QueryNodeRPCUrl) + if err != nil { + return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( + "invalid query node rpc url %s", + err.Error(), + ) + } + relayMinerConfig.PocketNode.QueryNodeRPCUrl = queryNodeRPCUrl + } + + if len(yamlPocketNodeConfig.QueryNodeGRPCUrl) == 0 { + return ErrRelayMinerConfigInvalidNodeUrl.Wrap("query node grpc url is required") + } + + // Check if the query node grpc url is a valid URL + queryNodeGRPCUrl, err := url.Parse(yamlPocketNodeConfig.QueryNodeGRPCUrl) + if err != nil { + return ErrRelayMinerConfigInvalidNodeUrl.Wrapf( + "invalid query node grpc url %s", + err.Error(), + ) + } + relayMinerConfig.PocketNode.QueryNodeGRPCUrl = queryNodeGRPCUrl + + return nil +} diff --git a/pkg/relayer/config/proxies_config_hydrator.go b/pkg/relayer/config/proxies_config_hydrator.go new file mode 100644 index 000000000..f3b7628ed --- /dev/null +++ b/pkg/relayer/config/proxies_config_hydrator.go @@ -0,0 +1,63 @@ +package config + +// HydrateProxies populates the proxies fields of the RelayMinerConfig that +// are relevant to the "proxies" section in the config file. +func (relayMinerConfig *RelayMinerConfig) HydrateProxies( + yamlProxyConfigs []YAMLRelayMinerProxyConfig, +) error { + // At least one proxy is required + if len(yamlProxyConfigs) == 0 { + return ErrRelayMinerConfigInvalidProxy.Wrap("no proxies provided") + } + + relayMinerConfig.Proxies = make(map[string]*RelayMinerProxyConfig) + + for _, yamlProxyConfig := range yamlProxyConfigs { + // Proxy name is required + if len(yamlProxyConfig.ProxyName) == 0 { + return ErrRelayMinerConfigInvalidProxy.Wrap("proxy name is required") + } + + // Proxy name should not be unique + if _, ok := relayMinerConfig.Proxies[yamlProxyConfig.ProxyName]; ok { + return ErrRelayMinerConfigInvalidProxy.Wrapf( + "duplicate porxy name %s", + yamlProxyConfig.ProxyName, + ) + } + + proxyConfig := &RelayMinerProxyConfig{ + ProxyName: yamlProxyConfig.ProxyName, + XForwardedHostLookup: yamlProxyConfig.XForwardedHostLookup, + Suppliers: make(map[string]*RelayMinerSupplierConfig), + } + + // Populate the proxy fields that are relevant to each supported proxy type + switch yamlProxyConfig.Type { + case "http": + if err := proxyConfig.parseHTTPProxyConfig(yamlProxyConfig); err != nil { + return err + } + default: + // Fail if the proxy type is not supported + return ErrRelayMinerConfigInvalidProxy.Wrapf( + "invalid proxy type %s", + yamlProxyConfig.Type, + ) + } + + switch yamlProxyConfig.Type { + case "http": + proxyConfig.Type = ProxyTypeHTTP + default: + ErrRelayMinerConfigInvalidProxy.Wrapf( + "invalid proxy type %s", + yamlProxyConfig.Type, + ) + } + + relayMinerConfig.Proxies[proxyConfig.ProxyName] = proxyConfig + } + + return nil +} diff --git a/pkg/relayer/config/proxy_http_config_parser.go b/pkg/relayer/config/proxy_http_config_parser.go new file mode 100644 index 000000000..a8f655f14 --- /dev/null +++ b/pkg/relayer/config/proxy_http_config_parser.go @@ -0,0 +1,73 @@ +package config + +import ( + "fmt" + "net/url" +) + +// parseHTTPProxyConfig populates the proxy fields of the target structure that +// are relevant to the "http" type in the proxy section of the config file. +// This function alters the target RelayMinerProxyConfig structure as a side effect. +func (proxyConfig *RelayMinerProxyConfig) parseHTTPProxyConfig( + yamlProxyConfig YAMLRelayMinerProxyConfig, +) error { + // Check if the proxy host is a valid URL. + // Since `yamlProxyConfig.Host` is a string representing the host, we need to + // prepend it with the "http://" scheme to make it a valid URL; we end up + // using the `Host` field of the resulting `url.URL` struct, so the prepended + // scheme is irrelevant. + proxyUrl, err := url.Parse(fmt.Sprintf("http://%s", yamlProxyConfig.Host)) + if err != nil { + return ErrRelayMinerConfigInvalidProxy.Wrapf( + "invalid proxy host %s", + err.Error(), + ) + } + + if proxyUrl.Host == "" { + return ErrRelayMinerConfigInvalidProxy.Wrap("empty proxy host") + } + + proxyConfig.Host = proxyUrl.Host + return nil +} + +// parseHTTPSupplierConfig populates the supplier fields of the target structure +// that are relevant to the "http" type in the supplier section of the config file. +// This function alters the target RelayMinerSupplierServiceConfig structure +// as a side effect. +func (supplierServiceConfig *RelayMinerSupplierServiceConfig) parseHTTPSupplierConfig( + yamlSupplierServiceConfig YAMLRelayMinerSupplierServiceConfig, +) error { + // Check if the supplier url is not empty + if len(yamlSupplierServiceConfig.Url) == 0 { + return ErrRelayMinerConfigInvalidSupplier.Wrap("empty supplier url") + } + + // Check if the supplier url is a valid URL + supplierServiceUrl, err := url.Parse(yamlSupplierServiceConfig.Url) + if err != nil { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "invalid supplier url %s", + err.Error(), + ) + } + + supplierServiceConfig.Url = supplierServiceUrl + + // If the Authentication section is not empty, populate the supplier service + // authentication fields + if yamlSupplierServiceConfig.Authentication != (YAMLRelayMinerSupplierServiceAuthentication{}) { + supplierServiceConfig.Authentication = &RelayMinerSupplierServiceAuthentication{ + Username: yamlSupplierServiceConfig.Authentication.Username, + Password: yamlSupplierServiceConfig.Authentication.Password, + } + } + + // If the Headers section is not empty, populate the supplier service headers fields + if yamlSupplierServiceConfig.Headers != nil { + supplierServiceConfig.Headers = yamlSupplierServiceConfig.Headers + } + + return nil +} diff --git a/pkg/relayer/config/relayminer_configs_reader.go b/pkg/relayer/config/relayminer_configs_reader.go new file mode 100644 index 000000000..b546d451d --- /dev/null +++ b/pkg/relayer/config/relayminer_configs_reader.go @@ -0,0 +1,84 @@ +package config + +import yaml "gopkg.in/yaml.v2" + +// ParseRelayMinerConfigs parses the relay miner config file into a RelayMinerConfig +func ParseRelayMinerConfigs(configContent []byte) (*RelayMinerConfig, error) { + var ( + yamlRelayMinerConfig YAMLRelayMinerConfig + relayMinerConfig = &RelayMinerConfig{} + ) + + // The config file should not be empty + if len(configContent) == 0 { + return nil, ErrRelayMinerConfigEmpty + } + + // Unmarshal the stake config file into a yamlAppGateConfig + if err := yaml.Unmarshal(configContent, &yamlRelayMinerConfig); err != nil { + return nil, ErrRelayMinerConfigUnmarshalYAML.Wrap(err.Error()) + } + + // Top level section + // SigningKeyName is required + if len(yamlRelayMinerConfig.SigningKeyName) == 0 { + return nil, ErrRelayMinerConfigInvalidSigningKeyName + } + relayMinerConfig.SigningKeyName = yamlRelayMinerConfig.SigningKeyName + + // SmtStorePath is required + if len(yamlRelayMinerConfig.SmtStorePath) == 0 { + return nil, ErrRelayMinerConfigInvalidSmtStorePath + } + relayMinerConfig.SmtStorePath = yamlRelayMinerConfig.SmtStorePath + + // No additional validation on metrics. The server would fail to start if they are invalid + // which is the intended behaviour. + relayMinerConfig.Metrics = &RelayMinerMetricsConfig{ + Enabled: yamlRelayMinerConfig.Metrics.Enabled, + Addr: yamlRelayMinerConfig.Metrics.Addr, + } + + // Hydrate the pocket node urls + if err := relayMinerConfig.HydratePocketNodeUrls(&yamlRelayMinerConfig.PocketNode); err != nil { + return nil, err + } + + // Hydrate the proxies + if err := relayMinerConfig.HydrateProxies(yamlRelayMinerConfig.Proxies); err != nil { + return nil, err + } + + // Hydrate the suppliers + if err := relayMinerConfig.HydrateSuppliers(yamlRelayMinerConfig.Suppliers); err != nil { + return nil, err + } + + // Check if proxies are referencing hosts more than once + if err := relayMinerConfig.EnsureUniqueHosts(); err != nil { + return nil, err + } + + return relayMinerConfig, nil +} + +// EnsureUniqueHosts checks if each proxy is referencing a host more than once +func (relayMinerConfig *RelayMinerConfig) EnsureUniqueHosts() error { + for _, proxyConfig := range relayMinerConfig.Proxies { + existingHosts := make(map[string]bool) + for _, supplierConfig := range proxyConfig.Suppliers { + for _, host := range supplierConfig.Hosts { + if _, ok := existingHosts[host]; ok { + return ErrRelayMinerConfigInvalidProxy.Wrapf( + "duplicate host %s in proxy %s", + host, + proxyConfig.ProxyName, + ) + } + existingHosts[host] = true + } + } + } + + return nil +} diff --git a/pkg/relayer/config/relayminer_configs_reader_test.go b/pkg/relayer/config/relayminer_configs_reader_test.go new file mode 100644 index 000000000..6b8bc3c60 --- /dev/null +++ b/pkg/relayer/config/relayminer_configs_reader_test.go @@ -0,0 +1,1265 @@ +package config_test + +import ( + "net/url" + "testing" + + sdkerrors "cosmossdk.io/errors" + "github.com/gogo/status" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/relayer/config" + "github.com/pokt-network/poktroll/testutil/yaml" +) + +func Test_ParseRelayMinerConfigs(t *testing.T) { + tests := []struct { + desc string + + inputConfigYAML string + + expectedError *sdkerrors.Error + expectedConfig *config.RelayMinerConfig + }{ + // Valid Configs + { + desc: "valid: relay miner config", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + authentication: + username: user + password: pwd + headers: {} + hosts: + - tcp://ethereum.devnet1.poktroll.com + - tcp://ethereum + proxy_names: + - http-example + `, + + expectedError: nil, + expectedConfig: &config.RelayMinerConfig{ + PocketNode: &config.RelayMinerPocketNodeConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, + }, + SigningKeyName: "servicer1", + SmtStorePath: "smt_stores", + Proxies: map[string]*config.RelayMinerProxyConfig{ + "http-example": { + ProxyName: "http-example", + Host: "127.0.0.1:8080", + Type: config.ProxyTypeHTTP, + XForwardedHostLookup: false, + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + "ethereum": { + ServiceId: "ethereum", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, + Authentication: &config.RelayMinerSupplierServiceAuthentication{ + Username: "user", + Password: "pwd", + }, + Headers: map[string]string{}, + }, + Hosts: []string{ + "ethereum.devnet1.poktroll.com", + "ethereum", + }, + }, + }, + }, + }, + }, + }, + { + desc: "valid: multiple suppliers, single proxy", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + authentication: + username: user + password: pwd + headers: {} + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + - service_id: 7b-llm-model + type: http + service_config: + url: http://llama-endpoint + hosts: + - tcp://7b-llm-model.devnet1.poktroll.com + - tcp://7b-llm-model + proxy_names: + - http-example + `, + + expectedError: nil, + expectedConfig: &config.RelayMinerConfig{ + PocketNode: &config.RelayMinerPocketNodeConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, + }, + SigningKeyName: "servicer1", + SmtStorePath: "smt_stores", + Proxies: map[string]*config.RelayMinerProxyConfig{ + "http-example": { + ProxyName: "http-example", + Host: "127.0.0.1:8080", + Type: config.ProxyTypeHTTP, + XForwardedHostLookup: false, + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + "ethereum": { + ServiceId: "ethereum", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, + Authentication: &config.RelayMinerSupplierServiceAuthentication{ + Username: "user", + Password: "pwd", + }, + Headers: map[string]string{}, + }, + Hosts: []string{ + "ethereum.devnet1.poktroll.com", + "ethereum", + }, + }, + "7b-llm-model": { + ServiceId: "7b-llm-model", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "llama-endpoint"}, + }, + Hosts: []string{ + "7b-llm-model.devnet1.poktroll.com", + "7b-llm-model", + }, + }, + }, + }, + }, + }, + }, + { + desc: "valid: multiple proxies for a single supplier, no auth", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: first-proxy + host: 127.0.0.1:8080 + type: http + - proxy_name: second-proxy + host: 127.0.0.1:8081 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - first-proxy + - second-proxy + `, + + expectedError: nil, + expectedConfig: &config.RelayMinerConfig{ + PocketNode: &config.RelayMinerPocketNodeConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, + }, + SigningKeyName: "servicer1", + SmtStorePath: "smt_stores", + Proxies: map[string]*config.RelayMinerProxyConfig{ + "first-proxy": { + ProxyName: "first-proxy", + Host: "127.0.0.1:8080", + Type: config.ProxyTypeHTTP, + XForwardedHostLookup: false, + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + "ethereum": { + ServiceId: "ethereum", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, + }, + Hosts: []string{ + "ethereum.devnet1.poktroll.com", + }, + }, + }, + }, + "second-proxy": { + ProxyName: "second-proxy", + Host: "127.0.0.1:8081", + Type: config.ProxyTypeHTTP, + XForwardedHostLookup: false, + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + "ethereum": { + ServiceId: "ethereum", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, + }, + Hosts: []string{ + "ethereum.devnet1.poktroll.com", + }, + }, + }, + }, + }, + }, + }, + { + desc: "valid: relay miner config with query node rpc url defaulting to tx node rpc url", + + inputConfigYAML: ` + pocket_node: + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + - tcp://ethereum + proxy_names: + - http-example + `, + + expectedError: nil, + expectedConfig: &config.RelayMinerConfig{ + PocketNode: &config.RelayMinerPocketNodeConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, + }, + SigningKeyName: "servicer1", + SmtStorePath: "smt_stores", + Proxies: map[string]*config.RelayMinerProxyConfig{ + "http-example": { + ProxyName: "http-example", + Host: "127.0.0.1:8080", + Type: config.ProxyTypeHTTP, + XForwardedHostLookup: false, + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + "ethereum": { + ServiceId: "ethereum", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, + }, + Hosts: []string{ + "ethereum.devnet1.poktroll.com", + "ethereum", + }, + }, + }, + }, + }, + }, + }, + { + desc: "valid: relay miner config with x_forwarded_host_lookup set to true", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + x_forwarded_host_lookup: true + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + - tcp://ethereum + proxy_names: + - http-example + `, + + expectedError: nil, + expectedConfig: &config.RelayMinerConfig{ + PocketNode: &config.RelayMinerPocketNodeConfig{ + QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, + QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, + TxNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, + }, + SigningKeyName: "servicer1", + SmtStorePath: "smt_stores", + Proxies: map[string]*config.RelayMinerProxyConfig{ + "http-example": { + ProxyName: "http-example", + Host: "127.0.0.1:8080", + Type: config.ProxyTypeHTTP, + XForwardedHostLookup: true, + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + "ethereum": { + ServiceId: "ethereum", + Type: config.ProxyTypeHTTP, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "anvil.servicer:8545"}, + }, + Hosts: []string{ + "ethereum.devnet1.poktroll.com", + "ethereum", + }, + }, + }, + }, + }, + }, + }, + // Invalid Configs + { + desc: "invalid: invalid tx node grpc url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: &tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + }, + { + desc: "invalid: missing tx node grpc url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + # explicitly omitted tx node grpc url + query_node_grpc_url: tcp://127.0.0.1:36658 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + }, + { + desc: "invalid: invalid query node grpc url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: &tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + }, + { + desc: "invalid: invalid query node rpc url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: &tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + }, + { + desc: "invalid: missing query node grpc url", + + inputConfigYAML: ` + pocket_node: + # explicitly omitted query node rpc url + query_node_rpc_url: tcp://127.0.0.1:36657 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + }, + { + desc: "invalid: missing signing key name", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + # explicitly omitted signing key name + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSigningKeyName, + }, + { + desc: "invalid: missing smt store path", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + # explicitly omitted smt store path + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSmtStorePath, + }, + { + desc: "invalid: missing proxies section", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + # explicitly omitted proxies section + suppliers: + - proxy_name: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: empty proxies section", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: # explicitly empty proxies section + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: omitted proxy name", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + # explicitly omitted proxy name + - host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: empty proxy name", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: # explicitly empty proxy name + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: missing http proxy host", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + # explicitly missing proxy host + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: empty http proxy host", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: # explicitly empty proxy host + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: missing proxy type", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + # explicitly missing proxy type + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: empty proxy type", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: # explicitly empty proxy type + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: unsupported proxy type", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: unsupported + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: missing supplier name", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + # explicitly missing supplier name + - type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: empty supplier name", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: # explicitly empty supplier name + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: unsupported supplier type", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: unsupported + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: missing supplier type", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + # explicitly missing supplier type + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: empty supplier type", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: # explicitly empty supplier type + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: bad supplier service config url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: &http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: empty supplier service config url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: # explicitly empty supplier service config url + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: missing supplier service config url", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + # explicitly missing supplier service config url + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: bad supplier host", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - &tcp://ethereum.devnet1.poktroll.com + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: blank supplier host", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - # explicitly blank supplier host + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: empty supplier proxy references", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://ethereum.devnet1.poktroll.com + proxy_names: + - bad-proxy-name + `, + + expectedError: config.ErrRelayMinerConfigInvalidSupplier, + }, + { + desc: "invalid: empty supplier proxy references", + + inputConfigYAML: ` + pocket_node: + query_node_rpc_url: tcp://127.0.0.1:36657 + query_node_grpc_url: tcp://127.0.0.1:36658 + tx_node_rpc_url: tcp://127.0.0.1:36659 + signing_key_name: servicer1 + smt_store_path: smt_stores + proxies: + - proxy_name: http-example + host: 127.0.0.1:8080 + type: http + suppliers: + - service_id: ethereum + type: http + service_config: + url: http://anvil.servicer:8545 + hosts: + - tcp://devnet1.poktroll.com # hosts for both suppliers are the same + proxy_names: + - http-example + - service_id: avax + type: http + service_config: + url: http://avax.servicer:8545 + hosts: + - tcp://devnet1.poktroll.com # hosts for both suppliers are the same + proxy_names: + - http-example + `, + + expectedError: config.ErrRelayMinerConfigInvalidProxy, + }, + { + desc: "invalid: empty RelayMiner config file", + + inputConfigYAML: ``, + + expectedError: config.ErrRelayMinerConfigEmpty, + }, + // TODO_NB: Test for supplier and proxy types mismatch once we have more + // than one proxy type. + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) + config, err := config.ParseRelayMinerConfigs([]byte(normalizedConfig)) + + if tt.expectedError != nil { + require.ErrorIs(t, err, tt.expectedError) + require.Nil(t, config) + stat, ok := status.FromError(tt.expectedError) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Nil(t, config) + return + } + + require.NoError(t, err) + + require.Equal( + t, + tt.expectedConfig.SigningKeyName, + config.SigningKeyName, + ) + + require.Equal( + t, + tt.expectedConfig.SmtStorePath, + config.SmtStorePath, + ) + + require.Equal( + t, + tt.expectedConfig.PocketNode.QueryNodeGRPCUrl.String(), + config.PocketNode.QueryNodeGRPCUrl.String(), + ) + + require.Equal( + t, + tt.expectedConfig.PocketNode.QueryNodeRPCUrl.String(), + config.PocketNode.QueryNodeRPCUrl.String(), + ) + + require.Equal( + t, + tt.expectedConfig.PocketNode.TxNodeRPCUrl.String(), + config.PocketNode.TxNodeRPCUrl.String(), + ) + + for proxyName, proxy := range tt.expectedConfig.Proxies { + require.Equal( + t, + proxy.ProxyName, + config.Proxies[proxyName].ProxyName, + ) + + require.Equal( + t, + proxy.Host, + config.Proxies[proxyName].Host, + ) + + require.Equal( + t, + proxy.Type, + config.Proxies[proxyName].Type, + ) + + for supplierName, supplier := range proxy.Suppliers { + require.Equal( + t, + supplier.ServiceId, + config.Proxies[proxyName].Suppliers[supplierName].ServiceId, + ) + + require.Equal( + t, + supplier.Type, + config.Proxies[proxyName].Suppliers[supplierName].Type, + ) + + require.Equal( + t, + supplier.ServiceConfig.Url.String(), + config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Url.String(), + ) + + if supplier.ServiceConfig.Authentication != nil { + require.NotNil( + t, + config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication, + ) + + require.Equal( + t, + supplier.ServiceConfig.Authentication.Username, + config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication.Username, + ) + + require.Equal( + t, + supplier.ServiceConfig.Authentication.Password, + config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Authentication.Password, + ) + } + + for headerKey, headerValue := range supplier.ServiceConfig.Headers { + require.Equal( + t, + headerValue, + config.Proxies[proxyName].Suppliers[supplierName].ServiceConfig.Headers[headerKey], + ) + } + + for i, host := range supplier.Hosts { + require.Contains( + t, + host, + config.Proxies[proxyName].Suppliers[supplierName].Hosts[i], + ) + } + } + } + }) + } +} diff --git a/pkg/relayer/config/supplier_hydrator.go b/pkg/relayer/config/supplier_hydrator.go new file mode 100644 index 000000000..0b54a36f0 --- /dev/null +++ b/pkg/relayer/config/supplier_hydrator.go @@ -0,0 +1,82 @@ +package config + +import "net/url" + +// HydrateSupplier populates a single supplier's fields of the RelayMinerConfig +// that are relevant to each supplier in the "suppliers" section of the config file. +func (supplierConfig *RelayMinerSupplierConfig) HydrateSupplier( + yamlSupplierConfig YAMLRelayMinerSupplierConfig, +) error { + // Supplier name is required + if len(yamlSupplierConfig.ServiceId) == 0 { + return ErrRelayMinerConfigInvalidSupplier.Wrap("supplier name is required") + } + supplierConfig.ServiceId = yamlSupplierConfig.ServiceId + + // Supplier hosts + supplierConfig.Hosts = []string{} + existingHosts := make(map[string]bool) + for _, host := range yamlSupplierConfig.Hosts { + // Check if the supplier host is empty + if len(host) == 0 { + return ErrRelayMinerConfigInvalidSupplier.Wrap("empty supplier host") + } + + // Check if the supplier host is a valid URL + supplierHost, err := url.Parse(host) + if err != nil { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "invalid supplier host %s", + host, + ) + } + + // Check if the supplier host is unique + if _, ok := existingHosts[supplierHost.Host]; ok { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "duplicate supplier host %s", + host, + ) + } + existingHosts[supplierHost.Host] = true + + // Add the supplier host to the suppliers list + supplierConfig.Hosts = append(supplierConfig.Hosts, supplierHost.Host) + } + + // Add a default host which corresponds to the supplier name if it is not + // already in the list + if _, ok := existingHosts[supplierConfig.ServiceId]; !ok { + supplierConfig.Hosts = append(supplierConfig.Hosts, supplierConfig.ServiceId) + } + + // Populate the supplier service fields that are relevant to each supported + // supplier type. + // If other supplier types are added in the future, they should be handled + // by their own functions. + supplierConfig.ServiceConfig = &RelayMinerSupplierServiceConfig{} + switch yamlSupplierConfig.Type { + case "http": + supplierConfig.Type = ProxyTypeHTTP + if err := supplierConfig.ServiceConfig. + parseHTTPSupplierConfig(yamlSupplierConfig.ServiceConfig); err != nil { + return err + } + default: + // Fail if the supplier type is not supported + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "invalid supplier type %s", + yamlSupplierConfig.Type, + ) + } + + // Check if the supplier has proxies + if len(yamlSupplierConfig.ProxyNames) == 0 { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "supplier %s has no proxies", + supplierConfig.ServiceId, + ) + } + + return nil +} diff --git a/pkg/relayer/config/suppliers_config_hydrator.go b/pkg/relayer/config/suppliers_config_hydrator.go new file mode 100644 index 000000000..b8f0f4fa7 --- /dev/null +++ b/pkg/relayer/config/suppliers_config_hydrator.go @@ -0,0 +1,51 @@ +package config + +// HydrateSuppliers populates the suppliers fields of the RelayMinerConfig that +// are relevant to the "suppliers" section in the config file. +func (relayMinerConfig *RelayMinerConfig) HydrateSuppliers( + yamlSupplierConfigs []YAMLRelayMinerSupplierConfig, +) error { + existingSuppliers := make(map[string]bool) + for _, yamlSupplierConfig := range yamlSupplierConfigs { + // Hydrate and validate each supplier in the suppliers list of the config file. + supplierConfig := &RelayMinerSupplierConfig{} + if err := supplierConfig.HydrateSupplier(yamlSupplierConfig); err != nil { + return err + } + + // Supplier name should not be unique + if _, ok := existingSuppliers[yamlSupplierConfig.ServiceId]; ok { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "duplicate supplier name %s", + yamlSupplierConfig.ServiceId, + ) + } + // Mark the supplier as existing + existingSuppliers[yamlSupplierConfig.ServiceId] = true + + // Add the supplier config to the referenced proxies + for _, proxyName := range yamlSupplierConfig.ProxyNames { + // If the proxy name is referencing a non-existent proxy, fail + if _, ok := relayMinerConfig.Proxies[proxyName]; !ok { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "no matching proxy %s for supplier %s", + supplierConfig.ServiceId, + proxyName, + ) + } + + // If the proxy name is referencing a proxy of a different type, fail + if supplierConfig.Type != relayMinerConfig.Proxies[proxyName].Type { + return ErrRelayMinerConfigInvalidSupplier.Wrapf( + "supplier %s and proxy %s have different types", + supplierConfig.ServiceId, + proxyName, + ) + } + + relayMinerConfig.Proxies[proxyName].Suppliers[supplierConfig.ServiceId] = supplierConfig + } + } + + return nil +} diff --git a/pkg/relayer/config/types.go b/pkg/relayer/config/types.go new file mode 100644 index 000000000..edd63ff54 --- /dev/null +++ b/pkg/relayer/config/types.go @@ -0,0 +1,163 @@ +package config + +import "net/url" + +type ProxyType int + +const ( + ProxyTypeHTTP ProxyType = iota + // TODO: Support other proxy types: HTTPS, TCP, UNIX socket, UDP, QUIC, WebRTC ... +) + +// YAMLRelayMinerConfig is the structure used to unmarshal the RelayMiner config file +// TODO_DOCUMENT(@red-0ne): Add proper README documentation for yaml config files +// and update inline comments accordingly. +type YAMLRelayMinerConfig struct { + PocketNode YAMLRelayMinerPocketNodeConfig `yaml:"pocket_node"` + SigningKeyName string `yaml:"signing_key_name"` + SmtStorePath string `yaml:"smt_store_path"` + Metrics YAMLRelayMinerMetricsConfig `yaml:"metrics"` + Proxies []YAMLRelayMinerProxyConfig `yaml:"proxies"` + Suppliers []YAMLRelayMinerSupplierConfig `yaml:"suppliers"` +} + +// YAMLRelayMinerPocketNodeConfig is the structure used to unmarshal the pocket +// node URLs section of the RelayMiner config file +type YAMLRelayMinerPocketNodeConfig struct { + QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` + QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` + TxNodeRPCUrl string `yaml:"tx_node_rpc_url"` +} + +// YAMLRelayMinerProxyConfig is the structure used to unmarshal the proxy +// section of the RelayMiner config file +type YAMLRelayMinerProxyConfig struct { + ProxyName string `yaml:"proxy_name"` + Type string `yaml:"type"` + Host string `yaml:"host"` + XForwardedHostLookup bool `yaml:"x_forwarded_host_lookup"` +} + +// YAMLRelayMinerMetricsConfig is the structure used to unmarshal the metrics +// section of the RelayMiner config file +type YAMLRelayMinerMetricsConfig struct { + Enabled bool `yaml:"enabled"` + Addr string `yaml:"addr"` +} + +// YAMLRelayMinerSupplierConfig is the structure used to unmarshal the supplier +// section of the RelayMiner config file +type YAMLRelayMinerSupplierConfig struct { + ServiceId string `yaml:"service_id"` + Type string `yaml:"type"` + Hosts []string `yaml:"hosts"` + ServiceConfig YAMLRelayMinerSupplierServiceConfig `yaml:"service_config"` + ProxyNames []string `yaml:"proxy_names"` +} + +// YAMLRelayMinerSupplierServiceConfig is the structure used to unmarshal the supplier +// service sub-section of the RelayMiner config file +type YAMLRelayMinerSupplierServiceConfig struct { + Url string `yaml:"url"` + Authentication YAMLRelayMinerSupplierServiceAuthentication `yaml:"authentication,omitempty"` + Headers map[string]string `yaml:"headers,omitempty"` +} + +// YAMLRelayMinerSupplierServiceAuthentication is the structure used to unmarshal +// the supplier service basic auth of the RelayMiner config file when the +// supplier is of type "http" +type YAMLRelayMinerSupplierServiceAuthentication struct { + Username string `yaml:"username,omitempty"` + Password string `yaml:"password,omitempty"` +} + +// RelayMinerConfig is the structure describing the RelayMiner config +type RelayMinerConfig struct { + PocketNode *RelayMinerPocketNodeConfig + Proxies map[string]*RelayMinerProxyConfig + Metrics *RelayMinerMetricsConfig + SigningKeyName string + SmtStorePath string +} + +// RelayMinerPocketNodeConfig is the structure resulting from parsing the pocket +// node URLs section of the RelayMiner config file +type RelayMinerPocketNodeConfig struct { + QueryNodeRPCUrl *url.URL + QueryNodeGRPCUrl *url.URL + TxNodeRPCUrl *url.URL +} + +// RelayMinerProxyConfig is the structure resulting from parsing the proxy +// section of the RelayMiner config file. +// Each proxy embeds a map of supplier configs that are associated with it. +// Other proxy types may embed other fields in the future. eg. "https" may +// embed a TLS config. +type RelayMinerProxyConfig struct { + // ProxyName is the name of the proxy server, used to identify it in the config + ProxyName string + // Type is the transport protocol used by the proxy server like (http, https, etc.) + Type ProxyType + // Host is the host on which the proxy server will listen for incoming + // relay requests + Host string + // XForwardedHostLookup is a flag that indicates whether the proxy server + // should lookup the host from the X-Forwarded-Host header before falling + // back to the Host header. + XForwardedHostLookup bool + // Suppliers is a map of serviceIds -> RelayMinerSupplierConfig + Suppliers map[string]*RelayMinerSupplierConfig +} + +// RelayMinerMetricsConfig is the structure resulting from parsing the metrics +// section of the RelayMiner config file +type RelayMinerMetricsConfig struct { + Enabled bool + Addr string +} + +// RelayMinerSupplierConfig is the structure resulting from parsing the supplier +// section of the RelayMiner config file. +type RelayMinerSupplierConfig struct { + // ServiceId is the serviceId corresponding to the current configuration. + ServiceId string + // Type is the transport protocol used by the supplier, it must match the + // type of the proxy it is associated with. + Type ProxyType + // Hosts is a list of hosts advertised on-chain by the supplier, the corresponding + // proxy server will accept relay requests for these hosts. + Hosts []string + // ServiceConfig is the config of the service that relays will be proxied to. + // Other supplier types may embed other fields in the future. eg. "https" may + // embed a TLS config. + ServiceConfig *RelayMinerSupplierServiceConfig +} + +// RelayMinerSupplierServiceConfig is the structure resulting from parsing the supplier +// service sub-section of the RelayMiner config file. +type RelayMinerSupplierServiceConfig struct { + // Url is the URL of the service that relays will be proxied to. + Url *url.URL + // Authentication is the basic auth structure used to authenticate to the + // request being proxied from the current proxy server. + // If the service the relay requests are forwarded to requires basic auth + // then this field must be populated. + // TODO_TECHDEBT(@red-0ne): Pass the authentication to the service instance + // when the relay request is forwarded to it. + Authentication *RelayMinerSupplierServiceAuthentication + // Headers is a map of headers to be used for other authentication means. + // If the service the relay requests are forwarded to requires header based + // authentication then this field must be populated accordingly. + // For example: { "Authorization": "Bearer " } + // TODO_TECHDEBT(@red-0ne): Add these headers to the forwarded request + // before sending it to the service instance. + Headers map[string]string +} + +// RelayMinerSupplierServiceAuthentication is the structure resulting from parsing +// the supplier service basic auth of the RelayMiner config file when the +// supplier is of type "http" +type RelayMinerSupplierServiceAuthentication struct { + Username string + Password string +} diff --git a/pkg/relayer/interface.go b/pkg/relayer/interface.go new file mode 100644 index 000000000..ba426f9e8 --- /dev/null +++ b/pkg/relayer/interface.go @@ -0,0 +1,151 @@ +//go:generate mockgen -destination=../../testutil/mockrelayer/relayer_proxy_mock.go -package=mockrelayer . RelayerProxy +//go:generate mockgen -destination=../../testutil/mockrelayer/miner_mock.go -package=mockrelayer . Miner +//go:generate mockgen -destination=../../testutil/mockrelayer/relayer_sessions_manager_mock.go -package=mockrelayer . RelayerSessionsManager + +package relayer + +import ( + "context" + + "github.com/pokt-network/smt" + + "github.com/pokt-network/poktroll/pkg/observable" + servicetypes "github.com/pokt-network/poktroll/x/service/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// RelaysObservable is an observable which is notified with Relay values. +// +// TODO_HACK: The purpose of this type is to work around gomock's lack of +// support for generic types. For the same reason, this type cannot be an +// alias (i.e. RelaysObservable = observable.Observable[*servicetypes.Relay]). +type RelaysObservable observable.Observable[*servicetypes.Relay] + +// MinedRelaysObservable is an observable which is notified with MinedRelay values. +// +// TODO_HACK: The purpose of this type is to work around gomock's lack of +// support for generic types. For the same reason, this type cannot be an +// alias (i.e. MinedRelaysObservable = observable.Observable[*MinedRelay]). +type MinedRelaysObservable observable.Observable[*MinedRelay] + +// Miner is responsible for observing servedRelayObs, hashing and checking the +// difficulty of each, finally publishing those with sufficient difficulty to +// minedRelayObs as they are applicable for relay volume. +type Miner interface { + MinedRelays( + ctx context.Context, + servedRelayObs RelaysObservable, + ) (minedRelaysObs MinedRelaysObservable) +} + +type MinerOption func(Miner) + +// RelayerProxy is the interface for the proxy that serves relays to the application. +// It is responsible for starting and stopping all supported RelayServers. +// While handling requests and responding in a closed loop, it also notifies +// the miner about the relays that have been served. +type RelayerProxy interface { + // Start starts all advertised relay servers and returns an error if any of them fail to start. + Start(ctx context.Context) error + + // Stop stops all advertised relay servers and returns an error if any of them fail. + Stop(ctx context.Context) error + + // ServedRelays returns an observable that notifies the miner about the relays that have been served. + // A served relay is one whose RelayRequest's signature and session have been verified, + // and its RelayResponse has been signed and successfully sent to the client. + ServedRelays() RelaysObservable + + // VerifyRelayRequest is a shared method used by RelayServers to check the + // relay request signature and session validity. + // TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface + // that should not be responsible for verifying relay requests. + VerifyRelayRequest( + ctx context.Context, + relayRequest *servicetypes.RelayRequest, + service *sharedtypes.Service, + ) error + + // SignRelayResponse is a shared method used by RelayServers to sign + // and append the signature to the RelayResponse. + // TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface + // that should not be responsible for signing relay responses. + SignRelayResponse(relayResponse *servicetypes.RelayResponse) error +} + +type RelayerProxyOption func(RelayerProxy) + +// RelayServer is the interface of the advertised relay servers provided by the RelayerProxy. +type RelayServer interface { + // Start starts the service server and returns an error if it fails. + Start(ctx context.Context) error + + // Stop terminates the service server and returns an error if it fails. + Stop(ctx context.Context) error +} + +// RelayerSessionsManager is responsible for managing the relayer's session lifecycles. +// It handles the creation and retrieval of SMSTs (trees) for a given session, as +// well as the respective and subsequent claim creation and proof submission. +// This is largely accomplished by pipelining observables of relays and sessions +// through a series of map operations. +// +// TODO_TECHDEBT: add architecture diagrams covering observable flows throughout +// the relayer package. +type RelayerSessionsManager interface { + // InsertRelays receives an observable of relays that should be included + // in their respective session's SMST (tree). + InsertRelays(minedRelaysObs MinedRelaysObservable) + + // Start iterates over the session trees at the end of each, respective, session. + // The session trees are piped through a series of map operations which progress + // them through the claim/proof lifecycle, broadcasting transactions to the + // network as necessary. + Start(ctx context.Context) + + // Stop unsubscribes all observables from the InsertRelays observable which + // will close downstream observables as they drain. + // + // TODO_TECHDEBT: Either add a mechanism to wait for draining to complete + // and/or ensure that the state at each pipeline stage is persisted to disk + // and exit as early as possible. + Stop() +} + +type RelayerSessionsManagerOption func(RelayerSessionsManager) + +// SessionTree is an interface that wraps an SMST (Sparse Merkle State Trie) and its corresponding session. +type SessionTree interface { + // GetSessionHeader returns the header of the session corresponding to the SMST. + GetSessionHeader() *sessiontypes.SessionHeader + + // Update is a wrapper for the SMST's Update function. It updates the SMST with + // the given key, value, and weight. + // This function should be called when a Relay has been successfully served. + Update(key, value []byte, weight uint64) error + + // ProveClosest is a wrapper for the SMST's ProveClosest function. It returns the + // proof for the given path. + // This function should be called several blocks after a session has been claimed and needs to be proven. + ProveClosest(path []byte) (proof *smt.SparseMerkleClosestProof, err error) + + // Flush gets the root hash of the SMST needed for submitting the claim; + // then commits the entire tree to disk and stops the KVStore. + // It should be called before submitting the claim on-chain. This function frees up + // the in-memory resources used by the SMST that are no longer needed while waiting + // for the proof submission window to open. + Flush() (SMSTRoot []byte, err error) + + // TODO_DISCUSS: This function should not be part of the interface as it is an optimization + // aiming to free up KVStore resources after the proof is no longer needed. + // Delete deletes the SMST from the KVStore. + // WARNING: This function should be called only after the proof has been successfully + // submitted on-chain and the servicer has confirmed that it has been rewarded. + Delete() error + + // StartClaiming marks the session tree as being picked up for claiming, + // so it won't be picked up by the relayer again. + // It returns an error if it has already been marked as such. + StartClaiming() error +} diff --git a/pkg/relayer/miner/gen/gen_fixtures.go b/pkg/relayer/miner/gen/gen_fixtures.go new file mode 100644 index 000000000..59071d9ab --- /dev/null +++ b/pkg/relayer/miner/gen/gen_fixtures.go @@ -0,0 +1,304 @@ +// NB: ensure this code is never included in any normal builds. +//go:build ignore + +// NB: package MUST be `main` so that it can be run as a binary. +package main + +import ( + "bytes" + "context" + "crypto/rand" + "flag" + "fmt" + "hash" + "log" + "os" + "strings" + "sync" + "time" + + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/miner" + "github.com/pokt-network/poktroll/pkg/relayer/protocol" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +const ( + defaultDifficultyBits = 16 + defaultFixtureLimitPerGroup = 5 + defaultRandLength = 16 + defaultOutPath = "relay_fixtures_test.go" +) + +var ( + // flagDifficultyBitsThreshold is the number of leading zero bits that a + // randomized, serialized relay must have to be included in the + // `marshaledMinableRelaysHex` slice which is generated. It is also used as + // the maximum difficulty allowed for relays to be included in the + // `marshaledUnminableRelaysHex` slice. + flagDifficultyBitsThreshold int + + // flagFixtureLimitPerGroup is the number of randomized, serialized relays that will be + // generated for each of `marshaledMinableRelaysHex` and + // `marshaledUnminableRelaysHex`. + flagFixtureLimitPerGroup int + + // flagOut is the path to the generated file. + flagOut string +) + +// TODO_TECHDEBT: remove once marshaling using canonical codec. +type marshalable interface { + Marshal() ([]byte, error) +} + +func init() { + flag.IntVar(&flagDifficultyBitsThreshold, "difficulty-bits-threshold", defaultDifficultyBits, "the number of leading zero bits that a randomized, serialized relay must have to be included in the `marshaledMinableRelaysHex` slice which is generated. It is also used as the maximum difficulty allowed for relays to be included in the `marshaledUnminableRelaysHex` slice.") + flag.IntVar(&flagFixtureLimitPerGroup, "fixture-limit-per-group", defaultFixtureLimitPerGroup, "the number of randomized, serialized relays that will be generated for each of `marshaledMinableRelaysHex` and `marshaledUnminableRelaysHex`.") + flag.StringVar(&flagOut, "out", defaultOutPath, "the path to the generated file.") +} + +// This is utility for generating relay fixtures for testing. It is not intended +// to be used **in/by** any tests but rather is persisted to aid in re-generation +// of relay fixtures should the test requirements change. It generates two slices +// of minedRelays, `marshaledMinableRelaysHex` and `marshaledUnminableRelaysHex`, +// which contain hex encoded strings of serialized relays. The relays in +// `marshaledMinableRelaysHex` have been pre-mined to difficulty 16 by populating +// the signature with random bytes. The relays in `marshaledUnminableRelaysHex` +// have been pre-mined to **exclude** relays with difficulty 16 (or greater). Like +// `marshaledMinableRelaysHex`, this is done by populating the signature with +// random bytes. +// Output file is truncated and overwritten if it already exists. +// +// To regenerate all fixtures, use `make go_testgen_fixtures`; to regenerate only this +// test's fixtures run `go generate ./pkg/relayer/miner/miner_test.go`. +func main() { + flag.Parse() + + ctx, cancelCtx := context.WithCancel(context.Background()) + defer cancelCtx() + + randRelaysObs, errCh := genRandomizedMinedRelayFixtures( + ctx, + defaultRandLength, + miner.DefaultRelayHasher, + ) + exitOnError(errCh) + + outputBuffer := new(bytes.Buffer) + + // Collect the minable relay fixtures into a single string (one relay per line). + marshaledMinableRelaysHex := getMarshaledRelayFmtLines(ctx, randRelaysObs, difficultyGTE) + + // Collect the unminable relay fixtures into a single string (one relay per line). + marshaledUnminableRelaysHex := getMarshaledRelayFmtLines(ctx, randRelaysObs, difficultyLT) + + // Interpolate the collected relay fixtures into the relay fixtures template. + if err := relayFixturesTemplate.Execute( + outputBuffer, + map[string]any{ + "difficultyBitsThreshold": flagDifficultyBitsThreshold, + "MarshaledMinableRelaysHex": marshaledMinableRelaysHex, + "MarshaledUnminableRelaysHex": marshaledUnminableRelaysHex, + }, + ); err != nil { + log.Fatal(err) + } + + // Write the output buffer to the file at flagOut path. + if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { + log.Fatal(err) + } +} + +// genRandomizedMinedRelayFixtures returns an observable of mined relays which +// are generated by randomizing the signature of a relay. It generates these mined +// relay fixtures continuously until the context is canceled. It also returns an +// error channel which will receive any error it encounters while generating. +func genRandomizedMinedRelayFixtures( + ctx context.Context, + randLength int, + newHasher func() hash.Hash, +) (observable.Observable[*relayer.MinedRelay], <-chan error) { + var ( + errCh = make(chan error, 1) + randBzObs, randBzPublishCh = channel.NewObservable[*relayer.MinedRelay]() + ) + + go func() { + for { + select { + case <-ctx.Done(): + return + default: + } + + randBz := make([]byte, randLength) + if _, err := rand.Read(randBz); err != nil { + errCh <- err + return + } + + // Populate a relay with the minimally sufficient randomized data. + relay := servicetypes.Relay{ + Req: &servicetypes.RelayRequest{ + Meta: &servicetypes.RelayRequestMetadata{ + Signature: randBz, + }, + Payload: nil, + }, + Res: nil, + } + + // TODO_BLOCKER: use canonical codec. + relayBz, err := relay.Marshal() + if err != nil { + errCh <- err + return + } + + // Hash relay bytes + relayHash, err := hashBytes(newHasher, relayBz) + if err != nil { + errCh <- err + return + } + + randBzPublishCh <- &relayer.MinedRelay{ + Relay: relay, + Bytes: relayBz, + Hash: relayHash, + } + } + }() + + return randBzObs, errCh +} + +// hashBytes hashes the given bytes using the given hasher. +func hashBytes(newHasher func() hash.Hash, relayBz []byte) ([]byte, error) { + hasher := newHasher() + if _, err := hasher.Write(relayBz); err != nil { + return nil, err + } + + return hasher.Sum(nil), nil +} + +// exitOnError exits the program if an error is received on the given error +// channel. +func exitOnError(errCh <-chan error) { + go func() { + for err := range errCh { + log.Fatalf("ERROR: %s", err) + } + }() +} + +// difficultyGTE returns true if the given hash has a difficulty greater than or +// equal to flagDifficultyBitsThreshold. +func difficultyGTE(hash []byte) bool { + return protocol.MustCountDifficultyBits(hash) >= flagDifficultyBitsThreshold +} + +// difficultyLT returns true if the given hash has a difficulty less than +// flagDifficultyBitsThreshold. +func difficultyLT(hash []byte) bool { + return protocol.MustCountDifficultyBits(hash) < flagDifficultyBitsThreshold +} + +// getMarshaledRelayFmtLines performs two map operations followed by a collect. +// The first map filters mined relays from the given observable, skipping when +// shouldAccept is false. This map, and as a result, all downstream observables +// are closed when flagFixtureLimitPerGroup number of relays have been accepted. +// The second map then marshals, hex-encodes, and formats the filtered mined relay. +// Finally, the collect operation collects the formatted mined relays into a slice +// to return. +func getMarshaledRelayFmtLines( + ctx context.Context, + randRelaysObs observable.Observable[*relayer.MinedRelay], + shouldAccept func(hash []byte) bool, +) string { + ctx, cancelFilterMapCollect := context.WithCancel(ctx) + filteredRelaysObs := filterLimitRelays( + ctx, + cancelFilterMapCollect, + flagFixtureLimitPerGroup, + randRelaysObs, + shouldAccept, + ) + + marshaledFilteredRelayLinesObs := channel.Map( + ctx, filteredRelaysObs, + newMapRelayMarshalLineFmt[*relayer.MinedRelay](relayFixtureLineFmt), + ) + + // Collect the filtered relays and return them (as a slice). + marshaledFilteredRelayLines := channel.Collect(ctx, marshaledFilteredRelayLinesObs) + return strings.Join(marshaledFilteredRelayLines, "\n") +} + +// filterLimitRelays maps over the given observable of mined relays, skipping when +// the given shouldAppend function returns false. Once flagFixtureLimitPerGroup +// number of relay fixtures have been mapped, it calls the given cancel function. +func filterLimitRelays( + ctx context.Context, + cancel context.CancelFunc, + limit int, + randRelaysObs observable.Observable[*relayer.MinedRelay], + shouldCollect func(hash []byte) bool, +) observable.Observable[*relayer.MinedRelay] { + var ( + counterMu sync.Mutex + minedRelayAcceptCounter = 0 + minedRelayRejectCounter = 0 + ) + + return channel.Map(ctx, randRelaysObs, + func( + _ context.Context, + minedRelay *relayer.MinedRelay, + ) (_ *relayer.MinedRelay, skip bool) { + counterMu.Lock() + defer counterMu.Unlock() + + // At the start of each iteration, check if the relayCounter has reached + // the limit. If so, cancel the ctx to stop the map operation. + if minedRelayAcceptCounter >= limit { + // Wait a tick for the map to complete as the observable drains + // asynchronously. + time.Sleep(time.Millisecond) + cancel() + return nil, true + } + + // Skip if shouldCollect returns false. + if !shouldCollect(minedRelay.Hash) { + minedRelayRejectCounter++ + return nil, true + } + + minedRelayAcceptCounter++ + return minedRelay, false + }, + ) +} + +// newMapRelayMarshalLineFmt returns a MapFn which formats the given marshalable +// as a hex-encoded string with the given line format string. +func newMapRelayMarshalLineFmt[T marshalable](lineFmt string) channel.MapFn[T, string] { + return func( + _ context.Context, + marsh T, + ) (_ string, skip bool) { + // TODO_BLOCKER: marshal using canonical codec. + minedRelayBz, err := marsh.Marshal() + if err != nil { + log.Fatal(err) + } + + return fmt.Sprintf(lineFmt, minedRelayBz), false + } +} diff --git a/pkg/relayer/miner/gen/template.go b/pkg/relayer/miner/gen/template.go new file mode 100644 index 000000000..c75e761a4 --- /dev/null +++ b/pkg/relayer/miner/gen/template.go @@ -0,0 +1,37 @@ +package main + +import "text/template" + +var ( + relayFixtureLineFmt = "\t\t\"%x\"," + relayFixturesTemplate = template.Must( + template.New("relay_fixtures_test.go").Parse( + `// DO NOT EDIT: this file was generated by gen/gen_fixtures.go, +// changes made will be overwritten upon regeneration. +// +// To regenerate all fixtures, use make go_testgen_fixture; to regenerate only this +// test's fixtures run go generate ./pkg/relayer/miner/miner_test.go. +package miner_test + +var ( + // marshaledMinableRelaysHex are the hex encoded strings of serialized + // relayer.MinedRelays which have been pre-mined to difficulty {{.difficultyBitsThreshold}} by + // populating the signature with random bytes. It is intended for use + // in tests. + marshaledMinableRelaysHex = []string{ +{{.MarshaledMinableRelaysHex}} + } + + // marshaledUnminableRelaysHex are the hex encoded strings of serialized + // relayer.MinedRelays which have been pre-mined to **exclude** relays with + // difficulty {{.difficultyBitsThreshold}} (or greater). Like marshaledMinableRelaysHex, this is done + // by populating the signature with random bytes. It is intended for use in + // tests. + marshaledUnminableRelaysHex = []string{ +{{.MarshaledUnminableRelaysHex}} + } +) +`, + ), + ) +) diff --git a/pkg/relayer/miner/miner.go b/pkg/relayer/miner/miner.go new file mode 100644 index 000000000..c3b062a04 --- /dev/null +++ b/pkg/relayer/miner/miner.go @@ -0,0 +1,137 @@ +package miner + +import ( + "context" + "crypto/sha256" + "hash" + + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/observable/filter" + "github.com/pokt-network/poktroll/pkg/observable/logging" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/protocol" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +var ( + _ relayer.Miner = (*miner)(nil) + // TODO_TECHDEBT(@h5law): Retrieve the relay hasher mechanism from the `smt` repo. + DefaultRelayHasher = sha256.New + // TODO_BLOCKER: query on-chain governance params once available. + // Setting this to 0 to effectively disables mining for now. + // I.e., all relays are added to the tree. + defaultRelayDifficultyBits = 0 +) + +// Miner is responsible for observing servedRelayObs, hashing and checking the +// difficulty of each, finally publishing those with sufficient difficulty to +// minedRelayObs as they are applicable for relay volume. +// +// Available options: +// - WithDifficulty +// +// TODO_BLOCKER: The relay hashing and relay difficulty mechanisms & values must come +// from on-chain. +type miner struct { + // relayHasher is a function which returns a hash.Hash interfact type. It is + // used to hash serialized relays to measure their mining difficulty. + relayHasher func() hash.Hash + // relayDifficultyBits is the minimum difficulty that a relay must have to be + // volume / reward applicable. + relayDifficultyBits int +} + +// NewMiner creates a new miner from the given dependencies and options. It +// returns an error if it has not been sufficiently configured or supplied. +func NewMiner( + opts ...relayer.MinerOption, +) (*miner, error) { + mnr := &miner{} + + for _, opt := range opts { + opt(mnr) + } + + mnr.setDefaults() + + return mnr, nil +} + +// MinedRelays maps servedRelaysObs through a pipeline which: +// 1. Hashes the relay +// 2. Checks if it's above the mining difficulty +// 3. Adds it to the session tree if so +// It DOES NOT BLOCK as map operations run in their own goroutines. +func (mnr *miner) MinedRelays( + ctx context.Context, + servedRelaysObs relayer.RelaysObservable, +) relayer.MinedRelaysObservable { + // NB: must cast back to generic observable type to use with Map. + // relayer.RelaysObervable cannot be an alias due to gomock's lack of + // support for generic types. + relaysObs := observable.Observable[*servicetypes.Relay](servedRelaysObs) + + // Map servedRelaysObs to a new observable of an either type, populated with + // the minedRelay or an error. It is notified after the relay has been mined + // or an error has been encountered, respectively. + eitherMinedRelaysObs := channel.Map(ctx, relaysObs, mnr.mapMineRelay) + logging.LogErrors(ctx, filter.EitherError(ctx, eitherMinedRelaysObs)) + + return filter.EitherSuccess(ctx, eitherMinedRelaysObs) +} + +// setDefaults ensures that the miner has been configured with a hasherConstructor and uses +// the default hasherConstructor if not. +func (mnr *miner) setDefaults() { + if mnr.relayHasher == nil { + mnr.relayHasher = DefaultRelayHasher + } + + if mnr.relayDifficultyBits == 0 { + mnr.relayDifficultyBits = defaultRelayDifficultyBits + } +} + +// mapMineRelay is intended to be used as a MapFn. +// 1. It hashes the relay and compares its difficult to the minimum threshold. +// 2. If the relay difficulty is sufficient -> return an Either[MineRelay Value] +// 3. If an error is encountered -> return an Either[error] +// 4. Otherwise, skip the relay. +func (mnr *miner) mapMineRelay( + _ context.Context, + relay *servicetypes.Relay, +) (_ either.Either[*relayer.MinedRelay], skip bool) { + // TODO_BLOCKER: marshal using canonical codec. + relayBz, err := relay.Marshal() + if err != nil { + return either.Error[*relayer.MinedRelay](err), false + } + + // TODO_BLOCKER: Centralize the logic of hashing a relay. It should live + // alongside signing & verification. + // + // TODO_IMPROVE: We need to hash the key; it would be nice if smst.Update() could do it + // since smst has a reference to the hasherConstructor + relayHash := mnr.hash(relayBz) + + // The relay IS NOT volume / reward applicable + if protocol.MustCountDifficultyBits(relayHash) < mnr.relayDifficultyBits { + return either.Success[*relayer.MinedRelay](nil), true + } + + // The relay IS volume / reward applicable + return either.Success(&relayer.MinedRelay{ + Relay: *relay, + Bytes: relayBz, + Hash: relayHash, + }), false +} + +// hash constructs a new hasher and hashes the given input bytes. +func (mnr *miner) hash(inputBz []byte) []byte { + hasher := mnr.relayHasher() + hasher.Write(inputBz) + return hasher.Sum(nil) +} diff --git a/pkg/relayer/miner/miner_test.go b/pkg/relayer/miner/miner_test.go new file mode 100644 index 000000000..9366f4121 --- /dev/null +++ b/pkg/relayer/miner/miner_test.go @@ -0,0 +1,145 @@ +//go:generate go run gen/gen_fixtures.go gen/template.go +// (see: https://pkg.go.dev/cmd/go/internal/generate) +// (see: https://go.googlesource.com/proposal/+/refs/heads/master/design/go-generate.md) + +package miner_test + +import ( + "context" + "encoding/hex" + "hash" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/miner" + "github.com/pokt-network/poktroll/testutil/testrelayer" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +const testDifficulty = 16 + +// TestMiner_MinedRelays constructs an observable of mined relays, through which +// it pipes pre-mined relay fixtures. It asserts that the observable only emits +// mined relays with difficulty equal to or greater than testDifficulty. +// +// To regenerate all fixtures, use `make go_testgen_fixtures`; to regenerate only this +// test's fixtures run `go generate ./pkg/relayer/miner/miner_test.go`. +func TestMiner_MinedRelays(t *testing.T) { + var ( + minedRelayCounter = 0 + ctx = context.Background() + actualMinedRelaysMu sync.Mutex + actualMinedRelays []*relayer.MinedRelay + mockRelaysObs, relaysFixturePublishCh = channel.NewObservable[*servicetypes.Relay]() + expectedMinedRelays = unmarshalHexMinedRelays( + t, marshaledMinableRelaysHex, + miner.DefaultRelayHasher, + ) + ) + + mnr, err := miner.NewMiner(miner.WithDifficulty(testDifficulty)) + require.NoError(t, err) + + minedRelays := mnr.MinedRelays(ctx, mockRelaysObs) + minedRelaysObserver := minedRelays.Subscribe(ctx) + + // Subscribe to the mined relays observable and append them to the + // actualMinedRelays slice asynchronously. + go func() { + for minedRelay := range minedRelaysObserver.Ch() { + actualMinedRelaysMu.Lock() + actualMinedRelays = append(actualMinedRelays, minedRelay) + minedRelayCounter++ + actualMinedRelaysMu.Unlock() + } + }() + + // Publish unminable relay fixtures to the mock relays observable. + publishRelayFixtures(t, marshaledUnminableRelaysHex, relaysFixturePublishCh) + time.Sleep(time.Millisecond) + + // Assert that no unminable relay fixtures were published to minedRelays. + actualMinedRelaysMu.Lock() + require.Empty(t, actualMinedRelays) + actualMinedRelaysMu.Unlock() + + // Publish minable relay fixtures to the relay fixtures observable. + publishRelayFixtures(t, marshaledMinableRelaysHex, relaysFixturePublishCh) + time.Sleep(time.Millisecond) + + // Assert that all minable relay fixtures were published to minedRelays. + actualMinedRelaysMu.Lock() + require.EqualValues(t, expectedMinedRelays, actualMinedRelays) + actualMinedRelaysMu.Unlock() +} + +func publishRelayFixtures( + t *testing.T, + marshalledRelaysHex []string, + mockRelaysPublishCh chan<- *servicetypes.Relay, +) { + t.Helper() + + for _, marshalledRelayHex := range marshalledRelaysHex { + relay := unmarshalHexRelay(t, marshalledRelayHex) + + mockRelaysPublishCh <- relay + } +} + +func unmarshalHexRelay( + t *testing.T, + marshalledHexRelay string, +) *servicetypes.Relay { + t.Helper() + + relayBz, err := hex.DecodeString(marshalledHexRelay) + require.NoError(t, err) + + var relay servicetypes.Relay + err = relay.Unmarshal(relayBz) + require.NoError(t, err) + + return &relay +} + +func unmarshalHexMinedRelays( + t *testing.T, + marshalledHexMinedRelays []string, + newHasher func() hash.Hash, +) (relays []*relayer.MinedRelay) { + t.Helper() + + for _, marshalledRelayHex := range marshalledHexMinedRelays { + relays = append(relays, unmarshalHexMinedRelay(t, marshalledRelayHex, newHasher)) + } + return relays +} + +func unmarshalHexMinedRelay( + t *testing.T, + marshalledHexMinedRelay string, + newHasher func() hash.Hash, +) *relayer.MinedRelay { + t.Helper() + + relayBz, err := hex.DecodeString(marshalledHexMinedRelay) + require.NoError(t, err) + + var relay servicetypes.Relay + err = relay.Unmarshal(relayBz) + require.NoError(t, err) + + relayHashBz := testrelayer.HashBytes(t, newHasher, relayBz) + + return &relayer.MinedRelay{ + Relay: relay, + Bytes: relayBz, + Hash: relayHashBz, + } +} diff --git a/pkg/relayer/miner/options.go b/pkg/relayer/miner/options.go new file mode 100644 index 000000000..fae783d85 --- /dev/null +++ b/pkg/relayer/miner/options.go @@ -0,0 +1,11 @@ +package miner + +import "github.com/pokt-network/poktroll/pkg/relayer" + +// WithDifficulty sets the difficulty of the miner, where difficultyBytes is the +// minimum number of leading zero bytes. +func WithDifficulty(difficultyBits int) relayer.MinerOption { + return func(mnr relayer.Miner) { + mnr.(*miner).relayDifficultyBits = difficultyBits + } +} diff --git a/pkg/relayer/miner/relay_fixtures_test.go b/pkg/relayer/miner/relay_fixtures_test.go new file mode 100644 index 000000000..c32dd4509 --- /dev/null +++ b/pkg/relayer/miner/relay_fixtures_test.go @@ -0,0 +1,33 @@ +// DO NOT EDIT: this file was generated by gen/gen_fixtures.go, +// changes made will be overwritten upon regeneration. +// +// To regenerate all fixtures, use make go_testgen_fixture; to regenerate only this +// test's fixtures run go generate ./pkg/relayer/miner/miner_test.go. +package miner_test + +var ( + // marshaledMinableRelaysHex are the hex encoded strings of serialized + // relayer.MinedRelays which have been pre-mined to difficulty 16 by + // populating the signature with random bytes. It is intended for use + // in tests. + marshaledMinableRelaysHex = []string{ + "0a140a121210bffa0b5c3f03c71f93d7611af54ba80b", + "0a140a1212106655cb3dccaada7837b094962d65426d", + "0a140a121210b19bcf19e96cb58bb37bae3a1769fc08", + "0a140a121210146014db743850694ce211403e91c451", + "0a140a12121016da74aea084a4d40aebf61d876809d4", + } + + // marshaledUnminableRelaysHex are the hex encoded strings of serialized + // relayer.MinedRelays which have been pre-mined to **exclude** relays with + // difficulty 16 (or greater). Like marshaledMinableRelaysHex, this is done + // by populating the signature with random bytes. It is intended for use in + // tests. + marshaledUnminableRelaysHex = []string{ + "0a140a12121070b059e32e4149bcded39d8eb0186fce", + "0a140a121210f5bb373e3d6cabe04675083ac4ffc36e", + "0a140a1212104ae2b0539ecd82ec56bf23b276d543c1", + "0a140a121210d4238199f9e52347b46d060c477b464e", + "0a140a1212103118a0689c4eb883e384d12378bc61e2", + } +) diff --git a/pkg/relayer/protocol/block_heights.go b/pkg/relayer/protocol/block_heights.go new file mode 100644 index 000000000..bb0676737 --- /dev/null +++ b/pkg/relayer/protocol/block_heights.go @@ -0,0 +1,68 @@ +package protocol + +import ( + "context" + "encoding/binary" + "fmt" + "math/rand" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// GetEarliestCreateClaimHeight returns the earliest block height at which a claim +// for a session with the given createClaimWindowStartHeight can be created. +// +// TODO_TEST(@bryanchriswhite): Add test coverage and more logs +func GetEarliestCreateClaimHeight(ctx context.Context, createClaimWindowStartBlock client.Block) int64 { + logger := polylog.Ctx(ctx) + + createClaimWindowStartBlockHash := createClaimWindowStartBlock.Hash() + logger.Debug(). + Int64( + "create_claim_window_start_block", + createClaimWindowStartBlock.Height(), + ). + Str( + "create_claim_window_start_block_hash", + // TODO_TECHDEBT: add polylog.Event#Hex() type method. + fmt.Sprintf("%x", createClaimWindowStartBlockHash), + ) + rngSeed, _ := binary.Varint(createClaimWindowStartBlockHash) + randomNumber := rand.NewSource(rngSeed).Int63() + + // TODO_TECHDEBT: query the on-chain governance parameter once available. + // randCreateClaimHeightOffset := randomNumber % (claimproofparams.GovCreateClaimIntervalBlocks - claimproofparams.GovCreateClaimWindowBlocks - 1) + _ = randomNumber + randCreateClaimHeightOffset := int64(0) + + return createClaimWindowStartBlock.Height() + randCreateClaimHeightOffset +} + +// GetEarliestSubmitProofHeight returns the earliest block height at which a proof +// for a session with the given submitProofWindowStartHeight can be submitted. +// +// TODO_TEST(@bryanchriswhite): Add test coverage and more logs +func GetEarliestSubmitProofHeight(ctx context.Context, submitProofWindowStartBlock client.Block) int64 { + logger := polylog.Ctx(ctx) + + earliestSubmitProofBlockHash := submitProofWindowStartBlock.Hash() + logger.Debug(). + Int64( + "submit_proof_window_start_block", + submitProofWindowStartBlock.Height(), + ). + Str( + "submit_proof_window_start_block_hash", + fmt.Sprintf("%x", earliestSubmitProofBlockHash), + ) + rngSeed, _ := binary.Varint(earliestSubmitProofBlockHash) + randomNumber := rand.NewSource(rngSeed).Int63() + + // TODO_TECHDEBT: query the on-chain governance parameter once available. + // randSubmitProofHeightOffset := randomNumber % (claimproofparams.GovSubmitProofIntervalBlocks - claimproofparams.GovSubmitProofWindowBlocks - 1) + _ = randomNumber + randSubmitProofHeightOffset := int64(0) + + return submitProofWindowStartBlock.Height() + randSubmitProofHeightOffset +} diff --git a/pkg/relayer/protocol/difficulty.go b/pkg/relayer/protocol/difficulty.go new file mode 100644 index 000000000..a33c4bac6 --- /dev/null +++ b/pkg/relayer/protocol/difficulty.go @@ -0,0 +1,42 @@ +package protocol + +import ( + "math/bits" +) + +// TODO_BLOCKER: Revisit this part of the algorithm after initial TestNet Launch. +// TODO_TEST: Add extensive tests for the core relay mining business logic. + +// MustCountDifficultyBits returns the number of leading zero bits in the given +// byte slice. It panics if an error is encountered. +func MustCountDifficultyBits(bz []byte) int { + diff, err := CountDifficultyBits(bz) + if err != nil { + panic(err) + } + + return diff +} + +// CountDifficultyBits returns the number of leading zero bits in the given byte +// slice. It returns an error if the byte slice is all zero bits. +func CountDifficultyBits(bz []byte) (int, error) { + bzLen := len(bz) + + var zeroBits int + for byteIdx, byteValue := range bz { + if byteValue != 0 { + zeroBits = bits.LeadingZeros8(byteValue) + if zeroBits == 8 { + // we already checked that byteValue != 0. + return 0, ErrDifficulty.Wrap("impossible code path") + } + + // We have byteIdx bytes that are all 0s and one byte that has + // zeroBits number of leading 0 bits. + return (byteIdx)*8 + zeroBits, nil + } + } + + return 0, ErrDifficulty.Wrapf("difficulty matches bytes length: %d; bytes (hex): % x", bzLen, bz) +} diff --git a/pkg/relayer/protocol/difficulty_test.go b/pkg/relayer/protocol/difficulty_test.go new file mode 100644 index 000000000..ae5548634 --- /dev/null +++ b/pkg/relayer/protocol/difficulty_test.go @@ -0,0 +1,56 @@ +package protocol_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/relayer/protocol" +) + +func TestCountDifficultyBits(t *testing.T) { + tests := []struct { + bz []byte + difficulty int + }{ + { + bz: []byte{0b11111111, 255, 255, 255}, + difficulty: 0, + }, + { + bz: []byte{0b01111111, 255, 255, 255}, + difficulty: 1, + }, + { + bz: []byte{0, 255, 255, 255}, + difficulty: 8, + }, + { + bz: []byte{0, 0b01111111, 255, 255}, + difficulty: 9, + }, + { + bz: []byte{0, 0b00111111, 255, 255}, + difficulty: 10, + }, + { + bz: []byte{0, 0, 255, 255}, + difficulty: 16, + }, + } + + for _, tt := range tests { + t.Run(fmt.Sprintf("difficulty_%d_zero_bits", tt.difficulty), func(t *testing.T) { + actualDifficulty, err := protocol.CountDifficultyBits(tt.bz) + require.NoError(t, err) + require.Equal(t, tt.difficulty, actualDifficulty) + }) + } +} + +func TestCountDifficultyBits_Error(t *testing.T) { + _, err := protocol.CountDifficultyBits([]byte{0, 0, 0, 0}) + require.ErrorIs(t, err, protocol.ErrDifficulty) + require.ErrorContains(t, err, "difficulty matches bytes length") +} diff --git a/pkg/relayer/protocol/errors.go b/pkg/relayer/protocol/errors.go new file mode 100644 index 000000000..f578bf8e0 --- /dev/null +++ b/pkg/relayer/protocol/errors.go @@ -0,0 +1,8 @@ +package protocol + +import errorsmod "cosmossdk.io/errors" + +var ( + ErrDifficulty = errorsmod.New(codespace, 1, "difficulty error") + codespace = "relayer/protocol" +) diff --git a/pkg/relayer/proxy/error_reply.go b/pkg/relayer/proxy/error_reply.go new file mode 100644 index 000000000..54272d787 --- /dev/null +++ b/pkg/relayer/proxy/error_reply.go @@ -0,0 +1,46 @@ +package proxy + +import ( + "context" + "net/http" + + "github.com/pokt-network/poktroll/pkg/partials" + "github.com/pokt-network/poktroll/x/service/types" +) + +// replyWithError builds the appropriate error format according to the payload +// using the passed in error and writes it to the writer. +// NOTE: This method is used to reply with an "internal" error that is related +// to the proxy itself and not to the relayed request. +func (sync *synchronousRPCServer) replyWithError( + ctx context.Context, + payloadBz []byte, + writer http.ResponseWriter, + proxyName string, + serviceId string, + err error, +) { + relaysErrorsTotal.With("service_id", serviceId, "proxy_name", proxyName).Add(1) + + responseBz, err := partials.GetErrorReply(ctx, payloadBz, err) + if err != nil { + sync.logger.Error().Err(err).Str("service_id", serviceId).Str("proxy_name", proxyName).Msg( + "failed getting error reply") + return + } + + relayResponse := &types.RelayResponse{Payload: responseBz} + + relayResponseBz, err := relayResponse.Marshal() + if err != nil { + sync.logger.Error().Err(err).Str("service_id", serviceId).Str("proxy_name", proxyName).Msg( + "failed marshaling relay response") + return + } + + if _, err = writer.Write(relayResponseBz); err != nil { + sync.logger.Error().Err(err).Str("service_id", serviceId).Str("proxy_name", proxyName).Msg( + "failed writing relay response") + return + } +} diff --git a/pkg/relayer/proxy/errors.go b/pkg/relayer/proxy/errors.go new file mode 100644 index 000000000..84604e836 --- /dev/null +++ b/pkg/relayer/proxy/errors.go @@ -0,0 +1,20 @@ +package proxy + +import ( + sdkerrors "cosmossdk.io/errors" +) + +var ( + codespace = "relayer_proxy" + ErrRelayerProxyUnsupportedRPCType = sdkerrors.Register(codespace, 1, "unsupported relayer proxy rpc type") + ErrRelayerProxyInvalidRelayRequestSignature = sdkerrors.Register(codespace, 2, "invalid relay request signature") + ErrRelayerProxyInvalidSession = sdkerrors.Register(codespace, 3, "invalid session in relayer request") + ErrRelayerProxyInvalidSupplier = sdkerrors.Register(codespace, 4, "invalid relayer proxy supplier") + ErrRelayerProxyUndefinedSigningKeyName = sdkerrors.Register(codespace, 5, "undefined relayer proxy signing key name") + ErrRelayerProxyUndefinedProxiedServicesEndpoints = sdkerrors.Register(codespace, 6, "undefined proxied services endpoints for relayer proxy") + ErrRelayerProxyInvalidRelayRequest = sdkerrors.Register(codespace, 7, "invalid relay request") + ErrRelayerProxyInvalidRelayResponse = sdkerrors.Register(codespace, 8, "invalid relay response") + ErrRelayerProxyEmptyRelayRequestSignature = sdkerrors.Register(codespace, 9, "empty relay response signature") + ErrRelayerProxyServiceEndpointNotHandled = sdkerrors.Register(codespace, 10, "service endpoint not handled by relayer proxy") + ErrRelayerProxyUnsupportedTransportType = sdkerrors.Register(codespace, 11, "unsupported proxy transport type") +) diff --git a/pkg/relayer/proxy/options.go b/pkg/relayer/proxy/options.go new file mode 100644 index 000000000..ab9344c95 --- /dev/null +++ b/pkg/relayer/proxy/options.go @@ -0,0 +1,21 @@ +package proxy + +import ( + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/config" +) + +// WithSigningKeyName sets the signing key name used by the relayer proxy to sign relay responses. +// It is used along with the keyring to get the supplier address and sign the relay responses. +func WithSigningKeyName(keyName string) relayer.RelayerProxyOption { + return func(relProxy relayer.RelayerProxy) { + relProxy.(*relayerProxy).signingKeyName = keyName + } +} + +// WithProxiedServicesEndpoints sets the endpoints of the proxied services. +func WithProxiedServicesEndpoints(proxyConfig map[string]*config.RelayMinerProxyConfig) relayer.RelayerProxyOption { + return func(relProxy relayer.RelayerProxy) { + relProxy.(*relayerProxy).proxyConfigs = proxyConfig + } +} diff --git a/pkg/relayer/proxy/proxy.go b/pkg/relayer/proxy/proxy.go new file mode 100644 index 000000000..ec9f5a1c4 --- /dev/null +++ b/pkg/relayer/proxy/proxy.go @@ -0,0 +1,172 @@ +package proxy + +import ( + "context" + + "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "golang.org/x/sync/errgroup" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/crypto" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/config" + "github.com/pokt-network/poktroll/x/service/types" +) + +var _ relayer.RelayerProxy = (*relayerProxy)(nil) + +// relayerProxy is the main relayer proxy that takes relay requests of supported services from the client +// and proxies them to the supported proxied services. +// It is responsible for notifying the miner about the relays that have been served so they can be counted +// when the miner enters the claim/proof phase. +// TODO_TEST: Have tests for the relayer proxy. +type relayerProxy struct { + logger polylog.Logger + + // signingKeyName is the supplier's key name in the Cosmos's keybase. It is used along with the keyring to + // get the supplier address and sign the relay responses. + signingKeyName string + keyring keyring.Keyring + + // blockClient is the client used to get the block at the latest height from the blockchain + // and be notified of new incoming blocks. It is used to update the current session data. + blockClient client.BlockClient + + // supplierQuerier is the querier used to get the supplier's advertised information from the blockchain, + // which contains the supported services, RPC types, and endpoints, etc... + supplierQuerier client.SupplierQueryClient + + // sessionQuerier is the querier used to get the current session from the blockchain, + // which is needed to check if the relay proxy should be serving an incoming relay request. + sessionQuerier client.SessionQueryClient + + // proxyServers is a map of proxyName -> RelayServer provided by the relayer proxy, + // where proxyName is the name of the proxy defined in the config file and + // RelayServer is the server that listens for incoming relay requests. + proxyServers map[string]relayer.RelayServer + + // proxyConfigs is a map of proxyName -> RelayMinerProxyConfig where proxyName + // is the name of the proxy defined in the config file and RelayMinerProxyConfig + // is the configuration of the proxy. + proxyConfigs map[string]*config.RelayMinerProxyConfig + + // servedRelays is an observable that notifies the miner about the relays that have been served. + servedRelays relayer.RelaysObservable + + // servedRelaysPublishCh is a channel that emits the relays that have been served so that the + // servedRelays observable can fan out the notifications to its subscribers. + servedRelaysPublishCh chan<- *types.Relay + + // ringCache is used to obtain and store the ring for the application. + ringCache crypto.RingCache + + // supplierAddress is the address of the supplier that the relayer proxy is running for. + supplierAddress string +} + +// NewRelayerProxy creates a new relayer proxy with the given dependencies or returns +// an error if the dependencies fail to resolve or the options are invalid. +// +// Required dependencies: +// - cosmosclient.Context +// - client.BlockClient +// +// Available options: +// - WithSigningKeyName +// - WithProxiedServicesEndpoints +func NewRelayerProxy( + deps depinject.Config, + opts ...relayer.RelayerProxyOption, +) (relayer.RelayerProxy, error) { + rp := &relayerProxy{} + + if err := depinject.Inject( + deps, + &rp.logger, + &rp.blockClient, + &rp.ringCache, + &rp.supplierQuerier, + &rp.sessionQuerier, + &rp.keyring, + ); err != nil { + return nil, err + } + + servedRelays, servedRelaysProducer := channel.NewObservable[*types.Relay]() + + rp.servedRelays = servedRelays + rp.servedRelaysPublishCh = servedRelaysProducer + + for _, opt := range opts { + opt(rp) + } + + if err := rp.validateConfig(); err != nil { + return nil, err + } + + return rp, nil +} + +// Start concurrently starts all advertised relay services and returns an error +// if any of them errors. +// This method IS BLOCKING until all RelayServers are stopped. +func (rp *relayerProxy) Start(ctx context.Context) error { + // The provided services map is built from the supplier's on-chain advertised information, + // which is a runtime parameter that can be changed by the supplier. + // NOTE: We build the provided services map at Start instead of NewRelayerProxy to avoid having to + // return an error from the constructor. + if err := rp.BuildProvidedServices(ctx); err != nil { + return err + } + + // Start the ring cache. + rp.ringCache.Start(ctx) + + startGroup, ctx := errgroup.WithContext(ctx) + + for _, relayServer := range rp.proxyServers { + server := relayServer // create a new variable scoped to the anonymous function + startGroup.Go(func() error { return server.Start(ctx) }) + } + + return startGroup.Wait() +} + +// Stop concurrently stops all advertised relay servers and returns an error if any of them fails. +// This method is blocking until all RelayServers are stopped. +func (rp *relayerProxy) Stop(ctx context.Context) error { + stopGroup, ctx := errgroup.WithContext(ctx) + + for _, relayServer := range rp.proxyServers { + // Create a new object (i.e. deep copy) variable scoped to the anonymous function below + server := relayServer + stopGroup.Go(func() error { return server.Stop(ctx) }) + } + + return stopGroup.Wait() +} + +// ServedRelays returns an observable that notifies the miner about the relays that have been served. +// A served relay is one whose RelayRequest's signature and session have been verified, +// and its RelayResponse has been signed and successfully sent to the client. +func (rp *relayerProxy) ServedRelays() relayer.RelaysObservable { + return rp.servedRelays +} + +// validateConfig validates the relayer proxy's configuration options and returns an error if it is invalid. +// TODO_TEST: Add tests for validating these configurations. +func (rp *relayerProxy) validateConfig() error { + if rp.signingKeyName == "" { + return ErrRelayerProxyUndefinedSigningKeyName + } + + if rp.proxyConfigs == nil || len(rp.proxyConfigs) == 0 { + return ErrRelayerProxyUndefinedProxiedServicesEndpoints + } + + return nil +} diff --git a/pkg/relayer/proxy/proxy_test.go b/pkg/relayer/proxy/proxy_test.go new file mode 100644 index 000000000..58ca8e3cc --- /dev/null +++ b/pkg/relayer/proxy/proxy_test.go @@ -0,0 +1,765 @@ +package proxy_test + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/relayer/config" + "github.com/pokt-network/poktroll/pkg/relayer/proxy" + "github.com/pokt-network/poktroll/testutil/testproxy" + servicetypes "github.com/pokt-network/poktroll/x/service/types" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +const ( + blockHeight = 1 + defaultService = "service1" + secondaryService = "service2" + thirdService = "service3" + defaultProxyServer = "server1" + secondaryProxyServer = "server2" +) + +var ( + // helpers used for tests that are initialized in init() + supplierKeyName string + + // supplierEndpoints is the map of serviceName -> []SupplierEndpoint + // where serviceName is the name of the service the supplier staked for + // and SupplierEndpoint is the endpoint of the service advertised on-chain + // by the supplier + supplierEndpoints map[string][]*sharedtypes.SupplierEndpoint + + // appPrivateKey is the private key of the application that is used to sign + // relay responses. + // It is also used in these tests to derive the public key and address of the + // application. + appPrivateKey *secp256k1.PrivKey + + // proxiedServices is the parsed configuration of the RelayMinerProxyConfig + proxiedServices map[string]*config.RelayMinerProxyConfig + + // defaultRelayerProxyBehavior is the list of functions that are used to + // define the behavior of the RelayerProxy in the tests. + defaultRelayerProxyBehavior []func(*testproxy.TestBehavior) +) + +func init() { + supplierKeyName = "supplierKeyName" + appPrivateKey = secp256k1.GenPrivKey() + + supplierEndpoints = map[string][]*sharedtypes.SupplierEndpoint{ + defaultService: { + { + Url: "http://supplier:8545/", + // TODO_EXTEND: Consider adding support for non JSON RPC services in the future + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + secondaryService: { + { + Url: "http://supplier:8546/", + RpcType: sharedtypes.RPCType_GRPC, + }, + }, + thirdService: { + { + Url: "http://supplier:8547/", + RpcType: sharedtypes.RPCType_GRPC, + }, + }, + } + + proxiedServices = map[string]*config.RelayMinerProxyConfig{ + defaultProxyServer: { + ProxyName: defaultProxyServer, + Type: config.ProxyTypeHTTP, + Host: "127.0.0.1:8080", + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + defaultService: { + ServiceId: defaultService, + Type: config.ProxyTypeHTTP, + Hosts: []string{"supplier:8545"}, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, + }, + }, + secondaryService: { + ServiceId: secondaryService, + Type: config.ProxyTypeHTTP, + Hosts: []string{"supplier:8546"}, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8546", Path: "/"}, + }, + }, + }, + }, + secondaryProxyServer: { + ProxyName: secondaryProxyServer, + Type: config.ProxyTypeHTTP, + Host: "127.0.0.1:8081", + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + thirdService: { + ServiceId: thirdService, + Type: config.ProxyTypeHTTP, + Hosts: []string{"supplier:8547"}, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8547", Path: "/"}, + }, + }, + }, + }, + } + + defaultRelayerProxyBehavior = []func(*testproxy.TestBehavior){ + testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), + testproxy.WithRelayerProxiedServices(proxiedServices), + testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), + testproxy.WithDefaultApplication(appPrivateKey), + testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), + } +} + +// RelayerProxy should start and stop without errors +func TestRelayerProxy_StartAndStop(t *testing.T) { + ctx := context.TODO() + // Setup the RelayerProxy instrumented behavior + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) + + // Create a RelayerProxy + rp, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(supplierKeyName), + proxy.WithProxiedServicesEndpoints(proxiedServices), + ) + require.NoError(t, err) + + // Start RelayerProxy + go rp.Start(ctx) + // Block so relayerProxy has sufficient time to start + time.Sleep(100 * time.Millisecond) + + // Test that RelayerProxy is handling requests (ignoring the actual response content) + res, err := http.DefaultClient.Get(fmt.Sprintf("http://%s/", proxiedServices[defaultProxyServer].Host)) + require.NoError(t, err) + require.NotNil(t, res) + + // Test that RelayerProxy is handling requests from the other server + res, err = http.DefaultClient.Get(fmt.Sprintf("http://%s/", proxiedServices[secondaryProxyServer].Host)) + require.NoError(t, err) + require.NotNil(t, res) + + // Stop RelayerProxy + err = rp.Stop(ctx) + require.NoError(t, err) +} + +// RelayerProxy should fail to start if the signing key is not found in the keyring +func TestRelayerProxy_InvalidSupplierKeyName(t *testing.T) { + ctx := context.TODO() + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) + + rp, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName("wrongKeyName"), + proxy.WithProxiedServicesEndpoints(proxiedServices), + ) + require.NoError(t, err) + + err = rp.Start(ctx) + require.Error(t, err) +} + +// RelayerProxy should fail to build if the signing key name is not provided +func TestRelayerProxy_MissingSupplierKeyName(t *testing.T) { + ctx := context.TODO() + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) + + _, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(""), + proxy.WithProxiedServicesEndpoints(proxiedServices), + ) + require.Error(t, err) +} + +// RelayerProxy should fail to build if the proxied services endpoints are not provided +func TestRelayerProxy_NoProxiedServices(t *testing.T) { + ctx := context.TODO() + + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, defaultRelayerProxyBehavior...) + + _, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(supplierKeyName), + proxy.WithProxiedServicesEndpoints(make(map[string]*config.RelayMinerProxyConfig)), + ) + require.Error(t, err) +} + +// RelayerProxy should fail to start if it cannot spawn a server for the +// services it advertized on-chain. +func TestRelayerProxy_UnsupportedRpcType(t *testing.T) { + ctx := context.TODO() + + unsupportedSupplierEndpoint := map[string][]*sharedtypes.SupplierEndpoint{ + defaultService: { + { + Url: "http://unsupported:8545/jsonrpc", + // TODO_EXTEND: Consider adding support for non JSON RPC services in the future + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + } + + unsupportedRPCTypeBehavior := []func(*testproxy.TestBehavior){ + testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), + testproxy.WithRelayerProxiedServices(proxiedServices), + + // The supplier is staked on-chain but the service it provides is not supported by the proxy + testproxy.WithDefaultSupplier(supplierKeyName, unsupportedSupplierEndpoint), + testproxy.WithDefaultApplication(appPrivateKey), + testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), + } + + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedRPCTypeBehavior...) + + rp, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(supplierKeyName), + proxy.WithProxiedServicesEndpoints(proxiedServices), + ) + require.NoError(t, err) + + err = rp.Start(ctx) + require.Error(t, err) +} + +func TestRelayerProxy_UnsupportedTransportType(t *testing.T) { + ctx := context.TODO() + + badTransportSupplierEndpoints := map[string][]*sharedtypes.SupplierEndpoint{ + defaultService: { + { + Url: "xttp://supplier:8545/", + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + } + + unsupportedTransportProxy := map[string]*config.RelayMinerProxyConfig{ + defaultProxyServer: { + ProxyName: defaultProxyServer, + // The proxy is configured with an unsupported transport type + Type: config.ProxyType(100), + Host: "127.0.0.1:8080", + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + defaultService: { + ServiceId: defaultService, + // The proxy is configured with an unsupported transport type + Type: config.ProxyType(100), + Hosts: []string{"supplier:8545"}, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, + }, + }, + }, + }, + } + + unsupportedTransportTypeBehavior := []func(*testproxy.TestBehavior){ + testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), + + // The proxy is configured with an unsupported transport type for the proxy + testproxy.WithRelayerProxiedServices(unsupportedTransportProxy), + testproxy.WithDefaultSupplier(supplierKeyName, badTransportSupplierEndpoints), + testproxy.WithDefaultApplication(appPrivateKey), + testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), + } + + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedTransportTypeBehavior...) + + rp, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(supplierKeyName), + proxy.WithProxiedServicesEndpoints(unsupportedTransportProxy), + ) + require.NoError(t, err) + + err = rp.Start(ctx) + require.ErrorIs(t, err, proxy.ErrRelayerProxyUnsupportedTransportType) +} + +func TestRelayerProxy_NonConfiguredSupplierServices(t *testing.T) { + ctx := context.TODO() + + missingServicesProxy := map[string]*config.RelayMinerProxyConfig{ + defaultProxyServer: { + ProxyName: defaultProxyServer, + Type: config.ProxyTypeHTTP, + Host: "127.0.0.1:8080", + Suppliers: map[string]*config.RelayMinerSupplierConfig{ + defaultService: { + ServiceId: defaultService, + Type: config.ProxyTypeHTTP, + Hosts: []string{"supplier:8545"}, + ServiceConfig: &config.RelayMinerSupplierServiceConfig{ + Url: &url.URL{Scheme: "http", Host: "127.0.0.1:8545", Path: "/"}, + }, + }, + }, + }, + } + + unsupportedTransportTypeBehavior := []func(*testproxy.TestBehavior){ + testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), + + // The proxy is configured with an unsupported transport type for the proxy + testproxy.WithRelayerProxiedServices(missingServicesProxy), + testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), + testproxy.WithDefaultApplication(appPrivateKey), + testproxy.WithDefaultSessionSupplier(supplierKeyName, defaultService, appPrivateKey), + } + + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, unsupportedTransportTypeBehavior...) + + rp, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(supplierKeyName), + proxy.WithProxiedServicesEndpoints(missingServicesProxy), + ) + require.NoError(t, err) + + err = rp.Start(ctx) + require.ErrorIs(t, err, proxy.ErrRelayerProxyServiceEndpointNotHandled) +} + +// Test different RelayRequest scenarios +func TestRelayerProxy_Relays(t *testing.T) { + // blockOutsideSessionGracePeriod is the block height that is after the first + // session's grace period and within the second session's grace period, + // meaning a relay should not be handled at this block height. + blockOutsideSessionGracePeriod := blockHeight + + sessionkeeper.NumBlocksPerSession + + sessionkeeper.GetSessionGracePeriodBlockCount() + + // blockWithinSessionGracePeriod is the block height that is after the first + // session but within its session's grace period, meaning a relay should be + // handled at this block height. + blockWithinSessionGracePeriod := blockHeight + sessionkeeper.GetSessionGracePeriodBlockCount() + + tests := []struct { + desc string + // RelayerProxy instrumented behavior + relayerProxyBehavior []func(*testproxy.TestBehavior) + // Input scenario builds a RelayRequest, marshals it and sends it to the RelayerProxy + inputScenario func( + t *testing.T, + test *testproxy.TestBehavior, + ) (errCode int32, errMsg string) + + // The request result should return any error form the http.DefaultClient.Do call. + // We infer the behavior from the response's code and message prefix + expectedErrCode int32 + expectedErrMsg string + }{ + { + desc: "Unparsable relay request", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithUnparsableBody, + + // expectedErrCode is because the proxy won't be able to unmarshal the request + // so it does not know how to format the error response + expectedErrCode: 0, + expectedErrMsg: "cannot unmarshal request payload", + }, + { + desc: "Missing session meta from relay request", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithMissingMeta, + + expectedErrCode: -32000, + expectedErrMsg: "missing meta from relay request", + }, + { + desc: "Missing signature from relay request", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithMissingSignature, + + expectedErrCode: -32000, + expectedErrMsg: "missing signature from relay request", + }, + { + desc: "Invalid signature associated with relay request", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithInvalidSignature, + + expectedErrCode: -32000, + expectedErrMsg: "error deserializing ring signature", + }, + { + desc: "Missing session header application address associated with relay request", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithMissingSessionHeaderApplicationAddress, + + expectedErrCode: -32000, + expectedErrMsg: "missing application address from relay request", + }, + { + desc: "Non staked application address", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithNonStakedApplicationAddress, + + expectedErrCode: -32000, + expectedErrMsg: "error getting ring for application address", + }, + { + desc: "Ring signature mismatch", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithRingSignatureMismatch, + + expectedErrCode: -32000, + expectedErrMsg: "ring signature does not match ring for application address", + }, + { + desc: "Session mismatch", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithDifferentSession, + + expectedErrCode: -32000, + expectedErrMsg: "session mismatch", + }, + { + desc: "Invalid relay supplier", + + relayerProxyBehavior: []func(*testproxy.TestBehavior){ + testproxy.WithRelayerProxyDependenciesForBlockHeight(supplierKeyName, blockHeight), + testproxy.WithRelayerProxiedServices(proxiedServices), + testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), + testproxy.WithDefaultApplication(appPrivateKey), + // Missing session supplier + testproxy.WithDefaultSessionSupplier("", defaultService, appPrivateKey), + }, + inputScenario: sendRequestWithInvalidRelaySupplier, + + expectedErrCode: -32000, + expectedErrMsg: "error while trying to retrieve a session", + }, + { + desc: "Relay request signature does not match the request payload", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithSignatureForDifferentPayload, + + expectedErrCode: -32000, + expectedErrMsg: "invalid ring signature", + }, + { + desc: "Successful relay", + + relayerProxyBehavior: defaultRelayerProxyBehavior, + inputScenario: sendRequestWithSuccessfulReply, + + expectedErrCode: 0, + expectedErrMsg: "", + }, + { + desc: "Successful late relay with session grace period", + + relayerProxyBehavior: []func(*testproxy.TestBehavior){ + // blockHeight is past the first session but within its session grace period + testproxy.WithRelayerProxyDependenciesForBlockHeight( + supplierKeyName, + blockWithinSessionGracePeriod, + ), + testproxy.WithRelayerProxiedServices(proxiedServices), + testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), + testproxy.WithDefaultApplication(appPrivateKey), + // Add 2 sessions, with the first one being within the withing grace period + // and the second one being the current session + testproxy.WithSuccessiveSessions(supplierKeyName, defaultService, appPrivateKey, 2), + }, + inputScenario: sendRequestWithCustomSessionHeight(blockHeight), + + expectedErrCode: 0, + expectedErrMsg: "", // Relay handled successfully + }, + { + desc: "Failed late relay outside session grace period", + + relayerProxyBehavior: []func(*testproxy.TestBehavior){ + // blockHeight is past the first session's grace period + testproxy.WithRelayerProxyDependenciesForBlockHeight( + supplierKeyName, + // Set the current block height value returned by the block provider + blockOutsideSessionGracePeriod, + ), + testproxy.WithRelayerProxiedServices(proxiedServices), + testproxy.WithDefaultSupplier(supplierKeyName, supplierEndpoints), + testproxy.WithDefaultApplication(appPrivateKey), + // Add 3 sessions, with the first one that is no longer within its + // session grace period + testproxy.WithSuccessiveSessions(supplierKeyName, defaultService, appPrivateKey, 3), + }, + // Send a request that has a late session past the grace period + inputScenario: sendRequestWithCustomSessionHeight(blockHeight), + + expectedErrCode: -32000, + expectedErrMsg: "session expired", // Relay rejected by the supplier + }, + } + + ctx := context.TODO() + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + ctx, cancel := context.WithCancel(ctx) + test := testproxy.NewRelayerProxyTestBehavior(ctx, t, tt.relayerProxyBehavior...) + + rp, err := proxy.NewRelayerProxy( + test.Deps, + proxy.WithSigningKeyName(supplierKeyName), + proxy.WithProxiedServicesEndpoints(proxiedServices), + ) + require.NoError(t, err) + + go rp.Start(ctx) + // Block so relayerProxy has sufficient time to start + time.Sleep(100 * time.Millisecond) + + errCode, errMsg := tt.inputScenario(t, test) + require.Equal(t, tt.expectedErrCode, errCode) + require.True(t, strings.HasPrefix(errMsg, tt.expectedErrMsg)) + + cancel() + }) + } +} + +func sendRequestWithUnparsableBody( + t *testing.T, + test *testproxy.TestBehavior, +) (errorCode int32, errorMessage string) { + // Send non JSONRpc payload when the post request specifies json + reader := io.NopCloser(bytes.NewReader([]byte("invalid request"))) + + res, err := http.DefaultClient.Post( + fmt.Sprintf("http://%s", proxiedServices[defaultProxyServer].Host), + "application/json", + reader, + ) + require.NoError(t, err) + require.NotNil(t, res) + + return testproxy.GetRelayResponseError(t, res) +} + +func sendRequestWithMissingMeta( + t *testing.T, + test *testproxy.TestBehavior, +) (errorCode int32, errorMessage string) { + + req := &servicetypes.RelayRequest{ + // RelayRequest is missing Metadata + Payload: testproxy.PrepareJsonRPCRequestPayload(), + } + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithMissingSignature( + t *testing.T, + test *testproxy.TestBehavior, +) (errorCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = nil + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithInvalidSignature( + t *testing.T, + test *testproxy.TestBehavior, +) (errorCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = []byte("invalid signature") + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithMissingSessionHeaderApplicationAddress( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + randomPrivKey := secp256k1.GenPrivKey() + req := testproxy.GenerateRelayRequest( + test, + randomPrivKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + + // The application address is missing from the session header + req.Meta.SessionHeader.ApplicationAddress = "" + + // Assign a valid but random ring signature so that the request is not rejected + // before looking at the application address + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithNonStakedApplicationAddress( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + randomPrivKey := secp256k1.GenPrivKey() + req := testproxy.GenerateRelayRequest( + test, + randomPrivKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + + // Have a valid signature from the non staked key + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithRingSignatureMismatch( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + + // The signature is valid but does not match the ring for the application address + randomPrivKey := secp256k1.GenPrivKey() + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, randomPrivKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithDifferentSession( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + // Use secondaryService instead of service1 so the session IDs don't match + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + secondaryService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithInvalidRelaySupplier( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithSignatureForDifferentPayload( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, appPrivateKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) + + // Alter the request payload so the hash doesn't match the one used by the signature + req.Payload = []byte(`{"method":"someMethod","id":1,"jsonrpc":"2.0","params":["alteredParam"]}`) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +func sendRequestWithSuccessfulReply( + t *testing.T, + test *testproxy.TestBehavior, +) (errCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + defaultService, + blockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) +} + +// sendRequestWithCustomSessionHeight is a helper function that generates a `RelayRequest` +// with a `Session` that contains the given `requestSessionBlockHeight` and sends it to the +// `RelayerProxy`. +func sendRequestWithCustomSessionHeight( + requestSessionBlockHeight int64, +) func(t *testing.T, test *testproxy.TestBehavior) (errCode int32, errorMessage string) { + return func(t *testing.T, test *testproxy.TestBehavior) (errCode int32, errorMessage string) { + req := testproxy.GenerateRelayRequest( + test, + appPrivateKey, + defaultService, + requestSessionBlockHeight, + testproxy.PrepareJsonRPCRequestPayload(), + ) + req.Meta.Signature = testproxy.GetApplicationRingSignature(t, req, appPrivateKey) + + return testproxy.MarshalAndSend(test, proxiedServices, defaultProxyServer, defaultService, req) + } +} diff --git a/pkg/relayer/proxy/relay_builders.go b/pkg/relayer/proxy/relay_builders.go new file mode 100644 index 000000000..c6e9c9a77 --- /dev/null +++ b/pkg/relayer/proxy/relay_builders.go @@ -0,0 +1,53 @@ +package proxy + +import ( + "io" + "net/http" + + "github.com/pokt-network/poktroll/x/service/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +// newRelayRequest builds a RelayRequest from an http.Request. +func (sync *synchronousRPCServer) newRelayRequest(request *http.Request) (*types.RelayRequest, error) { + requestBz, err := io.ReadAll(request.Body) + if err != nil { + return nil, err + } + + sync.logger.Debug().Msg("unmarshaling relay request") + + var relayReq types.RelayRequest + if err := relayReq.Unmarshal(requestBz); err != nil { + sync.logger.Debug().Msg("unmarshaling relay request failed") + return nil, err + } + + return &relayReq, nil +} + +// newRelayResponse builds a RelayResponse from an http.Response and a SessionHeader. +// It also signs the RelayResponse and assigns it to RelayResponse.Meta.SupplierSignature. +// The response's Body is passed directly into the RelayResponse.Payload field. +func (sync *synchronousRPCServer) newRelayResponse( + response *http.Response, + sessionHeader *sessiontypes.SessionHeader, +) (*types.RelayResponse, error) { + relayResponse := &types.RelayResponse{ + Meta: &types.RelayResponseMetadata{SessionHeader: sessionHeader}, + } + + responseBz, err := io.ReadAll(response.Body) + if err != nil { + return nil, err + } + + relayResponse.Payload = responseBz + + // Sign the relay response and add the signature to the relay response metadata + if err = sync.relayerProxy.SignRelayResponse(relayResponse); err != nil { + return nil, err + } + + return relayResponse, nil +} diff --git a/pkg/relayer/proxy/relay_signer.go b/pkg/relayer/proxy/relay_signer.go new file mode 100644 index 000000000..347bf6228 --- /dev/null +++ b/pkg/relayer/proxy/relay_signer.go @@ -0,0 +1,34 @@ +package proxy + +import ( + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/pkg/signer" + "github.com/pokt-network/poktroll/x/service/types" +) + +// SignRelayResponse is a shared method used by the RelayServers to sign the hash of the RelayResponse. +// It uses the keyring and keyName to sign the payload and returns the signature. +// TODO_TECHDEBT(@red-0ne): This method should be moved out of the RelayerProxy interface +// that should not be responsible for signing relay responses. +// See https://github.com/pokt-network/poktroll/issues/160 for a better design. +func (rp *relayerProxy) SignRelayResponse(relayResponse *types.RelayResponse) error { + // create a simple signer for the request + signer := signer.NewSimpleSigner(rp.keyring, rp.signingKeyName) + + // extract and hash the relay response's signable bytes + signableBz, err := relayResponse.GetSignableBytesHash() + if err != nil { + return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error getting signable bytes: %v", err) + } + + // sign the relay response + responseSig, err := signer.Sign(signableBz) + if err != nil { + return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error signing relay response: %v", err) + } + + // set the relay response's signature + relayResponse.Meta.SupplierSignature = responseSig + return nil +} diff --git a/pkg/relayer/proxy/relay_verifier.go b/pkg/relayer/proxy/relay_verifier.go new file mode 100644 index 000000000..60c1458e0 --- /dev/null +++ b/pkg/relayer/proxy/relay_verifier.go @@ -0,0 +1,168 @@ +package proxy + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" + ring "github.com/noot/ring-go" + + sessiontypes "github.com/pokt-network/poktroll/pkg/relayer/session" + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// VerifyRelayRequest is a shared method used by RelayServers to check the relay request signature and session validity. +func (rp *relayerProxy) VerifyRelayRequest( + ctx context.Context, + relayRequest *types.RelayRequest, + service *sharedtypes.Service, +) error { + rp.logger.Debug(). + Fields(map[string]any{ + "session_id": relayRequest.Meta.SessionHeader.SessionId, + "application_address": relayRequest.Meta.SessionHeader.ApplicationAddress, + "service_id": relayRequest.Meta.SessionHeader.Service.Id, + }). + Msg("verifying relay request signature") + + // extract the relay request's ring signature + if relayRequest.Meta == nil { + return ErrRelayerProxyEmptyRelayRequestSignature.Wrapf( + "request payload: %s", relayRequest.Payload, + ) + } + signature := relayRequest.Meta.Signature + if signature == nil { + return sdkerrors.Wrapf( + ErrRelayerProxyInvalidRelayRequest, + "missing signature from relay request: %v", relayRequest, + ) + } + + ringSig := new(ring.RingSig) + if err := ringSig.Deserialize(ring_secp256k1.NewCurve(), signature); err != nil { + return sdkerrors.Wrapf( + ErrRelayerProxyInvalidRelayRequestSignature, + "error deserializing ring signature: %v", err, + ) + } + + if relayRequest.Meta.SessionHeader.ApplicationAddress == "" { + return sdkerrors.Wrap( + ErrRelayerProxyInvalidRelayRequest, + "missing application address from relay request", + ) + } + + // get the ring for the application address of the relay request + appAddress := relayRequest.Meta.SessionHeader.ApplicationAddress + appRing, err := rp.ringCache.GetRingForAddress(ctx, appAddress) + if err != nil { + return sdkerrors.Wrapf( + ErrRelayerProxyInvalidRelayRequest, + "error getting ring for application address %s: %v", appAddress, err, + ) + } + + // verify the ring signature against the ring + if !ringSig.Ring().Equals(appRing) { + return sdkerrors.Wrapf( + ErrRelayerProxyInvalidRelayRequestSignature, + "ring signature does not match ring for application address %s", appAddress, + ) + } + + // get and hash the signable bytes of the relay request + requestSignableBz, err := relayRequest.GetSignableBytesHash() + if err != nil { + return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayRequest, "error getting signable bytes: %v", err) + } + + // verify the relay request's signature + if valid := ringSig.Verify(requestSignableBz); !valid { + return sdkerrors.Wrapf( + ErrRelayerProxyInvalidRelayRequestSignature, + "invalid ring signature", + ) + } + + // Query for the current session to check if relayRequest sessionId matches the current session. + rp.logger.Debug(). + Fields(map[string]any{ + "session_id": relayRequest.Meta.SessionHeader.SessionId, + "application_address": relayRequest.Meta.SessionHeader.ApplicationAddress, + "service_id": relayRequest.Meta.SessionHeader.Service.Id, + }). + Msg("verifying relay request session") + + sessionBlockHeight, err := rp.getTargetSessionBlockHeight(ctx, relayRequest) + if err != nil { + return err + } + + session, err := rp.sessionQuerier.GetSession( + ctx, + appAddress, + service.Id, + sessionBlockHeight, + ) + + if err != nil { + return err + } + + // Since the retrieved sessionId was in terms of: + // - the current block height and sessionGracePeriod (which are not provided by the relayRequest) + // - serviceId (which is not provided by the relayRequest) + // - applicationAddress (which is used to to verify the relayRequest signature) + // we can reduce the session validity check to checking if the retrieved session's sessionId + // matches the relayRequest sessionId. + // TODO_INVESTIGATE: Revisit the assumptions above at some point in the future, but good enough for now. + if session.SessionId != relayRequest.Meta.SessionHeader.SessionId { + return ErrRelayerProxyInvalidSession.Wrapf( + "session mismatch, expecting: %+v, got: %+v", + session.Header, + relayRequest.Meta.SessionHeader, + ) + } + + // Check if the relayRequest is allowed to be served by the relayer proxy. + for _, supplier := range session.Suppliers { + if supplier.Address == rp.supplierAddress { + return nil + } + } + + return ErrRelayerProxyInvalidSupplier +} + +// getTargetSessionBlockHeight returns the block height at which the session +// for the given relayRequest should be processed. If the session is within the +// grace period, the session's end block height is returned. Otherwise, +// the current block height is returned. +// If the session has expired, then return an error. +func (rp *relayerProxy) getTargetSessionBlockHeight( + ctx context.Context, + relayRequest *types.RelayRequest, +) (sessionBlockHeight int64, err error) { + currentBlockHeight := rp.blockClient.LastNBlocks(ctx, 1)[0].Height() + sessionEndblockHeight := relayRequest.Meta.SessionHeader.GetSessionEndBlockHeight() + + // Check if the `RelayRequest`'s session has expired. + if sessionEndblockHeight < currentBlockHeight { + // Do not process the `RelayRequest` if the session has expired and the current + // block height is outside the session's grace period. + if sessiontypes.IsWithinGracePeriod(sessionEndblockHeight, currentBlockHeight) { + return sessionEndblockHeight, nil + } + + return 0, ErrRelayerProxyInvalidSession.Wrapf( + "session expired, expecting: %d, got: %d", + sessionEndblockHeight, + currentBlockHeight, + ) + } + + return currentBlockHeight, nil +} diff --git a/pkg/relayer/proxy/server_builder.go b/pkg/relayer/proxy/server_builder.go new file mode 100644 index 000000000..02c96cbe8 --- /dev/null +++ b/pkg/relayer/proxy/server_builder.go @@ -0,0 +1,109 @@ +package proxy + +import ( + "context" + "net/url" + + "golang.org/x/exp/slices" + + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/config" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// BuildProvidedServices builds the advertised relay servers from the supplier's on-chain advertised services. +// It populates the relayerProxy's `advertisedRelayServers` map of servers for each service, where each server +// is responsible for listening for incoming relay requests and relaying them to the supported proxied service. +func (rp *relayerProxy) BuildProvidedServices(ctx context.Context) error { + // Get the supplier address from the keyring + supplierKey, err := rp.keyring.Key(rp.signingKeyName) + if err != nil { + return err + } + + supplierAddress, err := supplierKey.GetAddress() + if err != nil { + return err + } + + // Get the supplier's advertised information from the blockchain + supplier, err := rp.supplierQuerier.GetSupplier(ctx, supplierAddress.String()) + if err != nil { + return err + } + + // Check that the supplier's advertised services' endpoints are present in + // the proxy config and handled by a proxy host + // Iterate over the supplier's advertised services then iterate over each + // service's endpoint + for _, service := range supplier.Services { + for _, endpoint := range service.Endpoints { + endpointUrl, err := url.Parse(endpoint.Url) + if err != nil { + return err + } + found := false + // Iterate over the proxy configs and check if `endpointUrl` is present + // in any of the proxy config's suppliers' service's hosts + for _, proxyConfig := range rp.proxyConfigs { + supplierService, ok := proxyConfig.Suppliers[service.Service.Id] + if ok && slices.Contains(supplierService.Hosts, endpointUrl.Host) { + found = true + break + } + } + + if !found { + return ErrRelayerProxyServiceEndpointNotHandled.Wrapf( + "service endpoint %s not handled by proxy", + endpoint.Url, + ) + } + } + } + + rp.supplierAddress = supplier.Address + + if rp.proxyServers, err = rp.initializeProxyServers(supplier.Services); err != nil { + return err + } + + return nil +} + +// initializeProxyServers initializes the proxy servers for each proxy config. +func (rp *relayerProxy) initializeProxyServers( + supplierServices []*sharedtypes.SupplierServiceConfig, +) (proxyServerMap map[string]relayer.RelayServer, err error) { + // Build a map of serviceId -> service for the supplier's advertised services + supplierServiceMap := make(map[string]*sharedtypes.Service) + for _, service := range supplierServices { + supplierServiceMap[service.Service.Id] = service.Service + } + + // Build a map of proxyName -> RelayServer for each proxy defined in the config file + proxyServers := make(map[string]relayer.RelayServer) + + for _, proxyConfig := range rp.proxyConfigs { + rp.logger.Info().Str("proxy host", proxyConfig.Host).Msg("starting relay proxy server") + + // TODO(@h5law): Implement a switch that handles all synchronous + // RPC types in one server type and asynchronous RPC types in another + // to create the appropriate RelayServer. + // Initialize the proxy server according to the proxy type defined in the config file + switch proxyConfig.Type { + case config.ProxyTypeHTTP: + proxyServers[proxyConfig.ProxyName] = NewSynchronousServer( + rp.logger, + proxyConfig, + supplierServiceMap, + rp.servedRelaysPublishCh, + rp, + ) + default: + return nil, ErrRelayerProxyUnsupportedTransportType + } + } + + return proxyServers, nil +} diff --git a/pkg/relayer/proxy/synchronous.go b/pkg/relayer/proxy/synchronous.go new file mode 100644 index 000000000..57353f566 --- /dev/null +++ b/pkg/relayer/proxy/synchronous.go @@ -0,0 +1,285 @@ +package proxy + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "time" + + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/config" + "github.com/pokt-network/poktroll/x/service/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +var _ relayer.RelayServer = (*synchronousRPCServer)(nil) + +// synchronousRPCServer is the struct that holds the state of the synchronous +// RPC server. It is used to listen for and respond to relay requests where +// there is a one-to-one correspondence between relay requests and relay responses. +type synchronousRPCServer struct { + logger polylog.Logger + + // supplierServiceMap is a map of serviceId -> SupplierServiceConfig + // representing the supplier's advertised services. + supplierServiceMap map[string]*sharedtypes.Service + + // proxyConfig is the configuration of the proxy server. It contains the + // host address of the server, the service endpoint, and the advertised service. + // endpoints it gets relay requests from. + proxyConfig *config.RelayMinerProxyConfig + + // server is the HTTP server that listens for incoming relay requests. + server *http.Server + + // relayerProxy is the main relayer proxy that the server uses to perform its operations. + relayerProxy relayer.RelayerProxy + + // servedRelaysProducer is a channel that emits the relays that have been served, allowing + // the servedRelays observable to fan-out notifications to its subscribers. + servedRelaysProducer chan<- *types.Relay +} + +// NewSynchronousServer creates a new HTTP server that listens for incoming +// relay requests and forwards them to the supported proxied service endpoint. +// It takes the serviceId, endpointUrl, and the main RelayerProxy as arguments +// and returns a RelayServer that listens to incoming RelayRequests. +func NewSynchronousServer( + logger polylog.Logger, + proxyConfig *config.RelayMinerProxyConfig, + supplierServiceMap map[string]*sharedtypes.Service, + servedRelaysProducer chan<- *types.Relay, + proxy relayer.RelayerProxy, +) relayer.RelayServer { + return &synchronousRPCServer{ + logger: logger, + supplierServiceMap: supplierServiceMap, + server: &http.Server{Addr: proxyConfig.Host}, + relayerProxy: proxy, + servedRelaysProducer: servedRelaysProducer, + proxyConfig: proxyConfig, + } +} + +// Start starts the service server and returns an error if it fails. +// It also waits for the passed in context to end before shutting down. +// This method is blocking and should be called in a goroutine. +func (sync *synchronousRPCServer) Start(ctx context.Context) error { + go func() { + <-ctx.Done() + sync.server.Shutdown(ctx) + }() + + // Set the HTTP handler. + sync.server.Handler = sync + + return sync.server.ListenAndServe() +} + +// Stop terminates the service server and returns an error if it fails. +func (sync *synchronousRPCServer) Stop(ctx context.Context) error { + return sync.server.Shutdown(ctx) +} + +// ServeHTTP listens for incoming relay requests. It implements the respective +// method of the http.Handler interface. It is called by http.ListenAndServe() +// when synchronousRPCServer is used as an http.Handler with an http.Server. +// (see https://pkg.go.dev/net/http#Handler) +func (sync *synchronousRPCServer) ServeHTTP(writer http.ResponseWriter, request *http.Request) { + startTime := time.Now() + ctx := request.Context() + + var originHost string + // When the proxy is behind a reverse proxy, or is getting its requests from + // a CDN or a load balancer, the host header may not contain the on-chain + // advertized address needed to determine the service that the relay request is for. + // These CDNs and reverse proxies usually set the X-Forwarded-Host header + // to the original host. + // RelayMiner operators that have such a setup can set the XForwardedHostLookup + // option to true in the proxy config to enable the proxy to look up the + // original host from the X-Forwarded-Host header. + // Get the original host from X-Forwarded-Host header if specified in the proxy + // config and fall back to the Host header if it is not specified. + if sync.proxyConfig.XForwardedHostLookup { + originHost = request.Header.Get("X-Forwarded-Host") + } + + if originHost == "" { + originHost = request.Host + } + + var supplierService *sharedtypes.Service + var serviceUrl *url.URL + + // Get the Service and serviceUrl corresponding to the originHost. + // TODO_IMPROVE(red-0ne): Checking that the originHost is currently done by + // iterating over the proxy config's suppliers and checking if the originHost + // is present in any of the supplier's service's hosts. We could improve this + // by building a map at the server initialization level with originHost as the + // key so that we can get the service and serviceUrl in O(1) time. + for _, supplierServiceConfig := range sync.proxyConfig.Suppliers { + for _, host := range supplierServiceConfig.Hosts { + if host == originHost { + supplierService = sync.supplierServiceMap[supplierServiceConfig.ServiceId] + serviceUrl = supplierServiceConfig.ServiceConfig.Url + break + } + } + + if serviceUrl != nil { + break + } + } + + if supplierService == nil || serviceUrl == nil { + sync.replyWithError( + ctx, + []byte{}, + writer, + sync.proxyConfig.ProxyName, + "unknown", + ErrRelayerProxyServiceEndpointNotHandled, + ) + return + } + + // Increment the relays counter. + relaysTotal.With("proxy_name", sync.proxyConfig.ProxyName, "service_id", supplierService.Id).Add(1) + defer func() { + duration := time.Since(startTime).Seconds() + + // Capture the relay request duration metric. + relaysDurationSeconds.With( + "proxy_name", sync.proxyConfig.ProxyName, + "service_id", supplierService.Id).Observe(duration) + }() + + sync.logger.Debug().Msg("serving synchronous relay request") + + // Extract the relay request from the request body. + sync.logger.Debug().Msg("extracting relay request from request body") + relayRequest, err := sync.newRelayRequest(request) + if err != nil { + sync.replyWithError(ctx, []byte{}, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) + sync.logger.Warn().Err(err).Msg("failed serving relay request") + return + } + + if relayRequest.Meta == nil { + err = sdkerrors.Wrapf( + ErrRelayerProxyInvalidRelayRequest, + "missing meta from relay request: %v", relayRequest, + ) + sync.replyWithError(ctx, relayRequest.Payload, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) + sync.logger.Warn().Err(err).Msg("relay request metadata is nil which could be a result of failed unmashaling") + return + } + + // Relay the request to the proxied service and build the response that will be sent back to the client. + relay, err := sync.serveHTTP(ctx, serviceUrl, supplierService, request, relayRequest) + if err != nil { + // Reply with an error if the relay could not be served. + sync.replyWithError(ctx, relayRequest.Payload, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) + sync.logger.Warn().Err(err).Msg("failed serving relay request") + return + } + + // Send the relay response to the client. + if err := sync.sendRelayResponse(relay.Res, writer); err != nil { + sync.replyWithError(ctx, relayRequest.Payload, writer, sync.proxyConfig.ProxyName, supplierService.Id, err) + sync.logger.Warn().Err(err).Msg("failed sending relay response") + return + } + + sync.logger.Info().Fields(map[string]any{ + "application_address": relay.Res.Meta.SessionHeader.ApplicationAddress, + "service_id": relay.Res.Meta.SessionHeader.Service.Id, + "session_start_height": relay.Res.Meta.SessionHeader.SessionStartBlockHeight, + "server_addr": sync.server.Addr, + }).Msg("relay request served successfully") + + // Emit the relay to the servedRelays observable. + sync.servedRelaysProducer <- relay +} + +// serveHTTP holds the underlying logic of ServeHTTP. +func (sync *synchronousRPCServer) serveHTTP( + ctx context.Context, + serviceUrl *url.URL, + supplierService *sharedtypes.Service, + request *http.Request, + relayRequest *types.RelayRequest, +) (*types.Relay, error) { + // Verify the relay request signature and session. + // TODO_TECHDEBT(red-0ne): Currently, the relayer proxy is responsible for verifying + // the relay request signature. This responsibility should be shifted to the relayer itself. + // Consider using a middleware pattern to handle non-proxy specific logic, such as + // request signature verification, session verification, and response signature. + // This would help in separating concerns and improving code maintainability. + // See https://github.com/pokt-network/poktroll/issues/160 + if err := sync.relayerProxy.VerifyRelayRequest(ctx, relayRequest, supplierService); err != nil { + return nil, err + } + + // Get the relayRequest payload's `io.ReadCloser` to add it to the http.Request + // that will be sent to the proxied (i.e. staked for) service. + // (see https://pkg.go.dev/net/http#Request) Body field type. + requestBodyReader := io.NopCloser(bytes.NewBuffer(relayRequest.Payload)) + sync.logger.Debug(). + Str("request_payload", string(relayRequest.Payload)). + Msg("serving relay request") + + // Build the request to be sent to the native service by substituting + // the destination URL's host with the native service's listen address. + sync.logger.Debug(). + Str("destination_url", serviceUrl.String()). + Msg("building relay request payload to service") + + relayHTTPRequest := &http.Request{ + Method: request.Method, + Header: request.Header, + URL: serviceUrl, + Host: serviceUrl.Host, + Body: requestBodyReader, + } + + // Send the relay request to the native service. + httpResponse, err := http.DefaultClient.Do(relayHTTPRequest) + if err != nil { + return nil, err + } + + // Build the relay response from the native service response + // Use relayRequest.Meta.SessionHeader on the relayResponse session header since it was verified to be valid + // and has to be the same as the relayResponse session header. + sync.logger.Debug(). + Str("relay_request_session_header", relayRequest.Meta.SessionHeader.String()). + Msg("building relay response protobuf from service response") + + relayResponse, err := sync.newRelayResponse(httpResponse, relayRequest.Meta.SessionHeader) + if err != nil { + return nil, err + } + + return &types.Relay{Req: relayRequest, Res: relayResponse}, nil +} + +// sendRelayResponse marshals the relay response and sends it to the client. +func (sync *synchronousRPCServer) sendRelayResponse( + relayResponse *types.RelayResponse, + writer http.ResponseWriter, +) error { + cdc := types.ModuleCdc + relayResponseBz, err := cdc.Marshal(relayResponse) + if err != nil { + return err + } + + _, err = writer.Write(relayResponseBz) + return err +} diff --git a/pkg/relayer/relayminer.go b/pkg/relayer/relayminer.go new file mode 100644 index 000000000..cf64b9c84 --- /dev/null +++ b/pkg/relayer/relayminer.go @@ -0,0 +1,98 @@ +package relayer + +import ( + "context" + "net" + "net/http" + + "cosmossdk.io/depinject" + "github.com/prometheus/client_golang/prometheus/promhttp" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// relayMiner is the main struct that encapsulates the relayer's responsibilities (i.e. Relay Mining). +// It starts and stops the RelayerProxy and provide the served relays observable to the miner. +type relayMiner struct { + logger polylog.Logger + relayerProxy RelayerProxy + miner Miner + relayerSessionsManager RelayerSessionsManager +} + +// NewRelayMiner creates a new Relayer instance with the given dependencies. +// It injects the dependencies into the Relayer instance and returns it. +// +// Required dependencies: +// - RelayerProxy +// - Miner +// - RelayerSessionsManager +func NewRelayMiner(ctx context.Context, deps depinject.Config) (*relayMiner, error) { + rel := &relayMiner{ + logger: polylog.Ctx(ctx), + } + + if err := depinject.Inject( + deps, + &rel.relayerProxy, + &rel.miner, + &rel.relayerSessionsManager, + ); err != nil { + return nil, err + } + + // Set up relay pipeline + servedRelaysObs := rel.relayerProxy.ServedRelays() + minedRelaysObs := rel.miner.MinedRelays(ctx, servedRelaysObs) + rel.relayerSessionsManager.InsertRelays(minedRelaysObs) + + return rel, nil +} + +// Start provides the miner with the served relays observable and starts the relayer proxy. +// This method is blocking while the relayer proxy is running and returns when Stop is called +// or when the relayer proxy fails to start. +func (rel *relayMiner) Start(ctx context.Context) error { + // relayerSessionsManager.Start does not block. + // Set up the session (proof/claim) lifecycle pipeline. + rel.logger.Info().Msg("starting relayer sessions manager") + rel.relayerSessionsManager.Start(ctx) + + // Start the flow of relays by starting relayer proxy. + // This is a blocking call as it waits for the waitgroup in relayerProxy.Start() + // that starts all the relay servers to be done. + rel.logger.Info().Msg("starting relayer proxy") + if err := rel.relayerProxy.Start(ctx); err != nil { + return err + } + + rel.logger.Info().Msg("relayer proxy stopped; exiting") + return nil +} + +// Stop stops the relayer proxy which in turn stops all advertised relay servers +// and unsubscribes the miner from the served relays observable. +func (rel *relayMiner) Stop(ctx context.Context) error { + rel.relayerSessionsManager.Stop() + return rel.relayerProxy.Stop(ctx) +} + +// Starts a metrics server on the given address. +func (rel *relayMiner) ServeMetrics(addr string) error { + ln, err := net.Listen("tcp", addr) + if err != nil { + rel.logger.Error().Err(err).Msg("failed to listen on address for metrics") + return err + } + + // If no error, start the server in a new goroutine + go func() { + rel.logger.Info().Str("endpoint", addr).Msg("serving metrics") + if err := http.Serve(ln, promhttp.Handler()); err != nil { + rel.logger.Error().Err(err).Msg("metrics server failed") + return + } + }() + + return nil +} diff --git a/pkg/relayer/relayminer_test.go b/pkg/relayer/relayminer_test.go new file mode 100644 index 000000000..f7de39d39 --- /dev/null +++ b/pkg/relayer/relayminer_test.go @@ -0,0 +1,59 @@ +package relayer_test + +import ( + "context" + "testing" + "time" + + "cosmossdk.io/depinject" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/testutil/testrelayer" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +func TestRelayMiner_StartAndStop(t *testing.T) { + srObs, _ := channel.NewObservable[*servicetypes.Relay]() + servedRelaysObs := relayer.RelaysObservable(srObs) + + mrObs, _ := channel.NewObservable[*relayer.MinedRelay]() + minedRelaysObs := relayer.MinedRelaysObservable(mrObs) + + ctx := polyzero.NewLogger().WithContext(context.Background()) + relayerProxyMock := testrelayer.NewMockOneTimeRelayerProxy( + ctx, t, + servedRelaysObs, + ) + + minerMock := testrelayer.NewMockOneTimeMiner( + ctx, t, + servedRelaysObs, + minedRelaysObs, + ) + + relayerSessionsManagerMock := testrelayer.NewMockOneTimeRelayerSessionsManager( + ctx, t, + minedRelaysObs, + ) + + deps := depinject.Supply( + relayerProxyMock, + minerMock, + relayerSessionsManagerMock, + ) + + relayminer, err := relayer.NewRelayMiner(ctx, deps) + require.NoError(t, err) + require.NotNil(t, relayminer) + + err = relayminer.Start(ctx) + require.NoError(t, err) + + time.Sleep(time.Millisecond) + + err = relayminer.Stop(ctx) + require.NoError(t, err) +} diff --git a/pkg/relayer/session/claim.go b/pkg/relayer/session/claim.go new file mode 100644 index 000000000..7344f05b9 --- /dev/null +++ b/pkg/relayer/session/claim.go @@ -0,0 +1,140 @@ +package session + +import ( + "context" + "fmt" + + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/observable/filter" + "github.com/pokt-network/poktroll/pkg/observable/logging" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/protocol" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" +) + +// createClaims maps over the sessionsToClaimObs observable. For each claim, it: +// 1. Calculates the earliest block height at which it is safe to CreateClaim +// 2. Waits for said block and creates the claim on-chain +// 3. Maps errors to a new observable and logs them +// 4. Returns an observable of the successfully claimed sessions +// It DOES NOT BLOCK as map operations run in their own goroutines. +func (rs *relayerSessionsManager) createClaims(ctx context.Context) observable.Observable[relayer.SessionTree] { + // Map sessionsToClaimObs to a new observable of the same type which is notified + // when the session is eligible to be claimed. + sessionsWithOpenClaimWindowObs := channel.Map( + ctx, rs.sessionsToClaimObs, + rs.mapWaitForEarliestCreateClaimHeight, + ) + + failedCreateClaimSessionsObs, failedCreateClaimSessionsPublishCh := channel.NewObservable[relayer.SessionTree]() + + // Map sessionsWithOpenClaimWindowObs to a new observable of an either type, + // populated with the session or an error, which is notified after the session + // claim has been created or an error has been encountered, respectively. + eitherClaimedSessionsObs := channel.Map( + ctx, sessionsWithOpenClaimWindowObs, + rs.newMapClaimSessionFn(failedCreateClaimSessionsPublishCh), + ) + + // TODO_TECHDEBT: pass failed create claim sessions to some retry mechanism. + _ = failedCreateClaimSessionsObs + logging.LogErrors(ctx, filter.EitherError(ctx, eitherClaimedSessionsObs)) + + // Map eitherClaimedSessions to a new observable of relayer.SessionTree which + // is notified when the corresponding claim creation succeeded. + return filter.EitherSuccess(ctx, eitherClaimedSessionsObs) +} + +// mapWaitForEarliestCreateClaimHeight is intended to be used as a MapFn. It +// calculates and waits for the earliest block height, allowed by the protocol, +// at which a claim can be created for the given session, then emits the session +// **at that moment**. +func (rs *relayerSessionsManager) mapWaitForEarliestCreateClaimHeight( + ctx context.Context, + session relayer.SessionTree, +) (_ relayer.SessionTree, skip bool) { + rs.waitForEarliestCreateClaimHeight( + ctx, session.GetSessionHeader().GetSessionEndBlockHeight(), + ) + return session, false +} + +// waitForEarliestCreateClaimHeight calculates and waits for (blocking until) the +// earliest block height, allowed by the protocol, at which a claim can be created +// for a session with the given sessionEndHeight. It is calculated relative to +// sessionEndHeight using on-chain governance parameters and randomized input. +// It IS A BLOCKING function. +func (rs *relayerSessionsManager) waitForEarliestCreateClaimHeight( + ctx context.Context, + sessionEndHeight int64, +) { + logger := polylog.Ctx(ctx) + + // TODO_TECHDEBT: refactor this logic to a shared package. + + // TODO_TECHDEBT: query the on-chain governance SessionGracePeriod parameter once available. + // createClaimWindowStartHeight has to systematically start after the session's + // grace period ends to ensure the Claim creation is done after the session + // has been finalized. + createClaimWindowStartHeight := sessionEndHeight + sessionkeeper.GetSessionGracePeriodBlockCount() + + // TODO_TECHDEBT: query the on-chain governance parameter once available. + // + claimproofparams.GovCreateClaimWindowStartHeightOffset + + // we wait for createClaimWindowStartHeight to be received before proceeding since we need its hash + // to know where this servicer's claim submission window starts. + logger.Info(). + Int64("create_claim_window_start_height", createClaimWindowStartHeight). + Msg("waiting & blocking for global earliest claim submission height") + createClaimWindowStartBlock := rs.waitForBlock(ctx, createClaimWindowStartHeight) + + logger.Info(). + Int64("create_claim_window_start_height", createClaimWindowStartBlock.Height()). + Str("hash", fmt.Sprintf("%x", createClaimWindowStartBlock.Hash())). + Msg("received global earliest claim submission height") + + earliestCreateClaimHeight := protocol.GetEarliestCreateClaimHeight(ctx, createClaimWindowStartBlock) + + logger.Info(). + Int64("earliest_create_claim_height", earliestCreateClaimHeight). + Str("hash", fmt.Sprintf("%x", createClaimWindowStartBlock.Hash())). + Msg("waiting & blocking for earliest claim creation height for this supplier") + + _ = rs.waitForBlock(ctx, earliestCreateClaimHeight) +} + +// newMapClaimSessionFn returns a new MapFn that creates a claim for the given +// session. Any session which encounters an error while creating a claim is sent +// on the failedCreateClaimSessions channel. +func (rs *relayerSessionsManager) newMapClaimSessionFn( + failedCreateClaimSessionsPublishCh chan<- relayer.SessionTree, +) channel.MapFn[relayer.SessionTree, either.SessionTree] { + return func( + ctx context.Context, + session relayer.SessionTree, + ) (_ either.SessionTree, skip bool) { + logger := polylog.Ctx(ctx) + + // this session should no longer be updated + claimRoot, err := session.Flush() + if err != nil { + return either.Error[relayer.SessionTree](err), false + } + + latestBlock := rs.blockClient.LastNBlocks(ctx, 1)[0] + logger.Info(). + Int64("current_block", latestBlock.Height()+1). + Msg("submitting claim") + + sessionHeader := session.GetSessionHeader() + if err := rs.supplierClient.CreateClaim(ctx, *sessionHeader, claimRoot); err != nil { + failedCreateClaimSessionsPublishCh <- session + return either.Error[relayer.SessionTree](err), false + } + + return either.Success(session), false + } +} diff --git a/pkg/relayer/session/errors.go b/pkg/relayer/session/errors.go new file mode 100644 index 000000000..398e18ecb --- /dev/null +++ b/pkg/relayer/session/errors.go @@ -0,0 +1,13 @@ +package session + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "relayer_session" + ErrSessionTreeClosed = sdkerrors.Register(codespace, 1, "session tree already closed") + ErrSessionTreeNotClosed = sdkerrors.Register(codespace, 2, "session tree not closed") + ErrSessionTreeStorePathExists = sdkerrors.Register(codespace, 3, "session tree store path already exists") + ErrSessionTreeProofPathMismatch = sdkerrors.Register(codespace, 4, "session tree proof path mismatch") + ErrSessionTreeUndefinedStoresDirectory = sdkerrors.Register(codespace, 5, "session tree key-value store directory undefined for where they will be saved on disk") + ErrSessionTreeAlreadyMarkedAsClaimed = sdkerrors.Register(codespace, 6, "session tree already marked as claimed") +) diff --git a/pkg/relayer/session/options.go b/pkg/relayer/session/options.go new file mode 100644 index 000000000..1edadc132 --- /dev/null +++ b/pkg/relayer/session/options.go @@ -0,0 +1,13 @@ +package session + +import ( + "github.com/pokt-network/poktroll/pkg/relayer" +) + +// WithStoresDirectory sets the path on disk where KVStore data files used to store +// SMST of work sessions are created. +func WithStoresDirectory(storesDirectory string) relayer.RelayerSessionsManagerOption { + return func(relSessionMgr relayer.RelayerSessionsManager) { + relSessionMgr.(*relayerSessionsManager).storesDirectory = storesDirectory + } +} diff --git a/pkg/relayer/session/proof.go b/pkg/relayer/session/proof.go new file mode 100644 index 000000000..081d10dca --- /dev/null +++ b/pkg/relayer/session/proof.go @@ -0,0 +1,120 @@ +package session + +import ( + "context" + + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/observable/filter" + "github.com/pokt-network/poktroll/pkg/observable/logging" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/protocol" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" +) + +// submitProofs maps over the given claimedSessions observable. +// For each session, it: +// 1. Calculates the earliest block height at which to submit a proof +// 2. Waits for said height and submits the proof on-chain +// 3. Maps errors to a new observable and logs them +// It DOES NOT BLOCKas map operations run in their own goroutines. +func (rs *relayerSessionsManager) submitProofs( + ctx context.Context, + claimedSessionsObs observable.Observable[relayer.SessionTree], +) { + // Map claimedSessionsObs to a new observable of the same type which is notified + // when the session is eligible to be proven. + sessionsWithOpenProofWindowObs := channel.Map( + ctx, claimedSessionsObs, + rs.mapWaitForEarliestSubmitProofHeight, + ) + + failedSubmitProofSessionsObs, failedSubmitProofSessionsPublishCh := channel.NewObservable[relayer.SessionTree]() + + // Map sessionsWithOpenProofWindow to a new observable of an either type, + // populated with the session or an error, which is notified after the session + // proof has been submitted or an error has been encountered, respectively. + eitherProvenSessionsObs := channel.Map( + ctx, sessionsWithOpenProofWindowObs, + rs.newMapProveSessionFn(failedSubmitProofSessionsPublishCh), + ) + + // TODO_TECHDEBT: pass failed submit proof sessions to some retry mechanism. + _ = failedSubmitProofSessionsObs + logging.LogErrors(ctx, filter.EitherError(ctx, eitherProvenSessionsObs)) +} + +// mapWaitForEarliestSubmitProofHeight is intended to be used as a MapFn. It +// calculates and waits for the earliest block height, allowed by the protocol, +// at which a proof can be submitted for the given session, then emits the session +// **at that moment**. +func (rs *relayerSessionsManager) mapWaitForEarliestSubmitProofHeight( + ctx context.Context, + session relayer.SessionTree, +) (_ relayer.SessionTree, skip bool) { + rs.waitForEarliestSubmitProofHeight( + ctx, session.GetSessionHeader().GetSessionEndBlockHeight(), + ) + return session, false +} + +// waitForEarliestSubmitProofHeight calculates and waits for (blocking until) the +// earliest block height, allowed by the protocol, at which a proof can be submitted +// for a session which was claimed at createClaimHeight. It is calculated relative +// to createClaimHeight using on-chain governance parameters and randomized input. +// It IS A BLOCKING function. +func (rs *relayerSessionsManager) waitForEarliestSubmitProofHeight( + ctx context.Context, + createClaimHeight int64, +) { + submitProofWindowStartHeight := createClaimHeight + sessionkeeper.GetSessionGracePeriodBlockCount() + // TODO_TECHDEBT: query the on-chain governance parameter once available. + // + claimproofparams.GovSubmitProofWindowStartHeightOffset + + // we wait for submitProofWindowStartHeight to be received before proceeding since we need its hash + rs.logger.Info(). + Int64("submitProofWindowStartHeight", submitProofWindowStartHeight). + Msg("waiting & blocking for global earliest proof submission height") + submitProofWindowStartBlock := rs.waitForBlock(ctx, submitProofWindowStartHeight) + + earliestSubmitProofHeight := protocol.GetEarliestSubmitProofHeight(ctx, submitProofWindowStartBlock) + _ = rs.waitForBlock(ctx, earliestSubmitProofHeight) +} + +// newMapProveSessionFn returns a new MapFn that submits a proof for the given +// session. Any session which encouters errors while submitting a proof is sent +// on the failedSubmitProofSessions channel. +func (rs *relayerSessionsManager) newMapProveSessionFn( + failedSubmitProofSessionsCh chan<- relayer.SessionTree, +) channel.MapFn[relayer.SessionTree, either.SessionTree] { + return func( + ctx context.Context, + session relayer.SessionTree, + ) (_ either.SessionTree, skip bool) { + // TODO_BLOCKER: The block that'll be used as a source of entropy for which + // branch(es) to prove should be deterministic and use on-chain governance params + // rather than latest. + latestBlock := rs.blockClient.LastNBlocks(ctx, 1)[0] + proof, err := session.ProveClosest(latestBlock.Hash()) + if err != nil { + return either.Error[relayer.SessionTree](err), false + } + + rs.logger.Info(). + Int64("currentBlockHeight", latestBlock.Height()+1). + Msg("submitting proof") + + // SubmitProof ensures on-chain proof inclusion so we can safely prune the tree. + if err := rs.supplierClient.SubmitProof( + ctx, + *session.GetSessionHeader(), + proof, + ); err != nil { + failedSubmitProofSessionsCh <- session + return either.Error[relayer.SessionTree](err), false + } + + return either.Success(session), false + } +} diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go new file mode 100644 index 000000000..187086f7f --- /dev/null +++ b/pkg/relayer/session/session.go @@ -0,0 +1,274 @@ +package session + +import ( + "context" + "sync" + + "cosmossdk.io/depinject" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/observable/logging" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/relayer" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +var _ relayer.RelayerSessionsManager = (*relayerSessionsManager)(nil) + +type sessionsTreesMap = map[int64]map[string]relayer.SessionTree + +// relayerSessionsManager is an implementation of the RelayerSessions interface. +// TODO_TEST: Add tests to the relayerSessionsManager. +type relayerSessionsManager struct { + logger polylog.Logger + + relayObs relayer.MinedRelaysObservable + + // sessionsToClaimObs notifies about sessions that are ready to be claimed. + sessionsToClaimObs observable.Observable[relayer.SessionTree] + + // sessionTrees is a map of block heights pointing to a map of SessionTrees + // indexed by their sessionId. + // The block height index is used to know when the sessions contained in the entry should be closed, + // this helps to avoid iterating over all sessionsTrees to check if they are ready to be closed. + sessionsTrees sessionsTreesMap + sessionsTreesMu *sync.Mutex + + // blockClient is used to get the notifications of committed blocks. + blockClient client.BlockClient + + // supplierClient is used to create claims and submit proofs for sessions. + supplierClient client.SupplierClient + + // storesDirectory points to a path on disk where KVStore data files are created. + storesDirectory string +} + +// NewRelayerSessions creates a new relayerSessions. +// +// Required dependencies: +// - client.BlockClient +// - client.SupplierClient +// +// Available options: +// - WithStoresDirectory +func NewRelayerSessions( + ctx context.Context, + deps depinject.Config, + opts ...relayer.RelayerSessionsManagerOption, +) (relayer.RelayerSessionsManager, error) { + rs := &relayerSessionsManager{ + logger: polylog.Ctx(ctx), + sessionsTrees: make(sessionsTreesMap), + sessionsTreesMu: &sync.Mutex{}, + } + + if err := depinject.Inject( + deps, + &rs.blockClient, + &rs.supplierClient, + ); err != nil { + return nil, err + } + + for _, opt := range opts { + opt(rs) + } + + if err := rs.validateConfig(); err != nil { + return nil, err + } + + rs.sessionsToClaimObs = channel.MapExpand[client.Block, relayer.SessionTree]( + ctx, + rs.blockClient.CommittedBlocksSequence(ctx), + rs.mapBlockToSessionsToClaim, + ) + + return rs, nil +} + +// Start maps over the session trees at the end of each, respective, session. +// The session trees are piped through a series of map operations which progress +// them through the claim/proof lifecycle, broadcasting transactions to the +// network as necessary. +// It IS NOT BLOCKING as map operations run in their own goroutines. +func (rs *relayerSessionsManager) Start(ctx context.Context) { + // NB: must cast back to generic observable type to use with Map. + // relayer.MinedRelaysObservable cannot be an alias due to gomock's lack of + // support for generic types. + relayObs := observable.Observable[*relayer.MinedRelay](rs.relayObs) + + // Map eitherMinedRelays to a new observable of an error type which is + // notified if an error was encountered while attempting to add the relay to + // the session tree. + miningErrorsObs := channel.Map(ctx, relayObs, rs.mapAddMinedRelayToSessionTree) + logging.LogErrors(ctx, miningErrorsObs) + + // Start claim/proof pipeline. + claimedSessionsObs := rs.createClaims(ctx) + rs.submitProofs(ctx, claimedSessionsObs) +} + +// Stop unsubscribes all observables from the InsertRelays observable which +// will close downstream observables as they drain. +// +// TODO_TECHDEBT: Either add a mechanism to wait for draining to complete +// and/or ensure that the state at each pipeline stage is persisted to disk +// and exit as early as possible. +func (rs *relayerSessionsManager) Stop() { + rs.relayObs.UnsubscribeAll() +} + +// SessionsToClaim returns an observable that notifies when sessions are ready to be claimed. +func (rs *relayerSessionsManager) InsertRelays(relays relayer.MinedRelaysObservable) { + rs.relayObs = relays +} + +// ensureSessionTree returns the SessionTree for a given session. +// If no tree for the session exists, a new SessionTree is created before returning. +func (rs *relayerSessionsManager) ensureSessionTree(sessionHeader *sessiontypes.SessionHeader) (relayer.SessionTree, error) { + sessionsTrees, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] + + // If there is no map for sessions at the sessionEndHeight, create one. + if !ok { + sessionsTrees = make(map[string]relayer.SessionTree) + rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] = sessionsTrees + } + + // Get the sessionTree for the given session. + sessionTree, ok := sessionsTrees[sessionHeader.SessionId] + + // If the sessionTree does not exist, create it. + var err error + if !ok { + sessionTree, err = NewSessionTree(sessionHeader, rs.storesDirectory, rs.removeFromRelayerSessions) + if err != nil { + return nil, err + } + + sessionsTrees[sessionHeader.SessionId] = sessionTree + } + + return sessionTree, nil +} + +// mapBlockToSessionsToClaim maps a block to a list of sessions which can be +// claimed as of that block. +func (rs *relayerSessionsManager) mapBlockToSessionsToClaim( + _ context.Context, + block client.Block, +) (sessionTrees []relayer.SessionTree, skip bool) { + rs.sessionsTreesMu.Lock() + defer rs.sessionsTreesMu.Unlock() + + // Check if there are sessions that need to enter the claim/proof phase + // as their end block height was the one before the last committed block or + // earlier. + // Iterate over the sessionsTrees map to get the ones that end at a block height + // lower than the current block height. + for endBlockHeight, sessionsTreesEndingAtBlockHeight := range rs.sessionsTrees { + if IsWithinGracePeriod(endBlockHeight, block.Height()) { + // Iterate over the sessionsTrees that have grace period ending at this + // block height and add them to the list of sessionTrees to be published. + for _, sessionTree := range sessionsTreesEndingAtBlockHeight { + // Mark the session as claimed and add it to the list of sessionTrees to be published. + // If the session has already been claimed, it will be skipped. + // Appending the sessionTree to the list of sessionTrees is protected + // against concurrent access by the sessionsTreesMu such that the first + // call that marks the session as claimed will be the only one to add the + // sessionTree to the list. + if err := sessionTree.StartClaiming(); err == nil { + sessionTrees = append(sessionTrees, sessionTree) + } + } + } + } + return sessionTrees, false +} + +// removeFromRelayerSessions removes the SessionTree from the relayerSessions. +func (rs *relayerSessionsManager) removeFromRelayerSessions(sessionHeader *sessiontypes.SessionHeader) { + rs.sessionsTreesMu.Lock() + defer rs.sessionsTreesMu.Unlock() + + sessionsTreesEndingAtBlockHeight, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] + if !ok { + rs.logger.Debug(). + Int64("session_end_block_height", sessionHeader.SessionEndBlockHeight). + Msg("no session tree found for ending sessions") + return + } + + delete(sessionsTreesEndingAtBlockHeight, sessionHeader.SessionId) + + // Check if the sessionsTrees map is empty and delete it if so. + // This is an optimization done to save memory by avoiding an endlessly growing sessionsTrees map. + if len(sessionsTreesEndingAtBlockHeight) == 0 { + delete(rs.sessionsTrees, sessionHeader.SessionEndBlockHeight) + } +} + +// validateConfig validates the relayerSessionsManager's configuration. +// TODO_TEST: Add unit tests to validate these configurations. +func (rp *relayerSessionsManager) validateConfig() error { + if rp.storesDirectory == "" { + return ErrSessionTreeUndefinedStoresDirectory + } + + return nil +} + +// waitForBlock blocks until the block at the given height (or greater) is +// observed as having been committed. +func (rs *relayerSessionsManager) waitForBlock(ctx context.Context, height int64) client.Block { + subscription := rs.blockClient.CommittedBlocksSequence(ctx).Subscribe(ctx) + defer subscription.Unsubscribe() + + for block := range subscription.Ch() { + if block.Height() >= height { + return block + } + } + + return nil +} + +// mapAddMinedRelayToSessionTree is intended to be used as a MapFn. It adds the relay +// to the session tree. If it encounters an error, it returns the error. Otherwise, +// it skips output (only outputs errors). +func (rs *relayerSessionsManager) mapAddMinedRelayToSessionTree( + _ context.Context, + relay *relayer.MinedRelay, +) (_ error, skip bool) { + rs.sessionsTreesMu.Lock() + defer rs.sessionsTreesMu.Unlock() + // ensure the session tree exists for this relay + // TODO_CONSIDERATION: if we get the session header from the response, there + // is no possibility that we forgot to hydrate it (i.e. blindly trust the client). + sessionHeader := relay.GetReq().GetMeta().GetSessionHeader() + smst, err := rs.ensureSessionTree(sessionHeader) + if err != nil { + // TODO_IMPROVE: log additional info? + rs.logger.Error().Err(err).Msg("failed to ensure session tree") + return err, false + } + + if err := smst.Update(relay.Hash, relay.Bytes, 1); err != nil { + // TODO_IMPROVE: log additional info? + rs.logger.Error().Err(err).Msg("failed to update smt") + return err, false + } + + // Skip because this map function only outputs errors. + return nil, true +} + +// IsWithinGracePeriod checks if the grace period for the session has ended +// and signals whether it is time to create a claim for it. +func IsWithinGracePeriod(sessionEndBlockHeight, currentBlockHeight int64) bool { + return currentBlockHeight <= sessionEndBlockHeight+sessionkeeper.GetSessionGracePeriodBlockCount() +} diff --git a/pkg/relayer/session/session_test.go b/pkg/relayer/session/session_test.go new file mode 100644 index 000000000..64d3dcef1 --- /dev/null +++ b/pkg/relayer/session/session_test.go @@ -0,0 +1,86 @@ +package session_test + +import ( + "context" + "testing" + "time" + + "cosmossdk.io/depinject" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/session" + "github.com/pokt-network/poktroll/testutil/testclient/testblock" + "github.com/pokt-network/poktroll/testutil/testclient/testsupplier" + "github.com/pokt-network/poktroll/testutil/testpolylog" + "github.com/pokt-network/poktroll/testutil/testrelayer" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" +) + +func TestRelayerSessionsManager_Start(t *testing.T) { + const ( + sessionStartHeight = 1 + sessionEndHeight = 2 + ) + var ( + zeroByteSlice = []byte{0} + _, ctx = testpolylog.NewLoggerWithCtx(context.Background(), polyzero.DebugLevel) + ) + + // Set up dependencies. + blocksObs, blockPublishCh := channel.NewReplayObservable[client.Block](ctx, 1) + blockClient := testblock.NewAnyTimesCommittedBlocksSequenceBlockClient(t, blocksObs) + supplierClient := testsupplier.NewOneTimeClaimProofSupplierClient(ctx, t) + + deps := depinject.Supply(blockClient, supplierClient) + storesDirectoryOpt := testrelayer.WithTempStoresDirectory(t) + + // Create a new relayer sessions manager. + relayerSessionsManager, err := session.NewRelayerSessions(ctx, deps, storesDirectoryOpt) + require.NoError(t, err) + require.NotNil(t, relayerSessionsManager) + + // Pass a mined relays observable via InsertRelays. + mrObs, minedRelaysPublishCh := channel.NewObservable[*relayer.MinedRelay]() + minedRelaysObs := relayer.MinedRelaysObservable(mrObs) + relayerSessionsManager.InsertRelays(minedRelaysObs) + + // Start the relayer sessions manager. + relayerSessionsManager.Start(ctx) + + // Publish a mined relay to the minedRelaysPublishCh to insert into the session tree. + minedRelay := testrelayer.NewMinedRelay(t, sessionStartHeight, sessionEndHeight) + minedRelaysPublishCh <- minedRelay + + // Wait a tick to allow the relayer sessions manager to process asynchronously. + // It should have created a session tree for the relay. + time.Sleep(10 * time.Millisecond) + + // Publish a block to the blockPublishCh to simulate non-actionable blocks. + noopBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionStartHeight) + blockPublishCh <- noopBlock + + // Calculate the session grace period end block height to emit that block height + // to the blockPublishCh to trigger claim creation for the session. + sessionGracePeriodEndBlockHeight := int64(sessionEndHeight + sessionkeeper.GetSessionGracePeriodBlockCount()) + + // Publish a block to the blockPublishCh to trigger claim creation for the session. + // TODO_TECHDEBT: assumes claiming at sessionGracePeriodEndBlockHeight is valid. + // This will likely change in future work. + triggerClaimBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionGracePeriodEndBlockHeight) + blockPublishCh <- triggerClaimBlock + + // TODO_IMPROVE: ensure correctness of persisted session trees here. + + // Publish a block to the blockPublishCh to trigger proof submission for the session. + // TODO_TECHDEBT: assumes proving at sessionGracePeriodEndBlockHeight + 1 is valid. + // This will likely change in future work. + triggerProofBlock := testblock.NewAnyTimesBlock(t, zeroByteSlice, sessionGracePeriodEndBlockHeight+1) + blockPublishCh <- triggerProofBlock + + // Wait a tick to allow the relayer sessions manager to process asynchronously. + time.Sleep(250 * time.Millisecond) +} diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go new file mode 100644 index 000000000..b663c472f --- /dev/null +++ b/pkg/relayer/session/sessiontree.go @@ -0,0 +1,225 @@ +package session + +import ( + "bytes" + "crypto/sha256" + "os" + "path/filepath" + "sync" + + "github.com/pokt-network/smt" + "github.com/pokt-network/smt/kvstore/badger" + + "github.com/pokt-network/poktroll/pkg/relayer" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +var _ relayer.SessionTree = (*sessionTree)(nil) + +// sessionTree is an implementation of the SessionTree interface. +// TODO_TEST: Add tests to the sessionTree. +type sessionTree struct { + // sessionMu is a mutex used to protect sessionTree operations from concurrent access. + sessionMu *sync.Mutex + + // sessionHeader is the header of the session corresponding to the SMST (Sparse Merkle State Trie). + sessionHeader *sessiontypes.SessionHeader + + // sessionSMT is the SMST (Sparse Merkle State Trie) corresponding the session. + sessionSMT smt.SparseMerkleSumTrie + + // claimedRoot is the root hash of the SMST needed for submitting the claim. + // If it holds a non-nil value, it means that the SMST has been flushed, + // committed to disk and no more updates can be made to it. A non-nil value also + // indicates that a proof could be generated using ProveClosest function. + claimedRoot []byte + + // proofPath is the path for which the proof was generated. + proofPath []byte + + // proof is the generated proof for the session given a proofPath. + proof *smt.SparseMerkleClosestProof + + // treeStore is the KVStore used to store the SMST. + treeStore badger.BadgerKVStore + + // storePath is the path to the KVStore used to store the SMST. + // It is created from the storePrefix and the session.sessionId. + // We keep track of it so we can use it at the end of the claim/proof lifecycle + // to delete the KVStore when it is no longer needed. + storePath string + + // removeFromRelayerSessions is a function that removes the sessionTree from + // the RelayerSessionsManager. + // Since the sessionTree has no knowledge of the RelayerSessionsManager, + // we pass this callback from the session manager to the sessionTree so + // it can remove itself from the RelayerSessionsManager when it is no longer needed. + removeFromRelayerSessions func(sessionHeader *sessiontypes.SessionHeader) + + isClaiming bool +} + +// NewSessionTree creates a new sessionTree from a Session and a storePrefix. It also takes a function +// removeFromRelayerSessions that removes the sessionTree from the RelayerSessionsManager. +// It returns an error if the KVStore fails to be created. +func NewSessionTree( + sessionHeader *sessiontypes.SessionHeader, + storesDirectory string, + removeFromRelayerSessions func(sessionHeader *sessiontypes.SessionHeader), +) (relayer.SessionTree, error) { + // Join the storePrefix and the session.sessionId to create a unique storePath + storePath := filepath.Join(storesDirectory, sessionHeader.SessionId) + + // Make sure storePath does not exist when creating a new SessionTree + if _, err := os.Stat(storePath); err != nil && !os.IsNotExist(err) { + return nil, ErrSessionTreeStorePathExists.Wrapf("storePath: %q", storePath) + } + + treeStore, err := badger.NewKVStore(storePath) + if err != nil { + return nil, err + } + + // Create the SMST from the KVStore and a nil value hasher so the proof would + // contain a non-hashed Relay that could be used to validate the proof on-chain. + trie := smt.NewSparseMerkleSumTrie(treeStore, sha256.New(), smt.WithValueHasher(nil)) + + sessionTree := &sessionTree{ + sessionHeader: sessionHeader, + storePath: storePath, + treeStore: treeStore, + sessionSMT: trie, + sessionMu: &sync.Mutex{}, + + removeFromRelayerSessions: removeFromRelayerSessions, + } + + return sessionTree, nil +} + +// GetSession returns the session corresponding to the SMST. +func (st *sessionTree) GetSessionHeader() *sessiontypes.SessionHeader { + return st.sessionHeader +} + +// Update is a wrapper for the SMST's Update function. It updates the SMST with +// the given key, value, and weight. +// This function should be called by the Miner when a Relay has been successfully served. +// It returns an error if the SMST has been flushed to disk which indicates +// that updates are no longer allowed. +func (st *sessionTree) Update(key, value []byte, weight uint64) error { + st.sessionMu.Lock() + defer st.sessionMu.Unlock() + + if st.claimedRoot != nil { + return ErrSessionTreeClosed + } + + return st.sessionSMT.Update(key, value, weight) +} + +// ProveClosest is a wrapper for the SMST's ProveClosest function. It returns a proof for the given path. +// This function is intended to be called after a session has been claimed and needs to be proven. +// If the proof has already been generated, it returns the cached proof. +// It returns an error if the SMST has not been flushed yet (the claim has not been generated) +func (st *sessionTree) ProveClosest(path []byte) (proof *smt.SparseMerkleClosestProof, err error) { + st.sessionMu.Lock() + defer st.sessionMu.Unlock() + + // A claim need to be generated before a proof can be generated. + if st.claimedRoot == nil { + return nil, ErrSessionTreeNotClosed + } + + // If the proof has already been generated, return the cached proof. + if st.proof != nil { + // Make sure the path is the same as the one for which the proof was generated. + if !bytes.Equal(path, st.proofPath) { + return nil, ErrSessionTreeProofPathMismatch + } + + return st.proof, nil + } + + // Restore the KVStore from disk since it has been closed after the claim has been generated. + st.treeStore, err = badger.NewKVStore(st.storePath) + if err != nil { + return nil, err + } + + st.sessionSMT = smt.ImportSparseMerkleSumTrie(st.treeStore, sha256.New(), st.claimedRoot, smt.WithValueHasher(nil)) + + // Generate the proof and cache it along with the path for which it was generated. + st.proof, err = st.sessionSMT.ProveClosest(path) + st.proofPath = path + + return st.proof, err +} + +// Flush gets the root hash of the SMST needed for submitting the claim; +// then commits the entire tree to disk and stops the KVStore. +// It should be called before submitting the claim on-chain. This function frees up the KVStore resources. +// If the SMST has already been flushed to disk, it returns the cached root hash. +func (st *sessionTree) Flush() (SMSTRoot []byte, err error) { + st.sessionMu.Lock() + defer st.sessionMu.Unlock() + + // We already have the root hash, return it. + if st.claimedRoot != nil { + return st.claimedRoot, nil + } + + st.claimedRoot = st.sessionSMT.Root() + + // Commit the tree to disk + if err := st.sessionSMT.Commit(); err != nil { + return nil, err + } + + // Stop the KVStore + if err := st.treeStore.Stop(); err != nil { + return nil, err + } + + st.treeStore = nil + st.sessionSMT = nil + + return st.claimedRoot, nil +} + +// Delete deletes the SMST from the KVStore and removes the sessionTree from the RelayerSessionsManager. +// WARNING: This function deletes the KVStore associated to the session and should be +// called only after the proof has been successfully submitted on-chain and the servicer +// has confirmed that it has been rewarded. +func (st *sessionTree) Delete() error { + st.sessionMu.Lock() + defer st.sessionMu.Unlock() + + st.removeFromRelayerSessions(st.sessionHeader) + + if err := st.treeStore.ClearAll(); err != nil { + return err + } + + if err := st.treeStore.Stop(); err != nil { + return err + } + + // Delete the KVStore from disk + return os.RemoveAll(filepath.Dir(st.storePath)) +} + +// StartClaiming marks the session tree as being picked up for claiming, +// so it won't be picked up by the relayer again. +// It returns an error if it has already been marked as such. +func (st *sessionTree) StartClaiming() error { + st.sessionMu.Lock() + defer st.sessionMu.Unlock() + + if st.isClaiming { + return ErrSessionTreeAlreadyMarkedAsClaimed + } + + st.isClaiming = true + return nil +} diff --git a/pkg/relayer/session/sessiontree_test.go b/pkg/relayer/session/sessiontree_test.go new file mode 100644 index 000000000..4e199dcfe --- /dev/null +++ b/pkg/relayer/session/sessiontree_test.go @@ -0,0 +1,3 @@ +package session_test + +// TODO: Add tests to the sessionTree logic diff --git a/pkg/relayer/types.go b/pkg/relayer/types.go new file mode 100644 index 000000000..1216dd25e --- /dev/null +++ b/pkg/relayer/types.go @@ -0,0 +1,10 @@ +package relayer + +import "github.com/pokt-network/poktroll/x/service/types" + +// MinedRelay is a wrapper around a relay that has been serialized and hashed. +type MinedRelay struct { + types.Relay + Bytes []byte + Hash []byte +} diff --git a/pkg/retry/retry.go b/pkg/retry/retry.go new file mode 100644 index 000000000..bd06af941 --- /dev/null +++ b/pkg/retry/retry.go @@ -0,0 +1,77 @@ +package retry + +import ( + "context" + "time" + + "github.com/pokt-network/poktroll/pkg/polylog" +) + +type RetryFunc func() chan error + +// OnError continuously invokes the provided work function (workFn) until either the context (ctx) +// is canceled or the error channel returned by workFn is closed. If workFn encounters an error, +// OnError will retry invoking workFn based on the provided retry parameters. +// +// Parameters: +// - ctx: the context to monitor for cancellation. If canceled, OnError will exit without error. +// - retryLimit: the maximum number of retries for workFn upon encountering an error. +// - retryDelay: the duration to wait before retrying workFn after an error. +// - retryResetCount: Specifies the duration of continuous error-free operation required +// before the retry count is reset. If the work function operates without +// errors for this duration, any subsequent error will restart the retry +// count from the beginning. +// - workName: a name or descriptor for the work function, used for logging purposes. +// - workFn: a function that performs some work and returns an error channel. +// This channel emits errors encountered during the work. +// +// Returns: +// - If the context is canceled, the function returns nil. +// - If the error channel is closed, a warning is logged, and the function returns nil. +// - If the retry limit is reached, the function returns the error from the channel. +// +// Note: After each error, a delay specified by retryDelay is introduced before retrying workFn.func OnError( +func OnError( + ctx context.Context, + retryLimit int, + retryDelay time.Duration, + retryResetTimeout time.Duration, + workName string, + workFn RetryFunc, +) error { + logger := polylog.Ctx(ctx) + + var retryCount int + errCh := workFn() + for { + select { + case <-ctx.Done(): + return nil + case <-time.After(retryResetTimeout): + retryCount = 0 + case err, ok := <-errCh: + // Exit the retry loop if the error channel is closed. + if !ok { + logger.Warn(). + Str("work_name", workName). + Msg("error channel closed, will no longer retry on error") + return nil + } + + if retryCount >= retryLimit { + return err + } + + // Wait retryDelay before retrying. + time.Sleep(retryDelay) + + // Increment retryCount and retry workFn. + retryCount++ + errCh = workFn() + logger.Error(). + Str("work_name", workName). + Err(err). + Msgf("on retry: %d", retryCount) + } + } +} diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go new file mode 100644 index 000000000..d328bda73 --- /dev/null +++ b/pkg/retry/retry_test.go @@ -0,0 +1,337 @@ +package retry_test + +/* TODO_TECHDEBT: improve this test: +- fix race condition around the logOutput buffer +- factor our common setup and assertion code +- drive out flakiness +- improve comments +*/ + +import ( + "bytes" + "context" + "fmt" + "log" + "strings" + "sync/atomic" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/retry" +) + +var testErr = fmt.Errorf("test error") + +// TestOnError verifies the behavior of the OnError function in the retry package. +// It ensures that the function correctly retries a failing operation for a specified +// number of times with the expected delay between retries. +func TestOnError(t *testing.T) { + t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") + + // Setting up the test variables. + var ( + // logOutput captures the log output for verification of logged messages. + logOutput bytes.Buffer + // expectedRetryDelay is the duration we expect between retries. + expectedRetryDelay = time.Millisecond + // expectedRetryLimit is the maximum number of retries the test expects. + expectedRetryLimit = 5 + // retryResetTimeout is the duration after which the retry count should reset. + retryResetTimeout = time.Second + // testFnCallCount keeps track of how many times the test function is called. + testFnCallCount int32 + // testFnCallTimeCh is a channel receives a time.Time each when the test + // function is called. + testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) + ctx = context.Background() + ) + + // Redirect the standard logger's output to our custom buffer for later verification. + log.SetOutput(&logOutput) + + // Define testFn, a function that simulates a failing operation and logs its invocation times. + testFn := func() chan error { + // Record the current time to track the delay between retries. + testFnCallTimeCh <- time.Now() + + // Create a channel to return an error, simulating a failing operation. + errCh := make(chan error, 1) + errCh <- testErr + + // Increment the call count safely across goroutine boundaries. + atomic.AddInt32(&testFnCallCount, 1) + + return errCh + } + + // Create a channel to receive the error result from the OnError function. + retryOnErrorErrCh := make(chan error, 1) + + // Start the OnError function in a separate goroutine, simulating concurrent operation. + go func() { + // Call the OnError function with the test parameters and function. + retryOnErrorErrCh <- retry.OnError( + ctx, + expectedRetryLimit, + expectedRetryDelay, + retryResetTimeout, + "TestOnError", + testFn, + ) + }() + + // Calculate the total expected time for all retries to complete. + totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) + // Wait for the OnError function to execute and retry the expected number of times. + time.Sleep(totalExpectedDelay + 100*time.Millisecond) + + // Verify that the test function was called the expected number of times. + require.Equal(t, expectedRetryLimit, int(testFnCallCount), "Test function was not called the expected number of times") + + // Verify the delay between retries of the test function. + var prevCallTime time.Time + for i := 0; i < expectedRetryLimit; i++ { + // Retrieve the next function call time from the channel. + nextCallTime, ok := <-testFnCallTimeCh + if !ok { + t.Fatalf("expected %d calls to testFn, but channel closed after %d", expectedRetryLimit, i) + } + + // For all calls after the first, check that the delay since the previous call meets expectations. + if i != 0 { + actualRetryDelay := nextCallTime.Sub(prevCallTime) + require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay, "Retry delay was less than expected") + } + + // Update prevCallTime for the next iteration. + prevCallTime = nextCallTime + } + + // Verify that the OnError function returned the expected error. + select { + case err := <-retryOnErrorErrCh: + require.ErrorIs(t, err, testErr, "OnError did not return the expected error") + case <-time.After(100 * time.Millisecond): + t.Fatal("expected error from OnError, but none received") + } + + // Verify the error messages logged during the retries. + expectedErrorLine := "ERROR: retrying TestOnError after error: test error" + trimmedLogOutput := strings.Trim(logOutput.String(), "\n") + logOutputLines := strings.Split(trimmedLogOutput, "\n") + require.Lenf(t, logOutputLines, expectedRetryLimit, "unexpected number of log lines") + for _, line := range logOutputLines { + require.Contains(t, line, expectedErrorLine, "log line does not contain the expected prefix") + } +} + +// TODO_TECHDEBT: assert that the retry loop exits when the context is closed. +func TestOnError_ExitsWhenCtxCloses(t *testing.T) { + t.SkipNow() +} + +func TestOnError_ExitsWhenErrChCloses(t *testing.T) { + t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") + + // Setup test variables and log capture + var ( + logOutput bytes.Buffer + testFnCallCount int32 + expectedRetryDelay = time.Millisecond + expectedRetryLimit = 3 + retryLimit = 5 + retryResetTimeout = time.Second + testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) + ctx = context.Background() + ) + + // Redirect the log output for verification later + log.SetOutput(&logOutput) + + // Define the test function that simulates an error and counts its invocations + testFn := func() chan error { + atomic.AddInt32(&testFnCallCount, 1) // Increment the invocation count atomically + testFnCallTimeCh <- time.Now() // Track the invocation time + + errCh := make(chan error, 1) + if atomic.LoadInt32(&testFnCallCount) >= int32(expectedRetryLimit) { + close(errCh) + return errCh + } + + errCh <- testErr + return errCh + } + + retryOnErrorErrCh := make(chan error, 1) + // Spawn a goroutine to test the OnError function + go func() { + retryOnErrorErrCh <- retry.OnError( + ctx, + retryLimit, + expectedRetryDelay, + retryResetTimeout, + "TestOnError_ExitsWhenErrChCloses", + testFn, + ) + }() + + // Wait for the OnError function to execute and retry the expected number of times + totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) + time.Sleep(totalExpectedDelay + 100*time.Millisecond) + + // Assert that the test function was called the expected number of times + require.Equal(t, expectedRetryLimit, int(testFnCallCount)) + + // Assert that the retry delay between function calls matches the expected delay + var prevCallTime = new(time.Time) + for i := 0; i < expectedRetryLimit; i++ { + select { + case nextCallTime := <-testFnCallTimeCh: + if i != 0 { + actualRetryDelay := nextCallTime.Sub(*prevCallTime) + require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay) + } + + *prevCallTime = nextCallTime + default: + t.Fatalf( + "expected %d calls to testFn, but only received %d", + expectedRetryLimit, i+1, + ) + } + } + + select { + case err := <-retryOnErrorErrCh: + require.NoError(t, err) + case <-time.After(100 * time.Millisecond): + t.Fatalf("expected error from OnError, but none received") + } + + // Verify the logged error messages + var ( + logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") + errorLines = logOutputLines[:len(logOutputLines)-1] + warnLine = logOutputLines[len(logOutputLines)-1] + expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses closed, will no longer retry on error" + expectedErrorMsg = "ERROR: retrying TestOnError_ExitsWhenErrChCloses after error: test error" + ) + + require.Lenf( + t, logOutputLines, + expectedRetryLimit, + "expected %d log lines, got %d", + expectedRetryLimit, len(logOutputLines), + ) + for _, line := range errorLines { + require.Contains(t, line, expectedErrorMsg) + } + require.Contains(t, warnLine, expectedWarnMsg) +} + +// assert that retryCount resets on success +func TestOnError_RetryCountResetTimeout(t *testing.T) { + t.Skip("TODO_TECHDEBT: this test should pass but contains a race condition around the logOutput buffer") + + // Setup test variables and log capture + var ( + logOutput bytes.Buffer + testFnCallCount int32 + expectedRetryDelay = time.Millisecond + expectedRetryLimit = 9 + retryLimit = 5 + retryResetTimeout = 3 * time.Millisecond + testFnCallTimeCh = make(chan time.Time, expectedRetryLimit) + ctx = context.Background() + ) + + // Redirect the log output for verification later + log.SetOutput(&logOutput) + + // Define the test function that simulates an error and counts its invocations + testFn := func() chan error { + // Track the invocation time + testFnCallTimeCh <- time.Now() + + errCh := make(chan error, 1) + + count := atomic.LoadInt32(&testFnCallCount) + if count == int32(retryLimit) { + go func() { + time.Sleep(retryResetTimeout) + errCh <- testErr + }() + } else { + errCh <- testErr + } + + // Increment the invocation count atomically + atomic.AddInt32(&testFnCallCount, 1) + return errCh + } + + retryOnErrorErrCh := make(chan error, 1) + // Spawn a goroutine to test the OnError function + go func() { + retryOnErrorErrCh <- retry.OnError( + ctx, + retryLimit, + expectedRetryDelay, + retryResetTimeout, + "TestOnError", + testFn, + ) + }() + + // Wait for the OnError function to execute and retry the expected number of times + totalExpectedDelay := expectedRetryDelay * time.Duration(expectedRetryLimit) + time.Sleep(totalExpectedDelay + 100*time.Millisecond) + + // Assert that the test function was called the expected number of times + require.Equal(t, expectedRetryLimit, int(testFnCallCount)) + + // Assert that the retry delay between function calls matches the expected delay + var prevCallTime = new(time.Time) + for i := 0; i < expectedRetryLimit; i++ { + select { + case nextCallTime := <-testFnCallTimeCh: + if i != 0 { + actualRetryDelay := nextCallTime.Sub(*prevCallTime) + require.GreaterOrEqual(t, actualRetryDelay, expectedRetryDelay) + } + + *prevCallTime = nextCallTime + default: + t.Fatalf( + "expected %d calls to testFn, but only received %d", + expectedRetryLimit, i+1, + ) + } + } + + // Verify the logged error messages + var ( + logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") + expectedPrefix = "ERROR: retrying TestOnError after error: test error" + ) + + select { + case err := <-retryOnErrorErrCh: + require.ErrorIs(t, err, testErr) + case <-time.After(100 * time.Millisecond): + t.Fatalf("expected error from OnError, but none received") + } + + require.Lenf( + t, logOutputLines, + expectedRetryLimit-1, + "expected %d log lines, got %d", + expectedRetryLimit-1, len(logOutputLines), + ) + for _, line := range logOutputLines { + require.Contains(t, line, expectedPrefix) + } +} diff --git a/pkg/sdk/deps_builder.go b/pkg/sdk/deps_builder.go new file mode 100644 index 000000000..cfd0ff4b3 --- /dev/null +++ b/pkg/sdk/deps_builder.go @@ -0,0 +1,94 @@ +package sdk + +import ( + "context" + + "cosmossdk.io/depinject" + grpctypes "github.com/cosmos/gogoproto/grpc" + grpc "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + + block "github.com/pokt-network/poktroll/pkg/client/block" + "github.com/pokt-network/poktroll/pkg/client/delegation" + eventsquery "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/client/query" + "github.com/pokt-network/poktroll/pkg/crypto/rings" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +// buildDeps builds the dependencies for the POKTRollSDK if they are not provided +// in the config. This is useful for the SDK consumers that do not want or +// cannot provide the dependencies through depinject. +func (sdk *poktrollSDK) buildDeps( + ctx context.Context, + config *POKTRollSDKConfig, +) (depinject.Config, error) { + pocketNodeWebsocketURL := HostToWebsocketURL(config.QueryNodeUrl.Host) + + // Have a new depinject config + deps := depinject.Configs() + + // Supply the logger + deps = depinject.Configs(deps, depinject.Supply(polylog.Ctx(ctx))) + + // Create and supply the events query client + eventsQueryClient := eventsquery.NewEventsQueryClient(pocketNodeWebsocketURL) + deps = depinject.Configs(deps, depinject.Supply(eventsQueryClient)) + + // Create and supply the block client that depends on the events query client + blockClient, err := block.NewBlockClient(ctx, deps) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(blockClient)) + + // Create and supply the grpc client used by the queriers + // TODO_TECHDEBT: Configure the grpc client options from the config. + var grpcClient grpctypes.ClientConn + grpcClient, err = grpc.Dial( + config.QueryNodeGRPCUrl.Host, + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(grpcClient)) + + // Create and supply the account querier + accountQuerier, err := query.NewAccountQuerier(deps) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(accountQuerier)) + + // Create and supply the application querier + applicationQuerier, err := query.NewApplicationQuerier(deps) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(applicationQuerier)) + + // Create and supply the session querier + sessionQuerier, err := query.NewSessionQuerier(deps) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(sessionQuerier)) + + // Create and supply the delegation client + delegationClient, err := delegation.NewDelegationClient(ctx, deps) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(delegationClient)) + + // Create and supply the ring cache that depends on: + // the logger, application and account querier and the delegation client + ringCache, err := rings.NewRingCache(deps) + if err != nil { + return nil, err + } + deps = depinject.Configs(deps, depinject.Supply(ringCache)) + + return deps, nil +} diff --git a/pkg/sdk/errors.go b/pkg/sdk/errors.go new file mode 100644 index 000000000..fa42d684a --- /dev/null +++ b/pkg/sdk/errors.go @@ -0,0 +1,17 @@ +package sdk + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// TODO_TECHDEBT: Do a source code wise find-replace using regex pattern match +// of `sdkerrors\.Wrapf\(([a-zA-Z]+), ` with `$1.Wrapf(` +var ( + codespace = "poktrollsdk" + ErrSDKHandleRelay = sdkerrors.Register(codespace, 1, "internal error handling relay request") + ErrSDKInvalidRelayResponseSignature = sdkerrors.Register(codespace, 2, "invalid relay response signature") + ErrSDKEmptyRelayResponseSignature = sdkerrors.Register(codespace, 3, "empty relay response signature") + ErrSDKVerifyResponseSignature = sdkerrors.Register(codespace, 4, "error verifying relay response signature") + ErrSDKGetApplications = sdkerrors.Register(codespace, 5, "error querying on-chain applications") + ErrSDKEmptySupplierPubKey = sdkerrors.Register(codespace, 6, "empty supplier public key") +) diff --git a/pkg/sdk/interface.go b/pkg/sdk/interface.go new file mode 100644 index 000000000..aa462abd6 --- /dev/null +++ b/pkg/sdk/interface.go @@ -0,0 +1,32 @@ +package sdk + +import ( + "context" + "net/http" + + apptypes "github.com/pokt-network/poktroll/x/application/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" +) + +// POKTRollSDK is the interface for the POKTRoll SDK. It is used by gateways +// and/or applications to interact with the Pocket protocol. +type POKTRollSDK interface { + // GetApplications queries a list of all on-chain applications, optionally filtered by + // delegated gateway + GetApplications(ctx context.Context, options GetApplicationsOptions) ([]apptypes.Application, error) + + // GetSessionSupplierEndpoints returns the suppliers endpoints of the current session for + // the given application and service. + GetSessionSupplierEndpoints( + ctx context.Context, + appAddress string, + serviceId string, + ) (session *SessionSuppliers, err error) + + // SendRelay sends a relay request to the given supplier's endpoint. + SendRelay( + ctx context.Context, + sessionSupplierEndpoint *SingleSupplierEndpoint, + request *http.Request, + ) (response *servicetypes.RelayResponse, err error) +} diff --git a/pkg/sdk/relay_verifier.go b/pkg/sdk/relay_verifier.go new file mode 100644 index 000000000..6b487a9a6 --- /dev/null +++ b/pkg/sdk/relay_verifier.go @@ -0,0 +1,82 @@ +package sdk + +import ( + "context" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/x/service/types" +) + +// verifyResponse verifies the relay response signature. +func (sdk *poktrollSDK) verifyResponse( + ctx context.Context, + supplierAddress string, + relayResponse *types.RelayResponse, +) error { + logger := polylog.Ctx(context.Background()) + + // Get the supplier's public key. + supplierPubKey, err := sdk.getSupplierPubKeyFromAddress(ctx, supplierAddress) + if err != nil { + return err + } + + // Extract the supplier's signature + if relayResponse.Meta == nil { + return ErrSDKEmptyRelayResponseSignature.Wrapf( + "response payload: %s", relayResponse.Payload, + ) + } + supplierSignature := relayResponse.Meta.SupplierSignature + + // Get the relay response signable bytes and hash them. + responseSignableBz, err := relayResponse.GetSignableBytesHash() + if err != nil { + return err + } + + logger.Debug(). + Str("supplier", supplierAddress). + Str("application", relayResponse.Meta.SessionHeader.ApplicationAddress). + Str("service", relayResponse.Meta.SessionHeader.Service.Id). + Int64("end_height", relayResponse.Meta.SessionHeader.SessionEndBlockHeight). + Msg("About to verify relay response signature.") + + // Verify the relay response signature. + if !supplierPubKey.VerifySignature(responseSignableBz[:], supplierSignature) { + return ErrSDKInvalidRelayResponseSignature + } + + return nil +} + +// getSupplierPubKeyFromAddress gets the supplier's public key from the cache or +// queries if it is not found. The public key is then cached before being returned. +func (sdk *poktrollSDK) getSupplierPubKeyFromAddress( + ctx context.Context, + supplierAddress string, +) (cryptotypes.PubKey, error) { + supplierPubKey, ok := sdk.supplierAccountCache[supplierAddress] + if ok { + return supplierPubKey, nil + } + + // Query for the supplier account to get the application's public key + // to verify the relay request signature. + acc, err := sdk.accountQuerier.GetAccount(ctx, supplierAddress) + if err != nil { + return nil, err + } + + fetchedPubKey := acc.GetPubKey() + if fetchedPubKey == nil { + return nil, ErrSDKEmptySupplierPubKey + } + + // Cache the retrieved public key. + sdk.supplierAccountCache[supplierAddress] = fetchedPubKey + + return fetchedPubKey, nil +} diff --git a/pkg/sdk/sdk.go b/pkg/sdk/sdk.go new file mode 100644 index 000000000..c2c836e6b --- /dev/null +++ b/pkg/sdk/sdk.go @@ -0,0 +1,115 @@ +package sdk + +import ( + "context" + "fmt" + "net/url" + "sync" + + "cosmossdk.io/depinject" + ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" + ringtypes "github.com/athanorlabs/go-dleq/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/crypto" + "github.com/pokt-network/poktroll/pkg/polylog" +) + +var _ POKTRollSDK = (*poktrollSDK)(nil) + +// POKTRollSDKConfig is the configuration for the POKTRollSDK. +// It contains the Pocket Node URL to be used by the queriers and the private key +// to be used for signing relay requests. +// Deps is an optional field that can be used to provide the needed dependencies +// for the SDK. If it is not provided, the SDK will build the dependencies itself. +type POKTRollSDKConfig struct { + QueryNodeGRPCUrl *url.URL + QueryNodeUrl *url.URL + PrivateKey cryptotypes.PrivKey + Deps depinject.Config +} + +// poktrollSDK is the implementation of the POKTRollSDK. +type poktrollSDK struct { + logger polylog.Logger + config *POKTRollSDKConfig + + // signingKey is the scalar representation of the private key to be used + // for signing relay requests. + signingKey ringtypes.Scalar + + // ringCache is used to obtain and store the ring for the application. + ringCache crypto.RingCache + + // sessionQuerier is the querier for the session module. + // It used to get the current session for the application given a requested service. + sessionQuerier client.SessionQueryClient + + // serviceSessionSuppliersMu is a mutex to protect latestSessions map reads and updates. + serviceSessionSuppliersMu sync.RWMutex + + // serviceSessionSuppliers is a map of serviceId -> {appAddress -> SessionSuppliers} + // for a specific session + serviceSessionSuppliers map[string]map[string]*SessionSuppliers + + // accountQuerier is the querier for the account module. + // It is used to get the the supplier's public key to verify the relay response signature. + accountQuerier client.AccountQueryClient + + // applicationQuerier is the querier for the application module. + // It is used to query a specific application or all applications + applicationQuerier client.ApplicationQueryClient + + // blockClient is the client for the block module. + // It is used to get the current block height to query for the current session. + blockClient client.BlockClient + + // accountCache is a cache of the supplier accounts that has been queried + // TODO_TECHDEBT: Add a size limit to the cache. + supplierAccountCache map[string]cryptotypes.PubKey +} + +// NewPOKTRollSDK creates a new POKTRollSDK instance with the given configuration. +func NewPOKTRollSDK(ctx context.Context, config *POKTRollSDKConfig) (POKTRollSDK, error) { + sdk := &poktrollSDK{ + config: config, + serviceSessionSuppliers: make(map[string]map[string]*SessionSuppliers), + supplierAccountCache: make(map[string]cryptotypes.PubKey), + } + + var err error + var deps depinject.Config + + // Build the dependencies if they are not provided in the config. + if config.Deps != nil { + deps = config.Deps + } else if deps, err = sdk.buildDeps(ctx, config); err != nil { + return nil, err + } + + if err := depinject.Inject( + deps, + &sdk.logger, + &sdk.ringCache, + &sdk.sessionQuerier, + &sdk.accountQuerier, + &sdk.applicationQuerier, + &sdk.blockClient, + ); err != nil { + return nil, err + } + + // Store the private key as a ring scalar to be used for ring signatures. + crv := ring_secp256k1.NewCurve() + sdk.signingKey, err = crv.DecodeToScalar(config.PrivateKey.Bytes()) + if err != nil { + return nil, fmt.Errorf("failed to decode private key: %w", err) + } + + // Start the ring cache, when the context is canceled, the ring cache + // will stop. And clear any cached rings. + sdk.ringCache.Start(ctx) + + return sdk, nil +} diff --git a/pkg/sdk/send_relay.go b/pkg/sdk/send_relay.go new file mode 100644 index 000000000..45e93a728 --- /dev/null +++ b/pkg/sdk/send_relay.go @@ -0,0 +1,109 @@ +package sdk + +import ( + "bytes" + "context" + "io" + "net/http" + + "github.com/pokt-network/poktroll/pkg/signer" + "github.com/pokt-network/poktroll/x/service/types" +) + +// SendRelay sends a relay request to the given supplier's endpoint. +// It signs the request, relays it to the supplier and verifies the response signature. +// It takes an http.Request as an argument and uses its method and headers to create +// the relay request. +func (sdk *poktrollSDK) SendRelay( + ctx context.Context, + supplierEndpoint *SingleSupplierEndpoint, + request *http.Request, +) (response *types.RelayResponse, err error) { + payloadBz, err := io.ReadAll(request.Body) + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("reading request body: %s", err) + } + + // Create the relay request. + relayRequest := &types.RelayRequest{ + Meta: &types.RelayRequestMetadata{ + SessionHeader: supplierEndpoint.Header, + Signature: nil, // signature added below + }, + Payload: payloadBz, + } + + // Get the application's signer. + appAddress := supplierEndpoint.Header.ApplicationAddress + appRing, err := sdk.ringCache.GetRingForAddress(ctx, appAddress) + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("getting app ring: %s", err) + } + signer := signer.NewRingSigner(appRing, sdk.signingKey) + + // Hash and sign the request's signable bytes. + signableBz, err := relayRequest.GetSignableBytesHash() + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error getting signable bytes: %s", err) + } + + requestSig, err := signer.Sign(signableBz) + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error signing relay: %s", err) + } + relayRequest.Meta.Signature = requestSig + + // Marshal the relay request to bytes and create a reader to be used as an HTTP request body. + cdc := types.ModuleCdc + relayRequestBz, err := cdc.Marshal(relayRequest) + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error marshaling relay request: %s", err) + } + relayRequestReader := io.NopCloser(bytes.NewReader(relayRequestBz)) + var relayReq types.RelayRequest + if err := relayReq.Unmarshal(relayRequestBz); err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error unmarshaling relay request: %s", err) + } + + // Create the HTTP request to send the request to the relayer. + // All the RPC protocols to be supported (JSONRPC, Rest, Websockets, gRPC, etc) + // use HTTP under the hood. + relayHTTPRequest := &http.Request{ + Method: request.Method, + Header: request.Header, + URL: supplierEndpoint.Url, + Body: relayRequestReader, + } + + sdk.logger.Debug(). + Str("supplier_url", supplierEndpoint.Url.String()). + Msg("sending relay request") + relayHTTPResponse, err := http.DefaultClient.Do(relayHTTPRequest) + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error sending relay request: %s", err) + } + + // Read the response body bytes. + relayResponseBz, err := io.ReadAll(relayHTTPResponse.Body) + if err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error reading relay response body: %s", err) + } + + // Unmarshal the response bytes into a RelayResponse. + relayResponse := &types.RelayResponse{} + if err := relayResponse.Unmarshal(relayResponseBz); err != nil { + return nil, ErrSDKHandleRelay.Wrapf("error unmarshaling relay response: %s", err) + } + + // Verify the response signature. We use the supplier address that we got from + // the getRelayerUrl function since this is the address we are expecting to sign the response. + // TODO_TECHDEBT: if the RelayResponse is an internal error response, we should not verify the signature + // as in some relayer early failures, it may not be signed by the supplier. + // TODO_IMPROVE: Add more logging & telemetry so we can get visibility and signal into + // failed responses. + if err := sdk.verifyResponse(ctx, supplierEndpoint.SupplierAddress, relayResponse); err != nil { + return nil, ErrSDKVerifyResponseSignature.Wrapf("%s", err) + } + + return relayResponse, nil +} diff --git a/pkg/sdk/session.go b/pkg/sdk/session.go new file mode 100644 index 000000000..634f7a7d1 --- /dev/null +++ b/pkg/sdk/session.go @@ -0,0 +1,114 @@ +package sdk + +import ( + "context" + "net/url" + + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// SessionSuppliers is the structure that represents a session's end block height +// and its matching suppliers. +type SessionSuppliers struct { + // Session is the fully hydrated session object returned by the query. + Session *sessiontypes.Session + + // SuppliersEndpoints is a slice of the session's suppliers endpoints each + // item representing a single supplier endpoint augmented with the session + // header and the supplier's address. + // An item from this slice is what needs to be passed to the `SendRelay` + // function so it has all the information needed to send the relay request. + SuppliersEndpoints []*SingleSupplierEndpoint +} + +// SingleSupplierEndpoint is the structure that represents a supplier's endpoint +// augmented with the session's header and the supplier's address for easy +// access to the needed information when sending a relay request. +type SingleSupplierEndpoint struct { + Url *url.URL + RpcType sharedtypes.RPCType + SupplierAddress string + Header *sessiontypes.SessionHeader +} + +// GetSessionSupplierEndpoints returns a flattened structure of the endpoints +// from all suppliers in the session and returns them as a SupplierEndpoint slice. +// It queries for the latest session and caches it if the cached one is outdated. +func (sdk *poktrollSDK) GetSessionSupplierEndpoints( + ctx context.Context, + appAddress, serviceId string, +) (*SessionSuppliers, error) { + sdk.serviceSessionSuppliersMu.RLock() + defer sdk.serviceSessionSuppliersMu.RUnlock() + + latestBlockHeight := sdk.blockClient.LastNBlocks(ctx, 1)[0].Height() + + // Create the latestSessions map entry for the serviceId if it doesn't exist. + if _, ok := sdk.serviceSessionSuppliers[serviceId]; !ok { + sdk.serviceSessionSuppliers[serviceId] = map[string]*SessionSuppliers{} + } + + // Create the latestSessions[serviceId] map entry for the appAddress if it doesn't exist. + if _, ok := sdk.serviceSessionSuppliers[serviceId][appAddress]; !ok { + sdk.serviceSessionSuppliers[serviceId][appAddress] = &SessionSuppliers{} + } + + // currentSession is guaranteed to exist after the checks above. + currentSession := sdk.serviceSessionSuppliers[serviceId][appAddress] + + // Return the current session's SuppliersEndpoints if the session is still valid. + if currentSession.Session != nil && + latestBlockHeight < currentSession.Session.Header.SessionEndBlockHeight { + return currentSession, nil + } + + // Query for the current session. + session, err := sdk.sessionQuerier.GetSession( + ctx, + appAddress, + serviceId, + latestBlockHeight, + ) + if err != nil { + return nil, err + } + + // Override the old Session and SessionSuppliers and construct the new one. + currentSession.Session = session + currentSession.SuppliersEndpoints = []*SingleSupplierEndpoint{} + + for _, supplier := range session.Suppliers { + for _, service := range supplier.Services { + // Skip the session's services that don't match the requested serviceId. + if service.Service.Id != serviceId { + continue + } + + // Loop through the services' endpoints and add them to the + // SessionSuppliers.SuppliersEndpoints slice. + for _, endpoint := range service.Endpoints { + url, err := url.Parse(endpoint.Url) + if err != nil { + sdk.logger.Error(). + Str("url", endpoint.Url). + Err(err). + Msg("failed to parse url") + continue + } + + currentSession.SuppliersEndpoints = append( + currentSession.SuppliersEndpoints, + &SingleSupplierEndpoint{ + Url: url, + RpcType: endpoint.RpcType, + SupplierAddress: supplier.Address, + Header: session.Header, + }, + ) + } + } + } + + return currentSession, nil +} diff --git a/pkg/sdk/urls.go b/pkg/sdk/urls.go new file mode 100644 index 000000000..de182f150 --- /dev/null +++ b/pkg/sdk/urls.go @@ -0,0 +1,10 @@ +package sdk + +import "fmt" + +// HostToWebsocketURL converts the provided host into a websocket URL that can +// be used to subscribe to onchain events and query the chain via a client +// context or send transactions via a tx client context. +func HostToWebsocketURL(host string) string { + return fmt.Sprintf("ws://%s/websocket", host) +} diff --git a/pkg/signer/interface.go b/pkg/signer/interface.go new file mode 100644 index 000000000..63b40b86d --- /dev/null +++ b/pkg/signer/interface.go @@ -0,0 +1,9 @@ +package signer + +// Signer is an interface that abstracts the signing of a message, it is used +// to sign both relay requests and responses via one of the two implementations. +// The Signer interface expects a 32 byte message (sha256 hash) and returns a +// byte slice containing the signature or any error that occurred during signing. +type Signer interface { + Sign(msg [32]byte) (signature []byte, err error) +} diff --git a/pkg/signer/ring_signer.go b/pkg/signer/ring_signer.go new file mode 100644 index 000000000..b2c46a5ce --- /dev/null +++ b/pkg/signer/ring_signer.go @@ -0,0 +1,34 @@ +package signer + +import ( + "fmt" + + ringtypes "github.com/athanorlabs/go-dleq/types" + ring "github.com/noot/ring-go" +) + +var _ Signer = (*RingSigner)(nil) + +// RingSigner is a signer implementation that uses a ring to sign messages, for +// verification the ring signature must be verified and confirmed to be using +// the expected ring. +type RingSigner struct { + ring *ring.Ring + privKey ringtypes.Scalar +} + +// NewRingSigner creates a new RingSigner instance with the ring and private +// key provided +func NewRingSigner(ring *ring.Ring, privKey ringtypes.Scalar) *RingSigner { + return &RingSigner{ring: ring, privKey: privKey} +} + +// Sign uses the ring and private key to sign the message provided and returns the +// serialized ring signature that can be deserialized and verified by the verifier +func (r *RingSigner) Sign(msg [32]byte) ([]byte, error) { + ringSig, err := r.ring.Sign(msg, r.privKey) + if err != nil { + return nil, fmt.Errorf("failed to sign message [%v]: %w", msg, err) + } + return ringSig.Serialize() +} diff --git a/pkg/signer/simple_signer.go b/pkg/signer/simple_signer.go new file mode 100644 index 000000000..432c1c8a3 --- /dev/null +++ b/pkg/signer/simple_signer.go @@ -0,0 +1,23 @@ +package signer + +import "github.com/cosmos/cosmos-sdk/crypto/keyring" + +var _ Signer = (*SimpleSigner)(nil) + +// SimpleSigner is a signer implementation that uses the local keyring to sign +// messages, for verification using the signer's corresponding public key +type SimpleSigner struct { + keyring keyring.Keyring + keyName string +} + +// NewSimpleSigner creates a new SimpleSigner instance with the keyring and keyName provided +func NewSimpleSigner(keyring keyring.Keyring, keyName string) *SimpleSigner { + return &SimpleSigner{keyring: keyring, keyName: keyName} +} + +// Sign signs the given message using the SimpleSigner's keyring and keyName +func (s *SimpleSigner) Sign(msg [32]byte) (signature []byte, err error) { + sig, _, err := s.keyring.Sign(s.keyName, msg[:]) + return sig, err +} From 3aea3f7292e818fc660e60bebba85399c3f713a7 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 10:52:11 +0100 Subject: [PATCH 20/54] restore: e2e/* --- e2e/tests/help.feature | 7 + e2e/tests/init_test.go | 422 ++++++++++++++++++++++++++++++++ e2e/tests/node.go | 154 ++++++++++++ e2e/tests/relay.feature | 20 ++ e2e/tests/send.feature | 13 + e2e/tests/session.feature | 44 ++++ e2e/tests/session_steps_test.go | 226 +++++++++++++++++ e2e/tests/stake.feature | 25 ++ 8 files changed, 911 insertions(+) create mode 100644 e2e/tests/help.feature create mode 100644 e2e/tests/init_test.go create mode 100644 e2e/tests/node.go create mode 100644 e2e/tests/relay.feature create mode 100644 e2e/tests/send.feature create mode 100644 e2e/tests/session.feature create mode 100644 e2e/tests/session_steps_test.go create mode 100644 e2e/tests/stake.feature diff --git a/e2e/tests/help.feature b/e2e/tests/help.feature new file mode 100644 index 000000000..7d0867f99 --- /dev/null +++ b/e2e/tests/help.feature @@ -0,0 +1,7 @@ +Feature: Root Namespace + + Scenario: User Needs Help + Given the user has the pocketd binary installed + When the user runs the command "help" + Then the user should be able to see standard output containing "Available Commands" + And the pocketd binary should exit without error diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go new file mode 100644 index 000000000..5afc0409f --- /dev/null +++ b/e2e/tests/init_test.go @@ -0,0 +1,422 @@ +//go:build e2e + +package e2e + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "regexp" + "strconv" + "strings" + "testing" + "time" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/regen-network/gocuke" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/testutil/testclient" + apptypes "github.com/pokt-network/poktroll/x/application/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +var ( + addrRe *regexp.Regexp + amountRe *regexp.Regexp + + accNameToAddrMap = make(map[string]string) + accAddrToNameMap = make(map[string]string) + accNameToAppMap = make(map[string]apptypes.Application) + accNameToSupplierMap = make(map[string]sharedtypes.Supplier) + + flagFeaturesPath string + keyRingFlag = "--keyring-backend=test" + appGateServerUrl = "http://localhost:42069" // Keeping localhost by default because that is how we run the tests on our machines locally +) + +func init() { + addrRe = regexp.MustCompile(`address:\s+(\S+)\s+name:\s+(\S+)`) + amountRe = regexp.MustCompile(`amount:\s+"(.+?)"\s+denom:\s+upokt`) + + flag.StringVar(&flagFeaturesPath, "features-path", "*.feature", "Specifies glob paths for the runner to look up .feature files") + + // If "APPGATE_SERVER_URL" envar is present, use it for appGateServerUrl + if url := os.Getenv("APPGATE_SERVER_URL"); url != "" { + appGateServerUrl = url + } +} + +func TestMain(m *testing.M) { + flag.Parse() + log.Printf("features path: %s", flagFeaturesPath) + m.Run() +} + +type suite struct { + gocuke.TestingT + // TODO_TECHDEBT: rename to `poktrolld`. + pocketd *pocketdBin + scenarioState map[string]any // temporary state for each scenario + cdc codec.Codec + supplierQueryClient suppliertypes.QueryClient +} + +func (s *suite) Before() { + s.pocketd = new(pocketdBin) + s.scenarioState = make(map[string]any) + s.cdc = app.MakeEncodingConfig().Marshaler + s.buildAddrMap() + s.buildAppMap() + s.buildSupplierMap() + + flagSet := testclient.NewLocalnetFlagSet(s) + clientCtx := testclient.NewLocalnetClientCtx(s, flagSet) + s.supplierQueryClient = suppliertypes.NewQueryClient(clientCtx) +} + +// TestFeatures runs the e2e tests specified in any .features files in this directory +// * This test suite assumes that a LocalNet is running +func TestFeatures(t *testing.T) { + gocuke.NewRunner(t, &suite{}).Path(flagFeaturesPath).Run() +} + +// TODO_TECHDEBT: rename `pocketd` to `poktrolld`. +func (s *suite) TheUserHasThePocketdBinaryInstalled() { + s.TheUserRunsTheCommand("help") +} + +func (s *suite) ThePocketdBinaryShouldExitWithoutError() { + require.NoError(s, s.pocketd.result.Err) +} + +func (s *suite) TheUserRunsTheCommand(cmd string) { + cmds := strings.Split(cmd, " ") + res, err := s.pocketd.RunCommand(cmds...) + s.pocketd.result = res + if err != nil { + s.Fatalf("error running command %s: %s", cmd, err) + } +} + +func (s *suite) TheUserShouldBeAbleToSeeStandardOutputContaining(arg1 string) { + if !strings.Contains(s.pocketd.result.Stdout, arg1) { + s.Fatalf("stdout must contain %s", arg1) + } +} + +func (s *suite) TheUserSendsUpoktFromAccountToAccount(amount int64, accName1, accName2 string) { + args := []string{ + "tx", + "bank", + "send", + accNameToAddrMap[accName1], + accNameToAddrMap[accName2], + fmt.Sprintf("%dupokt", amount), + keyRingFlag, + "-y", + } + res, err := s.pocketd.RunCommandOnHost("", args...) + if err != nil { + s.Fatalf("error sending upokt: %s", err) + } + s.pocketd.result = res +} + +func (s *suite) TheAccountHasABalanceGreaterThanUpokt(accName string, amount int64) { + bal := s.getAccBalance(accName) + if int64(bal) < amount { + s.Fatalf("account %s does not have enough upokt: %d < %d", accName, bal, amount) + } + s.scenarioState[accName] = bal // save the balance for later +} + +func (s *suite) AnAccountExistsFor(accName string) { + bal := s.getAccBalance(accName) + s.scenarioState[accName] = bal // save the balance for later +} + +func (s *suite) TheAccountBalanceOfShouldBeUpoktThanBefore(accName string, amount int64, condition string) { + prev, ok := s.scenarioState[accName] + if !ok { + s.Fatalf("no previous balance found for %s", accName) + } + + bal := s.getAccBalance(accName) + switch condition { + case "more": + if bal <= prev.(int) { + s.Fatalf("account %s expected to have more upokt but: %d <= %d", accName, bal, prev) + } + case "less": + if bal >= prev.(int) { + s.Fatalf("account %s expected to have less upokt but: %d >= %d", accName, bal, prev) + } + default: + s.Fatalf("unknown condition %s", condition) + } +} + +func (s *suite) TheUserShouldWaitForSeconds(dur int64) { + time.Sleep(time.Duration(dur) * time.Second) +} + +func (s *suite) TheUserStakesAWithUpoktFromTheAccount(actorType string, amount int64, accName string) { + // Create a temporary config file + configPathPattern := fmt.Sprintf("%s_stake_config_*.yaml", accName) + configContent := fmt.Sprintf(`stake_amount: %d upokt`, amount) + configFile, err := ioutil.TempFile("", configPathPattern) + if err != nil { + s.Fatalf("error creating config file: %q", err) + } + if _, err = configFile.Write([]byte(configContent)); err != nil { + s.Fatalf("error writing config file: %q", err) + } + + args := []string{ + "tx", + actorType, + fmt.Sprintf("stake-%s", actorType), + "--config", + configFile.Name(), + "--from", + accName, + keyRingFlag, + "-y", + } + res, err := s.pocketd.RunCommandOnHost("", args...) + + // Remove the temporary config file + err = os.Remove(configFile.Name()) + if err != nil { + s.Fatalf("error removing config file: %q", err) + } + + if err != nil { + s.Fatalf("error staking %s: %s", actorType, err) + } + s.pocketd.result = res +} + +func (s *suite) TheUserUnstakesAFromTheAccount(actorType string, accName string) { + args := []string{ + "tx", + actorType, + fmt.Sprintf("unstake-%s", actorType), + "--from", + accName, + keyRingFlag, + "-y", + } + res, err := s.pocketd.RunCommandOnHost("", args...) + if err != nil { + s.Fatalf("error unstaking %s: %s", actorType, err) + } + s.pocketd.result = res +} + +func (s *suite) TheForAccountIsNotStaked(actorType, accName string) { + found, _ := s.getStakedAmount(actorType, accName) + if found { + s.Fatalf("account %s should not be staked", accName) + } +} + +func (s *suite) TheForAccountIsStakedWithUpokt(actorType, accName string, amount int64) { + found, stakeAmount := s.getStakedAmount(actorType, accName) + if !found { + s.Fatalf("account %s should be staked", accName) + } + if int64(stakeAmount) != amount { + s.Fatalf("account %s stake amount is not %d", accName, amount) + } +} + +func (s *suite) TheApplicationIsStakedForService(appName string, serviceId string) { + for _, serviceConfig := range accNameToAppMap[appName].ServiceConfigs { + if serviceConfig.Service.Id == serviceId { + return + } + } + s.Fatalf("application %s is not staked for service %s", appName, serviceId) +} + +func (s *suite) TheSupplierIsStakedForService(supplierName string, serviceId string) { + for _, serviceConfig := range accNameToSupplierMap[supplierName].Services { + if serviceConfig.Service.Id == serviceId { + return + } + } + s.Fatalf("supplier %s is not staked for service %s", supplierName, serviceId) +} + +func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName string, serviceId string, supplierName string) { + app, found := accNameToAppMap[appName] + if !found { + s.Fatalf("application %s not found", appName) + } + expectedSupplier, found := accNameToSupplierMap[supplierName] + if !found { + s.Fatalf("supplier %s not found", supplierName) + } + argsAndFlags := []string{ + "query", + "session", + "get-session", + app.Address, + serviceId, + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) + if err != nil { + s.Fatalf("error getting session for app %s and service %s: %s", appName, serviceId, err) + } + var resp sessiontypes.QueryGetSessionResponse + responseBz := []byte(strings.TrimSpace(res.Stdout)) + s.cdc.MustUnmarshalJSON(responseBz, &resp) + for _, supplier := range resp.Session.Suppliers { + if supplier.Address == expectedSupplier.Address { + return + } + } + s.Fatalf("session for app %s and service %s does not contain supplier %s", appName, serviceId, supplierName) +} + +func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, requestData string) { + res, err := s.pocketd.RunCurl(appGateServerUrl, serviceId, requestData) + if err != nil { + s.Fatalf("error sending relay request from app %s to supplier %s for service %s: %v", appName, supplierName, serviceId, err) + } + + relayKey := relayReferenceKey(appName, supplierName) + s.scenarioState[relayKey] = res.Stdout +} + +func (s *suite) TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName string, supplierName string) { + relayKey := relayReferenceKey(appName, supplierName) + stdout, ok := s.scenarioState[relayKey] + + require.Truef(s, ok, "no relay response found for %s", relayKey) + require.Contains(s, stdout, `"result":"0x`) +} + +func (s *suite) getStakedAmount(actorType, accName string) (bool, int) { + s.Helper() + args := []string{ + "query", + actorType, + fmt.Sprintf("list-%s", actorType), + } + res, err := s.pocketd.RunCommandOnHost("", args...) + if err != nil { + s.Fatalf("error getting %s: %s", actorType, err) + } + s.pocketd.result = res + found := strings.Contains(res.Stdout, accNameToAddrMap[accName]) + amount := 0 + if found { + escapedAddress := regexp.QuoteMeta(accNameToAddrMap[accName]) + stakedAmountRe := regexp.MustCompile(`address: ` + escapedAddress + `\s+stake:\s+amount: "(\d+)"`) + matches := stakedAmountRe.FindStringSubmatch(res.Stdout) + if len(matches) < 2 { + s.Fatalf("no stake amount found for %s", accName) + } + amount, err = strconv.Atoi(matches[1]) + require.NoError(s, err) + } + return found, amount +} + +func (s *suite) buildAddrMap() { + s.Helper() + res, err := s.pocketd.RunCommand( + "keys", "list", keyRingFlag, + ) + if err != nil { + s.Fatalf("error getting keys: %s", err) + } + s.pocketd.result = res + matches := addrRe.FindAllStringSubmatch(res.Stdout, -1) + for _, match := range matches { + name := match[2] + address := match[1] + accNameToAddrMap[name] = address + accAddrToNameMap[address] = name + } +} + +func (s *suite) buildAppMap() { + s.Helper() + argsAndFlags := []string{ + "query", + "application", + "list-application", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) + if err != nil { + s.Fatalf("error getting application list: %s", err) + } + s.pocketd.result = res + var resp apptypes.QueryAllApplicationResponse + responseBz := []byte(strings.TrimSpace(res.Stdout)) + s.cdc.MustUnmarshalJSON(responseBz, &resp) + for _, app := range resp.Application { + accNameToAppMap[accAddrToNameMap[app.Address]] = app + } +} + +func (s *suite) buildSupplierMap() { + s.Helper() + argsAndFlags := []string{ + "query", + "supplier", + "list-supplier", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) + if err != nil { + s.Fatalf("error getting supplier list: %s", err) + } + s.pocketd.result = res + var resp suppliertypes.QueryAllSupplierResponse + responseBz := []byte(strings.TrimSpace(res.Stdout)) + s.cdc.MustUnmarshalJSON(responseBz, &resp) + for _, supplier := range resp.Supplier { + accNameToSupplierMap[accAddrToNameMap[supplier.Address]] = supplier + } +} + +func (s *suite) getAccBalance(accName string) int { + s.Helper() + args := []string{ + "query", + "bank", + "balances", + accNameToAddrMap[accName], + } + res, err := s.pocketd.RunCommandOnHost("", args...) + if err != nil { + s.Fatalf("error getting balance: %s", err) + } + s.pocketd.result = res + match := amountRe.FindStringSubmatch(res.Stdout) + if len(match) < 2 { + s.Fatalf("no balance found for %s", accName) + } + found, err := strconv.Atoi(match[1]) + require.NoError(s, err) + return found +} + +// TODO_IMPROVE: use `sessionId` and `supplierName` since those are the two values +// used to create the primary composite key on-chain to uniquely distinguish relays. +func relayReferenceKey(appName, supplierName string) string { + return fmt.Sprintf("%s/%s", appName, supplierName) +} diff --git a/e2e/tests/node.go b/e2e/tests/node.go new file mode 100644 index 000000000..5bf187556 --- /dev/null +++ b/e2e/tests/node.go @@ -0,0 +1,154 @@ +//go:build e2e + +package e2e + +import ( + "bytes" + "fmt" + "os" + "os/exec" + "strings" +) + +// TODO_TECHDEBT(https://github.com/ignite/cli/issues/3737): We're using a combination +// of `pocketd` (legacy) and `poktrolld` (current) because of an issue of how ignite works. +var ( + // defaultRPCURL used by pocketdBin to run remote commands + defaultRPCURL = os.Getenv("POCKET_NODE") + // defaultRPCPort is the default RPC port that pocketd listens on + defaultRPCPort = 36657 + // defaultRPCHost is the default RPC host that pocketd listens on + defaultRPCHost = "127.0.0.1" + // defaultHome is the default home directory for pocketd + defaultHome = os.Getenv("POKTROLLD_HOME") + // defaultAppGateServerURL used by curl commands to send relay requests + defaultAppGateServerURL = os.Getenv("APPGATE_SERVER") + // defaultDebugOutput provides verbose output on manipulations with binaries (cli command, stdout, stderr) + defaultDebugOutput = os.Getenv("E2E_DEBUG_OUTPUT") +) + +func init() { + if defaultRPCURL == "" { + defaultRPCURL = fmt.Sprintf("tcp://%s:%d", defaultRPCHost, defaultRPCPort) + } + if defaultHome == "" { + defaultHome = "../../localnet/poktrolld" + } +} + +// commandResult combines the stdout, stderr, and err of an operation +type commandResult struct { + Command string // the command that was executed + Stdout string // standard output + Stderr string // standard error + Err error // execution error, if any +} + +// PocketClient is a single function interface for interacting with a node +type PocketClient interface { + RunCommand(args ...string) (*commandResult, error) + RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) + RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) +} + +// Ensure that pocketdBin struct fulfills PocketClient +var _ PocketClient = (*pocketdBin)(nil) + +// pocketdBin holds the reults of the last command that was run +type pocketdBin struct { + result *commandResult // stores the result of the last command that was run +} + +// RunCommand runs a command on the local machine using the pocketd binary +func (p *pocketdBin) RunCommand(args ...string) (*commandResult, error) { + return p.runPocketCmd(args...) +} + +// RunCommandOnHost runs a command on specified host with the given args +func (p *pocketdBin) RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) { + if rpcUrl == "" { + rpcUrl = defaultRPCURL + } + args = append(args, "--node", rpcUrl) + return p.runPocketCmd(args...) +} + +// RunCurl runs a curl command on the local machine +func (p *pocketdBin) RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) { + if rpcUrl == "" { + rpcUrl = defaultAppGateServerURL + } + return p.runCurlPostCmd(rpcUrl, service, data, args...) +} + +// runPocketCmd is a helper to run a command using the local pocketd binary with the flags provided +func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) { + base := []string{"--home", defaultHome} + args = append(base, args...) + commandStr := "poktrolld " + strings.Join(args, " ") // Create a string representation of the command + cmd := exec.Command("poktrolld", args...) + + var stdoutBuf, stderrBuf bytes.Buffer + cmd.Stdout = &stdoutBuf + cmd.Stderr = &stderrBuf + + err := cmd.Run() + r := &commandResult{ + Command: commandStr, // Set the command string + Stdout: stdoutBuf.String(), + Stderr: stderrBuf.String(), + Err: err, + } + p.result = r + + if err != nil { + // Include the command executed in the error message for context + err = fmt.Errorf("error running command [%s]: %v, stderr: %s", commandStr, err, stderrBuf.String()) + } + + if defaultDebugOutput == "true" { + fmt.Printf("%#v\n", r) + } + + return r, err +} + +// runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided +func (p *pocketdBin) runCurlPostCmd(rpcUrl string, service string, data string, args ...string) (*commandResult, error) { + dataStr := fmt.Sprintf("%s", data) + urlStr := fmt.Sprintf("%s/%s", rpcUrl, service) + base := []string{ + "-v", // verbose output + "-sS", // silent with error + "-X", "POST", // HTTP method + "-H", "Content-Type: application/json", // HTTP headers + "--data", dataStr, urlStr, // POST data + } + args = append(base, args...) + commandStr := "curl " + strings.Join(args, " ") // Create a string representation of the command + cmd := exec.Command("curl", args...) + + var stdoutBuf, stderrBuf bytes.Buffer + cmd.Stdout = &stdoutBuf + cmd.Stderr = &stderrBuf + + err := cmd.Run() + r := &commandResult{ + Command: commandStr, // Set the command string + Stdout: stdoutBuf.String(), + Stderr: stderrBuf.String(), + Err: err, + } + p.result = r + + if defaultDebugOutput == "true" { + fmt.Printf("%#v\n", r) + } + + if err != nil { + // Include the command executed in the error message for context + err = fmt.Errorf("error running command [%s]: %v, stderr: %s", commandStr, err, stderrBuf.String()) + } + + return r, err +} diff --git a/e2e/tests/relay.feature b/e2e/tests/relay.feature new file mode 100644 index 000000000..31d82af34 --- /dev/null +++ b/e2e/tests/relay.feature @@ -0,0 +1,20 @@ +Feature: Relay Namespace + + # NB: `make acc_initialize_pubkeys` must have been executed before this test is run + Scenario: App can send relay to Supplier + Given the user has the pocketd binary installed + And the application "app1" is staked for service "anvil" + And the supplier "supplier1" is staked for service "anvil" + And the session for application "app1" and service "anvil" contains the supplier "supplier1" + When the application "app1" sends the supplier "supplier1" a request for service "anvil" with data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' + Then the application "app1" receives a successful relay response signed by "supplier1" + + # TODO_TEST(@Olshansk): + # - Successful relay if using a gateway to proxy the relay + # - Succeedful relays when using multiple suppliers for app in some session + # - Successful deduction of app's balance after claim & proof lifecycle (requires querying claims, proofs, session start/end) + # - Successful inflatino of supplier's balance after claim & proof lifecycle (requires querying claims, proofs, session start/end) + # - Error if app1 is not staked for svc1 but relay is sent + # - Error if supplier is not staked for svc1 but relay is sent + # - Error if claiming the session too early + # - Error if proving the session too early \ No newline at end of file diff --git a/e2e/tests/send.feature b/e2e/tests/send.feature new file mode 100644 index 000000000..4df818bf2 --- /dev/null +++ b/e2e/tests/send.feature @@ -0,0 +1,13 @@ +Feature: Tx Namespace + + Scenario: User can send uPOKT + Given the user has the pocketd binary installed + And the account "app1" has a balance greater than "1000" uPOKT + And an account exists for "app2" + When the user sends "1000" uPOKT from account "app1" to account "app2" + Then the user should be able to see standard output containing "txhash:" + And the user should be able to see standard output containing "code: 0" + And the pocketd binary should exit without error + And the user should wait for "5" seconds + And the account balance of "app1" should be "1000" uPOKT "less" than before + And the account balance of "app2" should be "1000" uPOKT "more" than before diff --git a/e2e/tests/session.feature b/e2e/tests/session.feature new file mode 100644 index 000000000..f0626011d --- /dev/null +++ b/e2e/tests/session.feature @@ -0,0 +1,44 @@ +Feature: Session Namespace + + # TODO_TECHDEBT(@Olshansk, #180): This test requires you to run `make supplier1_stake && make app1_stake` first + # As a shorter workaround, we can also add steps that stake the application and supplier as part of the scenario. + Scenario: Supplier completes claim/proof lifecycle for a valid session + Given the user has the pocketd binary installed + When the supplier "supplier1" has serviced a session with "5" relays for service "svc1" for application "app1" + # TODO_TECHDEBT: Once the session grace period is configurable, set it to 0 at the beginning of this test. + # The timeout for when a claim can be submitted on-chain depends on `createClaimWindowStartHeight`, which + # is a function of `SessionGracePeriod`. The higher this value, the higher this timeout needs to be. Since + # this test is not dependant on the grace period, setting it to 0 and having a lower grace period will simplify it. + And the user should wait for "7" seconds + Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain + # TODO_IMPROVE: And an event should be emitted... + And after the supplier submits a proof for the session for service "svc1" for application "app1" + Then the proof submitted by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain + # TODO_IMPROVE: And an event should be emitted... + +# TODO_BLOCKER(@red-0ne): Make sure to implement and validate this test +# One way to exercise this behavior is to close the `RelayMiner` port to prevent +# the `RelayRequest` from being received and processed then reopen it after the +# the defined number of blocks has passed. +# Scenario: A late Relay inside the SessionGracePeriod is handled +# Given the user has the pocketd binary installed +# And the parameter "NumBlockPerSession" is "4" +# And the parameter "SessionGracePeriod" is "1" +# When the application "app1" sends a relay request to supplier "supplier1" for service "svc1" with session number "1" +# And the supplier "supplier1" waits "5" blocks +# And the supllier "supplier1" calls GetSession and gets session number "2" +# Then the supplier "supplier1" replys with a relay response for service "svc1" for application "app1" with session number "1" +# And the application "app1" receives a successful relay response signed by "supplier1" for session number "1" +# And after the supplier "supplier1" updates a claim for session number "1" for service "svc1" for application "app1" +# Then the claim created by supplier "supplier1" for service "svc1" for application "app1" should be persisted on-chain +# +# Scenario: A late Relay outside the SessionGracePeriod is rejected +# Given the user has the pocketd binary installed +# And the parameter "NumBlockPerSession" is "4" +# And the parameter "SessionGracePeriod" is "1" +# When the application "app1" sends a relay request to supplier "supplier1" for service "svc1" with session number "1" +# And the supplier "supplier1" waits "10" blocks +# And the supllier "supplier1" calls GetSession and gets session number "3" +# Then the supplier "supplier1" replys to application "app1" with a "session mismatch" error relay response +# And the application "app1" receives a failed relay response with a "session mismatch" error +# And the supplier "supplier1" do not update a claim for session number "1" for service "svc1" for application "app1" diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go new file mode 100644 index 000000000..dff132d9c --- /dev/null +++ b/e2e/tests/session_steps_test.go @@ -0,0 +1,226 @@ +//go:build e2e + +package e2e + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + "strings" + "time" + + "cosmossdk.io/depinject" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/testclient" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +const ( + // txEventTimeout is the duration of time to wait after sending a valid tx + // before the test should time out (fail). + txEventTimeout = 10 * time.Second + // txSenderEventSubscriptionQueryFmt is the format string which yields the + // cosmos-sdk event subscription "query" string for a given sender address. + // This is used by an events replay client to subscribe to tx events from the supplier. + // See: https://docs.cosmos.network/v0.47/learn/advanced/events#subscribing-to-events + txSenderEventSubscriptionQueryFmt = "tm.event='Tx' AND message.sender='%s'" + testEventsReplayClientBufferSize = 100 + testServiceId = "anvil" + // eventsReplayClientKey is the suite#scenarioState key for the events replay client + // which is subscribed to tx events where the tx sender is the scenario's supplier. + eventsReplayClientKey = "eventsReplayClientKey" + // preExistingClaimsKey is the suite#scenarioState key for any pre-existing + // claims when querying for all claims prior to running the scenario. + preExistingClaimsKey = "preExistingClaimsKey" + // preExistingProofsKey is the suite#scenarioState key for any pre-existing + // proofs when querying for all proofs prior to running the scenario. + preExistingProofsKey = "preExistingProofsKey" +) + +func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(serviceId, appName string) { + s.waitForMessageAction("/pocket.supplier.MsgCreateClaim") +} + +func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { + ctx := context.Background() + + allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{ + Filter: &suppliertypes.QueryAllClaimsRequest_SupplierAddress{ + SupplierAddress: accNameToAddrMap[supplierName], + }, + }) + require.NoError(s, err) + require.NotNil(s, allClaimsRes) + + // Assert that the number of claims has increased by one. + preExistingClaims, ok := s.scenarioState[preExistingClaimsKey].([]suppliertypes.Claim) + require.True(s, ok, "preExistingClaimsKey not found in scenarioState") + // NB: We are avoiding the use of require.Len here because it provides unreadable output + // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number + // of blocks per session, multiple claims may be created throughout the duration of the test. Until + // these values are appropriately adjusted + require.Greater(s, len(allClaimsRes.Claim), len(preExistingClaims), "number of claims must have increased") + + // TODO_IMPROVE: assert that the root hash of the claim contains the correct + // SMST sum. The sum can be retrieved by parsing the last 8 bytes as a + // binary-encoded uint64; e.g. something like: + // `binary.Uvarint(claim.RootHash[len(claim.RootHash-8):])` + + // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate + // them into the scenarioState key(s). + + claim := allClaimsRes.Claim[0] + require.Equal(s, accNameToAddrMap[supplierName], claim.SupplierAddress) +} + +func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication(supplierName, relayCountStr, serviceId, appName string) { + ctx := context.Background() + + relayCount, err := strconv.Atoi(relayCountStr) + require.NoError(s, err) + + // Query for any existing claims so that we can compare against them in + // future assertions about changes in on-chain claims. + allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{}) + require.NoError(s, err) + s.scenarioState[preExistingClaimsKey] = allClaimsRes.Claim + + // Query for any existing proofs so that we can compare against them in + // future assertions about changes in on-chain proofs. + allProofsRes, err := s.supplierQueryClient.AllProofs(ctx, &suppliertypes.QueryAllProofsRequest{}) + require.NoError(s, err) + s.scenarioState[preExistingProofsKey] = allProofsRes.Proof + + // Construct an events query client to listen for tx events from the supplier. + msgSenderQuery := fmt.Sprintf(txSenderEventSubscriptionQueryFmt, accNameToAddrMap[supplierName]) + + deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) + eventsReplayClient, err := events.NewEventsReplayClient[*abci.TxResult]( + ctx, + deps, + msgSenderQuery, + func(eventBz []byte) (*abci.TxResult, error) { + if strings.Contains(string(eventBz), "jsonrpc") { + return nil, nil + } + + // Unmarshal event data into an ABCI TxResult object. + txResult := &abci.TxResult{} + err = json.Unmarshal(eventBz, txResult) + require.NoError(s, err) + + return txResult, nil + }, + testEventsReplayClientBufferSize, + ) + require.NoError(s, err) + + s.scenarioState[eventsReplayClientKey] = eventsReplayClient + + s.sendRelaysForSession( + appName, + supplierName, + testServiceId, + relayCount, + ) +} + +func (s *suite) AfterTheSupplierSubmitsAProofForTheSessionForServiceForApplication(a string, b string) { + s.waitForMessageAction("/pocket.supplier.MsgSubmitProof") +} + +func (s *suite) TheProofSubmittedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { + ctx := context.Background() + + // Retrieve all on-chain proofs for supplierName + allProofsRes, err := s.supplierQueryClient.AllProofs(ctx, &suppliertypes.QueryAllProofsRequest{ + Filter: &suppliertypes.QueryAllProofsRequest_SupplierAddress{ + SupplierAddress: accNameToAddrMap[supplierName], + }, + }) + require.NoError(s, err) + require.NotNil(s, allProofsRes) + + // Assert that the number of proofs has increased by one. + preExistingProofs, ok := s.scenarioState[preExistingProofsKey].([]suppliertypes.Proof) + require.True(s, ok, "preExistingProofsKey not found in scenarioState") + // NB: We are avoiding the use of require.Len here because it provides unreadable output + // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number + // of blocks per session, multiple proofs may be created throughout the duration of the test. Until + // these values are appropriately adjusted, we assert on an increase in proofs rather than +1. + require.Greater(s, len(allProofsRes.Proof), len(preExistingProofs), "number of proofs must have increased") + + // TODO_UPNEXT(@bryanchriswhite): assert that the root hash of the proof contains the correct + // SMST sum. The sum can be retrieved via the `GetSum` function exposed + // by the SMT. + + // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate + // them into the scenarioState key(s). + + proof := allProofsRes.Proof[0] + require.Equal(s, accNameToAddrMap[supplierName], proof.SupplierAddress) +} + +func (s *suite) sendRelaysForSession( + appName string, + supplierName string, + serviceId string, + relayLimit int, +) { + s.TheApplicationIsStakedForService(appName, serviceId) + s.TheSupplierIsStakedForService(supplierName, serviceId) + s.TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceId, supplierName) + + // TODO_IMPROVE/TODO_COMMUNITY: hard-code a default set of RPC calls to iterate over for coverage. + data := `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}` + + for i := 0; i < relayLimit; i++ { + s.TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, data) + s.TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName, supplierName) + } +} + +// waitForMessageAction waits for an event to be observed which has the given message action. +func (s *suite) waitForMessageAction(action string) { + ctx, done := context.WithCancel(context.Background()) + + eventsReplayClient, ok := s.scenarioState[eventsReplayClientKey].(client.EventsReplayClient[*abci.TxResult]) + require.True(s, ok, "eventsReplayClientKey not found in scenarioState") + require.NotNil(s, eventsReplayClient) + + // For each observed event, **asynchronously** check if it contains the given action. + channel.ForEach[*abci.TxResult]( + ctx, eventsReplayClient.EventsSequence(ctx), + func(_ context.Context, txEvent *abci.TxResult) { + if txEvent == nil { + return + } + + // Range over each event's attributes to find the "action" attribute + // and compare its value to that of the action provided. + for _, event := range txEvent.Result.Events { + for _, attribute := range event.Attributes { + if attribute.Key == "action" { + if attribute.Value == action { + done() + return + } + } + } + } + }, + ) + + select { + case <-time.After(txEventTimeout): + s.Fatalf("timed out waiting for message with action %q", action) + case <-ctx.Done(): + s.Log("Success; message detected before timeout.") + } +} diff --git a/e2e/tests/stake.feature b/e2e/tests/stake.feature new file mode 100644 index 000000000..1171ef3d6 --- /dev/null +++ b/e2e/tests/stake.feature @@ -0,0 +1,25 @@ +Feature: Stake Namespaces + + Scenario: User can stake a Gateway + Given the user has the pocketd binary installed + And the "gateway" for account "gateway1" is not staked + And the account "gateway1" has a balance greater than "1000" uPOKT + When the user stakes a "gateway" with "1000" uPOKT from the account "gateway1" + Then the user should be able to see standard output containing "txhash:" + And the user should be able to see standard output containing "code: 0" + And the pocketd binary should exit without error + And the user should wait for "5" seconds + And the "gateway" for account "gateway1" is staked with "1000" uPOKT + And the account balance of "gateway1" should be "1000" uPOKT "less" than before + + Scenario: User can unstake a Gateway + Given the user has the pocketd binary installed + And the "gateway" for account "gateway1" is staked with "1000" uPOKT + And an account exists for "gateway1" + When the user unstakes a "gateway" from the account "gateway1" + Then the user should be able to see standard output containing "txhash:" + And the user should be able to see standard output containing "code: 0" + And the pocketd binary should exit without error + And the user should wait for "5" seconds + And the "gateway" for account "gateway1" is not staked + And the account balance of "gateway1" should be "1000" uPOKT "more" than before From f7b21872879a12a8aef371d853148ed37199caa3 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 10:53:23 +0100 Subject: [PATCH 21/54] restore: docusaurus --- .../pkg/appgate_server/_category_.json | 8 + .../docs/packages/pkg/appgate_server/main.md | 193 +++++++++ .../docs/packages/pkg/sdk/_category_.json | 8 + docusaurus/docs/packages/pkg/sdk/sdk.md | 365 ++++++++++++++++++ 4 files changed, 574 insertions(+) create mode 100644 docusaurus/docs/packages/pkg/appgate_server/_category_.json create mode 100644 docusaurus/docs/packages/pkg/appgate_server/main.md create mode 100644 docusaurus/docs/packages/pkg/sdk/_category_.json create mode 100644 docusaurus/docs/packages/pkg/sdk/sdk.md diff --git a/docusaurus/docs/packages/pkg/appgate_server/_category_.json b/docusaurus/docs/packages/pkg/appgate_server/_category_.json new file mode 100644 index 000000000..aeee27a8d --- /dev/null +++ b/docusaurus/docs/packages/pkg/appgate_server/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "appgate-server", + "position": 3, + "link": { + "type": "generated-index", + "description": "AppGateServer Documentation" + } +} diff --git a/docusaurus/docs/packages/pkg/appgate_server/main.md b/docusaurus/docs/packages/pkg/appgate_server/main.md new file mode 100644 index 000000000..a103e0c74 --- /dev/null +++ b/docusaurus/docs/packages/pkg/appgate_server/main.md @@ -0,0 +1,193 @@ +--- +title: AppGate Server +sidebar_position: 1 +--- + +# AppGate Server + +- [What is AppGate Server?](#what-is-appgate-server) +- [Architecture Overview](#architecture-overview) + - [Starting the AppGate Server](#starting-the-appgate-server) +- [Application Mode (self\_signing = true)](#application-mode-self_signing--true) + - [Application RPC Request Schema](#application-rpc-request-schema) +- [Gateway Mode (self\_signing = false)](#gateway-mode-self_signing--false) + - [Gateway RPC Request Schema](#gateway-rpc-request-schema) +- [POKTRollSDK integration](#poktrollsdk-integration) + +## What is AppGate Server? + +`AppGate Server` is a ready to use component that allows `Application`s and +`Gateway`s to relay RPC requests to the Pocket Network `Supplier`s without having +to manage the underlying logic of the protocol. + +An operator only needs to specify a single [configuration file](configs/appgate_server_config.md), +in order to run a sovereign `Application` or a `Gateway` via an `AppGate Server`. + +## Architecture Overview + +The following diagram captures a high-level overview of the `AppGate Server`'s message flow. + +```mermaid +flowchart TB + Client([Client]) + AGS(AppGate Server) + SDK[[POKTRollSDK]] + FN[Full Node] + S[Supplier] + + Client -- RPC Request --> AGS + AGS -- RPC Response --> Client + + AGS -..-> |Check Config| Mode{self_signing?} + Mode -. true .-> ApplicationMode(Application Mode) + Mode -. false .-> GatewayMode(Gateway Mode) + + ApplicationMode -- (AppPrivKey, AppAddr, ServiceId) --> SDK + GatewayMode -- (GatewayPrivKey, AppAddr, ServiceId) --> SDK + + SDK <-. Query \n Supplier list .-> FN + SDK <-- RelayRequest \n RelayResponse --> S + SDK -- RPC Response \n (After Signature Verification) --> AGS +``` + +### Starting the AppGate Server + +The `AppGate Server` could be configured to act as a `Gateway` or as a `Application`. + +It can be started by running the following command: + +```bash +poktrolld appgate-server \ + --config \ + --keyring-backend +``` + +Where `` is the path to the `.yaml` [appgate server config file](configs/appgate_server_config.md) +and `` is the backend to use for the keying. See the [cosmos documentation](https://docs.cosmos.network/v0.46/run-node/keyring.html) +for the full available set. + +Launching the `AppGate Server` starts an HTTP server that listens for incoming +RPC requests, and forwards them to the appropriate Pocket Network `Supplier`s. + +It takes care of things such as: + +- Querying and updating the list of `Supplier`s that are allowed to serve the + `Application` for given a `serviceId` during a given `session`. +- Selecting a `Supplier` to send the RPC request to. +- Appending the `Application`/`Gateway` ring-signature to the `RelayRequest` + before sending it to the `Supplier`. +- Sending the `RelayRequest` to the `Supplier`. +- Verifying the `Supplier`'s signature. +- Returning the `RelayResponse` to the requesting client + +## Application Mode (self_signing = true) + +If the [`self_signing`](configs/appgate_server_config.md#self_signing) field is +set to `true`, the `AppGate Server` will act as an `Application`. It will +only serve the address derived from the [`signing_key`](configs/appgate_server_config.md#signing_key). + +`RelayRequests` sent to the `AppGate Server` will be signed with the `signing_key` +resulting in a ring-signature that is only associated with the `Application`'s address. + +:::warning + +The `Application` MUST be sufficiently staked for the service being used as a +pre-requisite for the `AppGate Server` to properly service these requests. + +::: + +### Application RPC Request Schema + +When acting as an `Application`, the `AppGate Server` expects: + +- The `serviceId` to be part of the URL path +- The payload to be the body of the POST request +- The request should be sent to the [`listening_endpoint`](configs/appgate_server_config.md#listening_endpoint) specified in the config file + +The following `curl` command demonstrates how to send a JSON-RPC type request +to the `AppGate Server`: + +```bash +curl -X POST \ + http://:/ \ + -H 'Content-Type: application/json' \ + -d '{ + "jsonrpc": "2.0", + "method": "", + "params": [], + "id": 1 + }' +``` + +## Gateway Mode (self_signing = false) + +If the [`self_signing`](configs/appgate_server_config.md#self_signing) field +is set to `false`, then the `AppGate Server` will act as a `Gateway`, serving +`Application`s that delegated to the `Gateway` address represented by the +[`signing_key`](configs/appgate_server_config.md#signing_key). + +The `AppGate Server` will determine the `Application` address to use by extracting +it from the `senderAddr` query parameter and use it along with the `signing_key` to +generate a ring-signature associated with the `Application`'s and `Gateway`'s address. + +:::warning + +The `Gateway` and `Application` MUST be appropriately staked for this to work +with the `Application` also have sufficient stake to pay for the service in +order for this to work. + +::: + +### Gateway RPC Request Schema + +When acting as an `Gateway`, the `AppGate Server` expects: + +- The `serviceId` to be part of the URL path +- The `payload` to be the body of the POST request +- The `Application` address as a query parameter in the request URL +- The request should be sent to the [`listening_endpoint`](configs/appgate_server_config.md#listening_endpoint) specified in the config file + +The following `curl` command demonstrates how to send a JSON-RPC type request +to the `AppGate Server`: + +```bash +curl -X POST \ + http://:/?senderAddr= \ + -H 'Content-Type: application/json' \ + -d '{ + "jsonrpc": "2.0", + "method": "", + "params": [], + "id": 1 + }' +``` + +## POKTRollSDK integration + +The `AppGate Server` implementation uses the [POKTRollSDK](packages/pkg/sdk/sdk.md) to +interact with the Pocket Network. It can either be used directly or referenced on how +the `POKTRollSDK` can be used with a custom build `Application` / `Gateway`. +RPC requests to the Pocket Network. + +The `AppGate Server`'s own logic is responsible for: + +- Exposing the HTTP server that listens for incoming RPC requests. +- Extracting the `serviceId` and `Application` address from the RPC request. +- Calling `POKTRollSDK.GetSessionSupplierEndpoints` to get the list of `Supplier`s + that are allowed to serve the `Application` at a specific point in time. +- Selecting a `Supplier` to send the RPC request to. +- Calling the `POKTRollSDK.SendRelay` to send the `RelayRequest` to the selected + `Supplier`. +- Verifying and returning the `RelayResponse` to the RPC request sender. + +While `POKTRollSDK` manages: + +- Being up-to-date with the latest `Session`. +- Maintaining the list of `Supplier`s that are allowed to serve the `Application`. +- Forming the `RelayRequest` object. +- Creating the ring-signature for the `RelayRequest`. +- Sending the `RelayRequest` to the `Supplier`. +- Verifying the `Supplier`'s signature. + +A sequence diagram demonstrating the interaction between the `AppGate Server` and +the `POKTRollSDK` can be found in the [POKTRollSDK documentation](packages/pkg/sdk/sdk.md#poktrollsdk-sequence-diagram). diff --git a/docusaurus/docs/packages/pkg/sdk/_category_.json b/docusaurus/docs/packages/pkg/sdk/_category_.json new file mode 100644 index 000000000..4d762f5e6 --- /dev/null +++ b/docusaurus/docs/packages/pkg/sdk/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "sdk", + "position": 3, + "link": { + "type": "generated-index", + "description": "PoktrollSDK General Documentation" + } +} diff --git a/docusaurus/docs/packages/pkg/sdk/sdk.md b/docusaurus/docs/packages/pkg/sdk/sdk.md new file mode 100644 index 000000000..e2cf4e1bf --- /dev/null +++ b/docusaurus/docs/packages/pkg/sdk/sdk.md @@ -0,0 +1,365 @@ +--- +title: POKTRollSDK +sidebar_position: 1 +--- + +# POKTRollSDK + +:::warning + +The `POKTRollSDK` is still in its early stages and it is subject to change. We +will try to keep the changes to a minimum and to keep the community informed of +any changes that could affect the `POKTRollSDK` consumers. + +::: + +- [What is the POKTRollSDK?](#what-is-the-poktrollsdk) +- [Target audience](#target-audience) + - [Applications](#applications) + - [Gateways](#gateways) +- [POKTRollSDK API](#poktrollsdk-api) + - [GetSessionSupplierEndpoints](#getsessionsupplierendpoints) + - [SendRelay](#sendrelay) + - [NewPOKTRollSDK](#newpoktrollsdk) + - [POKTRollSDKConfig](#poktrollsdkconfig) +- [POKTRollSDK usage](#poktrollsdk-usage) + - [Example usage](#example-usage) +- [POKTRollSDK sequence diagram](#poktrollsdk-sequence-diagram) +- [How to contribute](#how-to-contribute) +- [Where to get help](#where-to-get-help) + +## What is the POKTRollSDK? + +`POKTRollSDK` is a package that provides the necessary functionality and tools +to interact with Pocket Network's on-chain actors. Specifically, it provides the +libraries for `Gateway`s and `Application`s to interact with the `Supplier`s of +the Pocket Network that complies with the on-chain protocol specifications. + +Some examples of functionality the `POKTRollSDK` provides is: + +- Maintaining `Application` state and session metadata based on network height. +- Querying and updating the list of `Supplier`s that are allowed to serve the + `Application` based on the service requested. +- Sending relay requests to the selected `Supplier`. +- Appending `Application` signature to the relay requests and verifying `Supplier` + signature on relay responses. + +It lets `Application` and `Gateway` developers easily integrate the Pocket +relaying mechanism into their workflow while leaving room for customization of the +different aspects of the relay request and response lifecycle. + +## Target audience + +`POKTRollSDK` is intended to be used by `Gateway` and `Application` developers +who want to interact with the Pocket Network in a way that complies with the +Pocket Network's protocol. + +### Applications + +`Application`s that want to use the Pocket Network to **permissionlessly** query +the services provided by the network's `Supplier`s. + +Provided that the `Application` is appropriately staked, the `POKTRollSDK` enables +them to directly, without the use of a Gateway `Gateway`s, to query the `Supplier`s. + +The `POKTRollSDK` takes care of the following: + +- Query and maintain the `Application`s latest session based on network height. +- Provides a list of `Supplier`s that are allowed to serve the `Application`. +- Handle signing of `RelayRequest`s. +- Sending the `RelayRequest` to the selected `Supplier`. +- Verifying the `RelayResponse` signature. + +:::note +It is currently up to the `Application` to implement the desired strategy of +selecting the `Supplier` that will be serving them. +::: + +The following diagram shows the different components involved in the case of an +`Application` integrating the `POKTRollSDK` into their workflow. + +```mermaid +flowchart RL + SDK(POKTRollSDK) + App([Application logic]) + Sup[Supplier] + Node[PocketNode] + + subgraph Application runtime + SDK -. Suppliers list .-> App + App <-- Relay Req/Res
(selected Supplier)--> SDK + end + + SDK -. Txs .-> Node + Node -. Session .-> SDK + Node <-. websocket subscription .-> SDK + + SDK <-- Relay Req/Res --> Sup +``` + +### Gateways + +`Gateway`s are services that forward relay requests to `Supplier`s on behalf of +`Application`s. End-users that do not want or cannot run their own `Application` +logic, such as wallets, can use `Gateway`s to interact with the Pocket Network. + +By integrating the `POKTRollSDK` into their workflow, operators can permissionlessly +setup a `Gateway` that complies with the Pocket Network's protocol. + +Provided that a `Gateway` has staked the necessary amount of `POKT`, and that +a staked `Application` has delegated trust to them on-chain, the `Gateway` +can provide the `Application` with additional off-chain services. These can +include but are not limited to: + +- User Authentication +- Off-chain API charges in addition to the on-chain POKT cost for service +- Performance and Quality-of-Service logic to select the best `Supplier` + +The following diagram shows the different components involved in the case of a +`Gateway` integrating the `POKTRollSDK` into their workflow. + +```mermaid +flowchart RL + SDK(POKTRollSDK) + Gate[Gateway] + Sup[Supplier] + Network((Pocket Network)) + Node[PocketNode] + + subgraph Gateway infra + subgraph Gateway runtime + SDK -. Suppliers list .-> Gate + Gate <-- Relay Req/Res --> SDK + end + Node <-. websocket subscription .-> SDK + Node -. Session .-> SDK + end + + Network <-.-> Node + SDK <-- Relay Req/Res --> Sup + +``` + +## POKTRollSDK API + +:::tip +Visit `pkg/sdk/interface.go` for the latest version of the `POKTRollSDK` interface +as documentation can get out of date. +::: + +`POKTRollSDK` consists of an interface that exposes the following methods: + +```go +type POKTRollSDK interface { + GetSessionSupplierEndpoints( + ctx context.Context, + appAddress string, + serviceId string, + ) (session *SessionSuppliers, err error) + + SendRelay( + ctx context.Context, + sessionSupplierEndpoint *SingleSupplierEndpoint, + request *http.Request, + ) (response *servicetypes.RelayResponse, err error) +} +``` + +The interface, its implementation and the relevant types involved could be found +at the following directory [pkg/sdk/](https://github.com/pokt-network/poktroll/blob/main/pkg/sdk) + +```bash +pkg/sdk/ +├── deps_builder.go # Logic for auto-building the dependencies of the SDK +├── errors.go # Errors returned by the SDK +├── interface.go # POKTRollSDK interface +├── relay_verifier.go # Logic to verify relay responses +├── sdk.go # POKTRollSDK implementation and initialization function +├── send_relay.go # Logic to send relay requests +├── session.go # Logic to handle sessions and retrieve the suppliers list +└── urls.go # Helpers to parse the urls used by the SDK to interact with the Pocket Network +``` + +### GetSessionSupplierEndpoints + +_tl;dr Which Supplier can service my application in this session?_ + +`GetSessionSupplierEndpoints` returns a `SessionSuppliers` struct that contains +the fully-hydrated session corresponding to the `appAddress` and `serviceId` +provided and a list of `SingleSupplierEndpoint`s, where each `SingleSupplierEndpoint` +contains the necessary information to send a relay request to the `Supplier` it represents. + +The `POKTRollSDK` consumer is free to run any strategy to select a `Supplier` from +the list returned by the `GetSessionSupplierEndpoints` method. + +### SendRelay + +_tl;dr Send a relay request to a specific Supplier._ + +Once a `Supplier` is selected, the `POKTRollSDK` consumer can then pass the corresponding +`SingleSupplierEndpoint` to the `SendRelay` method which will take care of constructing +the `RelayRequest`, sending it to the `Supplier` and verifying the response signature. + +Once the `RelayRequest` is sent, the `SendRelay` method will wait for the `RelayResponse` +and verify its signature before returning it to the `POKTRollSDK` consumer. + +:::warning + +The error returned by the `SendRelay` only indicates that an error occurred during +the process of sending the `RelayRequest` or verifying the `RelayResponse` signature +and does not indicate errors returned by the `Supplier` or the requested service. +These ones should be available in the `RelayResponse` returned by the `SendRelay` +and the `POKTRollSDK` considers them as valid responses. + +::: + +### NewPOKTRollSDK + +_tl;dr Start a new stateful POKTRollSDK instance._ + +`NewPOKTRollSDK` is the initializing function that returns a fully functional +`POKTRollSDK` implementation given it's provided a valid `POKTRollSDKConfig` +struct which contains the necessary information to build the dependencies of the +`POKTRollSDK` implementation. + +```go +func NewPOKTRollSDK( + ctx context.Context, + config *POKTRollSDKConfig, +) (POKTRollSDK, error) +``` + +### POKTRollSDKConfig + +`POKTRollSDKConfig` is a struct that contains the necessary information to build +the dependencies needed by the `POKTRollSDK` implementation. + +```go +type POKTRollSDKConfig struct { + QueryNodeGRPCUrl *url.URL + QueryNodeUrl *url.URL + PrivateKey cryptotypes.PrivKey + Deps depinject.Config +} +``` + +It consists of the following fields: + +- `QueryNodeGRPCUrl` is the url of the Pocket Node's gRPC endpoint, used to query + the Pocket Network's state for sessions, account information, delegations, etc. +- `QueryNodeUrl` is the url of the Pocket Node's websocket endpoint, used to + subscribe to the Pocket Network's new block events needed to keep the + `POKTRollSDK` session information up to date. +- `PrivateKey` is the private key used to sign the relay requests. It could be + either the `Gateway` or the `Application` private key depending on the use case. +- `Deps` is a `depinject.Config` struct that contains the dependencies needed by + the `POKTRollSDK` implementation. It is used to inject the dependencies into the + `POKTRollSDK` implementation. This field is optional and if not provided, the + `POKTRollSDK` implementation will use the default dependencies. + +## POKTRollSDK usage + +In order to use the `POKTRollSDK` the consumer needs to: + +1. Import the `POKTRollSDK` package +2. Initialize a new `POKTRollSDK` instance by calling the `NewPOKTRollSDK` function + and providing an adequate `POKTRollSDKConfig` struct. +3. Call the `GetSessionSupplierEndpoints` method to get the `SessionSuppliers`. +4. Select a `Supplier` from the list of `SingleSupplierEndpoint`s returned. +5. Call the `SendRelay` method providing the selected `SingleSupplierEndpoint` and + the request to send. + +### Example usage + +:::warning + +The code below is for illustrative purposes only. It shows how `GetSessionSupplierEndpoints` +and `SendRelay` could be used in a simple scenario. It does not show how to handle +errors or how to select a `Supplier` from the list of `SingleSupplierEndpoint`s + +::: + +:::tip + +For a complete integration example, please refer to the [AppGateServer](https://github.com/pokt-network/poktroll/blob/main/pkg/appgateserver) package. + +::: + +```go +package main + +import sdk "github.com/pokt-network/poktroll/pkg/sdk" + +func main() { + + // Build the POKTRollSDKConfig struct + sdkConfig := sdk.POKTRollSDKConfig{ + QueryNodeGRPCUrl grpcURL, + QueryNodeUrl rpcURL + PrivateKey: privateKey, + // Deps are omitted and the default dependencies will be used + } + + // Initialize a new POKTRollSDK instance + poktrollSDK, err := sdk.NewPOKTRollSDK(ctx, &sdkConfig) + + // Get the session and the corresponding list of suppliers + sessionSuppliers, err := poktrollSDK.GetSessionSupplierEndpoints( + ctx, + appAddress, + serviceId, + ) + + // Naively select the first supplier from the list of SingleSupplierEndpoints + selectedSupplier := sessionSuppliers.SuppliersEndpoints[0] + + // Send the request to the selected supplier and wait for the response + response, err := poktrollSDK.SendRelay(ctx, selectedSupplier, httpRequest) +} +``` + +## POKTRollSDK sequence diagram + +The following diagram shows the sequence of events that take place when an `Application` +or a `Gateway` uses the `POKTRollSDK` to interact with the Pocket Network. + +```mermaid +sequenceDiagram + participant GA as Gateway/Application + participant SDK as POKTRollSDK + participant Node as PocketNode + participant Network as PocketNetwork + participant S as Supplier + + loop async network communication + Network -->> Node: Blocks subscription + Node -->> SDK: Event subscription + end + + %% Session Suppliers Retrieval + GA ->> +SDK: GetSessionSupplierEndpoints + SDK ->> +Node: GetSession + Node ->> -SDK: Session + SDK ->> -GA: SessionSuppliers + + %% Relay Propagation + GA ->> +SDK: SendRelay + SDK ->> +S: RelayRequest + S ->> -SDK: RelayResponse + SDK ->> -GA: RelayResponse +``` + +## How to contribute + +If you want to contribute to the `POKTRollSDK` you can take a look at the +[current issues](https://github.com/pokt-network/poktroll/labels/sdk) +and the project's [roadmap](https://github.com/orgs/pokt-network/projects/144) + +Feel free to open a new ticket and add the `sdk` label to it if you find a bug or +have a feature request. + +You can also open a PR if you want to contribute with a new feature or a bug fix. + +## Where to get help + +If you want to discuss the `POKTRollSDK`, you can join the [Pocket Network Discord](https://discord.gg/build-with-grove) server and head to the `#protocol-public` channel. From 988f7f9be8451cb6cc7d2c7af0fecee61a6cb9f4 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 10:54:50 +0100 Subject: [PATCH 22/54] restore: off-chain testutil pkgs --- testutil/testchannel/drain.go | 26 ++ testutil/testclient/keyring.go | 31 ++ testutil/testclient/localnet.go | 88 ++++ testutil/testclient/testblock/client.go | 123 ++++++ testutil/testclient/testblock/godoc.go | 4 + testutil/testclient/testdelegation/client.go | 154 +++++++ testutil/testclient/testdelegation/godoc.go | 5 + testutil/testclient/testeventsquery/client.go | 125 ++++++ .../testclient/testeventsquery/connection.go | 115 +++++ testutil/testclient/testeventsquery/godoc.go | 5 + testutil/testclient/testkeyring/keyring.go | 17 + .../testclient/testqueryclients/accquerier.go | 67 +++ .../testclient/testqueryclients/appquerier.go | 90 ++++ testutil/testclient/testqueryclients/godoc.go | 4 + .../testqueryclients/sessionquerier.go | 101 +++++ .../testqueryclients/supplierquerier.go | 106 +++++ testutil/testclient/testsupplier/client.go | 71 +++ testutil/testclient/testtx/client.go | 95 ++++ testutil/testclient/testtx/context.go | 275 ++++++++++++ testutil/testcrypto/rings/cache.go | 48 ++ testutil/testcrypto/rings/godoc.go | 4 + testutil/testerrors/require.go | 11 + testutil/testproxy/jsonrpc.go | 24 + testutil/testproxy/relayerproxy.go | 409 ++++++++++++++++++ testutil/testrelayer/hash.go | 16 + testutil/testrelayer/miner.go | 34 ++ testutil/testrelayer/options.go | 23 + testutil/testrelayer/proxy.go | 37 ++ testutil/testrelayer/relays.go | 44 ++ testutil/testrelayer/sessions_manager.go | 37 ++ 30 files changed, 2189 insertions(+) create mode 100644 testutil/testchannel/drain.go create mode 100644 testutil/testclient/keyring.go create mode 100644 testutil/testclient/localnet.go create mode 100644 testutil/testclient/testblock/client.go create mode 100644 testutil/testclient/testblock/godoc.go create mode 100644 testutil/testclient/testdelegation/client.go create mode 100644 testutil/testclient/testdelegation/godoc.go create mode 100644 testutil/testclient/testeventsquery/client.go create mode 100644 testutil/testclient/testeventsquery/connection.go create mode 100644 testutil/testclient/testeventsquery/godoc.go create mode 100644 testutil/testclient/testkeyring/keyring.go create mode 100644 testutil/testclient/testqueryclients/accquerier.go create mode 100644 testutil/testclient/testqueryclients/appquerier.go create mode 100644 testutil/testclient/testqueryclients/godoc.go create mode 100644 testutil/testclient/testqueryclients/sessionquerier.go create mode 100644 testutil/testclient/testqueryclients/supplierquerier.go create mode 100644 testutil/testclient/testsupplier/client.go create mode 100644 testutil/testclient/testtx/client.go create mode 100644 testutil/testclient/testtx/context.go create mode 100644 testutil/testcrypto/rings/cache.go create mode 100644 testutil/testcrypto/rings/godoc.go create mode 100644 testutil/testerrors/require.go create mode 100644 testutil/testproxy/jsonrpc.go create mode 100644 testutil/testproxy/relayerproxy.go create mode 100644 testutil/testrelayer/hash.go create mode 100644 testutil/testrelayer/miner.go create mode 100644 testutil/testrelayer/options.go create mode 100644 testutil/testrelayer/proxy.go create mode 100644 testutil/testrelayer/relays.go create mode 100644 testutil/testrelayer/sessions_manager.go diff --git a/testutil/testchannel/drain.go b/testutil/testchannel/drain.go new file mode 100644 index 000000000..4b7ff00a3 --- /dev/null +++ b/testutil/testchannel/drain.go @@ -0,0 +1,26 @@ +package testchannel + +import ( + "time" + + "github.com/pokt-network/poktroll/pkg/observable" +) + +// DrainChannel attempts to receive from the given channel, blocking, until it is +// empty. It returns an error if the channel is not closed by the time it's empty. +// TODO_CONSIDERATION: this function could easily take a timeout parameter and add +// a case which returns an error if the timeout is exceeded. This would prevent +// the case where the channel never stops receiving from looping indefinitely. +func DrainChannel[V any](ch <-chan V) error { + for { + select { + case _, ok := <-ch: + if ok { + continue + } + return nil + case <-time.After(time.Millisecond): + return observable.ErrObserverClosed + } + } +} diff --git a/testutil/testclient/keyring.go b/testutil/testclient/keyring.go new file mode 100644 index 000000000..59d54f908 --- /dev/null +++ b/testutil/testclient/keyring.go @@ -0,0 +1,31 @@ +package testclient + +import ( + "testing" + + cosmoshd "github.com/cosmos/cosmos-sdk/crypto/hd" + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/stretchr/testify/require" +) + +// NewKey creates a new Secp256k1 key and mnemonic for the given name within +// the provided keyring. +func NewKey( + t *testing.T, + name string, + keyring cosmoskeyring.Keyring, +) (key *cosmoskeyring.Record, mnemonic string) { + t.Helper() + + key, mnemonic, err := keyring.NewMnemonic( + name, + cosmoskeyring.English, + "m/44'/118'/0'/0/0", + cosmoskeyring.DefaultBIP39Passphrase, + cosmoshd.Secp256k1, + ) + require.NoError(t, err) + require.NotNil(t, key) + + return key, mnemonic +} diff --git a/testutil/testclient/localnet.go b/testutil/testclient/localnet.go new file mode 100644 index 000000000..6b82f53f3 --- /dev/null +++ b/testutil/testclient/localnet.go @@ -0,0 +1,88 @@ +package testclient + +import ( + "fmt" + "os" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/regen-network/gocuke" + "github.com/spf13/pflag" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" +) + +var ( + // CometLocalTCPURL provides a default URL pointing to the localnet TCP endpoint. + CometLocalTCPURL = "tcp://localhost:36657" + + // CometLocalWebsocketURL provides a default URL pointing to the localnet websocket endpoint. + CometLocalWebsocketURL = "ws://localhost:36657/websocket" + + // EncodingConfig encapsulates encoding configurations for the Pocket application. + EncodingConfig = app.MakeEncodingConfig() +) + +// init initializes the SDK configuration upon package import. +func init() { + cmd.InitSDKConfig() + + // If SEQUENCER_RPC_ENDPOINT environment variable is set, use it to override the default localnet endpoint. + if endpoint := os.Getenv("SEQUENCER_RPC_ENDPOINT"); endpoint != "" { + CometLocalTCPURL = fmt.Sprintf("tcp://%s", endpoint) + CometLocalWebsocketURL = fmt.Sprintf("ws://%s/websocket", endpoint) + } +} + +// NewLocalnetClientCtx creates a client context specifically tailored for localnet +// environments. The returned client context is initialized with encoding +// configurations, a default home directory, a default account retriever, and +// command flags. +// +// Parameters: +// - t: The testing.T instance used for the current test. +// - flagSet: The set of flags to be read for initializing the client context. +// +// Returns: +// - A pointer to a populated client.Context instance suitable for localnet usage. +func NewLocalnetClientCtx(t gocuke.TestingT, flagSet *pflag.FlagSet) *client.Context { + t.Helper() + + homedir := app.DefaultNodeHome + clientCtx := client.Context{}. + WithCodec(EncodingConfig.Marshaler). + WithTxConfig(EncodingConfig.TxConfig). + WithHomeDir(homedir). + WithAccountRetriever(authtypes.AccountRetriever{}). + WithInterfaceRegistry(EncodingConfig.InterfaceRegistry) + + clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, flagSet) + require.NoError(t, err) + return &clientCtx +} + +// NewLocalnetFlagSet creates a set of predefined flags suitable for a localnet +// testing environment. +// +// Parameters: +// - t: The testing.T instance used for the current test. +// +// Returns: +// - A flag set populated with flags tailored for localnet environments. +func NewLocalnetFlagSet(t gocuke.TestingT) *pflag.FlagSet { + t.Helper() + + mockFlagSet := pflag.NewFlagSet("test", pflag.ContinueOnError) + // TODO_IMPROVE: It would be nice if the value could be set correctly based + // on whether the test using it is running in tilt or not. + mockFlagSet.String(flags.FlagNode, CometLocalTCPURL, "use localnet poktrolld node") + mockFlagSet.String(flags.FlagHome, "", "use localnet poktrolld node") + mockFlagSet.String(flags.FlagKeyringBackend, "test", "use test keyring") + err := mockFlagSet.Parse([]string{}) + require.NoError(t, err) + + return mockFlagSet +} diff --git a/testutil/testclient/testblock/client.go b/testutil/testclient/testblock/client.go new file mode 100644 index 000000000..91c1641b5 --- /dev/null +++ b/testutil/testclient/testblock/client.go @@ -0,0 +1,123 @@ +package testblock + +import ( + "context" + "testing" + + "cosmossdk.io/depinject" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/block" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +// NewLocalnetClient creates and returns a new BlockClient that's configured for +// use with the localnet sequencer. +func NewLocalnetClient(ctx context.Context, t *testing.T) client.BlockClient { + t.Helper() + + queryClient := testeventsquery.NewLocalnetClient(t) + require.NotNil(t, queryClient) + + deps := depinject.Supply(queryClient) + bClient, err := block.NewBlockClient(ctx, deps) + require.NoError(t, err) + + return bClient +} + +// NewAnyTimesCommittedBlocksSequenceBlockClient creates a new mock BlockClient. +// This mock BlockClient will expect any number of calls to CommittedBlocksSequence, +// and when that call is made, it returns the given EventsObservable[Block]. +func NewAnyTimesCommittedBlocksSequenceBlockClient( + t *testing.T, + blocksObs observable.Observable[client.Block], +) *mockclient.MockBlockClient { + t.Helper() + + // Create a mock for the block client which expects the LastNBlocks method to be called any number of times. + blockClientMock := NewAnyTimeLastNBlocksBlockClient(t, nil, 0) + + // Set up the mock expectation for the CommittedBlocksSequence method. When + // the method is called, it returns a new replay observable that publishes + // blocks sent on the given blocksPublishCh. + blockClientMock.EXPECT(). + CommittedBlocksSequence(gomock.Any()). + Return(blocksObs). + AnyTimes() + + return blockClientMock +} + +// NewOneTimeCommittedBlocksSequenceBlockClient creates a new mock BlockClient. +// This mock BlockClient will expect a call to CommittedBlocksSequence, and +// when that call is made, it returns a new BlocksObservable that is notified of +// blocks sent on the given blocksPublishCh. +// blocksPublishCh is the channel the caller can use to publish blocks the observable. +func NewOneTimeCommittedBlocksSequenceBlockClient( + t *testing.T, + blocksPublishCh chan client.Block, +) *mockclient.MockBlockClient { + t.Helper() + + // Create a mock for the block client which expects the LastNBlocks method to be called any number of times. + blockClientMock := NewAnyTimeLastNBlocksBlockClient(t, nil, 0) + + // Set up the mock expectation for the CommittedBlocksSequence method. When + // the method is called, it returns a new replay observable that publishes + // blocks sent on the given blocksPublishCh. + blockClientMock.EXPECT().CommittedBlocksSequence( + gomock.AssignableToTypeOf(context.Background()), + ).DoAndReturn(func(ctx context.Context) client.BlockReplayObservable { + // Create a new replay observable with a replay buffer size of 1. Blocks + // are published to this observable via the provided blocksPublishCh. + withPublisherOpt := channel.WithPublisher(blocksPublishCh) + obs, _ := channel.NewReplayObservable[client.Block]( + ctx, 1, withPublisherOpt, + ) + return obs + }) + + return blockClientMock +} + +// NewAnyTimeLastNBlocksBlockClient creates a mock BlockClient that expects +// calls to the LastNBlocks method any number of times. When the LastNBlocks +// method is called, it returns a mock Block with the provided hash and height. +func NewAnyTimeLastNBlocksBlockClient( + t *testing.T, + hash []byte, + height int64, +) *mockclient.MockBlockClient { + t.Helper() + ctrl := gomock.NewController(t) + + // Create a mock block that returns the provided hash and height. + blockMock := NewAnyTimesBlock(t, hash, height) + // Create a mock block client that expects calls to LastNBlocks method and + // returns the mock block. + blockClientMock := mockclient.NewMockBlockClient(ctrl) + blockClientMock.EXPECT().LastNBlocks(gomock.Any(), gomock.Any()).Return([]client.Block{blockMock}).AnyTimes() + + return blockClientMock +} + +// NewAnyTimesBlock creates a mock Block that expects calls to Height and Hash +// methods any number of times. When the methods are called, they return the +// provided height and hash respectively. +func NewAnyTimesBlock(t *testing.T, hash []byte, height int64) *mockclient.MockBlock { + t.Helper() + ctrl := gomock.NewController(t) + + // Create a mock block that returns the provided hash and height AnyTimes. + blockMock := mockclient.NewMockBlock(ctrl) + blockMock.EXPECT().Height().Return(height).AnyTimes() + blockMock.EXPECT().Hash().Return(hash).AnyTimes() + + return blockMock +} diff --git a/testutil/testclient/testblock/godoc.go b/testutil/testclient/testblock/godoc.go new file mode 100644 index 000000000..866bb4f70 --- /dev/null +++ b/testutil/testclient/testblock/godoc.go @@ -0,0 +1,4 @@ +// Package testblock provides helper functions for constructing real (e.g. localnet) +// and mock BlockClient objects with pre-configured and/or parameterized call +// arguments, return value(s), and/or expectations thereof. Intended for use in tests. +package testblock diff --git a/testutil/testclient/testdelegation/client.go b/testutil/testclient/testdelegation/client.go new file mode 100644 index 000000000..4d490e376 --- /dev/null +++ b/testutil/testclient/testdelegation/client.go @@ -0,0 +1,154 @@ +package testdelegation + +import ( + "context" + "fmt" + "testing" + + "cosmossdk.io/depinject" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/delegation" + "github.com/pokt-network/poktroll/pkg/observable" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +// NewLocalnetClient creates and returns a new DelegationClient that's configured for +// use with the localnet sequencer. +func NewLocalnetClient(ctx context.Context, t *testing.T) client.DelegationClient { + t.Helper() + + queryClient := testeventsquery.NewLocalnetClient(t) + require.NotNil(t, queryClient) + + deps := depinject.Supply(queryClient) + dClient, err := delegation.NewDelegationClient(ctx, deps) + require.NoError(t, err) + + return dClient +} + +// NewAnyTimesRedelegationsSequence creates a new mock DelegationClient. +// This mock DelegationClient will expect any number of calls to RedelegationsSequence, +// and when that call is made, it returns the given EventsObservable[Redelegation]. +func NewAnyTimesRedelegationsSequence( + ctx context.Context, + t *testing.T, + appAddress string, + redelegationObs observable.Observable[client.Redelegation], +) *mockclient.MockDelegationClient { + t.Helper() + + // Create a mock for the delegation client which expects the + // LastNRedelegations method to be called any number of times. + delegationClientMock := NewAnyTimeLastNRedelegationsClient(t, appAddress) + + // Set up the mock expectation for the RedelegationsSequence method. When + // the method is called, it returns a new replay observable that publishes + // redelegation events sent on the given redelegationObs. + delegationClientMock.EXPECT(). + RedelegationsSequence(ctx). + Return(redelegationObs). + AnyTimes() + + return delegationClientMock +} + +// NewOneTimeRedelegationsSequenceDelegationClient creates a new mock +// DelegationClient. This mock DelegationClient will expect a call to +// RedelegationsSequence, and when that call is made, it returns a new +// RedelegationReplayObservable that publishes Redelegation events sent on +// the given redelegationPublishCh. +// redelegationPublishCh is the channel the caller can use to publish +// Redelegation events to the observable. +func NewOneTimeRedelegationsSequenceDelegationClient( + ctx context.Context, + t *testing.T, + redelegationPublishCh chan client.Redelegation, +) *mockclient.MockDelegationClient { + t.Helper() + + // Create a mock for the delegation client which expects the + // LastNRedelegations method to be called any number of times. + delegationClientMock := NewAnyTimeLastNRedelegationsClient(t, "") + + // Set up the mock expectation for the RedelegationsSequence method. When + // the method is called, it returns a new replay observable that publishes + // delegation changes sent on the given redelegationPublishCh. + delegationClientMock.EXPECT().RedelegationsSequence(ctx). + DoAndReturn(func(ctx context.Context) client.RedelegationReplayObservable { + // Create a new replay observable with a replay buffer size of 1. + // Redelegation events are published to this observable via the + // provided redelegationPublishCh. + withPublisherOpt := channel.WithPublisher(redelegationPublishCh) + obs, _ := channel.NewReplayObservable[client.Redelegation]( + ctx, 1, withPublisherOpt, + ) + return obs + }).Times(1) + + delegationClientMock.EXPECT().Close().AnyTimes() + + return delegationClientMock +} + +// NewAnyTimeLastNRedelegationsClient creates a mock DelegationClient that +// expects calls to the LastNRedelegations method any number of times. When +// the LastNRedelegations method is called, it returns a mock Redelegation +// with the provided appAddress. +func NewAnyTimeLastNRedelegationsClient( + t *testing.T, + appAddress string, +) *mockclient.MockDelegationClient { + t.Helper() + ctrl := gomock.NewController(t) + + // Create a mock redelegation that returns the provided appAddress + redelegation := NewAnyTimesRedelegation(t, appAddress, "") + // Create a mock delegation client that expects calls to + // LastNRedelegations method and returns the mock redelegation. + delegationClientMock := mockclient.NewMockDelegationClient(ctrl) + delegationClientMock.EXPECT(). + LastNRedelegations(gomock.Any(), gomock.Any()). + Return([]client.Redelegation{redelegation}).AnyTimes() + delegationClientMock.EXPECT().Close().AnyTimes() + + return delegationClientMock +} + +// NewAnyTimesRedelegation creates a mock Redelegation that expects calls +// to the AppAddress method any number of times. When the method is called, it +// returns the provided app address. +func NewAnyTimesRedelegation( + t *testing.T, + appAddress string, + gatewayAddress string, +) *mockclient.MockRedelegation { + t.Helper() + ctrl := gomock.NewController(t) + + // Create a mock redelegation that returns the provided address AnyTimes. + redelegation := mockclient.NewMockRedelegation(ctrl) + redelegation.EXPECT().GetAppAddress().Return(appAddress).AnyTimes() + redelegation.EXPECT().GetGatewayAddress().Return(gatewayAddress).AnyTimes() + + return redelegation +} + +// NewRedelegationEventBytes returns a byte slice containing a JSON string +// that mocks the event bytes returned from the events query client for a +// Redelegation event. +func NewRedelegationEventBytes( + t *testing.T, + appAddress string, + gatewayAddress string, +) []byte { + t.Helper() + jsonTemplate := `{"tx":"SGVsbG8sIHdvcmxkIQ==","result":{"events":[{"type":"message","attributes":[{"key":"action","value":"/pocket.application.MsgDelegateToGateway"},{"key":"sender","value":"pokt1exampleaddress"},{"key":"module","value":"application"}]},{"type":"pocket.application.EventRedelegation","attributes":[{"key":"app_address","value":"\"%s\""},{"key":"gateway_address","value":"\"%s\""}]}]}}` + json := fmt.Sprintf(jsonTemplate, appAddress, gatewayAddress) + return []byte(json) +} diff --git a/testutil/testclient/testdelegation/godoc.go b/testutil/testclient/testdelegation/godoc.go new file mode 100644 index 000000000..4c7e7387d --- /dev/null +++ b/testutil/testclient/testdelegation/godoc.go @@ -0,0 +1,5 @@ +// Package testdelegation provides helper functions for constructing real (e.g. +// localnet) and mock DelegationClient objects with pre-configured and/or +// parameterised call arguments, return value(s), and/or expectations thereof. +// Intended for use in tests. +package testdelegation diff --git a/testutil/testclient/testeventsquery/client.go b/testutil/testclient/testeventsquery/client.go new file mode 100644 index 000000000..3d4251162 --- /dev/null +++ b/testutil/testclient/testeventsquery/client.go @@ -0,0 +1,125 @@ +package testeventsquery + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/events" + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient" +) + +// NewLocalnetClient creates and returns a new events query client that's configured +// for use with the localnet sequencer. Any options provided are applied to the client. +func NewLocalnetClient(t *testing.T, opts ...client.EventsQueryClientOption) client.EventsQueryClient { + t.Helper() + + return events.NewEventsQueryClient(testclient.CometLocalWebsocketURL, opts...) +} + +// NewOneTimeEventsQuery creates a mock of the EventsQueryClient which expects +// a single call to the EventsBytes method. It returns a mock client whose event +// bytes method always constructs a new observable. query is the query string +// for which event bytes subscription is expected to be for. +// The caller can simulate blockchain events by sending on publishCh, the value +// of which is set to the publish channel of the events bytes observable publish +// channel. +func NewOneTimeEventsQuery( + ctx context.Context, + t *testing.T, + query string, + publishChMu *sync.Mutex, + publishCh *chan<- either.Bytes, +) *mockclient.MockEventsQueryClient { + t.Helper() + ctrl := gomock.NewController(t) + + eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) + eventsQueryClient.EXPECT().EventsBytes(gomock.Eq(ctx), gomock.Eq(query)). + DoAndReturn(func( + ctx context.Context, + query string, + ) (eventsBzObservable client.EventsBytesObservable, err error) { + publishChMu.Lock() + eventsBzObservable, *publishCh = channel.NewObservable[either.Bytes]() + publishChMu.Unlock() + return eventsBzObservable, nil + }).Times(1) + return eventsQueryClient +} + +// NewOneTimeTxEventsQueryClient creates a mock of the Events that expects to to +// a single call to the EventsBytes method where the query is for transaction +// events for sender address matching that of the given key. +// The caller can simulate blockchain events by sending on publishCh, the value +// of which is set to the publish channel of the events bytes observable publish +// channel. +func NewOneTimeTxEventsQueryClient( + ctx context.Context, + t *testing.T, + key *cosmoskeyring.Record, + publishChMu *sync.Mutex, + publishCh *chan<- either.Bytes, +) *mockclient.MockEventsQueryClient { + t.Helper() + + signingAddr, err := key.GetAddress() + require.NoError(t, err) + + expectedEventsQuery := fmt.Sprintf( + "tm.event='Tx' AND message.sender='%s'", + signingAddr, + ) + return NewOneTimeEventsQuery( + ctx, t, + expectedEventsQuery, + publishChMu, + publishCh, + ) +} + +// NewAnyTimesEventsBytesEventsQueryClient returns a new events query client which +// is configured to return the expected event bytes when queried with the expected +// query, any number of times. The returned client also expects to be closed once. +func NewAnyTimesEventsBytesEventsQueryClient( + ctx context.Context, + t *testing.T, + expectedQuery string, + expectedEventBytes []byte, +) client.EventsQueryClient { + t.Helper() + + ctrl := gomock.NewController(t) + eventsQueryClient := mockclient.NewMockEventsQueryClient(ctrl) + eventsQueryClient.EXPECT().Close().Times(1) + eventsQueryClient.EXPECT(). + EventsBytes(gomock.AssignableToTypeOf(ctx), gomock.Eq(expectedQuery)). + DoAndReturn( + func(ctx context.Context, query string) (client.EventsBytesObservable, error) { + bytesObsvbl, bytesPublishCh := channel.NewReplayObservable[either.Bytes](ctx, 1) + + // Now that the observable is set up, publish the expected event bytes. + // Only need to send once because it's a ReplayObservable. + bytesPublishCh <- either.Success(expectedEventBytes) + + // Wait a tick for the observables to be set up. This isn't strictly + // necessary but is done to mitigate test flakiness. + time.Sleep(10 * time.Millisecond) + + return bytesObsvbl, nil + }, + ). + AnyTimes() + + return eventsQueryClient +} diff --git a/testutil/testclient/testeventsquery/connection.go b/testutil/testclient/testeventsquery/connection.go new file mode 100644 index 000000000..e51b31a81 --- /dev/null +++ b/testutil/testclient/testeventsquery/connection.go @@ -0,0 +1,115 @@ +package testeventsquery + +import ( + "sync/atomic" + "testing" + + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/testutil/mockclient" +) + +// NewOneTimeMockConnAndDialer returns a new mock connection and mock dialer that +// will return the mock connection when DialContext is called. The mock dialer +// will expect DialContext to be called exactly once. The connection mock will +// expect Close to be called exactly once. +// Callers must mock the Receive method with an EXPECT call before the connection +// mock can be used. +func NewOneTimeMockConnAndDialer(t *testing.T) ( + *mockclient.MockConnection, + *mockclient.MockDialer, +) { + ctrl := gomock.NewController(t) + connMock := mockclient.NewMockConnection(ctrl) + connMock.EXPECT().Close(). + Return(nil). + Times(1) + + dialerMock := NewOneTimeMockDialer(t, either.Success(connMock)) + + return connMock, dialerMock +} + +// NewOneTimeMockDialer returns a mock dialer that will return either the given +// connection mock or error when DialContext is called. The mock dialer will +// expect DialContext to be called exactly once. +func NewOneTimeMockDialer( + t *testing.T, + eitherConnMock either.Either[*mockclient.MockConnection], +) *mockclient.MockDialer { + ctrl := gomock.NewController(t) + dialerMock := mockclient.NewMockDialer(ctrl) + + connMock, err := eitherConnMock.ValueOrError() + dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). + Return(connMock, err). + Times(1) + + return dialerMock +} + +// NewNTimesReconnectMockConnAndDialer returns a new mock connection and mock +// dialer that will return the mock connection when DialContext is called. The +// mock dialer will expect DialContext to be called any times. The connection +// mock will expect Close and Send to be called exactly N times. +func NewNTimesReconnectMockConnAndDialer( + t *testing.T, + n int, + connClosed *atomic.Bool, + delayEvent *atomic.Bool, +) (*mockclient.MockConnection, *mockclient.MockDialer) { + connMock := NewNTimesReconnectConnectionMock(t, n, connClosed, delayEvent) + dialerMock := NewAnyTimesMockDailer(t, connMock) + return connMock, dialerMock +} + +// NewNTimesReconnectConnectionMock returns a mock connection that will expect +// Close and Send to be called exactly N times. The connection mock will set the +// connClosed atomic to true when Close is called and false when Send is called. +// The connection mock will set the delayEvent atomic to false when Send is +// called. This is to allow the caller to subscribe to the first event emitted +func NewNTimesReconnectConnectionMock( + t *testing.T, + n int, + connClosed *atomic.Bool, + delayEvent *atomic.Bool, +) *mockclient.MockConnection { + ctrl := gomock.NewController(t) + connMock := mockclient.NewMockConnection(ctrl) + // Expect the connection to be closed and the dialer to be re-established + connMock.EXPECT(). + Close(). + DoAndReturn(func() error { + connClosed.CompareAndSwap(false, true) + return nil + }). + Times(n) + // Expect the subscription to be re-established any number of times + connMock.EXPECT(). + Send(gomock.Any()). + DoAndReturn(func(eventBz []byte) error { + if connClosed.Load() { + connClosed.CompareAndSwap(true, false) + } + delayEvent.CompareAndSwap(true, false) + return nil + }). + Times(n) + return connMock +} + +// NewAnyTimesMockDailer returns a mock dialer that will return the given +// connection mock when DialContext is called. The mock dialer will expect +// DialContext to be called any number of times. +func NewAnyTimesMockDailer( + t *testing.T, + connMock *mockclient.MockConnection, +) *mockclient.MockDialer { + ctrl := gomock.NewController(t) + dialerMock := mockclient.NewMockDialer(ctrl) + dialerMock.EXPECT().DialContext(gomock.Any(), gomock.Any()). + Return(connMock, nil). + AnyTimes() + return dialerMock +} diff --git a/testutil/testclient/testeventsquery/godoc.go b/testutil/testclient/testeventsquery/godoc.go new file mode 100644 index 000000000..0caa02997 --- /dev/null +++ b/testutil/testclient/testeventsquery/godoc.go @@ -0,0 +1,5 @@ +// Package testeventsquery provides helper functions for constructing real +// (e.g. localnet) and mock EventsQueryClient objects with pre-configured and/or +// parameterized call arguments, return value(s), and/or expectations thereof. +// Intended for use in tests. +package testeventsquery diff --git a/testutil/testclient/testkeyring/keyring.go b/testutil/testclient/testkeyring/keyring.go new file mode 100644 index 000000000..bb83baf88 --- /dev/null +++ b/testutil/testclient/testkeyring/keyring.go @@ -0,0 +1,17 @@ +package testkeyring + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/crypto/keyring" + + "github.com/pokt-network/poktroll/testutil/testclient" +) + +// NewTestKeyringWithKey creates a new in-memory keyring with a test key +// with testSigningKeyName as its name. +func NewTestKeyringWithKey(t *testing.T, keyName string) (keyring.Keyring, *keyring.Record) { + keyring := keyring.NewInMemory(testclient.EncodingConfig.Marshaler) + key, _ := testclient.NewKey(t, keyName, keyring) + return keyring, key +} diff --git a/testutil/testclient/testqueryclients/accquerier.go b/testutil/testclient/testqueryclients/accquerier.go new file mode 100644 index 000000000..6924dc963 --- /dev/null +++ b/testutil/testclient/testqueryclients/accquerier.go @@ -0,0 +1,67 @@ +package testqueryclients + +import ( + "context" + "testing" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/testutil/mockclient" +) + +// addressAccountMap is a map of: +// +// addresses -> public keys. +// +// If an address is not present in the map or if the public key associated +// with an address is nil it is assumed that it does not exist on chain. +var addressAccountMap map[string]cryptotypes.PubKey + +func init() { + addressAccountMap = make(map[string]cryptotypes.PubKey) +} + +// NewTestAccountQueryClient creates a mock of the AccountQueryClient +// which allows the caller to call GetApplication any times and will return +// an application with the given address. +func NewTestAccountQueryClient( + t *testing.T, +) *mockclient.MockAccountQueryClient { + ctrl := gomock.NewController(t) + + accoutQuerier := mockclient.NewMockAccountQueryClient(ctrl) + accoutQuerier.EXPECT().GetAccount(gomock.Any(), gomock.Any()). + DoAndReturn(func( + _ context.Context, + address string, + ) (account accounttypes.AccountI, err error) { + anyPk := (*codectypes.Any)(nil) + if pk, ok := addressAccountMap[address]; ok { + anyPk, err = codectypes.NewAnyWithValue(pk) + if err != nil { + return nil, err + } + } + return &accounttypes.BaseAccount{ + Address: address, + PubKey: anyPk, + }, nil + }). + AnyTimes() + + return accoutQuerier +} + +// addAddressToAccountMap adds the given address to the addressAccountMap +// to mock it "existing" on chain, it will also remove the address from the +// map when the test is cleaned up. +func addAddressToAccountMap(t *testing.T, address string, pubkey cryptotypes.PubKey) { + t.Helper() + addressAccountMap[address] = pubkey + t.Cleanup(func() { + delete(addressAccountMap, address) + }) +} diff --git a/testutil/testclient/testqueryclients/appquerier.go b/testutil/testclient/testqueryclients/appquerier.go new file mode 100644 index 000000000..85432f35c --- /dev/null +++ b/testutil/testclient/testqueryclients/appquerier.go @@ -0,0 +1,90 @@ +package testqueryclients + +import ( + "context" + "testing" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/testutil/mockclient" + apptypes "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// appToGatewayMap is a map of: +// +// applicationAddresses -> list of the app's delegated gateway addresses. +// +// All addresses are assumed to exist on chain. +var appToGatewayMap map[string][]string + +func init() { + appToGatewayMap = make(map[string][]string) +} + +// NewTestApplicationQueryClient creates a mock of the ApplicationQueryClient +// which allows the caller to call GetApplication any times and will return +// an application with the given address. +func NewTestApplicationQueryClient( + t *testing.T, +) *mockclient.MockApplicationQueryClient { + ctrl := gomock.NewController(t) + + applicationQuerier := mockclient.NewMockApplicationQueryClient(ctrl) + applicationQuerier.EXPECT().GetApplication(gomock.Any(), gomock.Any()). + DoAndReturn(func( + _ context.Context, + appAddress string, + ) (application apptypes.Application, err error) { + delegateeAddresses, ok := appToGatewayMap[appAddress] + if !ok { + return apptypes.Application{}, apptypes.ErrAppNotFound + } + return apptypes.Application{ + Address: appAddress, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + { + Service: &sharedtypes.Service{ + Id: "svc1", + Name: "service one", + }, + }, + }, + DelegateeGatewayAddresses: delegateeAddresses, + }, nil + }). + AnyTimes() + + return applicationQuerier +} + +// AddAddressToApplicationMap adds the given address to the addressApplicationMap +// with the given delegated gateways addresses. It also adds it to the +// addressAccountMap so that the account will be deemed to exist on chain. +func AddAddressToApplicationMap( + t *testing.T, + address string, pubkey cryptotypes.PubKey, + delegateeAccounts map[string]cryptotypes.PubKey, +) { + t.Helper() + addAddressToAccountMap(t, address, pubkey) + delegateeAddresses := make([]string, 0) + for delegateeAddress, delegateePubKey := range delegateeAccounts { + delegateeAddresses = append(delegateeAddresses, delegateeAddress) + addAddressToAccountMap(t, delegateeAddress, delegateePubKey) + } + appToGatewayMap[address] = delegateeAddresses + t.Cleanup(func() { + delete(appToGatewayMap, address) + }) +} + +// RemoveAddressFromApplicationMap removes the given address from the +// addressApplicationMap. +func RemoveAddressFromApplicationMap(t *testing.T, address string) { + t.Helper() + delete(appToGatewayMap, address) +} diff --git a/testutil/testclient/testqueryclients/godoc.go b/testutil/testclient/testqueryclients/godoc.go new file mode 100644 index 000000000..4148a0e17 --- /dev/null +++ b/testutil/testclient/testqueryclients/godoc.go @@ -0,0 +1,4 @@ +// Package testqueryclients provides helper functions for contstructing mock +// AccountQueryClient objects parameterized call arguments, return value(s), +// and/or expectations thereof. Intended for use in tests. +package testqueryclients diff --git a/testutil/testclient/testqueryclients/sessionquerier.go b/testutil/testclient/testqueryclients/sessionquerier.go new file mode 100644 index 000000000..c8c24770a --- /dev/null +++ b/testutil/testclient/testqueryclients/sessionquerier.go @@ -0,0 +1,101 @@ +package testqueryclients + +import ( + "context" + "encoding/hex" + "fmt" + "testing" + + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/testutil/mockclient" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// blockHashBz is the []byte representation of the block hash used in the tests. +var blockHashBz []byte + +// sessionsMap is a map of: sessionId -> Session. +// If a sessionId is not present in the map, it implies we have not encountered +// that session yet. +var sessionsMap map[string]*sessiontypes.Session + +func init() { + sessionsMap = make(map[string]*sessiontypes.Session) + + var err error + if blockHashBz, err = hex.DecodeString("1B1051B7BF236FEA13EFA65B6BE678514FA5B6EA0AE9A7A4B68D45F95E4F18E0"); err != nil { + panic(fmt.Errorf("error while trying to decode block hash: %w", err)) + } +} + +// NewTestSessionQueryClient creates a mock of the SessionQueryClient +// which allows the caller to call GetSession any times and will return +// the session matching the app address, serviceID and the blockHeight passed. +func NewTestSessionQueryClient( + t *testing.T, +) *mockclient.MockSessionQueryClient { + ctrl := gomock.NewController(t) + + sessionQuerier := mockclient.NewMockSessionQueryClient(ctrl) + sessionQuerier.EXPECT().GetSession(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn(func( + _ context.Context, + address string, + serviceId string, + blockHeight int64, + ) (session *sessiontypes.Session, err error) { + sessionId, _ := sessionkeeper.GetSessionId(address, serviceId, blockHashBz, blockHeight) + + session, ok := sessionsMap[sessionId] + if !ok { + return nil, fmt.Errorf("error while trying to retrieve a session") + } + + return session, nil + }). + AnyTimes() + + return sessionQuerier +} + +// AddToExistingSessions adds the given session to the sessionsMap to mock it "existing" +// on chain, it will also remove the sessions from the map when the test is cleaned up. +func AddToExistingSessions( + t *testing.T, + appAddress string, + serviceId string, + blockHeight int64, + suppliersAddress []string, +) { + t.Helper() + + sessionId, _ := sessionkeeper.GetSessionId(appAddress, serviceId, blockHashBz, blockHeight) + + session := sessiontypes.Session{ + Header: &sessiontypes.SessionHeader{ + Service: &sharedtypes.Service{Id: serviceId}, + ApplicationAddress: appAddress, + SessionId: sessionId, + SessionStartBlockHeight: sessionkeeper.GetSessionStartBlockHeight(blockHeight), + SessionEndBlockHeight: sessionkeeper.GetSessionEndBlockHeight(blockHeight), + }, + NumBlocksPerSession: sessionkeeper.NumBlocksPerSession, + SessionNumber: sessionkeeper.GetSessionNumber(blockHeight), + SessionId: sessionId, + Suppliers: []*sharedtypes.Supplier{}, + } + + for _, supplierAddress := range suppliersAddress { + supplier := &sharedtypes.Supplier{Address: supplierAddress} + session.Suppliers = append(session.Suppliers, supplier) + } + + sessionsMap[sessionId] = &session + + t.Cleanup(func() { + delete(sessionsMap, sessionId) + }) +} diff --git a/testutil/testclient/testqueryclients/supplierquerier.go b/testutil/testclient/testqueryclients/supplierquerier.go new file mode 100644 index 000000000..6dd6b32b1 --- /dev/null +++ b/testutil/testclient/testqueryclients/supplierquerier.go @@ -0,0 +1,106 @@ +package testqueryclients + +import ( + "context" + "errors" + "testing" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/mockclient" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// suppliersProvidedServicesMap is a map of maps: +// +// supplierAddress -> {service -> []SupplierEndpoint} +// +// If an address is not present in the map it is then assumed that the supplier does +// not exist (has not staked) +var suppliersProvidedServicesMap map[string]map[string][]*sharedtypes.SupplierEndpoint + +func init() { + suppliersProvidedServicesMap = make(map[string]map[string][]*sharedtypes.SupplierEndpoint) +} + +// NewTestSupplierQueryClient creates a mock of the SupplierQueryClient +// which allows the caller to call GetSupplier any times and will return +// an application with the given address. +func NewTestSupplierQueryClient( + t *testing.T, +) *mockclient.MockSupplierQueryClient { + ctrl := gomock.NewController(t) + + supplierQuerier := mockclient.NewMockSupplierQueryClient(ctrl) + supplierQuerier.EXPECT().GetSupplier(gomock.Any(), gomock.Any()). + DoAndReturn(func( + _ context.Context, + address string, + ) (supplier sharedtypes.Supplier, err error) { + supplierProvidedServices, ok := suppliersProvidedServicesMap[address] + if !ok { + return sharedtypes.Supplier{}, errors.New("address not found") + } + + services := []*sharedtypes.SupplierServiceConfig{} + + for serviceId, providedService := range supplierProvidedServices { + serviceConfig := &sharedtypes.SupplierServiceConfig{ + Service: &sharedtypes.Service{ + Id: serviceId, + }, + Endpoints: []*sharedtypes.SupplierEndpoint{}, + } + + for _, endpointConfig := range providedService { + endpoint := &sharedtypes.SupplierEndpoint{ + Url: endpointConfig.Url, + RpcType: endpointConfig.RpcType, + } + serviceConfig.Endpoints = append(serviceConfig.Endpoints, endpoint) + } + + services = append(services, serviceConfig) + } + + return sharedtypes.Supplier{ + Address: address, + Services: services, + }, nil + }). + AnyTimes() + + return supplierQuerier +} + +// AddSupplierWithServiceEndpoints adds the given address and ServiceEndpoints +// to the suppliersProvidedServicesMap to mock it "existing" on chain, +// it will also remove the address from the map when the test is cleaned up. +func AddSuppliersWithServiceEndpoints( + t *testing.T, + address, service string, + endpoints []*sharedtypes.SupplierEndpoint, +) { + t.Helper() + require.NotEmpty(t, endpoints) + + supplier, ok := suppliersProvidedServicesMap[address] + if !ok { + supplier = make(map[string][]*sharedtypes.SupplierEndpoint) + } + + serviceEndpoints, ok := supplier[service] + if !ok { + serviceEndpoints = []*sharedtypes.SupplierEndpoint{} + } + + serviceEndpoints = append(serviceEndpoints, endpoints...) + + supplier[service] = serviceEndpoints + suppliersProvidedServicesMap[address] = supplier + + t.Cleanup(func() { + delete(addressAccountMap, address) + }) +} diff --git a/testutil/testclient/testsupplier/client.go b/testutil/testclient/testsupplier/client.go new file mode 100644 index 000000000..841cfc024 --- /dev/null +++ b/testutil/testclient/testsupplier/client.go @@ -0,0 +1,71 @@ +package testsupplier + +import ( + "context" + "testing" + + "cosmossdk.io/depinject" + "github.com/golang/mock/gomock" + "github.com/pokt-network/smt" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/supplier" + "github.com/pokt-network/poktroll/pkg/client/tx" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient/testtx" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +// NewLocalnetClient creates and returns a new supplier client that connects to +// the localnet sequencer. +func NewLocalnetClient( + t *testing.T, + signingKeyName string, +) client.SupplierClient { + t.Helper() + + txClientOpt := tx.WithSigningKeyName(signingKeyName) + supplierClientOpt := supplier.WithSigningKeyName(signingKeyName) + + txCtx := testtx.NewLocalnetContext(t) + txClient := testtx.NewLocalnetClient(t, txClientOpt) + + deps := depinject.Supply( + txCtx, + txClient, + ) + + supplierClient, err := supplier.NewSupplierClient(deps, supplierClientOpt) + require.NoError(t, err) + return supplierClient +} + +func NewOneTimeClaimProofSupplierClient( + ctx context.Context, + t *testing.T, +) *mockclient.MockSupplierClient { + t.Helper() + + ctrl := gomock.NewController(t) + supplierClientMock := mockclient.NewMockSupplierClient(ctrl) + supplierClientMock.EXPECT(). + CreateClaim( + gomock.Eq(ctx), + gomock.AssignableToTypeOf(sessiontypes.SessionHeader{}), + gomock.AssignableToTypeOf([]byte{}), + ). + Return(nil). + Times(1) + + supplierClientMock.EXPECT(). + SubmitProof( + gomock.Eq(ctx), + gomock.AssignableToTypeOf(sessiontypes.SessionHeader{}), + gomock.AssignableToTypeOf((*smt.SparseMerkleClosestProof)(nil)), + ). + Return(nil). + Times(1) + + return supplierClientMock +} diff --git a/testutil/testclient/testtx/client.go b/testutil/testclient/testtx/client.go new file mode 100644 index 000000000..405c24a2e --- /dev/null +++ b/testutil/testclient/testtx/client.go @@ -0,0 +1,95 @@ +package testtx + +import ( + "context" + "testing" + "time" + + "cosmossdk.io/depinject" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/tx" + "github.com/pokt-network/poktroll/pkg/either" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient/testblock" + "github.com/pokt-network/poktroll/testutil/testclient/testeventsquery" +) + +type signAndBroadcastFn func(context.Context, cosmostypes.Msg) either.AsyncError + +// TODO_CONSIDERATION: functions like these (NewLocalnetXXX) could probably accept +// and return depinject.Config arguments to support shared dependencies. + +// NewLocalnetClient creates and returns a new client for use with the localnet +// sequencer. +func NewLocalnetClient(t *testing.T, opts ...client.TxClientOption) client.TxClient { + t.Helper() + + ctx := context.Background() + txCtx := NewLocalnetContext(t) + eventsQueryClient := testeventsquery.NewLocalnetClient(t) + blockClient := testblock.NewLocalnetClient(ctx, t) + + deps := depinject.Supply( + txCtx, + eventsQueryClient, + blockClient, + ) + + txClient, err := tx.NewTxClient(ctx, deps, opts...) + require.NoError(t, err) + + return txClient +} + +// NewOneTimeDelayedSignAndBroadcastTxClient constructs a mock TxClient with the +// expectation to perform a SignAndBroadcast operation with a specified delay. +func NewOneTimeDelayedSignAndBroadcastTxClient( + t *testing.T, + ctx context.Context, + delay time.Duration, +) *mockclient.MockTxClient { + t.Helper() + + signAndBroadcast := newSignAndBroadcastSucceedsDelayed(delay) + return NewOneTimeSignAndBroadcastTxClient(t, ctx, signAndBroadcast) +} + +// NewOneTimeSignAndBroadcastTxClient constructs a mock TxClient with the +// expectation to perform a SignAndBroadcast operation, which will call and receive +// the return from the given signAndBroadcast function. +func NewOneTimeSignAndBroadcastTxClient( + t *testing.T, + ctx context.Context, + signAndBroadcast signAndBroadcastFn, +) *mockclient.MockTxClient { + t.Helper() + + ctrl := gomock.NewController(t) + + txClient := mockclient.NewMockTxClient(ctrl) + txClient.EXPECT().SignAndBroadcast( + gomock.Eq(ctx), + gomock.Any(), + ).DoAndReturn(signAndBroadcast).Times(1) + + return txClient +} + +// newSignAndBroadcastSucceedsDelayed returns a signAndBroadcastFn that succeeds +// after the given delay. +func newSignAndBroadcastSucceedsDelayed(delay time.Duration) signAndBroadcastFn { + return func(ctx context.Context, msg cosmostypes.Msg) either.AsyncError { + errCh := make(chan error) + + go func() { + time.Sleep(delay) + close(errCh) + }() + + return either.AsyncErr(errCh) + } +} diff --git a/testutil/testclient/testtx/context.go b/testutil/testclient/testtx/context.go new file mode 100644 index 000000000..aa255d650 --- /dev/null +++ b/testutil/testclient/testtx/context.go @@ -0,0 +1,275 @@ +package testtx + +import ( + "context" + "fmt" + "testing" + + "cosmossdk.io/depinject" + abci "github.com/cometbft/cometbft/abci/types" + cometbytes "github.com/cometbft/cometbft/libs/bytes" + cometrpctypes "github.com/cometbft/cometbft/rpc/core/types" + comettypes "github.com/cometbft/cometbft/types" + cosmosclient "github.com/cosmos/cosmos-sdk/client" + cosmostx "github.com/cosmos/cosmos-sdk/client/tx" + cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/client/tx" + txtypes "github.com/pokt-network/poktroll/pkg/client/tx/types" + "github.com/pokt-network/poktroll/testutil/mockclient" + "github.com/pokt-network/poktroll/testutil/testclient" +) + +// NewLocalnetContext creates and returns a new transaction context configured +// for use with the localnet sequencer. +func NewLocalnetContext(t *testing.T) client.TxContext { + t.Helper() + + flagSet := testclient.NewLocalnetFlagSet(t) + clientCtx := testclient.NewLocalnetClientCtx(t, flagSet) + txFactory, err := cosmostx.NewFactoryCLI(*clientCtx, flagSet) + require.NoError(t, err) + require.NotEmpty(t, txFactory) + + deps := depinject.Supply( + *clientCtx, + txFactory, + ) + + txCtx, err := tx.NewTxContext(deps) + require.NoError(t, err) + + return txCtx +} + +// TODO_IMPROVE: these mock constructor helpers could include parameters for the +// "times" (e.g. exact, min, max) values which are passed to their respective +// gomock.EXPECT() method calls (i.e. Times(), MinTimes(), MaxTimes()). +// When implementing such a pattern, be careful about making assumptions about +// correlations between these "times" values and the contexts in which the expected +// methods may be called. + +// NewOneTimeErrTxTimeoutTxContext creates a mock transaction context designed to +// simulate a specific timeout error scenario during transaction broadcasting. +// expectedErrMsg is populated with the same error message which is presented in +// the result from the QueryTx method so that it can be asserted against. +func NewOneTimeErrTxTimeoutTxContext( + t *testing.T, + keyring cosmoskeyring.Keyring, + signingKeyName string, + expectedErrMsg *string, +) *mockclient.MockTxContext { + t.Helper() + + signerKey, err := keyring.Key(signingKeyName) + require.NoError(t, err) + + signerAddr, err := signerKey.GetAddress() + require.NoError(t, err) + + *expectedErrMsg = fmt.Sprintf( + "fee payer address: %s does not exist: unknown address", + signerAddr.String(), + ) + + var expectedTx cometbytes.HexBytes + txCtxMock := NewBaseTxContext( + t, signingKeyName, + keyring, + &expectedTx, + ) + + // intercept #BroadcastTx() call to mock response and prevent actual broadcast + txCtxMock.EXPECT().BroadcastTx(gomock.Any()). + DoAndReturn( + func(txBytes []byte) (*cosmostypes.TxResponse, error) { + var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() + return &cosmostypes.TxResponse{ + Height: 1, + TxHash: expectedTxHash.String(), + }, nil + }, + ).Times(1) + + txCtxMock.EXPECT().QueryTx( + gomock.AssignableToTypeOf(context.Background()), + gomock.AssignableToTypeOf([]byte{}), + gomock.AssignableToTypeOf(false), + ).DoAndReturn( + func( + ctx context.Context, + txHash []byte, + _ bool, + ) (*cometrpctypes.ResultTx, error) { + return &cometrpctypes.ResultTx{ + Hash: txHash, + Height: 1, + TxResult: abci.ResponseDeliverTx{ + Code: 1, + Log: *expectedErrMsg, + Codespace: "test_codespace", + }, + Tx: expectedTx.Bytes(), + }, nil + }, + ) + + return txCtxMock +} + +// NewOneTimeErrCheckTxTxContext creates a mock transaction context to simulate +// a specific error scenario during the ABCI check-tx phase (i.e., during initial +// validation before the transaction is included in the block). +// expectedErrMsg is populated with the same error message which is presented in +// the result from the QueryTx method so that it can be asserted against. +func NewOneTimeErrCheckTxTxContext( + t *testing.T, + keyring cosmoskeyring.Keyring, + signingKeyName string, + expectedErrMsg *string, +) *mockclient.MockTxContext { + t.Helper() + + signerKey, err := keyring.Key(signingKeyName) + require.NoError(t, err) + + signerAddr, err := signerKey.GetAddress() + require.NoError(t, err) + + *expectedErrMsg = fmt.Sprintf( + "fee payer address: %s does not exist: unknown address", + signerAddr.String(), + ) + + var expectedTx cometbytes.HexBytes + txCtxMock := NewBaseTxContext( + t, signingKeyName, + keyring, + &expectedTx, + ) + + // intercept #BroadcastTx() call to mock response and prevent actual broadcast + txCtxMock.EXPECT().BroadcastTx(gomock.Any()). + DoAndReturn( + func(txBytes []byte) (*cosmostypes.TxResponse, error) { + var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() + return &cosmostypes.TxResponse{ + Height: 1, + TxHash: expectedTxHash.String(), + RawLog: *expectedErrMsg, + Code: 1, + Codespace: "test_codespace", + }, nil + }, + ).Times(1) + + return txCtxMock +} + +// NewOneTimeTxTxContext creates a mock transaction context primed to respond with +// a single successful transaction response. +func NewOneTimeTxTxContext( + t *testing.T, + keyring cosmoskeyring.Keyring, + signingKeyName string, + expectedTx *cometbytes.HexBytes, +) *mockclient.MockTxContext { + t.Helper() + + txCtxMock := NewBaseTxContext( + t, signingKeyName, + keyring, + expectedTx, + ) + + // intercept #BroadcastTx() call to mock response and prevent actual broadcast + txCtxMock.EXPECT().BroadcastTx(gomock.Any()). + DoAndReturn( + func(txBytes []byte) (*cosmostypes.TxResponse, error) { + var expectedTxHash cometbytes.HexBytes = comettypes.Tx(txBytes).Hash() + return &cosmostypes.TxResponse{ + Height: 1, + TxHash: expectedTxHash.String(), + }, nil + }, + ).Times(1) + + return txCtxMock +} + +// NewBaseTxContext creates a mock transaction context that's configured to expect +// calls to NewTxBuilder, SignTx, and EncodeTx methods, any number of times. +// EncodeTx is used to intercept the encoded transaction bytes and store them in +// the expectedTx output parameter. Each of these methods proxies to the corresponding +// method on a real transaction context. +func NewBaseTxContext( + t *testing.T, + signingKeyName string, + keyring cosmoskeyring.Keyring, + expectedTx *cometbytes.HexBytes, +) *mockclient.MockTxContext { + t.Helper() + + txCtxMock, txCtx := NewAnyTimesTxTxContext(t, keyring) + txCtxMock.EXPECT().NewTxBuilder(). + DoAndReturn(txCtx.NewTxBuilder). + AnyTimes() + txCtxMock.EXPECT().SignTx( + gomock.Eq(signingKeyName), + gomock.AssignableToTypeOf(txCtx.NewTxBuilder()), + gomock.Eq(false), gomock.Eq(false), + ).DoAndReturn(txCtx.SignTx).AnyTimes() + txCtxMock.EXPECT().EncodeTx(gomock.Any()). + DoAndReturn( + func(txBuilder cosmosclient.TxBuilder) (_ []byte, err error) { + // intercept cosmosTxContext#EncodeTx to get the encoded tx cometbytes + *expectedTx, err = txCtx.EncodeTx(txBuilder) + require.NoError(t, err) + return expectedTx.Bytes(), nil + }, + ).AnyTimes() + + return txCtxMock +} + +// NewAnyTimesTxTxContext initializes a mock transaction context that's configured to allow +// arbitrary calls to certain predefined interactions, primarily concerning the retrieval +// of account numbers and sequences. +func NewAnyTimesTxTxContext( + t *testing.T, + keyring cosmoskeyring.Keyring, +) (*mockclient.MockTxContext, client.TxContext) { + t.Helper() + + var ( + ctrl = gomock.NewController(t) + flagSet = testclient.NewLocalnetFlagSet(t) + ) + + // intercept #GetAccountNumberSequence() call to mock response and prevent actual query + accountRetrieverMock := mockclient.NewMockAccountRetriever(ctrl) + accountRetrieverMock.EXPECT().GetAccountNumberSequence(gomock.Any(), gomock.Any()). + Return(uint64(1), uint64(1), nil). + AnyTimes() + + clientCtx := testclient.NewLocalnetClientCtx(t, flagSet). + WithKeyring(keyring). + WithAccountRetriever(accountRetrieverMock) + + txFactory, err := cosmostx.NewFactoryCLI(clientCtx, flagSet) + require.NoError(t, err) + require.NotEmpty(t, txFactory) + + txClientCtx := txtypes.Context(clientCtx) + txCtxDeps := depinject.Supply(txFactory, txClientCtx) + txCtx, err := tx.NewTxContext(txCtxDeps) + require.NoError(t, err) + txCtxMock := mockclient.NewMockTxContext(ctrl) + txCtxMock.EXPECT().GetKeyring().Return(keyring).AnyTimes() + + return txCtxMock, txCtx +} diff --git a/testutil/testcrypto/rings/cache.go b/testutil/testcrypto/rings/cache.go new file mode 100644 index 000000000..ef25eb21b --- /dev/null +++ b/testutil/testcrypto/rings/cache.go @@ -0,0 +1,48 @@ +package testrings + +import ( + "context" + "testing" + + "cosmossdk.io/depinject" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/crypto" + "github.com/pokt-network/poktroll/pkg/crypto/rings" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/testutil/mockclient" +) + +// NewRingCacheWithMockDependencies creates a new "real" RingCache with the given +// mock Account and Application queriers supplied as dependencies. A Delegation +// client is required as a dependency and depending on how it is used will +// require a different function to generate the delegations client. +// The queriers are expected to maintain their respective mocked states: +// - Account querier: the account addresses and public keys +// - Application querier: the application addresses delegatee gateway addresses +// +// See: +// +// testutil/testclient/testqueryclients/accquerier.go +// testutil/testclient/testqueryclients/appquerier.go +// testutil/testclient/testdelegation/client.go +// +// for methods to create these queriers and maintain their states. +func NewRingCacheWithMockDependencies( + ctx context.Context, + t *testing.T, + accQuerier *mockclient.MockAccountQueryClient, + appQuerier *mockclient.MockApplicationQueryClient, + delegationClient *mockclient.MockDelegationClient, +) crypto.RingCache { + t.Helper() + + // Create the dependency injector with the mock queriers + logger := polylog.Ctx(ctx) + deps := depinject.Supply(logger, accQuerier, appQuerier, delegationClient) + + ringCache, err := rings.NewRingCache(deps) + require.NoError(t, err) + + return ringCache +} diff --git a/testutil/testcrypto/rings/godoc.go b/testutil/testcrypto/rings/godoc.go new file mode 100644 index 000000000..3d1e8f2c8 --- /dev/null +++ b/testutil/testcrypto/rings/godoc.go @@ -0,0 +1,4 @@ +// Package testrings provides helper functions for constructing real (e.g. localnet) +// and mock RingCache objects with pre-configured and/or parameterized call +// arguments, return value(s), and/or expectations thereof. Intended for use in tests. +package testrings diff --git a/testutil/testerrors/require.go b/testutil/testerrors/require.go new file mode 100644 index 000000000..624cdaf6e --- /dev/null +++ b/testutil/testerrors/require.go @@ -0,0 +1,11 @@ +package testerrors + +import errorsmod "cosmossdk.io/errors" + +var ( + // ErrAsync is returned when a test assertion fails in a goroutine other than + // the main test goroutine. This is done to avoid concurrent usage of + // t.Fatal() which can cause the test binary to exit before cleanup is complete. + ErrAsync = errorsmod.Register(codespace, 1, "required assertion failed") + codespace = "testerrors" +) diff --git a/testutil/testproxy/jsonrpc.go b/testutil/testproxy/jsonrpc.go new file mode 100644 index 000000000..7aace4f30 --- /dev/null +++ b/testutil/testproxy/jsonrpc.go @@ -0,0 +1,24 @@ +package testproxy + +// JSONRpcError is the error struct for the JSON RPC response +type JSONRpcError struct { + Code int32 `json:"code"` + Message string `json:"message"` +} + +// JSONRpcErrorReply is the error reply struct for the JSON RPC response +type JSONRpcErrorReply struct { + Id int32 `json:"id"` + Jsonrpc string `json:"jsonrpc"` + Error *JSONRpcError +} + +// prepareJsonRPCResponsePayload prepares a hard-coded JsonRPC payload for a specific response. +func prepareJsonRPCResponsePayload() []byte { + return []byte(`{"jsonrpc":"2.0","id":1,"result":"some result"}`) +} + +// PrepareJsonRPCRequestPayload prepares a hard-coded JsonRPC payload for a specific request. +func PrepareJsonRPCRequestPayload() []byte { + return []byte(`{"method":"someMethod","id":1,"jsonrpc":"2.0","params":["someParam"]}`) +} diff --git a/testutil/testproxy/relayerproxy.go b/testutil/testproxy/relayerproxy.go new file mode 100644 index 000000000..ba1101abf --- /dev/null +++ b/testutil/testproxy/relayerproxy.go @@ -0,0 +1,409 @@ +package testproxy + +import ( + "bytes" + "context" + "encoding/hex" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "testing" + + "cosmossdk.io/depinject" + ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" + ringtypes "github.com/athanorlabs/go-dleq/types" + keyringtypes "github.com/cosmos/cosmos-sdk/crypto/keyring" + secp256k1 "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + "github.com/noot/ring-go" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/client" + "github.com/pokt-network/poktroll/pkg/observable/channel" + "github.com/pokt-network/poktroll/pkg/polylog" + "github.com/pokt-network/poktroll/pkg/relayer/config" + "github.com/pokt-network/poktroll/pkg/signer" + "github.com/pokt-network/poktroll/testutil/testclient/testblock" + "github.com/pokt-network/poktroll/testutil/testclient/testdelegation" + testkeyring "github.com/pokt-network/poktroll/testutil/testclient/testkeyring" + "github.com/pokt-network/poktroll/testutil/testclient/testqueryclients" + testrings "github.com/pokt-network/poktroll/testutil/testcrypto/rings" + servicetypes "github.com/pokt-network/poktroll/x/service/types" + sessionkeeper "github.com/pokt-network/poktroll/x/session/keeper" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +// TestBehavior is a struct that holds the test context and mocks +// for the relayer proxy tests. +// It is used to provide the context needed by the instrumentation functions +// in order to isolate specific execution paths of the subject under test. +type TestBehavior struct { + ctx context.Context + t *testing.T + // Deps is exported so it can be used by the dependency injection framework + // from the pkg/relayer/proxy/proxy_test.go + Deps depinject.Config + + proxiedServices map[string]*http.Server +} + +// blockHeight is the default block height used in the tests. +const blockHeight = 1 + +// blockHashBz is the []byte representation of the block hash used in the tests. +var blockHashBz []byte + +func init() { + var err error + if blockHashBz, err = hex.DecodeString("1B1051B7BF236FEA13EFA65B6BE678514FA5B6EA0AE9A7A4B68D45F95E4F18E0"); err != nil { + panic(fmt.Errorf("error while trying to decode block hash: %w", err)) + } +} + +// NewRelayerProxyTestBehavior creates a TestBehavior with the provided set of +// behavior function that are used to instrument the tested subject's dependencies +// and isolate specific execution pathways. +func NewRelayerProxyTestBehavior( + ctx context.Context, + t *testing.T, + behaviors ...func(*TestBehavior), +) *TestBehavior { + test := &TestBehavior{ + ctx: ctx, + t: t, + proxiedServices: make(map[string]*http.Server), + } + + for _, behavior := range behaviors { + behavior(test) + } + + return test +} + +// WithRelayerProxyDependenciesForBlockHeight creates the dependencies for the relayer proxy +// from the TestBehavior.mocks so they have the right interface and can be +// used by the dependency injection framework. +// blockHeight being the block height that will be returned by the block client's +// LastNBlock method +func WithRelayerProxyDependenciesForBlockHeight( + keyName string, + blockHeight int64, +) func(*TestBehavior) { + return func(test *TestBehavior) { + logger := polylog.Ctx(test.ctx) + accountQueryClient := testqueryclients.NewTestAccountQueryClient(test.t) + applicationQueryClient := testqueryclients.NewTestApplicationQueryClient(test.t) + sessionQueryClient := testqueryclients.NewTestSessionQueryClient(test.t) + supplierQueryClient := testqueryclients.NewTestSupplierQueryClient(test.t) + + blockClient := testblock.NewAnyTimeLastNBlocksBlockClient(test.t, []byte{}, blockHeight) + keyring, _ := testkeyring.NewTestKeyringWithKey(test.t, keyName) + + redelegationObs, _ := channel.NewReplayObservable[client.Redelegation](test.ctx, 1) + delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(test.ctx, test.t, "", redelegationObs) + ringCache := testrings.NewRingCacheWithMockDependencies(test.ctx, test.t, accountQueryClient, applicationQueryClient, delegationClient) + + deps := depinject.Supply( + logger, + accountQueryClient, + ringCache, + blockClient, + sessionQueryClient, + supplierQueryClient, + keyring, + ) + + test.Deps = deps + } +} + +// WithRelayerProxiedServices creates the services that the relayer proxy will +// proxy requests to. +// It creates an HTTP server for each service and starts listening on the +// provided host. +func WithRelayerProxiedServices( + proxiedServices map[string]*config.RelayMinerProxyConfig, +) func(*TestBehavior) { + return func(test *TestBehavior) { + for _, proxy := range proxiedServices { + for serviceId, service := range proxy.Suppliers { + server := &http.Server{Addr: service.ServiceConfig.Url.Host} + server.Handler = http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.Write(prepareJsonRPCResponsePayload()) + }) + go func() { server.ListenAndServe() }() + go func() { + <-test.ctx.Done() + server.Shutdown(test.ctx) + }() + + test.proxiedServices[serviceId] = server + } + } + } +} + +// WithDefaultSupplier creates the default staked supplier for the test +func WithDefaultSupplier( + supplierKeyName string, + supplierEndpoints map[string][]*sharedtypes.SupplierEndpoint, +) func(*TestBehavior) { + return func(test *TestBehavior) { + var keyring keyringtypes.Keyring + + err := depinject.Inject(test.Deps, &keyring) + require.NoError(test.t, err) + + supplierAccount, err := keyring.Key(supplierKeyName) + require.NoError(test.t, err) + + supplierAccAddress, err := supplierAccount.GetAddress() + require.NoError(test.t, err) + + supplierAddress := supplierAccAddress.String() + + for serviceId, endpoints := range supplierEndpoints { + testqueryclients.AddSuppliersWithServiceEndpoints( + test.t, + supplierAddress, + serviceId, + endpoints, + ) + } + } +} + +// WithDefaultApplication creates the default staked application actor for the test +func WithDefaultApplication(appPrivateKey *secp256k1.PrivKey) func(*TestBehavior) { + return func(test *TestBehavior) { + appPubKey := appPrivateKey.PubKey() + appAddress := GetAddressFromPrivateKey(test, appPrivateKey) + delegateeAccounts := map[string]cryptotypes.PubKey{} + + testqueryclients.AddAddressToApplicationMap( + test.t, + appAddress, + appPubKey, + delegateeAccounts, + ) + } +} + +// WithDefaultSessionSupplier adds the default staked supplier to the +// application's current session +// If the supplierKeyName is empty, the supplier will not be staked so we can +// test the case where the supplier is not in the application's session's supplier list. +func WithDefaultSessionSupplier( + supplierKeyName string, + serviceId string, + appPrivateKey *secp256k1.PrivKey, +) func(*TestBehavior) { + return func(test *TestBehavior) { + if supplierKeyName == "" { + return + } + + appAddress := GetAddressFromPrivateKey(test, appPrivateKey) + + sessionSuppliers := []string{} + var keyring keyringtypes.Keyring + err := depinject.Inject(test.Deps, &keyring) + require.NoError(test.t, err) + + supplierAccount, err := keyring.Key(supplierKeyName) + require.NoError(test.t, err) + + supplierAccAddress, err := supplierAccount.GetAddress() + require.NoError(test.t, err) + + supplierAddress := supplierAccAddress.String() + sessionSuppliers = append(sessionSuppliers, supplierAddress) + + testqueryclients.AddToExistingSessions( + test.t, + appAddress, + serviceId, + blockHeight, + sessionSuppliers, + ) + } +} + +// WithSuccessiveSessions creates sessions with SessionNumber 0 through SessionCount -1 +// and adds all of them to the sessionMap. +// Each session is configured for the same serviceId and application provided. +func WithSuccessiveSessions( + supplierKeyName string, + serviceId string, + appPrivateKey *secp256k1.PrivKey, + sessionsCount int, +) func(*TestBehavior) { + return func(test *TestBehavior) { + appAddress := GetAddressFromPrivateKey(test, appPrivateKey) + + sessionSuppliers := []string{} + var keyring keyringtypes.Keyring + err := depinject.Inject(test.Deps, &keyring) + require.NoError(test.t, err) + + supplierAccount, err := keyring.Key(supplierKeyName) + require.NoError(test.t, err) + + supplierAccAddress, err := supplierAccount.GetAddress() + require.NoError(test.t, err) + + supplierAddress := supplierAccAddress.String() + sessionSuppliers = append(sessionSuppliers, supplierAddress) + + // Adding `sessionCount` sessions to the sessionsMap to make them available + // to the MockSessionQueryClient. + for i := 0; i < sessionsCount; i++ { + testqueryclients.AddToExistingSessions( + test.t, + appAddress, + serviceId, + sessionkeeper.NumBlocksPerSession*int64(i), + sessionSuppliers, + ) + } + } +} + +// TODO_TECHDEBT(@red-0ne): This function only supports JSON-RPC requests and +// needs to have its http.Request "Content-Type" header passed-in as a parameter +// and take out the GetRelayResponseError function which parses JSON-RPC responses +// to make it RPC-type agnostic. + +// MarshalAndSend marshals the request and sends it to the provided service. +func MarshalAndSend( + test *TestBehavior, + proxiedServices map[string]*config.RelayMinerProxyConfig, + proxyServeName string, + serviceId string, + request *servicetypes.RelayRequest, +) (errCode int32, errorMessage string) { + reqBz, err := request.Marshal() + require.NoError(test.t, err) + + var scheme string + switch proxiedServices[proxyServeName].Type { + case config.ProxyTypeHTTP: + scheme = "http" + default: + require.FailNow(test.t, "unsupported proxy type") + } + + reader := io.NopCloser(bytes.NewReader(reqBz)) + req := &http.Request{ + Method: http.MethodPost, + Header: http.Header{ + "Content-Type": []string{"application/json"}, + }, + URL: &url.URL{Scheme: scheme, Host: proxiedServices[proxyServeName].Host}, + Host: proxiedServices[proxyServeName].Suppliers[serviceId].Hosts[0], + Body: reader, + } + res, err := http.DefaultClient.Do(req) + require.NoError(test.t, err) + require.NotNil(test.t, res) + + return GetRelayResponseError(test.t, res) +} + +// GetRelayResponseError returns the error code and message from the relay response. +// If the response is not an error, it returns `0, ""`. +func GetRelayResponseError(t *testing.T, res *http.Response) (errCode int32, errMsg string) { + responseBody, err := io.ReadAll(res.Body) + require.NoError(t, err) + + relayResponse := &servicetypes.RelayResponse{} + err = relayResponse.Unmarshal(responseBody) + if err != nil { + return 0, "cannot unmarshal request body" + } + + var payload JSONRpcErrorReply + err = json.Unmarshal(relayResponse.Payload, &payload) + if err != nil { + return 0, "cannot unmarshal request payload" + } + + if payload.Error == nil { + return 0, "" + } + + return payload.Error.Code, payload.Error.Message +} + +// GetApplicationRingSignature crafts a ring signer for test purposes and uses +// it to sign the relay request +func GetApplicationRingSignature( + t *testing.T, + req *servicetypes.RelayRequest, + appPrivateKey *secp256k1.PrivKey, +) []byte { + publicKey := appPrivateKey.PubKey() + curve := ring_secp256k1.NewCurve() + + point, err := curve.DecodeToPoint(publicKey.Bytes()) + require.NoError(t, err) + + // At least two points are required to create a ring signer so we are reusing + // the same key for it + points := []ringtypes.Point{point, point} + pointsRing, err := ring.NewFixedKeyRingFromPublicKeys(curve, points) + require.NoError(t, err) + + scalar, err := curve.DecodeToScalar(appPrivateKey.Bytes()) + require.NoError(t, err) + + signer := signer.NewRingSigner(pointsRing, scalar) + + signableBz, err := req.GetSignableBytesHash() + require.NoError(t, err) + + signature, err := signer.Sign(signableBz) + require.NoError(t, err) + + return signature +} + +// GetAddressFromPrivateKey returns the address of the provided private key +func GetAddressFromPrivateKey(test *TestBehavior, privKey *secp256k1.PrivKey) string { + addressBz := privKey.PubKey().Address() + address, err := bech32.ConvertAndEncode("pokt", addressBz) + require.NoError(test.t, err) + return address +} + +// GenerateRelayRequest generates a relay request with the provided parameters +func GenerateRelayRequest( + test *TestBehavior, + privKey *secp256k1.PrivKey, + serviceId string, + blockHeight int64, + payload []byte, +) *servicetypes.RelayRequest { + appAddress := GetAddressFromPrivateKey(test, privKey) + sessionId, _ := sessionkeeper.GetSessionId(appAddress, serviceId, blockHashBz, blockHeight) + + return &servicetypes.RelayRequest{ + Meta: &servicetypes.RelayRequestMetadata{ + SessionHeader: &sessiontypes.SessionHeader{ + ApplicationAddress: appAddress, + SessionId: string(sessionId[:]), + Service: &sharedtypes.Service{Id: serviceId}, + SessionStartBlockHeight: sessionkeeper.GetSessionStartBlockHeight(blockHeight), + SessionEndBlockHeight: sessionkeeper.GetSessionEndBlockHeight(blockHeight), + }, + // The returned relay is unsigned and must be signed elsewhere for functionality + Signature: []byte(""), + }, + Payload: payload, + } +} diff --git a/testutil/testrelayer/hash.go b/testutil/testrelayer/hash.go new file mode 100644 index 000000000..d8c78e64e --- /dev/null +++ b/testutil/testrelayer/hash.go @@ -0,0 +1,16 @@ +package testrelayer + +import ( + "hash" + "testing" + + "github.com/stretchr/testify/require" +) + +// TODO_TECHDEBT(@h5law): Retrieve the relay hasher mechanism from the `smt` repo. +func HashBytes(t *testing.T, newHasher func() hash.Hash, relayBz []byte) []byte { + hasher := newHasher() + _, err := hasher.Write(relayBz) + require.NoError(t, err) + return hasher.Sum(nil) +} diff --git a/testutil/testrelayer/miner.go b/testutil/testrelayer/miner.go new file mode 100644 index 000000000..2a73c865c --- /dev/null +++ b/testutil/testrelayer/miner.go @@ -0,0 +1,34 @@ +package testrelayer + +import ( + "context" + "testing" + + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/testutil/mockrelayer" +) + +// NewMockOneTimeMiner creates a new mock Miner. This mock Miner will expect a +// call to MinedRelays with the given context and expectedRelayObs args. When +// that call is made, returnedMinedRelaysObs is returned. +func NewMockOneTimeMiner( + ctx context.Context, + t *testing.T, + expectedRelaysObs relayer.RelaysObservable, + returnedMinedRelaysObs relayer.MinedRelaysObservable, +) *mockrelayer.MockMiner { + t.Helper() + + ctrl := gomock.NewController(t) + minerMock := mockrelayer.NewMockMiner(ctrl) + minerMock.EXPECT(). + MinedRelays( + gomock.Eq(ctx), + gomock.Eq(expectedRelaysObs), + ). + Return(returnedMinedRelaysObs). + Times(1) + return minerMock +} diff --git a/testutil/testrelayer/options.go b/testutil/testrelayer/options.go new file mode 100644 index 000000000..a63518293 --- /dev/null +++ b/testutil/testrelayer/options.go @@ -0,0 +1,23 @@ +package testrelayer + +import ( + "fmt" + "os" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/session" +) + +func WithTempStoresDirectory(t *testing.T) relayer.RelayerSessionsManagerOption { + tmpDirPattern := fmt.Sprintf("%s_smt_kvstore", t.Name()) + tmpStoresDir, err := os.MkdirTemp("", tmpDirPattern) + require.NoError(t, err) + + // Delete all temporary files and directories created by the test on completion. + t.Cleanup(func() { _ = os.RemoveAll(tmpStoresDir) }) + + return session.WithStoresDirectory(tmpStoresDir) +} diff --git a/testutil/testrelayer/proxy.go b/testutil/testrelayer/proxy.go new file mode 100644 index 000000000..a876ebec3 --- /dev/null +++ b/testutil/testrelayer/proxy.go @@ -0,0 +1,37 @@ +package testrelayer + +import ( + "context" + "testing" + + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/testutil/mockrelayer" +) + +// NewMockOneTimeRelayerProxy creates a new mock RelayerProxy. This mock +// RelayerProxy will expect a call to ServedRelays with the given context, and +// when that call is made, returnedRelaysObs is returned. It also expects a call +// to Start and Stop with the given context. +func NewMockOneTimeRelayerProxy( + ctx context.Context, + t *testing.T, + returnedRelaysObs relayer.RelaysObservable, +) *mockrelayer.MockRelayerProxy { + t.Helper() + + ctrl := gomock.NewController(t) + relayerProxyMock := mockrelayer.NewMockRelayerProxy(ctrl) + relayerProxyMock.EXPECT(). + Start(gomock.Eq(ctx)). + Times(1) + relayerProxyMock.EXPECT(). + Stop(gomock.Eq(ctx)). + Times(1) + relayerProxyMock.EXPECT(). + ServedRelays(). + Return(returnedRelaysObs). + Times(1) + return relayerProxyMock +} diff --git a/testutil/testrelayer/relays.go b/testutil/testrelayer/relays.go new file mode 100644 index 000000000..53ddbadc2 --- /dev/null +++ b/testutil/testrelayer/relays.go @@ -0,0 +1,44 @@ +package testrelayer + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/pkg/relayer/miner" + servicetypes "github.com/pokt-network/poktroll/x/service/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" +) + +// NewMinedRelay returns a new mined relay with the given session start and end +// heights on the session header, and the bytes and hash fields populated. +func NewMinedRelay( + t *testing.T, + sessionStartHeight int64, + sessionEndHeight int64, +) *relayer.MinedRelay { + relay := servicetypes.Relay{ + Req: &servicetypes.RelayRequest{ + Meta: &servicetypes.RelayRequestMetadata{ + SessionHeader: &sessiontypes.SessionHeader{ + SessionStartBlockHeight: sessionStartHeight, + SessionEndBlockHeight: sessionEndHeight, + }, + }, + }, + Res: &servicetypes.RelayResponse{}, + } + + // TODO_BLOCKER: use canonical codec to serialize the relay + relayBz, err := relay.Marshal() + require.NoError(t, err) + + relayHash := HashBytes(t, miner.DefaultRelayHasher, relayBz) + + return &relayer.MinedRelay{ + Relay: relay, + Bytes: relayBz, + Hash: relayHash, + } +} diff --git a/testutil/testrelayer/sessions_manager.go b/testutil/testrelayer/sessions_manager.go new file mode 100644 index 000000000..b65e0a191 --- /dev/null +++ b/testutil/testrelayer/sessions_manager.go @@ -0,0 +1,37 @@ +package testrelayer + +import ( + "context" + "testing" + + "github.com/golang/mock/gomock" + + "github.com/pokt-network/poktroll/pkg/relayer" + "github.com/pokt-network/poktroll/testutil/mockrelayer" +) + +// NewMockOneTimeRelayerSessionsManager creates a new mock RelayerSessionsManager. +// This mock RelayerSessionsManager will expect a call to InsertRelays with the +// given context and expectedMinedRelaysObs args. When that call is made, +// returnedMinedRelaysObs is returned. It also expects a call to Start with the +// given context, and stop. +func NewMockOneTimeRelayerSessionsManager( + ctx context.Context, + t *testing.T, + expectedMinedRelaysObs relayer.MinedRelaysObservable, +) *mockrelayer.MockRelayerSessionsManager { + t.Helper() + + ctrl := gomock.NewController(t) + relayerSessionsManagerMock := mockrelayer.NewMockRelayerSessionsManager(ctrl) + relayerSessionsManagerMock.EXPECT(). + InsertRelays(gomock.Eq(expectedMinedRelaysObs)). + Times(1) + relayerSessionsManagerMock.EXPECT(). + Start(gomock.Eq(ctx)). + Times(1) + relayerSessionsManagerMock.EXPECT(). + Stop(). + Times(1) + return relayerSessionsManagerMock +} From 70be12501bd15e07ad937bd40a0d87b48ce75f15 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 10:58:07 +0100 Subject: [PATCH 23/54] restore: off-chain mock pkgs --- testutil/mockclient/mocks.go | 11 +++++++++++ testutil/mockcrypto/mock.go | 11 +++++++++++ testutil/mockrelayer/mocks.go | 11 +++++++++++ 3 files changed, 33 insertions(+) create mode 100644 testutil/mockclient/mocks.go create mode 100644 testutil/mockcrypto/mock.go create mode 100644 testutil/mockrelayer/mocks.go diff --git a/testutil/mockclient/mocks.go b/testutil/mockclient/mocks.go new file mode 100644 index 000000000..d89152942 --- /dev/null +++ b/testutil/mockclient/mocks.go @@ -0,0 +1,11 @@ +package mockclient + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/mockcrypto/mock.go b/testutil/mockcrypto/mock.go new file mode 100644 index 000000000..277adca25 --- /dev/null +++ b/testutil/mockcrypto/mock.go @@ -0,0 +1,11 @@ +package mockcrypto + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/mockrelayer/mocks.go b/testutil/mockrelayer/mocks.go new file mode 100644 index 000000000..0abe65d56 --- /dev/null +++ b/testutil/mockrelayer/mocks.go @@ -0,0 +1,11 @@ +package mockrelayer + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. From fccef78321e095b1cecc8f2d53b90859446fe403 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:46:55 +0100 Subject: [PATCH 24/54] reconcile: off-chain proto types --- api/poktroll/service/relay.pulsar.go | 2956 ++++++++++++++++++++++++++ proto/poktroll/service/relay.proto | 47 + x/service/types/relay.go | 57 + 3 files changed, 3060 insertions(+) create mode 100644 api/poktroll/service/relay.pulsar.go create mode 100644 proto/poktroll/service/relay.proto create mode 100644 x/service/types/relay.go diff --git a/api/poktroll/service/relay.pulsar.go b/api/poktroll/service/relay.pulsar.go new file mode 100644 index 000000000..58e673ebe --- /dev/null +++ b/api/poktroll/service/relay.pulsar.go @@ -0,0 +1,2956 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package service + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + session "github.com/pokt-network/poktroll/api/poktroll/session" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Relay protoreflect.MessageDescriptor + fd_Relay_req protoreflect.FieldDescriptor + fd_Relay_res protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_relay_proto_init() + md_Relay = File_poktroll_service_relay_proto.Messages().ByName("Relay") + fd_Relay_req = md_Relay.Fields().ByName("req") + fd_Relay_res = md_Relay.Fields().ByName("res") +} + +var _ protoreflect.Message = (*fastReflection_Relay)(nil) + +type fastReflection_Relay Relay + +func (x *Relay) ProtoReflect() protoreflect.Message { + return (*fastReflection_Relay)(x) +} + +func (x *Relay) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_relay_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Relay_messageType fastReflection_Relay_messageType +var _ protoreflect.MessageType = fastReflection_Relay_messageType{} + +type fastReflection_Relay_messageType struct{} + +func (x fastReflection_Relay_messageType) Zero() protoreflect.Message { + return (*fastReflection_Relay)(nil) +} +func (x fastReflection_Relay_messageType) New() protoreflect.Message { + return new(fastReflection_Relay) +} +func (x fastReflection_Relay_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Relay +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Relay) Descriptor() protoreflect.MessageDescriptor { + return md_Relay +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_Relay) Type() protoreflect.MessageType { + return _fastReflection_Relay_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Relay) New() protoreflect.Message { + return new(fastReflection_Relay) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Relay) Interface() protoreflect.ProtoMessage { + return (*Relay)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_Relay) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Req != nil { + value := protoreflect.ValueOfMessage(x.Req.ProtoReflect()) + if !f(fd_Relay_req, value) { + return + } + } + if x.Res != nil { + value := protoreflect.ValueOfMessage(x.Res.ProtoReflect()) + if !f(fd_Relay_res, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Relay) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.Relay.req": + return x.Req != nil + case "poktroll.service.Relay.res": + return x.Res != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Relay")) + } + panic(fmt.Errorf("message poktroll.service.Relay does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Relay) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.Relay.req": + x.Req = nil + case "poktroll.service.Relay.res": + x.Res = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Relay")) + } + panic(fmt.Errorf("message poktroll.service.Relay does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_Relay) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.Relay.req": + value := x.Req + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.Relay.res": + value := x.Res + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Relay")) + } + panic(fmt.Errorf("message poktroll.service.Relay does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Relay) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.Relay.req": + x.Req = value.Message().Interface().(*RelayRequest) + case "poktroll.service.Relay.res": + x.Res = value.Message().Interface().(*RelayResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Relay")) + } + panic(fmt.Errorf("message poktroll.service.Relay does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Relay) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Relay.req": + if x.Req == nil { + x.Req = new(RelayRequest) + } + return protoreflect.ValueOfMessage(x.Req.ProtoReflect()) + case "poktroll.service.Relay.res": + if x.Res == nil { + x.Res = new(RelayResponse) + } + return protoreflect.ValueOfMessage(x.Res.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Relay")) + } + panic(fmt.Errorf("message poktroll.service.Relay does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_Relay) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.Relay.req": + m := new(RelayRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.Relay.res": + m := new(RelayResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.Relay")) + } + panic(fmt.Errorf("message poktroll.service.Relay does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_Relay) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.Relay", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_Relay) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_Relay) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_Relay) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_Relay) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Relay) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Req != nil { + l = options.Size(x.Req) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Res != nil { + l = options.Size(x.Res) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Relay) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Res != nil { + encoded, err := options.Marshal(x.Res) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.Req != nil { + encoded, err := options.Marshal(x.Req) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Relay) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Relay: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Relay: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Req", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Req == nil { + x.Req = &RelayRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Req); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Res", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Res == nil { + x.Res = &RelayResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Res); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_RelayRequestMetadata protoreflect.MessageDescriptor + fd_RelayRequestMetadata_session_header protoreflect.FieldDescriptor + fd_RelayRequestMetadata_signature protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_relay_proto_init() + md_RelayRequestMetadata = File_poktroll_service_relay_proto.Messages().ByName("RelayRequestMetadata") + fd_RelayRequestMetadata_session_header = md_RelayRequestMetadata.Fields().ByName("session_header") + fd_RelayRequestMetadata_signature = md_RelayRequestMetadata.Fields().ByName("signature") +} + +var _ protoreflect.Message = (*fastReflection_RelayRequestMetadata)(nil) + +type fastReflection_RelayRequestMetadata RelayRequestMetadata + +func (x *RelayRequestMetadata) ProtoReflect() protoreflect.Message { + return (*fastReflection_RelayRequestMetadata)(x) +} + +func (x *RelayRequestMetadata) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_relay_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_RelayRequestMetadata_messageType fastReflection_RelayRequestMetadata_messageType +var _ protoreflect.MessageType = fastReflection_RelayRequestMetadata_messageType{} + +type fastReflection_RelayRequestMetadata_messageType struct{} + +func (x fastReflection_RelayRequestMetadata_messageType) Zero() protoreflect.Message { + return (*fastReflection_RelayRequestMetadata)(nil) +} +func (x fastReflection_RelayRequestMetadata_messageType) New() protoreflect.Message { + return new(fastReflection_RelayRequestMetadata) +} +func (x fastReflection_RelayRequestMetadata_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_RelayRequestMetadata +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_RelayRequestMetadata) Descriptor() protoreflect.MessageDescriptor { + return md_RelayRequestMetadata +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_RelayRequestMetadata) Type() protoreflect.MessageType { + return _fastReflection_RelayRequestMetadata_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_RelayRequestMetadata) New() protoreflect.Message { + return new(fastReflection_RelayRequestMetadata) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_RelayRequestMetadata) Interface() protoreflect.ProtoMessage { + return (*RelayRequestMetadata)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_RelayRequestMetadata) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SessionHeader != nil { + value := protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + if !f(fd_RelayRequestMetadata_session_header, value) { + return + } + } + if len(x.Signature) != 0 { + value := protoreflect.ValueOfBytes(x.Signature) + if !f(fd_RelayRequestMetadata_signature, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_RelayRequestMetadata) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.RelayRequestMetadata.session_header": + return x.SessionHeader != nil + case "poktroll.service.RelayRequestMetadata.signature": + return len(x.Signature) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequestMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequestMetadata does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequestMetadata) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.RelayRequestMetadata.session_header": + x.SessionHeader = nil + case "poktroll.service.RelayRequestMetadata.signature": + x.Signature = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequestMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequestMetadata does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_RelayRequestMetadata) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.RelayRequestMetadata.session_header": + value := x.SessionHeader + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.RelayRequestMetadata.signature": + value := x.Signature + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequestMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequestMetadata does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequestMetadata) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.RelayRequestMetadata.session_header": + x.SessionHeader = value.Message().Interface().(*session.SessionHeader) + case "poktroll.service.RelayRequestMetadata.signature": + x.Signature = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequestMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequestMetadata does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequestMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayRequestMetadata.session_header": + if x.SessionHeader == nil { + x.SessionHeader = new(session.SessionHeader) + } + return protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + case "poktroll.service.RelayRequestMetadata.signature": + panic(fmt.Errorf("field signature of message poktroll.service.RelayRequestMetadata is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequestMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequestMetadata does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_RelayRequestMetadata) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayRequestMetadata.session_header": + m := new(session.SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.RelayRequestMetadata.signature": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequestMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequestMetadata does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_RelayRequestMetadata) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.RelayRequestMetadata", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_RelayRequestMetadata) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequestMetadata) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_RelayRequestMetadata) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_RelayRequestMetadata) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*RelayRequestMetadata) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.SessionHeader != nil { + l = options.Size(x.SessionHeader) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Signature) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*RelayRequestMetadata) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Signature) > 0 { + i -= len(x.Signature) + copy(dAtA[i:], x.Signature) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signature))) + i-- + dAtA[i] = 0x12 + } + if x.SessionHeader != nil { + encoded, err := options.Marshal(x.SessionHeader) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*RelayRequestMetadata) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayRequestMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayRequestMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.SessionHeader == nil { + x.SessionHeader = &session.SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SessionHeader); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Signature = append(x.Signature[:0], dAtA[iNdEx:postIndex]...) + if x.Signature == nil { + x.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_RelayRequest protoreflect.MessageDescriptor + fd_RelayRequest_meta protoreflect.FieldDescriptor + fd_RelayRequest_payload protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_relay_proto_init() + md_RelayRequest = File_poktroll_service_relay_proto.Messages().ByName("RelayRequest") + fd_RelayRequest_meta = md_RelayRequest.Fields().ByName("meta") + fd_RelayRequest_payload = md_RelayRequest.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_RelayRequest)(nil) + +type fastReflection_RelayRequest RelayRequest + +func (x *RelayRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_RelayRequest)(x) +} + +func (x *RelayRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_relay_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_RelayRequest_messageType fastReflection_RelayRequest_messageType +var _ protoreflect.MessageType = fastReflection_RelayRequest_messageType{} + +type fastReflection_RelayRequest_messageType struct{} + +func (x fastReflection_RelayRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_RelayRequest)(nil) +} +func (x fastReflection_RelayRequest_messageType) New() protoreflect.Message { + return new(fastReflection_RelayRequest) +} +func (x fastReflection_RelayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_RelayRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_RelayRequest) Descriptor() protoreflect.MessageDescriptor { + return md_RelayRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_RelayRequest) Type() protoreflect.MessageType { + return _fastReflection_RelayRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_RelayRequest) New() protoreflect.Message { + return new(fastReflection_RelayRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_RelayRequest) Interface() protoreflect.ProtoMessage { + return (*RelayRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_RelayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Meta != nil { + value := protoreflect.ValueOfMessage(x.Meta.ProtoReflect()) + if !f(fd_RelayRequest_meta, value) { + return + } + } + if len(x.Payload) != 0 { + value := protoreflect.ValueOfBytes(x.Payload) + if !f(fd_RelayRequest_payload, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_RelayRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.RelayRequest.meta": + return x.Meta != nil + case "poktroll.service.RelayRequest.payload": + return len(x.Payload) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequest")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.RelayRequest.meta": + x.Meta = nil + case "poktroll.service.RelayRequest.payload": + x.Payload = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequest")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_RelayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.RelayRequest.meta": + value := x.Meta + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.RelayRequest.payload": + value := x.Payload + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequest")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.RelayRequest.meta": + x.Meta = value.Message().Interface().(*RelayRequestMetadata) + case "poktroll.service.RelayRequest.payload": + x.Payload = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequest")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayRequest.meta": + if x.Meta == nil { + x.Meta = new(RelayRequestMetadata) + } + return protoreflect.ValueOfMessage(x.Meta.ProtoReflect()) + case "poktroll.service.RelayRequest.payload": + panic(fmt.Errorf("field payload of message poktroll.service.RelayRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequest")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_RelayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayRequest.meta": + m := new(RelayRequestMetadata) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.RelayRequest.payload": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayRequest")) + } + panic(fmt.Errorf("message poktroll.service.RelayRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_RelayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.RelayRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_RelayRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_RelayRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_RelayRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*RelayRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Meta != nil { + l = options.Size(x.Meta) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Payload) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*RelayRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Payload) > 0 { + i -= len(x.Payload) + copy(dAtA[i:], x.Payload) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Payload))) + i-- + dAtA[i] = 0x12 + } + if x.Meta != nil { + encoded, err := options.Marshal(x.Meta) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*RelayRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Meta == nil { + x.Meta = &RelayRequestMetadata{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Meta); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Payload = append(x.Payload[:0], dAtA[iNdEx:postIndex]...) + if x.Payload == nil { + x.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_RelayResponse protoreflect.MessageDescriptor + fd_RelayResponse_meta protoreflect.FieldDescriptor + fd_RelayResponse_payload protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_relay_proto_init() + md_RelayResponse = File_poktroll_service_relay_proto.Messages().ByName("RelayResponse") + fd_RelayResponse_meta = md_RelayResponse.Fields().ByName("meta") + fd_RelayResponse_payload = md_RelayResponse.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_RelayResponse)(nil) + +type fastReflection_RelayResponse RelayResponse + +func (x *RelayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_RelayResponse)(x) +} + +func (x *RelayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_relay_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_RelayResponse_messageType fastReflection_RelayResponse_messageType +var _ protoreflect.MessageType = fastReflection_RelayResponse_messageType{} + +type fastReflection_RelayResponse_messageType struct{} + +func (x fastReflection_RelayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_RelayResponse)(nil) +} +func (x fastReflection_RelayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_RelayResponse) +} +func (x fastReflection_RelayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_RelayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_RelayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_RelayResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_RelayResponse) Type() protoreflect.MessageType { + return _fastReflection_RelayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_RelayResponse) New() protoreflect.Message { + return new(fastReflection_RelayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_RelayResponse) Interface() protoreflect.ProtoMessage { + return (*RelayResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_RelayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Meta != nil { + value := protoreflect.ValueOfMessage(x.Meta.ProtoReflect()) + if !f(fd_RelayResponse_meta, value) { + return + } + } + if len(x.Payload) != 0 { + value := protoreflect.ValueOfBytes(x.Payload) + if !f(fd_RelayResponse_payload, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_RelayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.RelayResponse.meta": + return x.Meta != nil + case "poktroll.service.RelayResponse.payload": + return len(x.Payload) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponse")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.RelayResponse.meta": + x.Meta = nil + case "poktroll.service.RelayResponse.payload": + x.Payload = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponse")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_RelayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.RelayResponse.meta": + value := x.Meta + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.RelayResponse.payload": + value := x.Payload + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponse")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.RelayResponse.meta": + x.Meta = value.Message().Interface().(*RelayResponseMetadata) + case "poktroll.service.RelayResponse.payload": + x.Payload = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponse")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayResponse.meta": + if x.Meta == nil { + x.Meta = new(RelayResponseMetadata) + } + return protoreflect.ValueOfMessage(x.Meta.ProtoReflect()) + case "poktroll.service.RelayResponse.payload": + panic(fmt.Errorf("field payload of message poktroll.service.RelayResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponse")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_RelayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayResponse.meta": + m := new(RelayResponseMetadata) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.RelayResponse.payload": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponse")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_RelayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.RelayResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_RelayResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_RelayResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_RelayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*RelayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Meta != nil { + l = options.Size(x.Meta) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Payload) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*RelayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Payload) > 0 { + i -= len(x.Payload) + copy(dAtA[i:], x.Payload) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Payload))) + i-- + dAtA[i] = 0x12 + } + if x.Meta != nil { + encoded, err := options.Marshal(x.Meta) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*RelayResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Meta == nil { + x.Meta = &RelayResponseMetadata{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Meta); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Payload = append(x.Payload[:0], dAtA[iNdEx:postIndex]...) + if x.Payload == nil { + x.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_RelayResponseMetadata protoreflect.MessageDescriptor + fd_RelayResponseMetadata_session_header protoreflect.FieldDescriptor + fd_RelayResponseMetadata_supplier_signature protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_service_relay_proto_init() + md_RelayResponseMetadata = File_poktroll_service_relay_proto.Messages().ByName("RelayResponseMetadata") + fd_RelayResponseMetadata_session_header = md_RelayResponseMetadata.Fields().ByName("session_header") + fd_RelayResponseMetadata_supplier_signature = md_RelayResponseMetadata.Fields().ByName("supplier_signature") +} + +var _ protoreflect.Message = (*fastReflection_RelayResponseMetadata)(nil) + +type fastReflection_RelayResponseMetadata RelayResponseMetadata + +func (x *RelayResponseMetadata) ProtoReflect() protoreflect.Message { + return (*fastReflection_RelayResponseMetadata)(x) +} + +func (x *RelayResponseMetadata) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_service_relay_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_RelayResponseMetadata_messageType fastReflection_RelayResponseMetadata_messageType +var _ protoreflect.MessageType = fastReflection_RelayResponseMetadata_messageType{} + +type fastReflection_RelayResponseMetadata_messageType struct{} + +func (x fastReflection_RelayResponseMetadata_messageType) Zero() protoreflect.Message { + return (*fastReflection_RelayResponseMetadata)(nil) +} +func (x fastReflection_RelayResponseMetadata_messageType) New() protoreflect.Message { + return new(fastReflection_RelayResponseMetadata) +} +func (x fastReflection_RelayResponseMetadata_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_RelayResponseMetadata +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_RelayResponseMetadata) Descriptor() protoreflect.MessageDescriptor { + return md_RelayResponseMetadata +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_RelayResponseMetadata) Type() protoreflect.MessageType { + return _fastReflection_RelayResponseMetadata_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_RelayResponseMetadata) New() protoreflect.Message { + return new(fastReflection_RelayResponseMetadata) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_RelayResponseMetadata) Interface() protoreflect.ProtoMessage { + return (*RelayResponseMetadata)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_RelayResponseMetadata) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.SessionHeader != nil { + value := protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + if !f(fd_RelayResponseMetadata_session_header, value) { + return + } + } + if len(x.SupplierSignature) != 0 { + value := protoreflect.ValueOfBytes(x.SupplierSignature) + if !f(fd_RelayResponseMetadata_supplier_signature, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_RelayResponseMetadata) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.service.RelayResponseMetadata.session_header": + return x.SessionHeader != nil + case "poktroll.service.RelayResponseMetadata.supplier_signature": + return len(x.SupplierSignature) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponseMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponseMetadata does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponseMetadata) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.service.RelayResponseMetadata.session_header": + x.SessionHeader = nil + case "poktroll.service.RelayResponseMetadata.supplier_signature": + x.SupplierSignature = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponseMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponseMetadata does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_RelayResponseMetadata) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.service.RelayResponseMetadata.session_header": + value := x.SessionHeader + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.service.RelayResponseMetadata.supplier_signature": + value := x.SupplierSignature + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponseMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponseMetadata does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponseMetadata) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.service.RelayResponseMetadata.session_header": + x.SessionHeader = value.Message().Interface().(*session.SessionHeader) + case "poktroll.service.RelayResponseMetadata.supplier_signature": + x.SupplierSignature = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponseMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponseMetadata does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponseMetadata) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayResponseMetadata.session_header": + if x.SessionHeader == nil { + x.SessionHeader = new(session.SessionHeader) + } + return protoreflect.ValueOfMessage(x.SessionHeader.ProtoReflect()) + case "poktroll.service.RelayResponseMetadata.supplier_signature": + panic(fmt.Errorf("field supplier_signature of message poktroll.service.RelayResponseMetadata is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponseMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponseMetadata does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_RelayResponseMetadata) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.service.RelayResponseMetadata.session_header": + m := new(session.SessionHeader) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.service.RelayResponseMetadata.supplier_signature": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.RelayResponseMetadata")) + } + panic(fmt.Errorf("message poktroll.service.RelayResponseMetadata does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_RelayResponseMetadata) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.RelayResponseMetadata", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_RelayResponseMetadata) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_RelayResponseMetadata) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_RelayResponseMetadata) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_RelayResponseMetadata) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*RelayResponseMetadata) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.SessionHeader != nil { + l = options.Size(x.SessionHeader) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.SupplierSignature) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*RelayResponseMetadata) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.SupplierSignature) > 0 { + i -= len(x.SupplierSignature) + copy(dAtA[i:], x.SupplierSignature) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupplierSignature))) + i-- + dAtA[i] = 0x12 + } + if x.SessionHeader != nil { + encoded, err := options.Marshal(x.SessionHeader) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*RelayResponseMetadata) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayResponseMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: RelayResponseMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SessionHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.SessionHeader == nil { + x.SessionHeader = &session.SessionHeader{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SessionHeader); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupplierSignature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SupplierSignature = append(x.SupplierSignature[:0], dAtA[iNdEx:postIndex]...) + if x.SupplierSignature == nil { + x.SupplierSignature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/service/relay.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Relay contains both the RelayRequest (signed by the Application) and the RelayResponse (signed by the Supplier). +// The serialized tuple is inserted into the SMST leaves as values in the Claim/Proof lifecycle. +type Relay struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Req *RelayRequest `protobuf:"bytes,1,opt,name=req,proto3" json:"req,omitempty"` + Res *RelayResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` +} + +func (x *Relay) Reset() { + *x = Relay{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_relay_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Relay) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Relay) ProtoMessage() {} + +// Deprecated: Use Relay.ProtoReflect.Descriptor instead. +func (*Relay) Descriptor() ([]byte, []int) { + return file_poktroll_service_relay_proto_rawDescGZIP(), []int{0} +} + +func (x *Relay) GetReq() *RelayRequest { + if x != nil { + return x.Req + } + return nil +} + +func (x *Relay) GetRes() *RelayResponse { + if x != nil { + return x.Res + } + return nil +} + +// RelayRequestMetadata contains the metadata for a RelayRequest. +type RelayRequestMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionHeader *session.SessionHeader `protobuf:"bytes,1,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` // Session header associated with the relay. + // The request signature is a serialized ring signature that may have been + // by either the application itself or one of the gateways that the + // application has delegated to. The signature is made using the ring of the + // application in both cases. + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *RelayRequestMetadata) Reset() { + *x = RelayRequestMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_relay_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RelayRequestMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RelayRequestMetadata) ProtoMessage() {} + +// Deprecated: Use RelayRequestMetadata.ProtoReflect.Descriptor instead. +func (*RelayRequestMetadata) Descriptor() ([]byte, []int) { + return file_poktroll_service_relay_proto_rawDescGZIP(), []int{1} +} + +func (x *RelayRequestMetadata) GetSessionHeader() *session.SessionHeader { + if x != nil { + return x.SessionHeader + } + return nil +} + +func (x *RelayRequestMetadata) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +// RelayRequest holds the request details for a relay. +type RelayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Meta *RelayRequestMetadata `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"` + // payload is the serialized payload for the request. + // The payload is passed directly to the service and as such can be any + // format that the service supports: JSON-RPC, REST, gRPC, etc. + Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *RelayRequest) Reset() { + *x = RelayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_relay_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RelayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RelayRequest) ProtoMessage() {} + +// Deprecated: Use RelayRequest.ProtoReflect.Descriptor instead. +func (*RelayRequest) Descriptor() ([]byte, []int) { + return file_poktroll_service_relay_proto_rawDescGZIP(), []int{2} +} + +func (x *RelayRequest) GetMeta() *RelayRequestMetadata { + if x != nil { + return x.Meta + } + return nil +} + +func (x *RelayRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +// RelayResponse contains the response details for a RelayRequest. +type RelayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Meta *RelayResponseMetadata `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"` + // payload is the serialized payload for the response. + // The payload is passed directly from the service and as such can be any + // format the the service responds with: JSON-RPC, REST, gRPC, etc. + Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *RelayResponse) Reset() { + *x = RelayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_relay_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RelayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RelayResponse) ProtoMessage() {} + +// Deprecated: Use RelayResponse.ProtoReflect.Descriptor instead. +func (*RelayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_service_relay_proto_rawDescGZIP(), []int{3} +} + +func (x *RelayResponse) GetMeta() *RelayResponseMetadata { + if x != nil { + return x.Meta + } + return nil +} + +func (x *RelayResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +// RelayResponseMetadata contains the metadata for a RelayResponse. +type RelayResponseMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionHeader *session.SessionHeader `protobuf:"bytes,1,opt,name=session_header,json=sessionHeader,proto3" json:"session_header,omitempty"` // Session header associated with the relay. + SupplierSignature []byte `protobuf:"bytes,2,opt,name=supplier_signature,json=supplierSignature,proto3" json:"supplier_signature,omitempty"` // Signature of the supplier on the response. +} + +func (x *RelayResponseMetadata) Reset() { + *x = RelayResponseMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_service_relay_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RelayResponseMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RelayResponseMetadata) ProtoMessage() {} + +// Deprecated: Use RelayResponseMetadata.ProtoReflect.Descriptor instead. +func (*RelayResponseMetadata) Descriptor() ([]byte, []int) { + return file_poktroll_service_relay_proto_rawDescGZIP(), []int{4} +} + +func (x *RelayResponseMetadata) GetSessionHeader() *session.SessionHeader { + if x != nil { + return x.SessionHeader + } + return nil +} + +func (x *RelayResponseMetadata) GetSupplierSignature() []byte { + if x != nil { + return x.SupplierSignature + } + return nil +} + +var File_poktroll_service_relay_proto protoreflect.FileDescriptor + +var file_poktroll_service_relay_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x6c, 0x0a, 0x05, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x30, 0x0a, 0x03, 0x72, 0x65, 0x71, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x03, 0x72, 0x65, 0x71, 0x12, 0x31, 0x0a, 0x03, 0x72, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x03, 0x72, 0x65, 0x73, 0x22, 0x7c, + 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x64, 0x0a, 0x0c, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x04, + 0x6d, 0x65, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x22, 0x66, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8e, 0x01, 0x0a, 0x15, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x12, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0xa6, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, + 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_service_relay_proto_rawDescOnce sync.Once + file_poktroll_service_relay_proto_rawDescData = file_poktroll_service_relay_proto_rawDesc +) + +func file_poktroll_service_relay_proto_rawDescGZIP() []byte { + file_poktroll_service_relay_proto_rawDescOnce.Do(func() { + file_poktroll_service_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_service_relay_proto_rawDescData) + }) + return file_poktroll_service_relay_proto_rawDescData +} + +var file_poktroll_service_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_poktroll_service_relay_proto_goTypes = []interface{}{ + (*Relay)(nil), // 0: poktroll.service.Relay + (*RelayRequestMetadata)(nil), // 1: poktroll.service.RelayRequestMetadata + (*RelayRequest)(nil), // 2: poktroll.service.RelayRequest + (*RelayResponse)(nil), // 3: poktroll.service.RelayResponse + (*RelayResponseMetadata)(nil), // 4: poktroll.service.RelayResponseMetadata + (*session.SessionHeader)(nil), // 5: poktroll.session.SessionHeader +} +var file_poktroll_service_relay_proto_depIdxs = []int32{ + 2, // 0: poktroll.service.Relay.req:type_name -> poktroll.service.RelayRequest + 3, // 1: poktroll.service.Relay.res:type_name -> poktroll.service.RelayResponse + 5, // 2: poktroll.service.RelayRequestMetadata.session_header:type_name -> poktroll.session.SessionHeader + 1, // 3: poktroll.service.RelayRequest.meta:type_name -> poktroll.service.RelayRequestMetadata + 4, // 4: poktroll.service.RelayResponse.meta:type_name -> poktroll.service.RelayResponseMetadata + 5, // 5: poktroll.service.RelayResponseMetadata.session_header:type_name -> poktroll.session.SessionHeader + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_poktroll_service_relay_proto_init() } +func file_poktroll_service_relay_proto_init() { + if File_poktroll_service_relay_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_service_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Relay); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayRequestMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_relay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_relay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_service_relay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayResponseMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_service_relay_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_service_relay_proto_goTypes, + DependencyIndexes: file_poktroll_service_relay_proto_depIdxs, + MessageInfos: file_poktroll_service_relay_proto_msgTypes, + }.Build() + File_poktroll_service_relay_proto = out.File + file_poktroll_service_relay_proto_rawDesc = nil + file_poktroll_service_relay_proto_goTypes = nil + file_poktroll_service_relay_proto_depIdxs = nil +} diff --git a/proto/poktroll/service/relay.proto b/proto/poktroll/service/relay.proto new file mode 100644 index 000000000..37ca25e2f --- /dev/null +++ b/proto/poktroll/service/relay.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package poktroll.service; + +import "poktroll/session/session.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + +// Relay contains both the RelayRequest (signed by the Application) and the RelayResponse (signed by the Supplier). +// The serialized tuple is inserted into the SMST leaves as values in the Claim/Proof lifecycle. +message Relay { + RelayRequest req = 1; + RelayResponse res = 2; +} + +// RelayRequestMetadata contains the metadata for a RelayRequest. +message RelayRequestMetadata { + session.SessionHeader session_header = 1; // Session header associated with the relay. + // The request signature is a serialized ring signature that may have been + // by either the application itself or one of the gateways that the + // application has delegated to. The signature is made using the ring of the + // application in both cases. + bytes signature = 2; +} + +// RelayRequest holds the request details for a relay. +message RelayRequest { + RelayRequestMetadata meta = 1; + // payload is the serialized payload for the request. + // The payload is passed directly to the service and as such can be any + // format that the service supports: JSON-RPC, REST, gRPC, etc. + bytes payload = 2; +} + +// RelayResponse contains the response details for a RelayRequest. +message RelayResponse { + RelayResponseMetadata meta = 1; + // payload is the serialized payload for the response. + // The payload is passed directly from the service and as such can be any + // format the the service responds with: JSON-RPC, REST, gRPC, etc. + bytes payload = 2; +} + +// RelayResponseMetadata contains the metadata for a RelayResponse. +message RelayResponseMetadata { + session.SessionHeader session_header = 1; // Session header associated with the relay. + bytes supplier_signature = 2; // Signature of the supplier on the response. +} diff --git a/x/service/types/relay.go b/x/service/types/relay.go new file mode 100644 index 000000000..7815fc1ab --- /dev/null +++ b/x/service/types/relay.go @@ -0,0 +1,57 @@ +package types + +import "crypto/sha256" + +// getSignableBytes returns the bytes resulting from marshaling the relay request +// A value receiver is used to avoid overwriting any pre-existing signature +func (req RelayRequest) getSignableBytes() ([]byte, error) { + // set signature to nil + req.Meta.Signature = nil + + return req.Marshal() +} + +// GetSignableBytesHash returns the hash of the signable bytes of the relay request +// Hashing the marshaled request message guarantees that the signable bytes are +// always of a constant and expected length. +func (req *RelayRequest) GetSignableBytesHash() ([32]byte, error) { + requestBz, err := req.getSignableBytes() + if err != nil { + return [32]byte{}, err + } + + // return the marshaled request hash to guarantee that the signable bytes are + // always of a constant and expected length + return sha256.Sum256(requestBz), nil +} + +// getSignableBytes returns the bytes resulting from marshaling the relay response +// A value receiver is used to avoid overwriting any pre-existing signature +func (res RelayResponse) getSignableBytes() ([]byte, error) { + // set signature to nil + res.Meta.SupplierSignature = nil + + return res.Marshal() +} + +// GetSignableBytesHash returns the hash of the signable bytes of the relay response +// Hashing the marshaled response message guarantees that the signable bytes are +// always of a constant and expected length. +func (res *RelayResponse) GetSignableBytesHash() ([32]byte, error) { + responseBz, err := res.getSignableBytes() + if err != nil { + return [32]byte{}, err + } + + // return the marshaled response hash to guarantee that the signable bytes are + // always of a constant and expected length + return sha256.Sum256(responseBz), nil +} + +func (res *RelayResponse) ValidateBasic() error { + // TODO_FUTURE: if a client gets a response with an invalid/incomplete + // SessionHeader, consider sending an on-chain challenge, lowering their + // QoS, or other future work. + + return nil +} From dc13057553d1f02d0a970d769ee044538bebd325 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:51:13 +0100 Subject: [PATCH 25/54] reconcile: off-chain & E2E with supplier/proof module split --- e2e/tests/init_test.go | 13 +++++++------ e2e/tests/session_steps_test.go | 30 +++++++++++++++--------------- pkg/client/supplier/client.go | 10 +++++++--- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 5afc0409f..81b45129e 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -22,6 +22,7 @@ import ( "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/testutil/testclient" apptypes "github.com/pokt-network/poktroll/x/application/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" @@ -62,10 +63,10 @@ func TestMain(m *testing.M) { type suite struct { gocuke.TestingT // TODO_TECHDEBT: rename to `poktrolld`. - pocketd *pocketdBin - scenarioState map[string]any // temporary state for each scenario - cdc codec.Codec - supplierQueryClient suppliertypes.QueryClient + pocketd *pocketdBin + scenarioState map[string]any // temporary state for each scenario + cdc codec.Codec + proofQueryClient prooftypes.QueryClient } func (s *suite) Before() { @@ -78,7 +79,7 @@ func (s *suite) Before() { flagSet := testclient.NewLocalnetFlagSet(s) clientCtx := testclient.NewLocalnetClientCtx(s, flagSet) - s.supplierQueryClient = suppliertypes.NewQueryClient(clientCtx) + s.proofQueryClient = prooftypes.NewQueryClient(clientCtx) } // TestFeatures runs the e2e tests specified in any .features files in this directory @@ -385,7 +386,7 @@ func (s *suite) buildSupplierMap() { s.Fatalf("error getting supplier list: %s", err) } s.pocketd.result = res - var resp suppliertypes.QueryAllSupplierResponse + var resp suppliertypes.QueryAllSuppliersResponse responseBz := []byte(strings.TrimSpace(res.Stdout)) s.cdc.MustUnmarshalJSON(responseBz, &resp) for _, supplier := range resp.Supplier { diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index dff132d9c..108993dcc 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -18,7 +18,7 @@ import ( "github.com/pokt-network/poktroll/pkg/client/events" "github.com/pokt-network/poktroll/pkg/observable/channel" "github.com/pokt-network/poktroll/testutil/testclient" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" ) const ( @@ -50,8 +50,8 @@ func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplicati func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { ctx := context.Background() - allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{ - Filter: &suppliertypes.QueryAllClaimsRequest_SupplierAddress{ + allClaimsRes, err := s.proofQueryClient.AllClaims(ctx, &prooftypes.QueryAllClaimsRequest{ + Filter: &prooftypes.QueryAllClaimsRequest_SupplierAddress{ SupplierAddress: accNameToAddrMap[supplierName], }, }) @@ -59,13 +59,13 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersist require.NotNil(s, allClaimsRes) // Assert that the number of claims has increased by one. - preExistingClaims, ok := s.scenarioState[preExistingClaimsKey].([]suppliertypes.Claim) + preExistingClaims, ok := s.scenarioState[preExistingClaimsKey].([]prooftypes.Claim) require.True(s, ok, "preExistingClaimsKey not found in scenarioState") // NB: We are avoiding the use of require.Len here because it provides unreadable output // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number // of blocks per session, multiple claims may be created throughout the duration of the test. Until // these values are appropriately adjusted - require.Greater(s, len(allClaimsRes.Claim), len(preExistingClaims), "number of claims must have increased") + require.Greater(s, len(allClaimsRes.Claims), len(preExistingClaims), "number of claims must have increased") // TODO_IMPROVE: assert that the root hash of the claim contains the correct // SMST sum. The sum can be retrieved by parsing the last 8 bytes as a @@ -75,7 +75,7 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersist // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate // them into the scenarioState key(s). - claim := allClaimsRes.Claim[0] + claim := allClaimsRes.Claims[0] require.Equal(s, accNameToAddrMap[supplierName], claim.SupplierAddress) } @@ -87,15 +87,15 @@ func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication // Query for any existing claims so that we can compare against them in // future assertions about changes in on-chain claims. - allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{}) + allClaimsRes, err := s.proofQueryClient.AllClaims(ctx, &prooftypes.QueryAllClaimsRequest{}) require.NoError(s, err) - s.scenarioState[preExistingClaimsKey] = allClaimsRes.Claim + s.scenarioState[preExistingClaimsKey] = allClaimsRes.Claims // Query for any existing proofs so that we can compare against them in // future assertions about changes in on-chain proofs. - allProofsRes, err := s.supplierQueryClient.AllProofs(ctx, &suppliertypes.QueryAllProofsRequest{}) + allProofsRes, err := s.proofQueryClient.AllProofs(ctx, &prooftypes.QueryAllProofsRequest{}) require.NoError(s, err) - s.scenarioState[preExistingProofsKey] = allProofsRes.Proof + s.scenarioState[preExistingProofsKey] = allProofsRes.Proofs // Construct an events query client to listen for tx events from the supplier. msgSenderQuery := fmt.Sprintf(txSenderEventSubscriptionQueryFmt, accNameToAddrMap[supplierName]) @@ -139,8 +139,8 @@ func (s *suite) TheProofSubmittedBySupplierForServiceForApplicationShouldBePersi ctx := context.Background() // Retrieve all on-chain proofs for supplierName - allProofsRes, err := s.supplierQueryClient.AllProofs(ctx, &suppliertypes.QueryAllProofsRequest{ - Filter: &suppliertypes.QueryAllProofsRequest_SupplierAddress{ + allProofsRes, err := s.proofQueryClient.AllProofs(ctx, &prooftypes.QueryAllProofsRequest{ + Filter: &prooftypes.QueryAllProofsRequest_SupplierAddress{ SupplierAddress: accNameToAddrMap[supplierName], }, }) @@ -148,13 +148,13 @@ func (s *suite) TheProofSubmittedBySupplierForServiceForApplicationShouldBePersi require.NotNil(s, allProofsRes) // Assert that the number of proofs has increased by one. - preExistingProofs, ok := s.scenarioState[preExistingProofsKey].([]suppliertypes.Proof) + preExistingProofs, ok := s.scenarioState[preExistingProofsKey].([]prooftypes.Proof) require.True(s, ok, "preExistingProofsKey not found in scenarioState") // NB: We are avoiding the use of require.Len here because it provides unreadable output // TODO_TECHDEBT: Due to the speed of the blocks of the LocalNet sequencer, along with the small number // of blocks per session, multiple proofs may be created throughout the duration of the test. Until // these values are appropriately adjusted, we assert on an increase in proofs rather than +1. - require.Greater(s, len(allProofsRes.Proof), len(preExistingProofs), "number of proofs must have increased") + require.Greater(s, len(allProofsRes.Proofs), len(preExistingProofs), "number of proofs must have increased") // TODO_UPNEXT(@bryanchriswhite): assert that the root hash of the proof contains the correct // SMST sum. The sum can be retrieved via the `GetSum` function exposed @@ -163,7 +163,7 @@ func (s *suite) TheProofSubmittedBySupplierForServiceForApplicationShouldBePersi // TODO_IMPROVE: add assertions about serviceId and appName and/or incorporate // them into the scenarioState key(s). - proof := allProofsRes.Proof[0] + proof := allProofsRes.Proofs[0] require.Equal(s, accNameToAddrMap[supplierName], proof.SupplierAddress) } diff --git a/pkg/client/supplier/client.go b/pkg/client/supplier/client.go index 4bf4c0554..a2fdcd10d 100644 --- a/pkg/client/supplier/client.go +++ b/pkg/client/supplier/client.go @@ -10,8 +10,8 @@ import ( "github.com/pokt-network/poktroll/pkg/client" "github.com/pokt-network/poktroll/pkg/client/keyring" "github.com/pokt-network/poktroll/pkg/polylog" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) var _ client.SupplierClient = (*supplierClient)(nil) @@ -74,7 +74,9 @@ func (sClient *supplierClient) SubmitProof( return err } - msg := &suppliertypes.MsgSubmitProof{ + // TODO(@bryanchriswhite): reconcile splitting of supplier & proof modules + // with off-chain pkgs/nomenclature. + msg := &prooftypes.MsgSubmitProof{ SupplierAddress: sClient.signingKeyAddr.String(), SessionHeader: &sessionHeader, Proof: proofBz, @@ -108,7 +110,9 @@ func (sClient *supplierClient) CreateClaim( ) error { logger := polylog.Ctx(ctx) - msg := &suppliertypes.MsgCreateClaim{ + // TODO(@bryanchriswhite): reconcile splitting of supplier & proof modules + // with off-chain pkgs/nomenclature. + msg := &prooftypes.MsgCreateClaim{ SupplierAddress: sClient.signingKeyAddr.String(), SessionHeader: &sessionHeader, RootHash: rootHash, From 50f914258502765d731a560fafd55c0f54fcdd0b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:53:13 +0100 Subject: [PATCH 26/54] fix: encoding config depinject --- e2e/tests/init_test.go | 11 +++++++- pkg/relayer/proxy/synchronous.go | 27 ++++++++++++++++-- pkg/sdk/send_relay.go | 15 ++++++++-- testutil/testclient/localnet.go | 32 ++++++++++++++++++---- testutil/testclient/testkeyring/keyring.go | 15 +++++++++- testutil/testkeyring/gen_accounts/gen.go | 18 ++++++++---- 6 files changed, 101 insertions(+), 17 deletions(-) diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 81b45129e..ed5e420e0 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -14,6 +14,8 @@ import ( "testing" "time" + "cosmossdk.io/depinject" + sdklog "cosmossdk.io/log" tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/codec" "github.com/regen-network/gocuke" @@ -72,7 +74,14 @@ type suite struct { func (s *suite) Before() { s.pocketd = new(pocketdBin) s.scenarioState = make(map[string]any) - s.cdc = app.MakeEncodingConfig().Marshaler + deps := depinject.Configs( + app.AppConfig(), + depinject.Supply( + sdklog.NewTestLogger(s), + ), + ) + err := depinject.Inject(deps, &s.cdc) + require.NoError(s, err) s.buildAddrMap() s.buildAppMap() s.buildSupplierMap() diff --git a/pkg/relayer/proxy/synchronous.go b/pkg/relayer/proxy/synchronous.go index 57353f566..a14201984 100644 --- a/pkg/relayer/proxy/synchronous.go +++ b/pkg/relayer/proxy/synchronous.go @@ -8,8 +8,13 @@ import ( "net/url" "time" + "cosmossdk.io/depinject" sdkerrors "cosmossdk.io/errors" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/pkg/polylog" "github.com/pokt-network/poktroll/pkg/relayer" "github.com/pokt-network/poktroll/pkg/relayer/config" @@ -17,7 +22,24 @@ import ( sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -var _ relayer.RelayServer = (*synchronousRPCServer)(nil) +var ( + _ relayer.RelayServer = (*synchronousRPCServer)(nil) + marshaler codec.Codec +) + +func init() { + cmd.InitSDKConfig() + deps := depinject.Configs( + app.AppConfig(), + depinject.Supply( + app.AppConfig(), + log.NewNopLogger(), + ), + ) + if err := depinject.Inject(deps, &marshaler); err != nil { + panic(err) + } +} // synchronousRPCServer is the struct that holds the state of the synchronous // RPC server. It is used to listen for and respond to relay requests where @@ -274,8 +296,7 @@ func (sync *synchronousRPCServer) sendRelayResponse( relayResponse *types.RelayResponse, writer http.ResponseWriter, ) error { - cdc := types.ModuleCdc - relayResponseBz, err := cdc.Marshal(relayResponse) + relayResponseBz, err := marshaler.Marshal(relayResponse) if err != nil { return err } diff --git a/pkg/sdk/send_relay.go b/pkg/sdk/send_relay.go index 45e93a728..ddfd9f5f8 100644 --- a/pkg/sdk/send_relay.go +++ b/pkg/sdk/send_relay.go @@ -6,10 +6,22 @@ import ( "io" "net/http" + "cosmossdk.io/depinject" + "github.com/cosmos/cosmos-sdk/codec" + + "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/pkg/signer" "github.com/pokt-network/poktroll/x/service/types" ) +var marshaler codec.Codec + +func init() { + if err := depinject.Inject(app.AppConfig(), &marshaler); err != nil { + panic(err) + } +} + // SendRelay sends a relay request to the given supplier's endpoint. // It signs the request, relays it to the supplier and verifies the response signature. // It takes an http.Request as an argument and uses its method and headers to create @@ -54,8 +66,7 @@ func (sdk *poktrollSDK) SendRelay( relayRequest.Meta.Signature = requestSig // Marshal the relay request to bytes and create a reader to be used as an HTTP request body. - cdc := types.ModuleCdc - relayRequestBz, err := cdc.Marshal(relayRequest) + relayRequestBz, err := marshaler.Marshal(relayRequest) if err != nil { return nil, ErrSDKHandleRelay.Wrapf("error marshaling relay request: %s", err) } diff --git a/testutil/testclient/localnet.go b/testutil/testclient/localnet.go index 6b82f53f3..82883b45d 100644 --- a/testutil/testclient/localnet.go +++ b/testutil/testclient/localnet.go @@ -4,8 +4,12 @@ import ( "fmt" "os" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/regen-network/gocuke" "github.com/spf13/pflag" @@ -22,14 +26,32 @@ var ( // CometLocalWebsocketURL provides a default URL pointing to the localnet websocket endpoint. CometLocalWebsocketURL = "ws://localhost:36657/websocket" - // EncodingConfig encapsulates encoding configurations for the Pocket application. - EncodingConfig = app.MakeEncodingConfig() + // TODO_IN_THIS_COMMIT: godoc comments... + TxConfig client.TxConfig + Marshaler codec.Codec + InterfaceRegistry codectypes.InterfaceRegistry ) // init initializes the SDK configuration upon package import. func init() { cmd.InitSDKConfig() + deps := depinject.Configs( + app.AppConfig(), + depinject.Supply( + app.AppConfig(), + log.NewLogger(os.Stderr), + ), + ) + if err := depinject.Inject( + deps, + &TxConfig, + &Marshaler, + &InterfaceRegistry, + ); err != nil { + panic(err) + } + // If SEQUENCER_RPC_ENDPOINT environment variable is set, use it to override the default localnet endpoint. if endpoint := os.Getenv("SEQUENCER_RPC_ENDPOINT"); endpoint != "" { CometLocalTCPURL = fmt.Sprintf("tcp://%s", endpoint) @@ -53,11 +75,11 @@ func NewLocalnetClientCtx(t gocuke.TestingT, flagSet *pflag.FlagSet) *client.Con homedir := app.DefaultNodeHome clientCtx := client.Context{}. - WithCodec(EncodingConfig.Marshaler). - WithTxConfig(EncodingConfig.TxConfig). + WithCodec(Marshaler). + WithTxConfig(TxConfig). WithHomeDir(homedir). WithAccountRetriever(authtypes.AccountRetriever{}). - WithInterfaceRegistry(EncodingConfig.InterfaceRegistry) + WithInterfaceRegistry(InterfaceRegistry) clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, flagSet) require.NoError(t, err) diff --git a/testutil/testclient/testkeyring/keyring.go b/testutil/testclient/testkeyring/keyring.go index bb83baf88..c1fc76d7d 100644 --- a/testutil/testclient/testkeyring/keyring.go +++ b/testutil/testclient/testkeyring/keyring.go @@ -3,15 +3,28 @@ package testkeyring import ( "testing" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/testutil/testclient" ) // NewTestKeyringWithKey creates a new in-memory keyring with a test key // with testSigningKeyName as its name. func NewTestKeyringWithKey(t *testing.T, keyName string) (keyring.Keyring, *keyring.Record) { - keyring := keyring.NewInMemory(testclient.EncodingConfig.Marshaler) + var marshaler codec.Codec + deps := depinject.Configs( + depinject.Supply(log.NewTestLogger(t)), + app.AppConfig(), + ) + err := depinject.Inject(deps, &marshaler) + require.NoError(t, err) + + keyring := keyring.NewInMemory(marshaler) key, _ := testclient.NewKey(t, keyName, keyring) return keyring, key } diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go index 8b05da7d2..56b047fec 100644 --- a/testutil/testkeyring/gen_accounts/gen.go +++ b/testutil/testkeyring/gen_accounts/gen.go @@ -1,5 +1,3 @@ -//go:build ignore - package main import ( @@ -10,13 +8,15 @@ import ( "os" "strings" + "cosmossdk.io/depinject" + sdklog "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/testutil/testkeyring" - "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/testutil/testkeyring" ) var ( @@ -33,7 +33,15 @@ func init() { func main() { flag.Parse() - kr := keyring.NewInMemory(app.MakeEncodingConfig().Marshaler) + var marshaler codec.Codec + deps := depinject.Configs( + app.AppConfig(), + depinject.Supply(sdklog.NewNopLogger()), + ) + if err := depinject.Inject(deps, &marshaler); err != nil { + log.Fatal(err) + } + kr := keyring.NewInMemory(marshaler) preGeneratedAccountLines := make([]string, flagAccountsLimit) for i := range preGeneratedAccountLines { From 67478be42f74d39b0ace00880043b8e54a0cc8a9 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:53:19 +0100 Subject: [PATCH 27/54] fix: math imports --- pkg/client/tx/client_test.go | 9 +++++---- testutil/testclient/testqueryclients/appquerier.go | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/client/tx/client_test.go b/pkg/client/tx/client_test.go index 4de1b2f9a..acd66c9a0 100644 --- a/pkg/client/tx/client_test.go +++ b/pkg/client/tx/client_test.go @@ -8,6 +8,7 @@ import ( "time" "cosmossdk.io/depinject" + "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" cometbytes "github.com/cometbft/cometbft/libs/bytes" cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -93,7 +94,7 @@ func TestTxClient_SignAndBroadcast_Succeeds(t *testing.T) { require.NoError(t, err) // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStake := types.NewCoin("upokt", math.NewInt(1000000)) appStakeMsg := &apptypes.MsgStakeApplication{ Address: signingKeyAddr.String(), Stake: &appStake, @@ -127,7 +128,7 @@ func TestTxClient_SignAndBroadcast_Succeeds(t *testing.T) { func TestTxClient_NewTxClient_Error(t *testing.T) { // Construct an empty in-memory keyring. - memKeyring := cosmoskeyring.NewInMemory(testclient.EncodingConfig.Marshaler) + memKeyring := cosmoskeyring.NewInMemory(testclient.Marshaler) tests := []struct { name string @@ -310,7 +311,7 @@ func TestTxClient_SignAndBroadcast_CheckTxError(t *testing.T) { require.NoError(t, err) // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStake := types.NewCoin("upokt", math.NewInt(1000000)) appStakeMsg := &apptypes.MsgStakeApplication{ Address: signingKeyAddr.String(), Stake: &appStake, @@ -378,7 +379,7 @@ func TestTxClient_SignAndBroadcast_Timeout(t *testing.T) { require.NoError(t, err) // Construct a valid (arbitrary) message to sign, encode, and broadcast. - appStake := types.NewCoin("upokt", types.NewInt(1000000)) + appStake := types.NewCoin("upokt", math.NewInt(1000000)) appStakeMsg := &apptypes.MsgStakeApplication{ Address: signingKeyAddr.String(), Stake: &appStake, diff --git a/testutil/testclient/testqueryclients/appquerier.go b/testutil/testclient/testqueryclients/appquerier.go index 85432f35c..9c0335b7a 100644 --- a/testutil/testclient/testqueryclients/appquerier.go +++ b/testutil/testclient/testqueryclients/appquerier.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "cosmossdk.io/math" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang/mock/gomock" @@ -44,7 +45,7 @@ func NewTestApplicationQueryClient( } return apptypes.Application{ Address: appAddress, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{ From 3248d32ed5e60f9804c2f2fc7660232d50b407a4 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:54:01 +0100 Subject: [PATCH 28/54] reconcile: off-chain v0.50 breaking changes --- pkg/client/tx/client.go | 9 ++++++--- pkg/signer/simple_signer.go | 7 +++++-- testutil/testclient/testtx/context.go | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go index 2149f383d..1bcc109c2 100644 --- a/pkg/client/tx/client.go +++ b/pkg/client/tx/client.go @@ -192,9 +192,12 @@ func (tClient *txClient) SignAndBroadcast( ) either.AsyncError { var validationErrs error for i, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - validationErr := ErrInvalidMsg.Wrapf("in msg with index %d: %s", i, err) - validationErrs = multierr.Append(validationErrs, validationErr) + validatableMsg, ok := msg.(cosmostypes.HasValidateBasic) + if ok { + if err := validatableMsg.ValidateBasic(); err != nil { + validationErr := ErrInvalidMsg.Wrapf("in msg with index %d: %s", i, err) + validationErrs = multierr.Append(validationErrs, validationErr) + } } } if validationErrs != nil { diff --git a/pkg/signer/simple_signer.go b/pkg/signer/simple_signer.go index 432c1c8a3..0a4cd2503 100644 --- a/pkg/signer/simple_signer.go +++ b/pkg/signer/simple_signer.go @@ -1,6 +1,9 @@ package signer -import "github.com/cosmos/cosmos-sdk/crypto/keyring" +import ( + "github.com/cosmos/cosmos-sdk/crypto/keyring" + signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" +) var _ Signer = (*SimpleSigner)(nil) @@ -18,6 +21,6 @@ func NewSimpleSigner(keyring keyring.Keyring, keyName string) *SimpleSigner { // Sign signs the given message using the SimpleSigner's keyring and keyName func (s *SimpleSigner) Sign(msg [32]byte) (signature []byte, err error) { - sig, _, err := s.keyring.Sign(s.keyName, msg[:]) + sig, _, err := s.keyring.Sign(s.keyName, msg[:], signingtypes.SignMode_SIGN_MODE_DIRECT) return sig, err } diff --git a/testutil/testclient/testtx/context.go b/testutil/testclient/testtx/context.go index aa255d650..c52eade11 100644 --- a/testutil/testclient/testtx/context.go +++ b/testutil/testclient/testtx/context.go @@ -108,7 +108,7 @@ func NewOneTimeErrTxTimeoutTxContext( return &cometrpctypes.ResultTx{ Hash: txHash, Height: 1, - TxResult: abci.ResponseDeliverTx{ + TxResult: abci.ExecTxResult{ Code: 1, Log: *expectedErrMsg, Codespace: "test_codespace", From 009e2e75681a2118bafd5c2fb8d0cb0235c21bfb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:54:23 +0100 Subject: [PATCH 29/54] fix: off-chain testutils --- testutil/network/network.go | 69 +++++++++++++++++++++++++++++++++++++ testutil/sample/sample.go | 16 +++++++++ 2 files changed, 85 insertions(+) diff --git a/testutil/network/network.go b/testutil/network/network.go index 5a7ce763c..c2c1f13b9 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -16,6 +16,7 @@ import ( "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/sample" + appmodule "github.com/pokt-network/poktroll/x/application/module" apptypes "github.com/pokt-network/poktroll/x/application/types" gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -207,6 +208,22 @@ func DefaultGatewayModuleGenesisState(t *testing.T, n int) *gatewaytypes.Genesis return state } +// GatewayModuleGenesisStateWithAddresses generates a GenesisState object with +// a gateway list full of gateways with the given addresses. +// It returns the populated GenesisState object. +func GatewayModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *gatewaytypes.GenesisState { + t.Helper() + state := gatewaytypes.DefaultGenesis() + for _, addr := range addresses { + gateway := gatewaytypes.Gateway{ + Address: addr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(10000)}, + } + state.GatewayList = append(state.GatewayList, gateway) + } + return state +} + // TODO_CLEANUP: Consolidate all of the helpers below to use shared business // logic and move into its own helpers file. @@ -263,6 +280,58 @@ func InitAccountWithSequence( require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) } +// DelegateAppToGateway delegates the provided application to the provided gateway +func DelegateAppToGateway( + t *testing.T, + net *Network, + appAddr string, + gatewayAddr string, +) { + t.Helper() + val := net.Validators[0] + ctx := val.ClientCtx + args := []string{ + gatewayAddr, + fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), + } + responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appmodule.CmdDelegateToGateway(), args) + require.NoError(t, err) + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) +} + +// UndelegateAppFromGateway undelegates the provided application from the provided gateway +func UndelegateAppFromGateway( + t *testing.T, + net *Network, + appAddr string, + gatewayAddr string, +) { + t.Helper() + val := net.Validators[0] + ctx := val.ClientCtx + args := []string{ + gatewayAddr, + fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), + } + responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appmodule.CmdUndelegateFromGateway(), args) + require.NoError(t, err) + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(responseRaw.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) +} + // freePorts return the available ports based on the number of requested ports. func freePorts(n int) ([]string, error) { closeFns := make([]func() error, n) diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 98f2153ed..6b299717f 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -2,12 +2,28 @@ package sample import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" ) +// AccAddressAndPubKey returns a sample account address and public key +func AccAddressAndPubKey() (string, cryptotypes.PubKey) { + pk := secp256k1.GenPrivKey().PubKey() + addr := pk.Address() + return sdk.AccAddress(addr).String(), pk +} + // AccAddress returns a sample account address func AccAddress() string { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() return sdk.AccAddress(addr).String() } + +// AccAddressAndPubKeyEdd2519 returns a sample account address and public key +func AccAddressAndPubKeyEdd2519() (string, cryptotypes.PubKey) { + pk := ed25519.GenPrivKey().PubKey() + addr := pk.Address() + return sdk.AccAddress(addr).String(), pk +} From 7948546abb9b018e33a0c643a88e35104f201727 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:55:00 +0100 Subject: [PATCH 30/54] fix: localnet --- Makefile | 6 ++++-- Tiltfile | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5f1955457..d8fd38e91 100644 --- a/Makefile +++ b/Makefile @@ -180,6 +180,7 @@ docker_wipe: check_docker warn_destructive prompt_user ## [WARNING] Remove all t .PHONY: localnet_up localnet_up: ## Starts localnet + make proto_regen make localnet_regenesis tilt up @@ -194,7 +195,7 @@ localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localn # intends to make this parameterizable in the future. @echo "Initializing chain..." @set -e ;\ - ignite chain init ;\ + ignite chain init --skip-proto ;\ mkdir -p $(POKTROLLD_HOME)/config/ ;\ cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME) ;\ cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ ;\ @@ -570,7 +571,8 @@ acc_initialize_pubkeys: ## Make sure the account keeper has public keys for all $(addr) $(PNF_ADDR) 1000upokt \ --yes \ --home=$(POKTROLLD_HOME) \ - --node $(POCKET_NODE);) + --node $(POCKET_NODE) \ + --chain-id poktroll;) .PHONY: acc_initialize_pubkeys_warn_message acc_initialize_pubkeys_warn_message: ## Print a warning message about the need to run `make acc_initialize_pubkeys` diff --git a/Tiltfile b/Tiltfile index d279e7fd0..bd8fcaf7a 100644 --- a/Tiltfile +++ b/Tiltfile @@ -72,7 +72,7 @@ k8s_yaml( # Hot reload protobuf changes local_resource( "hot-reload: generate protobufs", - "ignite generate proto-go -y", + "make proto_regen", deps=["proto"], labels=["hot-reloading"], ) From 7b3f6a2eeb536f5cc7f617bcb2199b76ef0d35e2 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:55:28 +0100 Subject: [PATCH 31/54] chore: update go.mod --- go.mod | 26 +++++++++++++++++++------- go.sum | 47 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index cf765b06f..629696459 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/upgrade v0.1.1 + github.com/athanorlabs/go-dleq v0.1.0 github.com/bufbuild/buf v1.29.0 github.com/cometbft/cometbft v0.38.2 github.com/cosmos/cosmos-db v1.0.0 @@ -33,19 +34,29 @@ require ( github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/go-kit/kit v0.13.0 github.com/gogo/status v1.1.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.1 + github.com/gorilla/websocket v1.5.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 + github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f github.com/pokt-network/smt v0.9.2 + github.com/pokt-network/smt/kvstore/badger v0.0.0-20240109205447-868237978c0b + github.com/prometheus/client_golang v1.18.0 + github.com/regen-network/gocuke v1.1.0 github.com/rs/zerolog v1.31.0 + github.com/slok/go-http-metrics v0.11.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.8.4 + go.uber.org/multierr v1.11.0 golang.org/x/crypto v0.18.0 + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 + golang.org/x/sync v0.6.0 golang.org/x/tools v0.17.0 google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac google.golang.org/grpc v1.60.1 @@ -78,6 +89,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/bufbuild/protocompile v0.8.0 // indirect github.com/bufbuild/protovalidate-go v0.5.0 // indirect @@ -90,6 +102,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect @@ -108,6 +121,10 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect + github.com/cucumber/common/messages/go/v19 v19.1.2 // indirect + github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect + github.com/cucumber/messages/go/v21 v21.0.1 // indirect + github.com/cucumber/tag-expressions/go/v5 v5.0.6 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect @@ -137,7 +154,6 @@ require ( github.com/getsentry/sentry-go v0.25.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-chi/chi/v5 v5.0.11 // indirect - github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect @@ -145,6 +161,7 @@ require ( github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gofrs/uuid/v5 v5.0.0 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -165,7 +182,6 @@ require ( github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/rpc v1.2.1 // indirect - github.com/gorilla/websocket v1.5.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -267,7 +283,6 @@ require ( github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect @@ -291,7 +306,7 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -315,13 +330,10 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.20.0 // indirect - go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.20.0 // indirect golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 35808c136..c58b8e121 100644 --- a/go.sum +++ b/go.sum @@ -319,6 +319,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= +github.com/athanorlabs/go-dleq v0.1.0 h1:0/llWZG8fz2uintMBKOiBC502zCsDA8nt8vxI73W9Qc= +github.com/athanorlabs/go-dleq v0.1.0/go.mod h1:DWry6jSD7A13MKmeZA0AX3/xBeQCXDoygX99VPwL3yU= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -349,6 +351,8 @@ github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5M github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= +github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= +github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= @@ -444,6 +448,8 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/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/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= +github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= @@ -531,6 +537,14 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/cucumber/common/messages/go/v19 v19.1.2 h1:8/ZkW9rj3KQo/regmI8kcy48tk57m427Olb7Y0lXcN4= +github.com/cucumber/common/messages/go/v19 v19.1.2/go.mod h1:0KLDvMVmmkEZcWUSKxFHSUSLS1gjujBbPN0p41IwwJ4= +github.com/cucumber/gherkin/go/v26 v26.2.0 h1:EgIjePLWiPeslwIWmNQ3XHcypPsWAHoMCz/YEBKP4GI= +github.com/cucumber/gherkin/go/v26 v26.2.0/go.mod h1:t2GAPnB8maCT4lkHL99BDCVNzCh1d7dBhCLt150Nr/0= +github.com/cucumber/messages/go/v21 v21.0.1 h1:wzA0LxwjlWQYZd32VTlAVDTkW6inOFmSM+RuOwHZiMI= +github.com/cucumber/messages/go/v21 v21.0.1/go.mod h1:zheH/2HS9JLVFukdrsPWoPdmUtmYQAQPLk7w5vWsk5s= +github.com/cucumber/tag-expressions/go/v5 v5.0.6 h1:F0mqsu69cG/3MTTZqy+PlaPcU/MMl936OJjxKgdFgWs= +github.com/cucumber/tag-expressions/go/v5 v5.0.6/go.mod h1:/sHRc0Vt+pPjgQdNZjH8W2cnmb+tiVYp19VESzpGQsw= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/daixiang0/gci v0.4.2/go.mod h1:d0f+IJhr9loBtIq+ebwhRoTt1LGbPH96ih8bKlsRT9E= github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= @@ -661,6 +675,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -703,14 +719,14 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= +github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -751,6 +767,8 @@ github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -1227,8 +1245,8 @@ github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+s github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1581,6 +1599,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nishanths/exhaustive v0.8.1/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f h1:1+NP/H13eFAqBYrGpRkbJUWVWIO2Zr2eP7a/q0UtZVQ= +github.com/noot/ring-go v0.0.0-20231019173746-6c4b33bcf03f/go.mod h1:0t3gzoSfW2bkTce1E/Jis3MQpjiKGhAgqieFK+nkQsI= 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= @@ -1703,6 +1723,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pokt-network/smt v0.9.2 h1:h/GnFm1F6mNBbF1hopr+9+y7nr173SU55NX7NxTVU0Y= github.com/pokt-network/smt v0.9.2/go.mod h1:S4Ho4OPkK2v2vUCHNtA49XDjqUC/OFYpBbynRVYmxvA= +github.com/pokt-network/smt/kvstore/badger v0.0.0-20240109205447-868237978c0b h1:TjfgV3vgW0zW47Br/OgUXD4M8iyR74EYanbFfN4ed8o= +github.com/pokt-network/smt/kvstore/badger v0.0.0-20240109205447-868237978c0b/go.mod h1:GbzcG5ebj8twKmBL1VzdPM4NS44okwYXBfQaVXT+6yU= github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= @@ -1786,6 +1808,8 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/gocuke v1.1.0 h1:gxlkRTfpR9gJ0mwqQZIpoXHZGx+KPshKQpKE0jtUH5s= +github.com/regen-network/gocuke v1.1.0/go.mod h1:nVBO9DEnZNUB/GjmJgAIojKxcEu9a0EZwry0qKW24Mk= github.com/remyoudompheng/go-dbus v0.0.0-20121104212943-b7232d34b1d5/go.mod h1:+u151txRmLpwxBmpYn9z3d1sdJdjRPQpsXuYeY9jNls= github.com/remyoudompheng/go-liblzma v0.0.0-20190506200333-81bf2d431b96/go.mod h1:90HvCY7+oHHUKkbeMCiHt1WuFR2/hPJ9QrljDG+v6ls= github.com/remyoudompheng/go-misc v0.0.0-20190427085024-2d6ac652a50e/go.mod h1:80FQABjoFzZ2M5uEa6FUaJYEmqU2UOKojlFVak1UAwI= @@ -1871,6 +1895,8 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/nosnakecase v1.5.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.6.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/slok/go-http-metrics v0.11.0 h1:ABJUpekCZSkQT1wQrFvS4kGbhea/w6ndFJaWJeh3zL0= +github.com/slok/go-http-metrics v0.11.0/go.mod h1:ZGKeYG1ET6TEJpQx18BqAJAvxw9jBAZXCHU7bWQqqAc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= @@ -1934,8 +1960,9 @@ github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5J github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= +github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -1946,9 +1973,11 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 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.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= From 0aed7ae8488173cf8e6f224d0a883db8b835740c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 16 Feb 2024 13:55:35 +0100 Subject: [PATCH 32/54] chore: update openapi.yml --- docs/static/openapi.yml | 4427 ++++++++++++++++++++++++++++++++++----- 1 file changed, 3874 insertions(+), 553 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 3dfa4ed44..c9122d232 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -18910,6 +18910,1956 @@ paths: parameters. tags: - Msg + /poktroll.application.Msg/DelegateToGateway: + post: + operationId: PoktrollApplicationMsg_DelegateToGateway + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + app_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic deterministic + encoding using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding + gateway_address: + type: string + title: >- + The Bech32 address of the gateway the application wants to + delegate to using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding using cosmos' + ScalarDescriptor to ensure deterministic deterministic + encoding + tags: + - Msg + /poktroll.application.Msg/StakeApplication: + post: + operationId: PoktrollApplicationMsg_StakeApplication + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + stake: + title: >- + The total amount of uPOKT the application has staked. Must be + ≥ to the current amount that the application has staked (if + any) + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + services: + type: array + items: + type: object + properties: + service: + title: The Service for which the application is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session + for a certain service but with some additional + configs that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as + a reminder than an optional onchain representation + of the service is necessary + title: >- + ApplicationServiceConfig holds the service configuration the + application stakes for + title: >- + The list of services this application is staked to request + service for + tags: + - Msg + /poktroll.application.Msg/UndelegateFromGateway: + post: + operationId: PoktrollApplicationMsg_UndelegateFromGateway + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + app_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic deterministic + encoding using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding + gateway_address: + type: string + title: >- + The Bech32 address of the gateway the application wants to + undelegate from using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding using cosmos' + ScalarDescriptor to ensure deterministic deterministic + encoding + tags: + - Msg + /poktroll.application.Msg/UnstakeApplication: + post: + operationId: PoktrollApplicationMsg_UnstakeApplication + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + address: + type: string + tags: + - Msg + /poktroll.application.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollApplicationMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + properties: + max_delegated_gateways: + type: string + format: uint64 + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /poktroll.gateway.Msg/StakeGateway: + post: + operationId: PoktrollGatewayMsg_StakeGateway + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + address: + type: string + title: The Bech32 address of the gateway + stake: + title: >- + The total amount of uPOKT the gateway is staking. Must be ≥ to + the current amount that the gateway has staked (if any) + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + tags: + - Msg + /poktroll.gateway.Msg/UnstakeGateway: + post: + operationId: PoktrollGatewayMsg_UnstakeGateway + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + address: + type: string + title: The Bech32 address of the gateway + tags: + - Msg + /poktroll.gateway.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollGatewayMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /pokt-network/poktroll/proof/claim: + get: + operationId: PoktrollProofQuery_AllClaims + responses: + '200': + description: A successful response. + schema: + type: object + properties: + claims: + type: array + items: + type: object + properties: + supplier_address: + type: string + title: the address of the supplier that submitted this claim + session_header: + description: >- + The session header of the session that this claim is + for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a + session for a certain service but with some + additional configs that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts + as a reminder than an optional onchain + representation of the service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above + values using on-chain but is included in the header + for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the + last block of the session + root_hash: + type: string + format: byte + description: Root hash returned from smt.SMST#Root(). + title: >- + Claim is the serialized object stored on-chain for claims + pending to be proven + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + - name: supplier_address + in: query + required: false + type: string + - name: session_id + in: query + required: false + type: string + - name: session_end_height + in: query + required: false + type: string + format: uint64 + tags: + - Query + /pokt-network/poktroll/proof/claim/{session_id}/{supplier_address}: + get: + summary: Queries a list of Claim items. + operationId: PoktrollProofQuery_Claim + responses: + '200': + description: A successful response. + schema: + type: object + properties: + claim: + type: object + properties: + supplier_address: + type: string + title: the address of the supplier that submitted this claim + session_header: + description: The session header of the session that this claim is for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session + for a certain service but with some additional + configs that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts + as a reminder than an optional onchain + representation of the service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values + using on-chain but is included in the header for + convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the + last block of the session + root_hash: + type: string + format: byte + description: Root hash returned from smt.SMST#Root(). + title: >- + Claim is the serialized object stored on-chain for claims + pending to be proven + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: session_id + in: path + required: true + type: string + - name: supplier_address + in: path + required: true + type: string + tags: + - Query + /pokt-network/poktroll/proof/params: + get: + summary: Parameters queries the parameters of the module. + operationId: PoktrollProofQuery_Params + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /pokt-network/poktroll/proof/proof: + get: + operationId: PoktrollProofQuery_AllProofs + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proofs: + type: array + items: + type: object + properties: + supplier_address: + type: string + session_header: + description: >- + The session header of the session that this claim is + for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a + session for a certain service but with some + additional configs that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts + as a reminder than an optional onchain + representation of the service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above + values using on-chain but is included in the header + for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the + last block of the session + closest_merkle_proof: + type: string + format: byte + description: >- + The serialized SMST proof from the `#ClosestProof()` + method. + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + - name: supplier_address + in: query + required: false + type: string + - name: session_id + in: query + required: false + type: string + - name: session_end_height + in: query + required: false + type: string + format: uint64 + tags: + - Query + /pokt-network/poktroll/proof/proof/{session_id}/{supplier_address}: + get: + summary: Queries a list of Proof items. + operationId: PoktrollProofQuery_Proof + responses: + '200': + description: A successful response. + schema: + type: object + properties: + proof: + type: object + properties: + supplier_address: + type: string + session_header: + description: The session header of the session that this claim is for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session + for a certain service but with some additional + configs that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts + as a reminder than an optional onchain + representation of the service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values + using on-chain but is included in the header for + convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the + last block of the session + closest_merkle_proof: + type: string + format: byte + description: >- + The serialized SMST proof from the `#ClosestProof()` + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: session_id + in: path + required: true + type: string + - name: supplier_address + in: path + required: true + type: string + tags: + - Query + /poktroll.proof.Msg/CreateClaim: + post: + operationId: PoktrollProofMsg_CreateClaim + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + supplier_address: + type: string + session_header: + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for + a certain service but with some additional configs + that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of + the service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values + using on-chain but is included in the header for + convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last + block of the session + description: >- + SessionHeader is a lightweight header for a session that can + be passed around. + + It is the minimal amount of data required to hydrate & + retrieve all data relevant to the session. + root_hash: + type: string + format: byte + title: root returned from smt.SMST#Root() + tags: + - Msg + /poktroll.proof.Msg/SubmitProof: + post: + operationId: PoktrollProofMsg_SubmitProof + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + supplier_address: + type: string + session_header: + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for + a certain service but with some additional configs + that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of + the service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values + using on-chain but is included in the header for + convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last + block of the session + description: >- + SessionHeader is a lightweight header for a session that can + be passed around. + + It is the minimal amount of data required to hydrate & + retrieve all data relevant to the session. + proof: + type: string + format: byte + title: serialized version of *smt.SparseMerkleClosestProof + tags: + - Msg + /poktroll.proof.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollProofMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /pokt-network/poktroll/service/params: + get: + summary: Parameters queries the parameters of the module. + operationId: PoktrollServiceQuery_Params + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + add_service_fee: + type: string + format: uint64 + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /pokt-network/poktroll/service/service: + get: + operationId: PoktrollServiceQuery_ServiceAll + responses: + '200': + description: A successful response. + schema: + type: object + properties: + service: + type: array + items: + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + title: >- + Service message to encapsulate unique and semantic + identifiers for a service on the network + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the + + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /pokt-network/poktroll/service/service/{index}: + get: + summary: Queries a list of Service items. + operationId: PoktrollServiceQuery_Service + responses: + '200': + description: A successful response. + schema: + type: object + properties: + service: + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + title: >- + Service message to encapsulate unique and semantic identifiers + for a service on the network + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: index + in: path + required: true + type: string + tags: + - Query + /poktroll.service.Msg/AddService: + post: + operationId: PoktrollServiceMsg_AddService + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: >- + MsgAddService defines a message for adding a new message to the + network. + + Services can be added by any actor in the network making them truly + + permissionless. + + TODO_DOCUMENT(@h5law): This is a key function in making services + + permissionless, document it's usage and design - in docusaurus + covering how + + the entire process works. + in: body + required: true + schema: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the service supplier using cosmos' + ScalarDescriptor + service: + title: The Service for which the supplier is adding to the network + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + description: >- + MsgAddService defines a message for adding a new message to the + network. + + Services can be added by any actor in the network making them + truly + + permissionless. + + TODO_DOCUMENT(@h5law): This is a key function in making services + + permissionless, document it's usage and design - in docusaurus + covering how + + the entire process works. + tags: + - Msg + /poktroll.service.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollServiceMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + properties: + add_service_fee: + type: string + format: uint64 + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /poktroll.session.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollSessionMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the module parameters to update. + + NOTE: All parameters must be supplied. + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /poktroll.supplier.Msg/StakeSupplier: + post: + operationId: PoktrollSupplierMsg_StakeSupplier + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the supplier using cosmos' + ScalarDescriptor to ensure deterministic deterministic + encoding using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding + stake: + title: >- + The total amount of uPOKT the supplier has staked. Must be ≥ + to the current amount that the supplier has staked (if any) + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + services: + type: array + items: + type: object + properties: + service: + title: The Service for which the supplier is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session + for a certain service but with some additional + configs that identify it? + name: + type: string + description: >- + (Optional) Semantic human readable name for the + service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as + a reminder than an optional onchain representation + of the service is necessary + endpoints: + type: array + items: + type: object + properties: + url: + type: string + title: URL of the endpoint + rpc_type: + title: Type of RPC exposed on the url above + type: string + enum: + - UNKNOWN_RPC + - GRPC + - WEBSOCKET + - JSON_RPC + - REST + default: UNKNOWN_RPC + description: |- + - UNKNOWN_RPC: Undefined RPC type + - GRPC: gRPC + - WEBSOCKET: WebSocket + - JSON_RPC: JSON-RPC + - REST: REST + configs: + type: array + items: + type: object + properties: + key: + title: Config option key + type: string + enum: + - UNKNOWN_CONFIG + - TIMEOUT + default: UNKNOWN_CONFIG + description: >- + Enum to define configuration options + + TODO_RESEARCH: Should these be configs, SLAs + or something else? There will be more + discussion once we get closer to + implementing on-chain QoS. + + - UNKNOWN_CONFIG: Undefined config option + - TIMEOUT: Timeout setting + value: + type: string + title: Config option value + title: >- + Key-value wrapper for config options, as proto + maps can't be keyed by enums + title: Additional configuration options for the endpoint + title: >- + SupplierEndpoint message to hold service configuration + details + title: List of endpoints for the service + title: >- + SupplierServiceConfig holds the service configuration the + supplier stakes for + title: >- + The list of services this supplier is staked to provide + service for + tags: + - Msg + /poktroll.supplier.Msg/UnstakeSupplier: + post: + operationId: PoktrollSupplierMsg_UnstakeSupplier + responses: + '200': + description: A successful response. + schema: + type: object + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the supplier using cosmos' + ScalarDescriptor to ensure deterministic deterministic + encoding using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding + tags: + - Msg + /poktroll.supplier.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollSupplierMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg definitions: cosmos.auth.v1beta1.MsgUpdateParams: type: object @@ -25144,17 +27094,222 @@ definitions: This message has been deprecated. Use MsgUpdateClient instead. ibc.core.client.v1.MsgSubmitMisbehaviourResponse: type: object - description: |- - MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response - type. - ibc.core.client.v1.MsgUpdateClient: + description: |- + MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + type. + ibc.core.client.v1.MsgUpdateClient: + type: object + properties: + client_id: + type: string + title: client unique identifier + client_message: + title: client message to update the light client + type: object + properties: + '@type': + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + additionalProperties: {} + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + signer: + type: string + title: signer address + description: |- + MsgUpdateClient defines an sdk.Msg to update a IBC client state using + the given client message. + ibc.core.client.v1.MsgUpdateClientResponse: + type: object + description: MsgUpdateClientResponse defines the Msg/UpdateClient response type. + ibc.core.client.v1.MsgUpdateParams: + type: object + properties: + signer: + type: string + title: signer address + params: + description: |- + params defines the client parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state types + which can be created + + and interacted with. If a client type is removed from the allowed + clients list, usage + + of this client will be disabled until it is added again to the + list. + description: MsgUpdateParams defines the sdk.Msg type to update the client parameters. + ibc.core.client.v1.MsgUpdateParamsResponse: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + ibc.core.client.v1.MsgUpgradeClient: type: object properties: client_id: type: string title: client unique identifier - client_message: - title: client message to update the light client + client_state: + title: upgraded client state type: object properties: '@type': @@ -25313,53 +27468,12 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - signer: - type: string - title: signer address - description: |- - MsgUpdateClient defines an sdk.Msg to update a IBC client state using - the given client message. - ibc.core.client.v1.MsgUpdateClientResponse: - type: object - description: MsgUpdateClientResponse defines the Msg/UpdateClient response type. - ibc.core.client.v1.MsgUpdateParams: - type: object - properties: - signer: - type: string - title: signer address - params: - description: |- - params defines the client parameters to update. - - NOTE: All parameters must be supplied. - type: object - properties: - allowed_clients: - type: array - items: - type: string - description: >- - allowed_clients defines the list of allowed client state types - which can be created - - and interacted with. If a client type is removed from the allowed - clients list, usage + consensus_state: + title: >- + upgraded consensus state, only contains enough information to serve as + a - of this client will be disabled until it is added again to the - list. - description: MsgUpdateParams defines the sdk.Msg type to update the client parameters. - ibc.core.client.v1.MsgUpdateParamsResponse: - type: object - description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. - ibc.core.client.v1.MsgUpgradeClient: - type: object - properties: - client_id: - type: string - title: client unique identifier - client_state: - title: upgraded client state + basis of trust in update logic type: object properties: '@type': @@ -25518,12 +27632,109 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - consensus_state: + proof_upgrade_client: + type: string + format: byte + title: proof that old chain committed to new client + proof_upgrade_consensus_state: + type: string + format: byte + title: proof that old chain committed to new consensus state + signer: + type: string + title: signer address + title: >- + MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new + client + + state + ibc.core.client.v1.MsgUpgradeClientResponse: + type: object + description: MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. + ibc.core.client.v1.Params: + type: object + properties: + allowed_clients: + type: array + items: + type: string + description: >- + allowed_clients defines the list of allowed client state types which + can be created + + and interacted with. If a client type is removed from the allowed + clients list, usage + + of this client will be disabled until it is added again to the list. + description: Params defines the set of IBC light client parameters. + ibc.core.commitment.v1.MerklePrefix: + type: object + properties: + key_prefix: + type: string + format: byte + title: |- + MerklePrefix is merkle path prefixed to the key. + The constructed key from the Path and the key will be append(Path.KeyPath, + append(Path.KeyPrefix, key...)) + ibc.core.connection.v1.Counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte title: >- - upgraded consensus state, only contains enough information to serve as - a + MerklePrefix is merkle path prefixed to the key. - basis of trust in update logic + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a connection + end. + ibc.core.connection.v1.MsgConnectionOpenAck: + type: object + properties: + connection_id: + type: string + counterparty_connection_id: + type: string + version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in + + the connection handshake. + client_state: type: object properties: '@type': @@ -25658,116 +27869,222 @@ definitions: additional field `@type` which contains the type URL. Example: - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + proof_try: + type: string + format: byte + title: |- + proof of the initialization the connection on Chain B: `UNITIALIZED -> + TRYOPEN` + proof_client: + type: string + format: byte + title: proof of client state included in message + proof_consensus: + type: string + format: byte + title: proof of client consensus state + consensus_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + reset the height in certain conditions e.g. hard forks, state-machine - If the embedded message type is well-known and has a custom JSON + breaking changes In these cases, the RevisionNumber is incremented so + that - representation, that representation will be embedded adding a field + height continues to be monitonically increasing even as the + RevisionHeight - `value` which holds the custom JSON in addition to the `@type` + gets reset + title: >- + Height is a monotonically increasing data type - field. Example (for message [google.protobuf.Duration][]): + that can be compared against another Height for the purposes of + updating and - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - proof_upgrade_client: + freezing clients + signer: type: string - format: byte - title: proof that old chain committed to new client - proof_upgrade_consensus_state: + host_consensus_state_proof: type: string format: byte - title: proof that old chain committed to new consensus state - signer: - type: string - title: signer address - title: >- - MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new - client - - state - ibc.core.client.v1.MsgUpgradeClientResponse: + title: >- + optional proof data for host state machines that are unable to + introspect their own consensus state + description: |- + MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + acknowledge the change of connection state to TRYOPEN on Chain B. + ibc.core.connection.v1.MsgConnectionOpenAckResponse: type: object - description: MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. - ibc.core.client.v1.Params: + description: >- + MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response + type. + ibc.core.connection.v1.MsgConnectionOpenConfirm: type: object properties: - allowed_clients: - type: array - items: - type: string + connection_id: + type: string + proof_ack: + type: string + format: byte + title: >- + proof for the change of the connection state on Chain A: `INIT -> + OPEN` + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision description: >- - allowed_clients defines the list of allowed client state types which - can be created + Normally the RevisionHeight is incremented at each height while + keeping - and interacted with. If a client type is removed from the allowed - clients list, usage + RevisionNumber the same. However some consensus algorithms may choose + to - of this client will be disabled until it is added again to the list. - description: Params defines the set of IBC light client parameters. - ibc.core.commitment.v1.MerklePrefix: - type: object - properties: - key_prefix: + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + signer: type: string - format: byte - title: |- - MerklePrefix is merkle path prefixed to the key. - The constructed key from the Path and the key will be append(Path.KeyPath, - append(Path.KeyPrefix, key...)) - ibc.core.connection.v1.Counterparty: + description: |- + MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + acknowledge the change of connection state to OPEN on Chain A. + ibc.core.connection.v1.MsgConnectionOpenConfirmResponse: + type: object + description: |- + MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + response type. + ibc.core.connection.v1.MsgConnectionOpenInit: type: object properties: client_id: type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: - type: string - description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. + counterparty: type: object properties: - key_prefix: + client_id: type: string - format: byte - title: >- - MerklePrefix is merkle path prefixed to the key. + description: >- + identifies the client on the counterparty chain associated with a + given - The constructed key from the Path and the key will be - append(Path.KeyPath, + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a - append(Path.KeyPrefix, key...)) - description: >- - Counterparty defines the counterparty chain associated with a connection - end. - ibc.core.connection.v1.MsgConnectionOpenAck: - type: object - properties: - connection_id: - type: string - counterparty_connection_id: - type: string + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. version: type: object properties: @@ -25784,6 +28101,29 @@ definitions: verison in the connection handshake. + delay_period: + type: string + format: uint64 + signer: + type: string + description: |- + MsgConnectionOpenInit defines the msg sent by an account on Chain A to + initialize a connection with Chain B. + ibc.core.connection.v1.MsgConnectionOpenInitResponse: + type: object + description: |- + MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + type. + ibc.core.connection.v1.MsgConnectionOpenTry: + type: object + properties: + client_id: + type: string + previous_connection_id: + type: string + description: >- + Deprecated: this field is unused. Crossing hellos are no longer + supported in core IBC. client_state: type: object properties: @@ -25939,10 +28279,65 @@ definitions: field. Example (for message [google.protobuf.Duration][]): - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + counterparty: + type: object + properties: + client_id: + type: string + description: >- + identifies the client on the counterparty chain associated with a + given + + connection. + connection_id: + type: string + description: >- + identifies the connection end on the counterparty chain associated + with a + + given connection. + prefix: + description: commitment merkle prefix of the counterparty chain. + type: object + properties: + key_prefix: + type: string + format: byte + title: >- + MerklePrefix is merkle path prefixed to the key. + + The constructed key from the Path and the key will be + append(Path.KeyPath, + + append(Path.KeyPrefix, key...)) + description: >- + Counterparty defines the counterparty chain associated with a + connection end. + delay_period: + type: string + format: uint64 + counterparty_versions: + type: array + items: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: >- + Version defines the versioning scheme used to negotiate the IBC + verison in + + the connection handshake. proof_height: type: object properties: @@ -25977,12 +28372,12 @@ definitions: updating and freezing clients - proof_try: + proof_init: type: string format: byte title: |- - proof of the initialization the connection on Chain B: `UNITIALIZED -> - TRYOPEN` + proof of the initialization the connection on Chain A: `UNITIALIZED -> + INIT` proof_client: type: string format: byte @@ -26034,514 +28429,1440 @@ definitions: optional proof data for host state machines that are unable to introspect their own consensus state description: |- - MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to - acknowledge the change of connection state to TRYOPEN on Chain B. - ibc.core.connection.v1.MsgConnectionOpenAckResponse: + MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + connection on Chain B. + ibc.core.connection.v1.MsgConnectionOpenTryResponse: type: object description: >- - MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response + MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. - ibc.core.connection.v1.MsgConnectionOpenConfirm: + ibc.core.connection.v1.MsgUpdateParams: type: object properties: - connection_id: + signer: type: string - proof_ack: + title: signer address + params: + description: |- + params defines the connection parameters to update. + + NOTE: All parameters must be supplied. + type: object + properties: + max_expected_time_per_block: + type: string + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the + + largest amount of time that the chain might reasonably take to + produce the next block under normal operating + + conditions. A safe choice is 3-5x the expected time per block. + description: >- + MsgUpdateParams defines the sdk.Msg type to update the connection + parameters. + ibc.core.connection.v1.MsgUpdateParamsResponse: + type: object + description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. + ibc.core.connection.v1.Params: + type: object + properties: + max_expected_time_per_block: + type: string + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the + + largest amount of time that the chain might reasonably take to produce + the next block under normal operating + + conditions. A safe choice is 3-5x the expected time per block. + description: Params defines the set of Connection parameters. + ibc.core.connection.v1.Version: + type: object + properties: + identifier: + type: string + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: |- + Version defines the versioning scheme used to negotiate the IBC verison in + the connection handshake. + poktroll.application.MsgDelegateToGateway: + type: object + properties: + app_address: type: string - format: byte title: >- - proof for the change of the connection state on Chain A: `INIT -> - OPEN` - proof_height: + The Bech32 address of the application using cosmos' ScalarDescriptor + to ensure deterministic deterministic encoding using cosmos' + ScalarDescriptor to ensure deterministic deterministic encoding + gateway_address: + type: string + title: >- + The Bech32 address of the gateway the application wants to delegate to + using cosmos' ScalarDescriptor to ensure deterministic deterministic + encoding using cosmos' ScalarDescriptor to ensure deterministic + deterministic encoding + poktroll.application.MsgDelegateToGatewayResponse: + type: object + poktroll.application.MsgStakeApplication: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the application using cosmos' ScalarDescriptor + to ensure deterministic encoding + stake: + title: >- + The total amount of uPOKT the application has staked. Must be ≥ to the + current amount that the application has staked (if any) type: object properties: - revision_number: + denom: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + amount: type: string - format: uint64 - title: the height within the given revision + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + services: + type: array + items: + type: object + properties: + service: + title: The Service for which the application is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + title: >- + ApplicationServiceConfig holds the service configuration the + application stakes for + title: The list of services this application is staked to request service for + poktroll.application.MsgStakeApplicationResponse: + type: object + poktroll.application.MsgUndelegateFromGateway: + type: object + properties: + app_address: + type: string + title: >- + The Bech32 address of the application using cosmos' ScalarDescriptor + to ensure deterministic deterministic encoding using cosmos' + ScalarDescriptor to ensure deterministic deterministic encoding + gateway_address: + type: string + title: >- + The Bech32 address of the gateway the application wants to undelegate + from using cosmos' ScalarDescriptor to ensure deterministic + deterministic encoding using cosmos' ScalarDescriptor to ensure + deterministic deterministic encoding + poktroll.application.MsgUndelegateFromGatewayResponse: + type: object + poktroll.application.MsgUnstakeApplication: + type: object + properties: + address: + type: string + poktroll.application.MsgUnstakeApplicationResponse: + type: object + poktroll.application.MsgUpdateParams: + type: object + properties: + authority: + type: string description: >- - Normally the RevisionHeight is incremented at each height while - keeping + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + properties: + max_delegated_gateways: + type: string + format: uint64 + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.application.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.application.Params: + type: object + properties: + max_delegated_gateways: + type: string + format: uint64 + description: Params defines the parameters for the module. + poktroll.shared.ApplicationServiceConfig: + type: object + properties: + service: + title: The Service for which the application is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + title: >- + ApplicationServiceConfig holds the service configuration the application + stakes for + poktroll.shared.Service: + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder than an + optional onchain representation of the service is necessary + title: >- + Service message to encapsulate unique and semantic identifiers for a + service on the network + poktroll.gateway.MsgStakeGateway: + type: object + properties: + address: + type: string + title: The Bech32 address of the gateway + stake: + title: >- + The total amount of uPOKT the gateway is staking. Must be ≥ to the + current amount that the gateway has staked (if any) + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - RevisionNumber the same. However some consensus algorithms may choose - to + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + poktroll.gateway.MsgStakeGatewayResponse: + type: object + poktroll.gateway.MsgUnstakeGateway: + type: object + properties: + address: + type: string + title: The Bech32 address of the gateway + poktroll.gateway.MsgUnstakeGatewayResponse: + type: object + poktroll.gateway.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.gateway.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.gateway.Params: + type: object + description: Params defines the parameters for the module. + cosmos.base.query.v1beta1.PageRequest: + type: object + properties: + key: + type: string + format: byte + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + offset: + type: string + format: uint64 + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + limit: + type: string + format: uint64 + description: >- + limit is the total number of results to be returned in the result + page. - reset the height in certain conditions e.g. hard forks, state-machine + If left empty it will default to a value to be set by each app. + count_total: + type: boolean + description: >- + count_total is set to true to indicate that the result set should + include - breaking changes In these cases, the RevisionNumber is incremented so - that + a count of the total number of items available for pagination in UIs. - height continues to be monitonically increasing even as the - RevisionHeight + count_total is only respected when offset is used. It is ignored when + key - gets reset - title: >- - Height is a monotonically increasing data type + is set. + reverse: + type: boolean + description: >- + reverse is set to true if results are to be returned in the descending + order. - that can be compared against another Height for the purposes of - updating and - freezing clients - signer: - type: string + Since: cosmos-sdk 0.43 description: |- - MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to - acknowledge the change of connection state to OPEN on Chain A. - ibc.core.connection.v1.MsgConnectionOpenConfirmResponse: + message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } + title: |- + PageRequest is to be embedded in gRPC request messages for efficient + pagination. Ex: + cosmos.base.query.v1beta1.PageResponse: type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise description: |- - MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm - response type. - ibc.core.connection.v1.MsgConnectionOpenInit: + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + poktroll.proof.Claim: type: object properties: - client_id: + supplier_address: type: string - counterparty: + title: the address of the supplier that submitted this claim + session_header: + description: The session header of the session that this claim is for. type: object properties: - client_id: - type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: + application_address: type: string - description: >- - identifies the connection end on the counterparty chain associated - with a - - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for type: object properties: - key_prefix: + id: type: string - format: byte + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that identify + it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session title: >- - MerklePrefix is merkle path prefixed to the key. - - The constructed key from the Path and the key will be - append(Path.KeyPath, - - append(Path.KeyPrefix, key...)) - description: >- - Counterparty defines the counterparty chain associated with a - connection end. - version: - type: object - properties: - identifier: + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in - - the connection handshake. - delay_period: - type: string - format: uint64 - signer: + format: int64 + title: >- + The height at which this session ended, this is the last block of + the session + root_hash: type: string - description: |- - MsgConnectionOpenInit defines the msg sent by an account on Chain A to - initialize a connection with Chain B. - ibc.core.connection.v1.MsgConnectionOpenInitResponse: + format: byte + description: Root hash returned from smt.SMST#Root(). + title: >- + Claim is the serialized object stored on-chain for claims pending to be + proven + poktroll.proof.Params: type: object - description: |- - MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response - type. - ibc.core.connection.v1.MsgConnectionOpenTry: + description: Params defines the parameters for the module. + poktroll.proof.Proof: type: object properties: - client_id: - type: string - previous_connection_id: + supplier_address: type: string - description: >- - Deprecated: this field is unused. Crossing hellos are no longer - supported in core IBC. - client_state: + session_header: + description: The session header of the session that this claim is for. type: object properties: - '@type': + application_address: type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that identify + it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last block of + the session + closest_merkle_proof: + type: string + format: byte + description: The serialized SMST proof from the `#ClosestProof()` method. + poktroll.proof.QueryAllClaimsResponse: + type: object + properties: + claims: + type: array + items: + type: object + properties: + supplier_address: + type: string + title: the address of the supplier that submitted this claim + session_header: + description: The session header of the session that this claim is for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last + block of the session + root_hash: + type: string + format: byte + description: Root hash returned from smt.SMST#Root(). + title: >- + Claim is the serialized object stored on-chain for claims pending to + be proven + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - representation, that representation will be embedded adding a field + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - `value` which holds the custom JSON in addition to the `@type` + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + poktroll.proof.QueryAllProofsResponse: + type: object + properties: + proofs: + type: array + items: + type: object + properties: + supplier_address: + type: string + session_header: + description: The session header of the session that this claim is for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last + block of the session + closest_merkle_proof: + type: string + format: byte + description: The serialized SMST proof from the `#ClosestProof()` method. + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - field. Example (for message [google.protobuf.Duration][]): + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - counterparty: + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + poktroll.proof.QueryGetClaimResponse: + type: object + properties: + claim: type: object properties: - client_id: + supplier_address: type: string - description: >- - identifies the client on the counterparty chain associated with a - given - - connection. - connection_id: + title: the address of the supplier that submitted this claim + session_header: + description: The session header of the session that this claim is for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last block + of the session + root_hash: type: string - description: >- - identifies the connection end on the counterparty chain associated - with a + format: byte + description: Root hash returned from smt.SMST#Root(). + title: >- + Claim is the serialized object stored on-chain for claims pending to + be proven + poktroll.proof.QueryGetProofResponse: + type: object + properties: + proof: + type: object + properties: + supplier_address: + type: string + session_header: + description: The session header of the session that this claim is for. + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last block + of the session + closest_merkle_proof: + type: string + format: byte + description: The serialized SMST proof from the `#ClosestProof()` method. + poktroll.proof.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: QueryParamsResponse is response type for the Query/Params RPC method. + poktroll.session.SessionHeader: + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' ScalarDescriptor + to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using on-chain + but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last block of the + session + description: >- + SessionHeader is a lightweight header for a session that can be passed + around. - given connection. - prefix: - description: commitment merkle prefix of the counterparty chain. + It is the minimal amount of data required to hydrate & retrieve all data + relevant to the session. + poktroll.proof.MsgCreateClaim: + type: object + properties: + supplier_address: + type: string + session_header: + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for type: object properties: - key_prefix: + id: type: string - format: byte + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that identify + it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session title: >- - MerklePrefix is merkle path prefixed to the key. + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last block of + the session + description: >- + SessionHeader is a lightweight header for a session that can be passed + around. - The constructed key from the Path and the key will be - append(Path.KeyPath, + It is the minimal amount of data required to hydrate & retrieve all + data relevant to the session. + root_hash: + type: string + format: byte + title: root returned from smt.SMST#Root() + poktroll.proof.MsgCreateClaimResponse: + type: object + poktroll.proof.MsgSubmitProof: + type: object + properties: + supplier_address: + type: string + session_header: + type: object + properties: + application_address: + type: string + title: >- + The Bech32 address of the application using cosmos' + ScalarDescriptor to ensure deterministic encoding + service: + title: The service this session is for + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that identify + it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + session_start_block_height: + type: string + format: int64 + title: The height at which this session started + session_id: + type: string + description: A unique pseudoranom ID for this session + title: >- + NOTE: session_id can be derived from the above values using + on-chain but is included in the header for convenience + session_end_block_height: + type: string + format: int64 + title: >- + The height at which this session ended, this is the last block of + the session + description: >- + SessionHeader is a lightweight header for a session that can be passed + around. - append(Path.KeyPrefix, key...)) + It is the minimal amount of data required to hydrate & retrieve all + data relevant to the session. + proof: + type: string + format: byte + title: serialized version of *smt.SparseMerkleClosestProof + poktroll.proof.MsgSubmitProofResponse: + type: object + poktroll.proof.MsgUpdateParams: + type: object + properties: + authority: + type: string description: >- - Counterparty defines the counterparty chain associated with a - connection end. - delay_period: + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.proof.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.service.Params: + type: object + properties: + add_service_fee: type: string format: uint64 - counterparty_versions: + description: Params defines the parameters for the module. + poktroll.service.QueryAllServiceResponse: + type: object + properties: + service: type: array items: type: object properties: - identifier: + id: type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: >- - Version defines the versioning scheme used to negotiate the IBC - verison in + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + title: >- + Service message to encapsulate unique and semantic identifiers for a + service on the network + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - the connection handshake. - proof_height: + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + poktroll.service.QueryGetServiceResponse: + type: object + properties: + service: + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + title: >- + Service message to encapsulate unique and semantic identifiers for a + service on the network + poktroll.service.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + add_service_fee: + type: string + format: uint64 + description: QueryParamsResponse is response type for the Query/Params RPC method. + poktroll.service.MsgAddService: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the service supplier using cosmos' + ScalarDescriptor + service: + title: The Service for which the supplier is adding to the network type: object properties: - revision_number: + id: type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: type: string - format: uint64 - title: the height within the given revision - description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + description: >- + MsgAddService defines a message for adding a new message to the network. - breaking changes In these cases, the RevisionNumber is incremented so - that + Services can be added by any actor in the network making them truly - height continues to be monitonically increasing even as the - RevisionHeight + permissionless. - gets reset - title: >- - Height is a monotonically increasing data type + TODO_DOCUMENT(@h5law): This is a key function in making services - that can be compared against another Height for the purposes of - updating and + permissionless, document it's usage and design - in docusaurus covering + how - freezing clients - proof_init: - type: string - format: byte - title: |- - proof of the initialization the connection on Chain A: `UNITIALIZED -> - INIT` - proof_client: - type: string - format: byte - title: proof of client state included in message - proof_consensus: + the entire process works. + poktroll.service.MsgAddServiceResponse: + type: object + poktroll.service.MsgUpdateParams: + type: object + properties: + authority: type: string - format: byte - title: proof of client consensus state - consensus_height: + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' type: object properties: - revision_number: - type: string - format: uint64 - title: the revision that the client is currently on - revision_height: + add_service_fee: type: string format: uint64 - title: the height within the given revision + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.service.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.session.MsgUpdateParams: + type: object + properties: + authority: + type: string description: >- - Normally the RevisionHeight is incremented at each height while - keeping - - RevisionNumber the same. However some consensus algorithms may choose - to - - reset the height in certain conditions e.g. hard forks, state-machine + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the module parameters to update. - breaking changes In these cases, the RevisionNumber is incremented so - that + NOTE: All parameters must be supplied. + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.session.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.session.Params: + type: object + description: Params defines the parameters for the module. + poktroll.shared.ConfigOption: + type: object + properties: + key: + title: Config option key + type: string + enum: + - UNKNOWN_CONFIG + - TIMEOUT + default: UNKNOWN_CONFIG + description: >- + Enum to define configuration options - height continues to be monitonically increasing even as the - RevisionHeight + TODO_RESEARCH: Should these be configs, SLAs or something else? There + will be more discussion once we get closer to implementing on-chain + QoS. - gets reset - title: >- - Height is a monotonically increasing data type + - UNKNOWN_CONFIG: Undefined config option + - TIMEOUT: Timeout setting + value: + type: string + title: Config option value + title: >- + Key-value wrapper for config options, as proto maps can't be keyed by + enums + poktroll.shared.ConfigOptions: + type: string + enum: + - UNKNOWN_CONFIG + - TIMEOUT + default: UNKNOWN_CONFIG + description: >- + Enum to define configuration options - that can be compared against another Height for the purposes of - updating and + TODO_RESEARCH: Should these be configs, SLAs or something else? There will + be more discussion once we get closer to implementing on-chain QoS. - freezing clients - signer: - type: string - host_consensus_state_proof: - type: string - format: byte - title: >- - optional proof data for host state machines that are unable to - introspect their own consensus state + - UNKNOWN_CONFIG: Undefined config option + - TIMEOUT: Timeout setting + poktroll.shared.RPCType: + type: string + enum: + - UNKNOWN_RPC + - GRPC + - WEBSOCKET + - JSON_RPC + - REST + default: UNKNOWN_RPC description: |- - MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a - connection on Chain B. - ibc.core.connection.v1.MsgConnectionOpenTryResponse: - type: object - description: >- - MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response - type. - ibc.core.connection.v1.MsgUpdateParams: + - UNKNOWN_RPC: Undefined RPC type + - GRPC: gRPC + - WEBSOCKET: WebSocket + - JSON_RPC: JSON-RPC + - REST: REST + title: Enum to define RPC types + poktroll.shared.SupplierEndpoint: type: object properties: - signer: + url: type: string - title: signer address - params: + title: URL of the endpoint + rpc_type: + title: Type of RPC exposed on the url above + type: string + enum: + - UNKNOWN_RPC + - GRPC + - WEBSOCKET + - JSON_RPC + - REST + default: UNKNOWN_RPC description: |- - params defines the connection parameters to update. + - UNKNOWN_RPC: Undefined RPC type + - GRPC: gRPC + - WEBSOCKET: WebSocket + - JSON_RPC: JSON-RPC + - REST: REST + configs: + type: array + items: + type: object + properties: + key: + title: Config option key + type: string + enum: + - UNKNOWN_CONFIG + - TIMEOUT + default: UNKNOWN_CONFIG + description: >- + Enum to define configuration options - NOTE: All parameters must be supplied. + TODO_RESEARCH: Should these be configs, SLAs or something else? + There will be more discussion once we get closer to implementing + on-chain QoS. + + - UNKNOWN_CONFIG: Undefined config option + - TIMEOUT: Timeout setting + value: + type: string + title: Config option value + title: >- + Key-value wrapper for config options, as proto maps can't be keyed + by enums + title: Additional configuration options for the endpoint + title: SupplierEndpoint message to hold service configuration details + poktroll.shared.SupplierServiceConfig: + type: object + properties: + service: + title: The Service for which the supplier is configured type: object properties: - max_expected_time_per_block: + id: type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + than an optional onchain representation of the service is + necessary + endpoints: + type: array + items: + type: object + properties: + url: + type: string + title: URL of the endpoint + rpc_type: + title: Type of RPC exposed on the url above + type: string + enum: + - UNKNOWN_RPC + - GRPC + - WEBSOCKET + - JSON_RPC + - REST + default: UNKNOWN_RPC + description: |- + - UNKNOWN_RPC: Undefined RPC type + - GRPC: gRPC + - WEBSOCKET: WebSocket + - JSON_RPC: JSON-RPC + - REST: REST + configs: + type: array + items: + type: object + properties: + key: + title: Config option key + type: string + enum: + - UNKNOWN_CONFIG + - TIMEOUT + default: UNKNOWN_CONFIG + description: >- + Enum to define configuration options - largest amount of time that the chain might reasonably take to - produce the next block under normal operating + TODO_RESEARCH: Should these be configs, SLAs or something + else? There will be more discussion once we get closer to + implementing on-chain QoS. - conditions. A safe choice is 3-5x the expected time per block. - description: >- - MsgUpdateParams defines the sdk.Msg type to update the connection - parameters. - ibc.core.connection.v1.MsgUpdateParamsResponse: - type: object - description: MsgUpdateParamsResponse defines the MsgUpdateParams response type. - ibc.core.connection.v1.Params: + - UNKNOWN_CONFIG: Undefined config option + - TIMEOUT: Timeout setting + value: + type: string + title: Config option value + title: >- + Key-value wrapper for config options, as proto maps can't be + keyed by enums + title: Additional configuration options for the endpoint + title: SupplierEndpoint message to hold service configuration details + title: List of endpoints for the service + title: >- + SupplierServiceConfig holds the service configuration the supplier stakes + for + poktroll.supplier.MsgStakeSupplier: type: object properties: - max_expected_time_per_block: + address: type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the + title: >- + The Bech32 address of the supplier using cosmos' ScalarDescriptor to + ensure deterministic deterministic encoding using cosmos' + ScalarDescriptor to ensure deterministic deterministic encoding + stake: + title: >- + The total amount of uPOKT the supplier has staked. Must be ≥ to the + current amount that the supplier has staked (if any) + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - largest amount of time that the chain might reasonably take to produce - the next block under normal operating + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + services: + type: array + items: + type: object + properties: + service: + title: The Service for which the supplier is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder than an optional onchain representation of the + service is necessary + endpoints: + type: array + items: + type: object + properties: + url: + type: string + title: URL of the endpoint + rpc_type: + title: Type of RPC exposed on the url above + type: string + enum: + - UNKNOWN_RPC + - GRPC + - WEBSOCKET + - JSON_RPC + - REST + default: UNKNOWN_RPC + description: |- + - UNKNOWN_RPC: Undefined RPC type + - GRPC: gRPC + - WEBSOCKET: WebSocket + - JSON_RPC: JSON-RPC + - REST: REST + configs: + type: array + items: + type: object + properties: + key: + title: Config option key + type: string + enum: + - UNKNOWN_CONFIG + - TIMEOUT + default: UNKNOWN_CONFIG + description: >- + Enum to define configuration options - conditions. A safe choice is 3-5x the expected time per block. - description: Params defines the set of Connection parameters. - ibc.core.connection.v1.Version: + TODO_RESEARCH: Should these be configs, SLAs or + something else? There will be more discussion once + we get closer to implementing on-chain QoS. + + - UNKNOWN_CONFIG: Undefined config option + - TIMEOUT: Timeout setting + value: + type: string + title: Config option value + title: >- + Key-value wrapper for config options, as proto maps + can't be keyed by enums + title: Additional configuration options for the endpoint + title: SupplierEndpoint message to hold service configuration details + title: List of endpoints for the service + title: >- + SupplierServiceConfig holds the service configuration the supplier + stakes for + title: The list of services this supplier is staked to provide service for + poktroll.supplier.MsgStakeSupplierResponse: + type: object + poktroll.supplier.MsgUnstakeSupplier: type: object properties: - identifier: + address: type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier + title: >- + The Bech32 address of the supplier using cosmos' ScalarDescriptor to + ensure deterministic deterministic encoding using cosmos' + ScalarDescriptor to ensure deterministic deterministic encoding + poktroll.supplier.MsgUnstakeSupplierResponse: + type: object + poktroll.supplier.MsgUpdateParams: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: 'NOTE: All parameters must be supplied.' + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.supplier.MsgUpdateParamsResponse: + type: object description: |- - Version defines the versioning scheme used to negotiate the IBC verison in - the connection handshake. + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.supplier.Params: + type: object + description: Params defines the parameters for the module. From c9665010e7834cad3aef0d718ef85f512d5a6a96 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sat, 17 Feb 2024 02:18:03 +0100 Subject: [PATCH 33/54] reconcile: add off-chain commands --- Makefile | 8 +++++++- cmd/poktrolld/cmd/root.go | 12 ++++++++++++ pkg/relayer/proxy/synchronous.go | 26 +++++--------------------- pkg/sdk/send_relay.go | 13 ++++--------- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index d8fd38e91..3a98d340e 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ POKTROLLD_HOME ?= ./localnet/poktrolld POCKET_NODE ?= tcp://127.0.0.1:36657 # The pocket rollup node (full node and sequencer in the localnet context) APPGATE_SERVER ?= http://localhost:42069 POCKET_ADDR_PREFIX = pokt +CHAIN_ID = poktroll #################### ### Dependencies ### @@ -208,6 +209,11 @@ localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localn mv temp.json ${HOME}/.poktroll/config/genesis.json ;\ cp ${HOME}/.poktroll/config/genesis.json $(POKTROLLD_HOME)/config/ ;\ +.PHONY: send_relay +send_relay: + curl -X POST -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ + http://localhost:42069/anvil # TODO_BLOCKER(@okdas): Figure out how to copy these over w/ a functional state. # cp ${HOME}/.poktroll/config/app.toml $(POKTROLLD_HOME)/config/app.toml @@ -391,7 +397,7 @@ app_list: ## List all the staked applications .PHONY: app_stake app_stake: ## Stake tokens for the application specified (must specify the APP and SERVICES env vars) - poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config $(POKTROLLD_HOME)/config/$(SERVICES) --keyring-backend test --from $(APP) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config $(POKTROLLD_HOME)/config/$(SERVICES) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: app1_stake app1_stake: ## Stake app1 (also staked in genesis) diff --git a/cmd/poktrolld/cmd/root.go b/cmd/poktrolld/cmd/root.go index 1bfbfd135..045e3505a 100644 --- a/cmd/poktrolld/cmd/root.go +++ b/cmd/poktrolld/cmd/root.go @@ -25,6 +25,8 @@ import ( "github.com/spf13/pflag" "github.com/pokt-network/poktroll/app" + appgateservercmd "github.com/pokt-network/poktroll/pkg/appgateserver/cmd" + relayercmd "github.com/pokt-network/poktroll/pkg/relayer/cmd" ) // NewRootCmd creates a new root command for poktrolld. It is called once in the main function. @@ -122,6 +124,16 @@ func NewRootCmd() *cobra.Command { panic(err) } + // add relayer command + rootCmd.AddCommand( + relayercmd.RelayerCmd(), + ) + + // add the appgate server command + rootCmd.AddCommand( + appgateservercmd.AppGateServerCmd(), + ) + return rootCmd } diff --git a/pkg/relayer/proxy/synchronous.go b/pkg/relayer/proxy/synchronous.go index a14201984..ce829f712 100644 --- a/pkg/relayer/proxy/synchronous.go +++ b/pkg/relayer/proxy/synchronous.go @@ -8,13 +8,9 @@ import ( "net/url" "time" - "cosmossdk.io/depinject" sdkerrors "cosmossdk.io/errors" - "cosmossdk.io/log" - "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/pokt-network/poktroll/app" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/pkg/polylog" "github.com/pokt-network/poktroll/pkg/relayer" "github.com/pokt-network/poktroll/pkg/relayer/config" @@ -22,23 +18,11 @@ import ( sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -var ( - _ relayer.RelayServer = (*synchronousRPCServer)(nil) - marshaler codec.Codec -) +var _ relayer.RelayServer = (*synchronousRPCServer)(nil) func init() { - cmd.InitSDKConfig() - deps := depinject.Configs( - app.AppConfig(), - depinject.Supply( - app.AppConfig(), - log.NewNopLogger(), - ), - ) - if err := depinject.Inject(deps, &marshaler); err != nil { - panic(err) - } + reg := codectypes.NewInterfaceRegistry() + types.RegisterInterfaces(reg) } // synchronousRPCServer is the struct that holds the state of the synchronous @@ -296,7 +280,7 @@ func (sync *synchronousRPCServer) sendRelayResponse( relayResponse *types.RelayResponse, writer http.ResponseWriter, ) error { - relayResponseBz, err := marshaler.Marshal(relayResponse) + relayResponseBz, err := relayResponse.Marshal() if err != nil { return err } diff --git a/pkg/sdk/send_relay.go b/pkg/sdk/send_relay.go index ddfd9f5f8..bb6ece483 100644 --- a/pkg/sdk/send_relay.go +++ b/pkg/sdk/send_relay.go @@ -6,20 +6,15 @@ import ( "io" "net/http" - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/pkg/signer" "github.com/pokt-network/poktroll/x/service/types" ) -var marshaler codec.Codec - func init() { - if err := depinject.Inject(app.AppConfig(), &marshaler); err != nil { - panic(err) - } + reg := codectypes.NewInterfaceRegistry() + types.RegisterInterfaces(reg) } // SendRelay sends a relay request to the given supplier's endpoint. @@ -66,7 +61,7 @@ func (sdk *poktrollSDK) SendRelay( relayRequest.Meta.Signature = requestSig // Marshal the relay request to bytes and create a reader to be used as an HTTP request body. - relayRequestBz, err := marshaler.Marshal(relayRequest) + relayRequestBz, err := relayRequest.Marshal() if err != nil { return nil, ErrSDKHandleRelay.Wrapf("error marshaling relay request: %s", err) } From 7407141046bf7d9b21dad45594fc583235c9a89b Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sat, 17 Feb 2024 02:21:55 +0100 Subject: [PATCH 34/54] fix: block unmarshalling using upstream types --- pkg/client/block/block.go | 27 +++++++++++-------- pkg/client/block/client_test.go | 46 ++++++++++++--------------------- 2 files changed, 33 insertions(+), 40 deletions(-) diff --git a/pkg/client/block/block.go b/pkg/client/block/block.go index 82c34aa2b..3660e9843 100644 --- a/pkg/client/block/block.go +++ b/pkg/client/block/block.go @@ -1,8 +1,8 @@ package block import ( - "encoding/json" - + "github.com/cometbft/cometbft/libs/json" + rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" "github.com/cometbft/cometbft/types" "github.com/pokt-network/poktroll/pkg/client" @@ -14,7 +14,7 @@ import ( // interface by loosely wrapping cometbft's block type, into which messages are // deserialized. type cometBlockEvent struct { - Block types.Block `json:"block"` + types.EventDataNewBlock } // Height returns the block's height. @@ -24,25 +24,30 @@ func (blockEvent *cometBlockEvent) Height() int64 { // Hash returns the binary representation of the block's hash as a byte slice. func (blockEvent *cometBlockEvent) Hash() []byte { - return blockEvent.Block.LastBlockID.Hash.Bytes() + // Use BlockID.Hash and not LastBlockID.Hash because the latter refers to the + // previous block's hash, not the hash of the block being fetched + // see: https://docs.cometbft.com/v0.37/spec/core/data_structures#blockid + // see: https://docs.cometbft.com/v0.37/spec/core/data_structures#header -> LastBlockID + return blockEvent.BlockID.Hash } // newCometBlockEvent is a function that attempts to deserialize the given bytes // into a comet block. If the resulting block has a height of zero, assume the event // was not a block event and return an ErrUnmarshalBlockEvent error. func newCometBlockEvent(blockMsgBz []byte) (client.Block, error) { - blockMsg := new(cometBlockEvent) - if err := json.Unmarshal(blockMsgBz, blockMsg); err != nil { + var rpcResponse rpctypes.RPCResponse + if err := json.Unmarshal(blockMsgBz, &rpcResponse); err != nil { return nil, err } - // The header height should never be zero. If it is, it means that blockMsg - // does not match the expected format which led unmarshaling to fail, - // and blockHeader.height to have a default value. - if blockMsg.Block.Header.Height == 0 { + var eventDataNewBlock types.EventDataNewBlock + + // If rpcResponse.Result fails unmarshaling into types.EventDataNewBlock, + // then it does not match the expected format + if err := json.Unmarshal(rpcResponse.Result, &eventDataNewBlock); err != nil { return nil, events.ErrEventsUnmarshalEvent. Wrapf("with block data: %s", string(blockMsgBz)) } - return blockMsg, nil + return &cometBlockEvent{eventDataNewBlock}, nil } diff --git a/pkg/client/block/client_test.go b/pkg/client/block/client_test.go index e44c8f32f..862bed75e 100644 --- a/pkg/client/block/client_test.go +++ b/pkg/client/block/client_test.go @@ -2,11 +2,13 @@ package block_test import ( "context" - "encoding/json" "testing" "time" "cosmossdk.io/depinject" + "github.com/cometbft/cometbft/libs/json" + rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" + "github.com/cometbft/cometbft/types" comettypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/require" @@ -16,7 +18,7 @@ import ( ) const ( - testTimeoutDuration = 100 * time.Millisecond + testTimeoutDuration = 100000 * time.Millisecond // duplicates pkg/client/block/client.go's committedBlocksQuery for testing purposes committedBlocksQuery = "tm.event='NewBlock'" @@ -26,16 +28,16 @@ func TestBlockClient(t *testing.T) { var ( expectedHeight = int64(1) expectedHash = []byte("test_hash") - expectedBlockEvent = &testBlockEvent{ - Block: comettypes.Block{ + expectedBlockEvent = &types.EventDataNewBlock{ + Block: &types.Block{ Header: comettypes.Header{ Height: 1, Time: time.Now(), - LastBlockID: comettypes.BlockID{ - Hash: expectedHash, - }, }, }, + BlockID: comettypes.BlockID{ + Hash: expectedHash, + }, } ctx = context.Background() ) @@ -43,10 +45,17 @@ func TestBlockClient(t *testing.T) { expectedEventBz, err := json.Marshal(expectedBlockEvent) require.NoError(t, err) + expectedRPCResponse := &rpctypes.RPCResponse{ + Result: expectedEventBz, + } + + expectedRPCResponseBz, err := json.Marshal(expectedRPCResponse) + require.NoError(t, err) + eventsQueryClient := testeventsquery.NewAnyTimesEventsBytesEventsQueryClient( ctx, t, committedBlocksQuery, - expectedEventBz, + expectedRPCResponseBz, ) deps := depinject.Supply(eventsQueryClient) @@ -107,24 +116,3 @@ func TestBlockClient(t *testing.T) { blockClient.Close() } - -/* -TODO_TECHDEBT/TODO_CONSIDERATION(#XXX): this duplicates the unexported block event - -type from pkg/client/block/block.go. We seem to have some conflicting preferences -which result in the need for this duplication until a preferred direction is -identified: - - - We should prefer tests being in their own pkgs (e.g. block_test) - - this would resolve if this test were in the block package instead. - - We should prefer to not export types which don't require exporting for API - consumption. - - This test is the only external (to the block pkg) dependency of cometBlockEvent. - - We could use the //go:build test constraint on a new file which exports it - for testing purposes. - - This would imply that we also add -tags=test to all applicable tooling - and add a test which fails if the tag is absent. -*/ -type testBlockEvent struct { - Block comettypes.Block `json:"block"` -} From 22fb7166e7fdbf9d3fceca49803347217b55d1f2 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sun, 18 Feb 2024 07:37:08 +0100 Subject: [PATCH 35/54] fix: add chain-id flag --- Makefile | 18 +++++++++--------- e2e/tests/init_test.go | 4 ++++ localnet/poktrolld/config/client.toml | 2 +- pkg/deps/config/suppliers.go | 13 +++++++++++++ pkg/relayer/cmd/cmd.go | 1 + 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3a98d340e..5a700cfb6 100644 --- a/Makefile +++ b/Makefile @@ -357,7 +357,7 @@ gateway_list: ## List all the staked gateways .PHONY: gateway_stake gateway_stake: ## Stake tokens for the gateway specified (must specify the gateway env var) - poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config $(POKTROLLD_HOME)/config/$(STAKE) --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config $(POKTROLLD_HOME)/config/$(STAKE) --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: gateway1_stake gateway1_stake: ## Stake gateway1 @@ -373,7 +373,7 @@ gateway3_stake: ## Stake gateway3 .PHONY: gateway_unstake gateway_unstake: ## Unstake an gateway (must specify the GATEWAY env var) - poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: gateway1_unstake gateway1_unstake: ## Unstake gateway1 @@ -413,7 +413,7 @@ app3_stake: ## Stake app3 .PHONY: app_unstake app_unstake: ## Unstake an application (must specify the APP env var) - poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: app1_unstake app1_unstake: ## Unstake app1 @@ -429,7 +429,7 @@ app3_unstake: ## Unstake app3 .PHONY: app_delegate app_delegate: ## Delegate trust to a gateway (must specify the APP and GATEWAY_ADDR env vars). Requires the app to be staked - poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: app1_delegate_gateway1 app1_delegate_gateway1: ## Delegate trust to gateway1 @@ -448,7 +448,7 @@ app3_delegate_gateway3: ## Delegate trust to gateway3 .PHONY: app_undelegate app_undelegate: ## Undelegate trust to a gateway (must specify the APP and GATEWAY_ADDR env vars). Requires the app to be staked - poktrolld --home=$(POKTROLLD_HOME) tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: app1_undelegate_gateway1 app1_undelegate_gateway1: ## Undelegate trust to gateway1 @@ -475,7 +475,7 @@ supplier_list: ## List all the staked supplier .PHONY: supplier_stake supplier_stake: ## Stake tokens for the supplier specified (must specify the SUPPLIER and SUPPLIER_CONFIG env vars) - poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config $(POKTROLLD_HOME)/config/$(SERVICES) --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config $(POKTROLLD_HOME)/config/$(SERVICES) --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: supplier1_stake supplier1_stake: ## Stake supplier1 (also staked in genesis) @@ -491,7 +491,7 @@ supplier3_stake: ## Stake supplier3 .PHONY: supplier_unstake supplier_unstake: ## Unstake an supplier (must specify the SUPPLIER env var) - poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: supplier1_unstake supplier1_unstake: ## Unstake supplier1 @@ -578,7 +578,7 @@ acc_initialize_pubkeys: ## Make sure the account keeper has public keys for all --yes \ --home=$(POKTROLLD_HOME) \ --node $(POCKET_NODE) \ - --chain-id poktroll;) + --chain-id $(CHAIN_ID);) .PHONY: acc_initialize_pubkeys_warn_message acc_initialize_pubkeys_warn_message: ## Print a warning message about the need to run `make acc_initialize_pubkeys` @@ -633,7 +633,7 @@ MODULES := application gateway pocket service session supplier tokenomics # TODO_IMPROVE(#322): Improve once we decide how to handle parameter updates .PHONY: update_tokenomics_params update_tokenomics_params: ## Update the tokenomics module params - poktrolld --home=$(POKTROLLD_HOME) tx tokenomics update-params 43 --keyring-backend test --from pnf --node $(POCKET_NODE) + poktrolld --home=$(POKTROLLD_HOME) tx tokenomics update-params 43 --keyring-backend test --from pnf --node $(POCKET_NODE) --chain-id $(CHAIN_ID) .PHONY: query_all_params query_all_params: check_jq ## Query the params from all available modules diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index ed5e420e0..6d98d1a2c 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -41,6 +41,7 @@ var ( flagFeaturesPath string keyRingFlag = "--keyring-backend=test" + chainIdFlag = "--chain-id=poktroll" appGateServerUrl = "http://localhost:42069" // Keeping localhost by default because that is how we run the tests on our machines locally ) @@ -130,6 +131,7 @@ func (s *suite) TheUserSendsUpoktFromAccountToAccount(amount int64, accName1, ac accNameToAddrMap[accName2], fmt.Sprintf("%dupokt", amount), keyRingFlag, + chainIdFlag, "-y", } res, err := s.pocketd.RunCommandOnHost("", args...) @@ -198,6 +200,7 @@ func (s *suite) TheUserStakesAWithUpoktFromTheAccount(actorType string, amount i "--from", accName, keyRingFlag, + chainIdFlag, "-y", } res, err := s.pocketd.RunCommandOnHost("", args...) @@ -222,6 +225,7 @@ func (s *suite) TheUserUnstakesAFromTheAccount(actorType string, accName string) "--from", accName, keyRingFlag, + chainIdFlag, "-y", } res, err := s.pocketd.RunCommandOnHost("", args...) diff --git a/localnet/poktrolld/config/client.toml b/localnet/poktrolld/config/client.toml index 7e41c8b68..57ac25034 100644 --- a/localnet/poktrolld/config/client.toml +++ b/localnet/poktrolld/config/client.toml @@ -1,5 +1,5 @@ broadcast-mode = "sync" -chain-id = "" +chain-id = "poktroll" keyring-backend = "test" node = "tcp://localhost:26657" output = "text" diff --git a/pkg/deps/config/suppliers.go b/pkg/deps/config/suppliers.go index 7c9f4dd21..be9214c9f 100644 --- a/pkg/deps/config/suppliers.go +++ b/pkg/deps/config/suppliers.go @@ -205,6 +205,15 @@ func NewSupplyTxClientContextFn( return nil, err } + tmpChainID, err := cmd.Flags().GetString(cosmosflags.FlagChainID) + if err != nil { + return nil, err + } + + if err := cmd.Flags().Set(cosmosflags.FlagChainID, tmpChainID); err != nil { + return nil, err + } + // NB: Currently, the implementations of GetClientTxContext() and // GetClientQueryContext() are identical, allowing for their interchangeable // use in both querying and transaction operations. However, in order to support @@ -231,6 +240,10 @@ func NewSupplyTxClientContextFn( return nil, err } + if err := cmd.Flags().Set(cosmosflags.FlagChainID, tmpChainID); err != nil { + return nil, err + } + return deps, nil } } diff --git a/pkg/relayer/cmd/cmd.go b/pkg/relayer/cmd/cmd.go index 7c758303c..1d96f83cf 100644 --- a/pkg/relayer/cmd/cmd.go +++ b/pkg/relayer/cmd/cmd.go @@ -73,6 +73,7 @@ for such operations.`, cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query and tx contexts correctly. It can be used to override the `QueryNodeRPCURL` and `TxNodeRPCURL` fields in the config file if specified.") cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCURL` field in the config file if specified.") cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") + cmd.Flags().String(cosmosflags.FlagChainID, "poktroll", "The network chain ID") return cmd } From 39da2251f3000fc70fc193bbc1e71aa0cd75f3ad Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sun, 18 Feb 2024 08:44:33 +0100 Subject: [PATCH 36/54] reconcile: Adapt transaction results --- e2e/tests/session_steps_test.go | 34 +++++++++++++++++++-------------- pkg/client/tx/client.go | 25 +++++++++++++++--------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 108993dcc..ff962e627 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -4,14 +4,14 @@ package e2e import ( "context" - "encoding/json" "fmt" "strconv" - "strings" "time" "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/json" + rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" + comettypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/pkg/client" @@ -44,7 +44,7 @@ const ( ) func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(serviceId, appName string) { - s.waitForMessageAction("/pocket.supplier.MsgCreateClaim") + s.waitForMessageAction("/poktroll.proof.MsgCreateClaim") } func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { @@ -101,18 +101,24 @@ func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication msgSenderQuery := fmt.Sprintf(txSenderEventSubscriptionQueryFmt, accNameToAddrMap[supplierName]) deps := depinject.Supply(events.NewEventsQueryClient(testclient.CometLocalWebsocketURL)) - eventsReplayClient, err := events.NewEventsReplayClient[*abci.TxResult]( + eventsReplayClient, err := events.NewEventsReplayClient[*comettypes.EventDataTx]( ctx, deps, msgSenderQuery, - func(eventBz []byte) (*abci.TxResult, error) { - if strings.Contains(string(eventBz), "jsonrpc") { + func(eventBz []byte) (*comettypes.EventDataTx, error) { + // Try to deserialize the provided bytes into an RPCResponse. + rpcResult := &rpctypes.RPCResponse{} + if err := json.Unmarshal(eventBz, rpcResult); err != nil { + return nil, events.ErrEventsUnmarshalEvent.Wrap(err.Error()) + } + + if string(rpcResult.Result) == "{}" { return nil, nil } - // Unmarshal event data into an ABCI TxResult object. - txResult := &abci.TxResult{} - err = json.Unmarshal(eventBz, txResult) + // Unmarshal event data into an comettype EventDataTx object. + txResult := &comettypes.EventDataTx{} + err = json.Unmarshal(rpcResult.Result, txResult) require.NoError(s, err) return txResult, nil @@ -132,7 +138,7 @@ func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication } func (s *suite) AfterTheSupplierSubmitsAProofForTheSessionForServiceForApplication(a string, b string) { - s.waitForMessageAction("/pocket.supplier.MsgSubmitProof") + s.waitForMessageAction("/poktroll.proof.MsgSubmitProof") } func (s *suite) TheProofSubmittedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { @@ -190,14 +196,14 @@ func (s *suite) sendRelaysForSession( func (s *suite) waitForMessageAction(action string) { ctx, done := context.WithCancel(context.Background()) - eventsReplayClient, ok := s.scenarioState[eventsReplayClientKey].(client.EventsReplayClient[*abci.TxResult]) + eventsReplayClient, ok := s.scenarioState[eventsReplayClientKey].(client.EventsReplayClient[*comettypes.EventDataTx]) require.True(s, ok, "eventsReplayClientKey not found in scenarioState") require.NotNil(s, eventsReplayClient) // For each observed event, **asynchronously** check if it contains the given action. - channel.ForEach[*abci.TxResult]( + channel.ForEach[*comettypes.EventDataTx]( ctx, eventsReplayClient.EventsSequence(ctx), - func(_ context.Context, txEvent *abci.TxResult) { + func(_ context.Context, txEvent *comettypes.EventDataTx) { if txEvent == nil { return } diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go index 1bcc109c2..f359ff14d 100644 --- a/pkg/client/tx/client.go +++ b/pkg/client/tx/client.go @@ -4,12 +4,12 @@ import ( "bytes" "context" "encoding/hex" - "encoding/json" "fmt" "sync" - "cosmossdk.io/api/tendermint/abci" "cosmossdk.io/depinject" + "github.com/cometbft/cometbft/libs/json" + rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" comettypes "github.com/cometbft/cometbft/types" cosmostypes "github.com/cosmos/cosmos-sdk/types" "go.uber.org/multierr" @@ -26,7 +26,7 @@ const ( // errored if it has not been committed. DefaultCommitTimeoutHeightOffset = 5 - // defaultTxReplayLimit is the number of abci.TxResult events that the replay + // defaultTxReplayLimit is the number of comettypes.EventDataTx events that the replay // observable returned by LastNBlocks() will be able to replay. // TODO_TECHDEBT/TODO_FUTURE: add a `blocksReplayLimit` field to the blockClient // struct that defaults to this but can be overridden via an option. @@ -69,7 +69,7 @@ type txClient struct { // eventsReplayClient is the client used to subscribe to transactions events from this // sender. It is used to receive notifications about transactions events corresponding // to transactions which it has constructed, signed, and broadcast. - eventsReplayClient client.EventsReplayClient[*abci.TxResult] + eventsReplayClient client.EventsReplayClient[*comettypes.EventDataTx] // blockClient is the client used to query for the latest block height. // It is used to implement timout logic for transactions which weren't committed. blockClient client.BlockClient @@ -144,7 +144,7 @@ func NewTxClient( eventQuery := fmt.Sprintf(txWithSenderAddrQueryFmt, tClient.signingAddr) // Initialize and events replay client. - tClient.eventsReplayClient, err = events.NewEventsReplayClient[*abci.TxResult]( + tClient.eventsReplayClient, err = events.NewEventsReplayClient[*comettypes.EventDataTx]( ctx, deps, eventQuery, @@ -491,18 +491,25 @@ func (tClient *txClient) getTxTimeoutError(ctx context.Context, txHashHex string // It checks if the given bytes correspond to a valid transaction event. // If the resulting TxResult has empty transaction bytes, it assumes that // the message was not a transaction results and returns an error. -func unmarshalTxResult(txResultBz []byte) (*abci.TxResult, error) { - txResult := new(abci.TxResult) +func unmarshalTxResult(txResultBz []byte) (*comettypes.EventDataTx, error) { + rpcResult := new(rpctypes.RPCResponse) + + // Try to deserialize the provided bytes into an RPCResponse. + if err := json.Unmarshal(txResultBz, rpcResult); err != nil { + return nil, events.ErrEventsUnmarshalEvent.Wrap(err.Error()) + } + + txResult := new(comettypes.EventDataTx) // Try to deserialize the provided bytes into a TxResult. - if err := json.Unmarshal(txResultBz, txResult); err != nil { + if err := json.Unmarshal(rpcResult.Result, txResult); err != nil { return nil, events.ErrEventsUnmarshalEvent.Wrap(err.Error()) } // Check if the TxResult has empty transaction bytes, which indicates // the message might not be a valid transaction event. if bytes.Equal(txResult.Tx, []byte{}) { - return nil, events.ErrEventsUnmarshalEvent.Wrap("event bytes do not correspond to an abci.TxResult event") + return nil, events.ErrEventsUnmarshalEvent.Wrap("event bytes do not correspond to an comettypes.EventDataTx event") } return txResult, nil From 6d10322797d4a1a5af3533c523357d3379ce3215 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sun, 18 Feb 2024 09:49:38 +0100 Subject: [PATCH 37/54] fix: tx client test --- pkg/client/tx/client_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkg/client/tx/client_test.go b/pkg/client/tx/client_test.go index acd66c9a0..bfefbc3a6 100644 --- a/pkg/client/tx/client_test.go +++ b/pkg/client/tx/client_test.go @@ -2,7 +2,6 @@ package tx_test import ( "context" - "encoding/json" "sync" "testing" "time" @@ -11,6 +10,9 @@ import ( "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" cometbytes "github.com/cometbft/cometbft/libs/bytes" + "github.com/cometbft/cometbft/libs/json" + rpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" + comettypes "github.com/cometbft/cometbft/types" cosmoskeyring "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/types" "github.com/golang/mock/gomock" @@ -107,13 +109,23 @@ func TestTxClient_SignAndBroadcast_Succeeds(t *testing.T) { require.NoError(t, err) // Construct the expected transaction event bytes from the expected transaction bytes. - txResultBz, err := json.Marshal(abci.TxResult{Tx: expectedTx}) + txResult := abci.TxResult{Tx: expectedTx} + txEvent := &comettypes.EventDataTx{TxResult: txResult} + + txResultBz, err := json.Marshal(txEvent) + require.NoError(t, err) + + rpcResult := &rpctypes.RPCResponse{ + Result: txResultBz, + } + + rpcResultBz, err := json.Marshal(rpcResult) require.NoError(t, err) // Publish the transaction event bytes to the events query client so that the transaction client // registers the transactions as committed (i.e. removes it from the timeout pool). txResultsBzPublishChMu.Lock() - txResultsBzPublishCh <- either.Success[[]byte](txResultBz) + txResultsBzPublishCh <- either.Success[[]byte](rpcResultBz) txResultsBzPublishChMu.Unlock() // Assert that the error channel was closed without receiving. From 30627bf09b12f624735d0eda4c606a25492247a3 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 21 Feb 2024 14:50:27 +0100 Subject: [PATCH 38/54] chore: gateway module review improvements --- api/poktroll/gateway/gateway.pulsar.go | 45 +- api/poktroll/gateway/query.pulsar.go | 518 +++++++++--------- api/poktroll/gateway/tx.pulsar.go | 9 +- proto/poktroll/gateway/gateway.proto | 2 +- proto/poktroll/gateway/genesis.proto | 10 +- proto/poktroll/gateway/params.proto | 5 +- proto/poktroll/gateway/query.proto | 18 +- proto/poktroll/gateway/tx.proto | 17 +- testutil/keeper/gateway.go | 6 +- x/gateway/keeper/gateway.go | 31 +- x/gateway/keeper/gateway_test.go | 40 +- x/gateway/keeper/msg_server.go | 4 +- x/gateway/keeper/msg_server_stake_gateway.go | 14 +- .../keeper/msg_server_stake_gateway_test.go | 10 +- x/gateway/keeper/msg_server_test.go | 4 + .../keeper/msg_server_unstake_gateway_test.go | 4 +- x/gateway/keeper/msg_update_params.go | 4 +- x/gateway/keeper/msg_update_params_test.go | 36 +- x/gateway/keeper/params.go | 10 +- x/gateway/keeper/query.go | 4 +- x/gateway/keeper/query_gateway.go | 8 +- x/gateway/keeper/query_gateway_test.go | 72 +-- x/gateway/keeper/query_params.go | 4 +- x/gateway/module/autocli.go | 68 +-- x/gateway/module/config/errors.go | 13 +- .../config/gateway_config_reader_test.go | 36 +- x/gateway/module/genesis.go | 16 +- x/gateway/module/genesis_test.go | 181 +----- x/gateway/module/helpers_test.go | 6 - x/gateway/module/module.go | 6 +- x/gateway/module/query.go | 3 +- x/gateway/module/query_gateway.go | 6 +- x/gateway/module/query_gateway_test.go | 66 +-- x/gateway/module/query_params.go | 2 +- x/gateway/module/tx.go | 9 +- x/gateway/module/tx_stake_gateway.go | 2 +- x/gateway/module/tx_stake_gateway_test.go | 52 +- x/gateway/module/tx_unstake_gateway.go | 2 +- x/gateway/module/tx_unstake_gateway_test.go | 38 +- x/gateway/simulation/stake_gateway.go | 1 + x/gateway/simulation/unstake_gateway.go | 1 + x/gateway/types/errors.go | 13 +- x/gateway/types/expected_keepers.go | 10 +- x/gateway/types/genesis.go | 30 +- x/gateway/types/genesis_test.go | 172 ++++++ x/gateway/types/key_gateway.go | 10 +- x/gateway/types/keys.go | 8 +- x/gateway/types/message_stake_gateway.go | 17 +- x/gateway/types/message_stake_gateway_test.go | 54 +- x/gateway/types/message_unstake_gateway.go | 7 +- .../types/message_unstake_gateway_test.go | 28 +- ...ate_params.go => message_update_params.go} | 0 x/gateway/types/params.go | 4 +- 53 files changed, 869 insertions(+), 867 deletions(-) create mode 100644 x/gateway/types/genesis_test.go rename x/gateway/types/{msg_update_params.go => message_update_params.go} (100%) diff --git a/api/poktroll/gateway/gateway.pulsar.go b/api/poktroll/gateway/gateway.pulsar.go index 76b5d7dff..904d9f9fa 100644 --- a/api/poktroll/gateway/gateway.pulsar.go +++ b/api/poktroll/gateway/gateway.pulsar.go @@ -6,7 +6,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -577,29 +576,27 @@ var file_poktroll_gateway_gateway_proto_rawDesc = []byte{ 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, - 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, - 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, + 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, + 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, + 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go index f7318f7e2..36691c4cf 100644 --- a/api/poktroll/gateway/query.pulsar.go +++ b/api/poktroll/gateway/query.pulsar.go @@ -1665,25 +1665,25 @@ func (x *fastReflection_QueryGetGatewayResponse) ProtoMethods() *protoiface.Meth } var ( - md_QueryAllGatewayRequest protoreflect.MessageDescriptor - fd_QueryAllGatewayRequest_pagination protoreflect.FieldDescriptor + md_QueryAllGatewaysRequest protoreflect.MessageDescriptor + fd_QueryAllGatewaysRequest_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_query_proto_init() - md_QueryAllGatewayRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayRequest") - fd_QueryAllGatewayRequest_pagination = md_QueryAllGatewayRequest.Fields().ByName("pagination") + md_QueryAllGatewaysRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewaysRequest") + fd_QueryAllGatewaysRequest_pagination = md_QueryAllGatewaysRequest.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllGatewayRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllGatewaysRequest)(nil) -type fastReflection_QueryAllGatewayRequest QueryAllGatewayRequest +type fastReflection_QueryAllGatewaysRequest QueryAllGatewaysRequest -func (x *QueryAllGatewayRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllGatewayRequest)(x) +func (x *QueryAllGatewaysRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysRequest)(x) } -func (x *QueryAllGatewayRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryAllGatewaysRequest) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_gateway_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1695,43 +1695,43 @@ func (x *QueryAllGatewayRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllGatewayRequest_messageType fastReflection_QueryAllGatewayRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllGatewayRequest_messageType{} +var _fastReflection_QueryAllGatewaysRequest_messageType fastReflection_QueryAllGatewaysRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewaysRequest_messageType{} -type fastReflection_QueryAllGatewayRequest_messageType struct{} +type fastReflection_QueryAllGatewaysRequest_messageType struct{} -func (x fastReflection_QueryAllGatewayRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllGatewayRequest)(nil) +func (x fastReflection_QueryAllGatewaysRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysRequest)(nil) } -func (x fastReflection_QueryAllGatewayRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayRequest) +func (x fastReflection_QueryAllGatewaysRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysRequest) } -func (x fastReflection_QueryAllGatewayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayRequest +func (x fastReflection_QueryAllGatewaysRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllGatewayRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayRequest +func (x *fastReflection_QueryAllGatewaysRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysRequest } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllGatewayRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryAllGatewayRequest_messageType +func (x *fastReflection_QueryAllGatewaysRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewaysRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllGatewayRequest) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayRequest) +func (x *fastReflection_QueryAllGatewaysRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllGatewayRequest) Interface() protoreflect.ProtoMessage { - return (*QueryAllGatewayRequest)(x) +func (x *fastReflection_QueryAllGatewaysRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewaysRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1739,10 +1739,10 @@ func (x *fastReflection_QueryAllGatewayRequest) Interface() protoreflect.ProtoMe // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllGatewayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllGatewaysRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllGatewayRequest_pagination, value) { + if !f(fd_QueryAllGatewaysRequest_pagination, value) { return } } @@ -1759,15 +1759,15 @@ func (x *fastReflection_QueryAllGatewayRequest) Range(f func(protoreflect.FieldD // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllGatewayRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllGatewaysRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } @@ -1777,15 +1777,15 @@ func (x *fastReflection_QueryAllGatewayRequest) Has(fd protoreflect.FieldDescrip // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllGatewaysRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } @@ -1795,16 +1795,16 @@ func (x *fastReflection_QueryAllGatewayRequest) Clear(fd protoreflect.FieldDescr // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllGatewayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", descriptor.FullName())) } } @@ -1818,15 +1818,15 @@ func (x *fastReflection_QueryAllGatewayRequest) Get(descriptor protoreflect.Fiel // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllGatewaysRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } @@ -1840,44 +1840,44 @@ func (x *fastReflection_QueryAllGatewayRequest) Set(fd protoreflect.FieldDescrip // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageRequest) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllGatewayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": m := new(v1beta1.PageRequest) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllGatewayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllGatewaysRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewaysRequest", d.FullName())) } panic("unreachable") } @@ -1885,7 +1885,7 @@ func (x *fastReflection_QueryAllGatewayRequest) WhichOneof(d protoreflect.OneofD // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllGatewayRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllGatewaysRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1896,7 +1896,7 @@ func (x *fastReflection_QueryAllGatewayRequest) GetUnknown() protoreflect.RawFie // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllGatewaysRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1908,7 +1908,7 @@ func (x *fastReflection_QueryAllGatewayRequest) SetUnknown(fields protoreflect.R // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllGatewayRequest) IsValid() bool { +func (x *fastReflection_QueryAllGatewaysRequest) IsValid() bool { return x != nil } @@ -1918,9 +1918,9 @@ func (x *fastReflection_QueryAllGatewayRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllGatewaysRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllGatewayRequest) + x := input.Message.Interface().(*QueryAllGatewaysRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1946,7 +1946,7 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayRequest) + x := input.Message.Interface().(*QueryAllGatewaysRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1990,7 +1990,7 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayRequest) + x := input.Message.Interface().(*QueryAllGatewaysRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2022,10 +2022,10 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2099,79 +2099,79 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho } } -var _ protoreflect.List = (*_QueryAllGatewayResponse_1_list)(nil) +var _ protoreflect.List = (*_QueryAllGatewaysResponse_1_list)(nil) -type _QueryAllGatewayResponse_1_list struct { +type _QueryAllGatewaysResponse_1_list struct { list *[]*Gateway } -func (x *_QueryAllGatewayResponse_1_list) Len() int { +func (x *_QueryAllGatewaysResponse_1_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_QueryAllGatewayResponse_1_list) Get(i int) protoreflect.Value { +func (x *_QueryAllGatewaysResponse_1_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_QueryAllGatewayResponse_1_list) Set(i int, value protoreflect.Value) { +func (x *_QueryAllGatewaysResponse_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*Gateway) (*x.list)[i] = concreteValue } -func (x *_QueryAllGatewayResponse_1_list) Append(value protoreflect.Value) { +func (x *_QueryAllGatewaysResponse_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*Gateway) *x.list = append(*x.list, concreteValue) } -func (x *_QueryAllGatewayResponse_1_list) AppendMutable() protoreflect.Value { +func (x *_QueryAllGatewaysResponse_1_list) AppendMutable() protoreflect.Value { v := new(Gateway) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllGatewayResponse_1_list) Truncate(n int) { +func (x *_QueryAllGatewaysResponse_1_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_QueryAllGatewayResponse_1_list) NewElement() protoreflect.Value { +func (x *_QueryAllGatewaysResponse_1_list) NewElement() protoreflect.Value { v := new(Gateway) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllGatewayResponse_1_list) IsValid() bool { +func (x *_QueryAllGatewaysResponse_1_list) IsValid() bool { return x.list != nil } var ( - md_QueryAllGatewayResponse protoreflect.MessageDescriptor - fd_QueryAllGatewayResponse_gateway protoreflect.FieldDescriptor - fd_QueryAllGatewayResponse_pagination protoreflect.FieldDescriptor + md_QueryAllGatewaysResponse protoreflect.MessageDescriptor + fd_QueryAllGatewaysResponse_gateways protoreflect.FieldDescriptor + fd_QueryAllGatewaysResponse_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_query_proto_init() - md_QueryAllGatewayResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayResponse") - fd_QueryAllGatewayResponse_gateway = md_QueryAllGatewayResponse.Fields().ByName("gateway") - fd_QueryAllGatewayResponse_pagination = md_QueryAllGatewayResponse.Fields().ByName("pagination") + md_QueryAllGatewaysResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewaysResponse") + fd_QueryAllGatewaysResponse_gateways = md_QueryAllGatewaysResponse.Fields().ByName("gateways") + fd_QueryAllGatewaysResponse_pagination = md_QueryAllGatewaysResponse.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllGatewayResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllGatewaysResponse)(nil) -type fastReflection_QueryAllGatewayResponse QueryAllGatewayResponse +type fastReflection_QueryAllGatewaysResponse QueryAllGatewaysResponse -func (x *QueryAllGatewayResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllGatewayResponse)(x) +func (x *QueryAllGatewaysResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysResponse)(x) } -func (x *QueryAllGatewayResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryAllGatewaysResponse) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_gateway_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2183,43 +2183,43 @@ func (x *QueryAllGatewayResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllGatewayResponse_messageType fastReflection_QueryAllGatewayResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllGatewayResponse_messageType{} +var _fastReflection_QueryAllGatewaysResponse_messageType fastReflection_QueryAllGatewaysResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewaysResponse_messageType{} -type fastReflection_QueryAllGatewayResponse_messageType struct{} +type fastReflection_QueryAllGatewaysResponse_messageType struct{} -func (x fastReflection_QueryAllGatewayResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllGatewayResponse)(nil) +func (x fastReflection_QueryAllGatewaysResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysResponse)(nil) } -func (x fastReflection_QueryAllGatewayResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayResponse) +func (x fastReflection_QueryAllGatewaysResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysResponse) } -func (x fastReflection_QueryAllGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayResponse +func (x fastReflection_QueryAllGatewaysResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllGatewayResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayResponse +func (x *fastReflection_QueryAllGatewaysResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllGatewayResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryAllGatewayResponse_messageType +func (x *fastReflection_QueryAllGatewaysResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewaysResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllGatewayResponse) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayResponse) +func (x *fastReflection_QueryAllGatewaysResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllGatewayResponse) Interface() protoreflect.ProtoMessage { - return (*QueryAllGatewayResponse)(x) +func (x *fastReflection_QueryAllGatewaysResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewaysResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2227,16 +2227,16 @@ func (x *fastReflection_QueryAllGatewayResponse) Interface() protoreflect.ProtoM // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Gateway) != 0 { - value := protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &x.Gateway}) - if !f(fd_QueryAllGatewayResponse_gateway, value) { +func (x *fastReflection_QueryAllGatewaysResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Gateways) != 0 { + value := protoreflect.ValueOfList(&_QueryAllGatewaysResponse_1_list{list: &x.Gateways}) + if !f(fd_QueryAllGatewaysResponse_gateways, value) { return } } if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllGatewayResponse_pagination, value) { + if !f(fd_QueryAllGatewaysResponse_pagination, value) { return } } @@ -2253,17 +2253,17 @@ func (x *fastReflection_QueryAllGatewayResponse) Range(f func(protoreflect.Field // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllGatewaysResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - return len(x.Gateway) != 0 - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + return len(x.Gateways) != 0 + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } @@ -2273,17 +2273,17 @@ func (x *fastReflection_QueryAllGatewayResponse) Has(fd protoreflect.FieldDescri // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllGatewaysResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - x.Gateway = nil - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + x.Gateways = nil + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } @@ -2293,22 +2293,22 @@ func (x *fastReflection_QueryAllGatewayResponse) Clear(fd protoreflect.FieldDesc // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - if len(x.Gateway) == 0 { - return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{}) + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + if len(x.Gateways) == 0 { + return protoreflect.ValueOfList(&_QueryAllGatewaysResponse_1_list{}) } - listValue := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + listValue := &_QueryAllGatewaysResponse_1_list{list: &x.Gateways} return protoreflect.ValueOfList(listValue) - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", descriptor.FullName())) } } @@ -2322,19 +2322,19 @@ func (x *fastReflection_QueryAllGatewayResponse) Get(descriptor protoreflect.Fie // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllGatewaysResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": lv := value.List() - clv := lv.(*_QueryAllGatewayResponse_1_list) - x.Gateway = *clv.list - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + clv := lv.(*_QueryAllGatewaysResponse_1_list) + x.Gateways = *clv.list + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } @@ -2348,53 +2348,53 @@ func (x *fastReflection_QueryAllGatewayResponse) Set(fd protoreflect.FieldDescri // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - if x.Gateway == nil { - x.Gateway = []*Gateway{} + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + if x.Gateways == nil { + x.Gateways = []*Gateway{} } - value := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + value := &_QueryAllGatewaysResponse_1_list{list: &x.Gateways} return protoreflect.ValueOfList(value) - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageResponse) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": list := []*Gateway{} - return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &list}) - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + return protoreflect.ValueOfList(&_QueryAllGatewaysResponse_1_list{list: &list}) + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": m := new(v1beta1.PageResponse) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllGatewaysResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewaysResponse", d.FullName())) } panic("unreachable") } @@ -2402,7 +2402,7 @@ func (x *fastReflection_QueryAllGatewayResponse) WhichOneof(d protoreflect.Oneof // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllGatewayResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllGatewaysResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2413,7 +2413,7 @@ func (x *fastReflection_QueryAllGatewayResponse) GetUnknown() protoreflect.RawFi // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllGatewaysResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2425,7 +2425,7 @@ func (x *fastReflection_QueryAllGatewayResponse) SetUnknown(fields protoreflect. // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllGatewayResponse) IsValid() bool { +func (x *fastReflection_QueryAllGatewaysResponse) IsValid() bool { return x != nil } @@ -2435,9 +2435,9 @@ func (x *fastReflection_QueryAllGatewayResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllGatewaysResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllGatewayResponse) + x := input.Message.Interface().(*QueryAllGatewaysResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2449,8 +2449,8 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth var n int var l int _ = l - if len(x.Gateway) > 0 { - for _, e := range x.Gateway { + if len(x.Gateways) > 0 { + for _, e := range x.Gateways { l = options.Size(e) n += 1 + l + runtime.Sov(uint64(l)) } @@ -2469,7 +2469,7 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayResponse) + x := input.Message.Interface().(*QueryAllGatewaysResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2502,9 +2502,9 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth i-- dAtA[i] = 0x12 } - if len(x.Gateway) > 0 { - for iNdEx := len(x.Gateway) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Gateway[iNdEx]) + if len(x.Gateways) > 0 { + for iNdEx := len(x.Gateways) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Gateways[iNdEx]) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2529,7 +2529,7 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayResponse) + x := input.Message.Interface().(*QueryAllGatewaysResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2561,15 +2561,15 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Gateway", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Gateways", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2596,8 +2596,8 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Gateway = append(x.Gateway, &Gateway{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateway[len(x.Gateway)-1]); err != nil { + x.Gateways = append(x.Gateways, &Gateway{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateways[len(x.Gateways)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2819,7 +2819,7 @@ func (x *QueryGetGatewayResponse) GetGateway() *Gateway { return nil } -type QueryAllGatewayRequest struct { +type QueryAllGatewaysRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2827,8 +2827,8 @@ type QueryAllGatewayRequest struct { Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllGatewayRequest) Reset() { - *x = QueryAllGatewayRequest{} +func (x *QueryAllGatewaysRequest) Reset() { + *x = QueryAllGatewaysRequest{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_gateway_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2836,35 +2836,35 @@ func (x *QueryAllGatewayRequest) Reset() { } } -func (x *QueryAllGatewayRequest) String() string { +func (x *QueryAllGatewaysRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllGatewayRequest) ProtoMessage() {} +func (*QueryAllGatewaysRequest) ProtoMessage() {} -// Deprecated: Use QueryAllGatewayRequest.ProtoReflect.Descriptor instead. -func (*QueryAllGatewayRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllGatewaysRequest.ProtoReflect.Descriptor instead. +func (*QueryAllGatewaysRequest) Descriptor() ([]byte, []int) { return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{4} } -func (x *QueryAllGatewayRequest) GetPagination() *v1beta1.PageRequest { +func (x *QueryAllGatewaysRequest) GetPagination() *v1beta1.PageRequest { if x != nil { return x.Pagination } return nil } -type QueryAllGatewayResponse struct { +type QueryAllGatewaysResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Gateway []*Gateway `protobuf:"bytes,1,rep,name=gateway,proto3" json:"gateway,omitempty"` + Gateways []*Gateway `protobuf:"bytes,1,rep,name=gateways,proto3" json:"gateways,omitempty"` Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllGatewayResponse) Reset() { - *x = QueryAllGatewayResponse{} +func (x *QueryAllGatewaysResponse) Reset() { + *x = QueryAllGatewaysResponse{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_gateway_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2872,25 +2872,25 @@ func (x *QueryAllGatewayResponse) Reset() { } } -func (x *QueryAllGatewayResponse) String() string { +func (x *QueryAllGatewaysResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllGatewayResponse) ProtoMessage() {} +func (*QueryAllGatewaysResponse) ProtoMessage() {} -// Deprecated: Use QueryAllGatewayResponse.ProtoReflect.Descriptor instead. -func (*QueryAllGatewayResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllGatewaysResponse.ProtoReflect.Descriptor instead. +func (*QueryAllGatewaysResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryAllGatewayResponse) GetGateway() []*Gateway { +func (x *QueryAllGatewaysResponse) GetGateways() []*Gateway { if x != nil { - return x.Gateway + return x.Gateways } return nil } -func (x *QueryAllGatewayResponse) GetPagination() *v1beta1.PageResponse { +func (x *QueryAllGatewaysResponse) GetPagination() *v1beta1.PageResponse { if x != nil { return x.Pagination } @@ -2911,13 +2911,13 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, @@ -2933,62 +2933,62 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, - 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, - 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, - 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x79, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa0, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, + 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x12, 0x47, + 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xc0, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, - 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, - 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, - 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x28, + 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x32, 0x12, 0x30, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, - 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, - 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3005,29 +3005,29 @@ func file_poktroll_gateway_query_proto_rawDescGZIP() []byte { var file_poktroll_gateway_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_gateway_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse - (*QueryGetGatewayRequest)(nil), // 2: poktroll.gateway.QueryGetGatewayRequest - (*QueryGetGatewayResponse)(nil), // 3: poktroll.gateway.QueryGetGatewayResponse - (*QueryAllGatewayRequest)(nil), // 4: poktroll.gateway.QueryAllGatewayRequest - (*QueryAllGatewayResponse)(nil), // 5: poktroll.gateway.QueryAllGatewayResponse - (*Params)(nil), // 6: poktroll.gateway.Params - (*Gateway)(nil), // 7: poktroll.gateway.Gateway - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse + (*QueryGetGatewayRequest)(nil), // 2: poktroll.gateway.QueryGetGatewayRequest + (*QueryGetGatewayResponse)(nil), // 3: poktroll.gateway.QueryGetGatewayResponse + (*QueryAllGatewaysRequest)(nil), // 4: poktroll.gateway.QueryAllGatewaysRequest + (*QueryAllGatewaysResponse)(nil), // 5: poktroll.gateway.QueryAllGatewaysResponse + (*Params)(nil), // 6: poktroll.gateway.Params + (*Gateway)(nil), // 7: poktroll.gateway.Gateway + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_gateway_query_proto_depIdxs = []int32{ 6, // 0: poktroll.gateway.QueryParamsResponse.params:type_name -> poktroll.gateway.Params 7, // 1: poktroll.gateway.QueryGetGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway - 8, // 2: poktroll.gateway.QueryAllGatewayRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.gateway.QueryAllGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway - 9, // 4: poktroll.gateway.QueryAllGatewayResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 8, // 2: poktroll.gateway.QueryAllGatewaysRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.gateway.QueryAllGatewaysResponse.gateways:type_name -> poktroll.gateway.Gateway + 9, // 4: poktroll.gateway.QueryAllGatewaysResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 0, // 5: poktroll.gateway.Query.Params:input_type -> poktroll.gateway.QueryParamsRequest 2, // 6: poktroll.gateway.Query.Gateway:input_type -> poktroll.gateway.QueryGetGatewayRequest - 4, // 7: poktroll.gateway.Query.GatewayAll:input_type -> poktroll.gateway.QueryAllGatewayRequest + 4, // 7: poktroll.gateway.Query.AllGateways:input_type -> poktroll.gateway.QueryAllGatewaysRequest 1, // 8: poktroll.gateway.Query.Params:output_type -> poktroll.gateway.QueryParamsResponse 3, // 9: poktroll.gateway.Query.Gateway:output_type -> poktroll.gateway.QueryGetGatewayResponse - 5, // 10: poktroll.gateway.Query.GatewayAll:output_type -> poktroll.gateway.QueryAllGatewayResponse + 5, // 10: poktroll.gateway.Query.AllGateways:output_type -> poktroll.gateway.QueryAllGatewaysResponse 8, // [8:11] is the sub-list for method output_type 5, // [5:8] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -3092,7 +3092,7 @@ func file_poktroll_gateway_query_proto_init() { } } file_poktroll_gateway_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllGatewayRequest); i { + switch v := v.(*QueryAllGatewaysRequest); i { case 0: return &v.state case 1: @@ -3104,7 +3104,7 @@ func file_poktroll_gateway_query_proto_init() { } } file_poktroll_gateway_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllGatewayResponse); i { + switch v := v.(*QueryAllGatewaysResponse); i { case 0: return &v.state case 1: diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 0c3dff1c9..0a23aed5c 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2524,6 +2524,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/gateway parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } @@ -2731,11 +2732,11 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, - 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, diff --git a/proto/poktroll/gateway/gateway.proto b/proto/poktroll/gateway/gateway.proto index ff6798ba7..498938b92 100644 --- a/proto/poktroll/gateway/gateway.proto +++ b/proto/poktroll/gateway/gateway.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package poktroll.gateway; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; message Gateway { diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto index d8b01b7c4..f3158785f 100644 --- a/proto/poktroll/gateway/genesis.proto +++ b/proto/poktroll/gateway/genesis.proto @@ -1,18 +1,18 @@ syntax = "proto3"; - package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/gateway/params.proto"; import "poktroll/gateway/gateway.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - // GenesisState defines the gateway module's genesis state. message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; repeated Gateway gateway_list = 2 [(gogoproto.nullable) = false] ; } diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto index bb7a65110..8ec48a41b 100644 --- a/proto/poktroll/gateway/params.proto +++ b/proto/poktroll/gateway/params.proto @@ -1,14 +1,13 @@ syntax = "proto3"; package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/gateway/Params"; option (gogoproto.equal) = true; - } \ No newline at end of file diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto index 6e000cf4f..100070c53 100644 --- a/proto/poktroll/gateway/query.proto +++ b/proto/poktroll/gateway/query.proto @@ -1,17 +1,17 @@ syntax = "proto3"; - package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "poktroll/gateway/params.proto"; -import "poktroll/gateway/gateway.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; +import "poktroll/gateway/params.proto"; +import "poktroll/gateway/gateway.proto"; // Query defines the gRPC querier service. service Query { @@ -27,7 +27,7 @@ service Query { option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway/{address}"; } - rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { + rpc AllGateways (QueryAllGatewaysRequest) returns (QueryAllGatewaysResponse) { option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway"; } @@ -50,12 +50,12 @@ message QueryGetGatewayResponse { Gateway gateway = 1 [(gogoproto.nullable) = false]; } -message QueryAllGatewayRequest { +message QueryAllGatewaysRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllGatewayResponse { - repeated Gateway gateway = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; +message QueryAllGatewaysResponse { + repeated Gateway gateways = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 0d7312952..194a9d27d 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -1,15 +1,15 @@ syntax = "proto3"; - package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "poktroll/gateway/params.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; +import "poktroll/gateway/params.proto"; // Msg defines the Msg service. service Msg { @@ -23,14 +23,17 @@ service Msg { } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/gateway/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/gateway/MsgUpdateParams"; // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the module parameters to update. + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + // params defines the x/gateway parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -40,7 +43,7 @@ message MsgUpdateParams { message MsgUpdateParamsResponse {} message MsgStakeGateway { - option (cosmos.msg.v1.signer) = "address"; + option (cosmos.msg.v1.signer) = "address"; // see: https://docs.cosmos.network/main/build/building-modules/protobuf-annotations#signer string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) } diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go index 906a742dd..e7176e11a 100644 --- a/testutil/keeper/gateway.go +++ b/testutil/keeper/gateway.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" @@ -23,7 +24,8 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func GatewayKeeper(t testing.TB) (keeper.Keeper, context.Context) { + t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() @@ -51,7 +53,7 @@ func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go index a1b8ea56d..eefe312de 100644 --- a/x/gateway/keeper/gateway.go +++ b/x/gateway/keeper/gateway.go @@ -14,30 +14,29 @@ import ( func (k Keeper) SetGateway(ctx context.Context, gateway types.Gateway) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) - b := k.cdc.MustMarshal(&gateway) + gatewayBz := k.cdc.MustMarshal(&gateway) store.Set(types.GatewayKey( gateway.Address, - ), b) + ), gatewayBz) } // GetGateway returns a gateway from its index func (k Keeper) GetGateway( ctx context.Context, address string, - -) (val types.Gateway, found bool) { +) (gateway types.Gateway, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) - b := store.Get(types.GatewayKey( + gatewayBz := store.Get(types.GatewayKey( address, )) - if b == nil { - return val, false + if gatewayBz == nil { + return gateway, false } - k.cdc.MustUnmarshal(b, &val) - return val, true + k.cdc.MustUnmarshal(gatewayBz, &gateway) + return gateway, true } // RemoveGateway removes a gateway from the store @@ -48,13 +47,11 @@ func (k Keeper) RemoveGateway( ) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) - store.Delete(types.GatewayKey( - address, - )) + store.Delete(types.GatewayKey(address)) } -// GetAllGateway returns all gateway -func (k Keeper) GetAllGateway(ctx context.Context) (list []types.Gateway) { +// GetAllGateways returns all gateway +func (k Keeper) GetAllGateways(ctx context.Context) (gateways []types.Gateway) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) @@ -62,9 +59,9 @@ func (k Keeper) GetAllGateway(ctx context.Context) (list []types.Gateway) { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Gateway - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) + var gateway types.Gateway + k.cdc.MustUnmarshal(iterator.Value(), &gateway) + gateways = append(gateways, gateway) } return diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go index 0e77c232e..58d74e7fd 100644 --- a/x/gateway/keeper/gateway_test.go +++ b/x/gateway/keeper/gateway_test.go @@ -22,14 +22,14 @@ func init() { cmd.InitSDKConfig() } -func createNGateway(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { - items := make([]types.Gateway, n) - for i := range items { - items[i].Address = strconv.Itoa(i) +func createNGateways(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { + gateway := make([]types.Gateway, n) + for i := range gateway { + gateway[i].Address = strconv.Itoa(i) - keeper.SetGateway(ctx, items[i]) + keeper.SetGateway(ctx, gateway[i]) } - return items + return gateway } func TestGatewayModuleAddress(t *testing.T) { @@ -39,37 +39,37 @@ func TestGatewayModuleAddress(t *testing.T) { func TestGatewayGet(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetGateway(ctx, - item.Address, + gateways := createNGateways(keeper, ctx, 10) + for _, gateway := range gateways { + foundGateway, found := keeper.GetGateway(ctx, + gateway.Address, ) require.True(t, found) require.Equal(t, - nullify.Fill(&item), - nullify.Fill(&rst), + nullify.Fill(&gateway), + nullify.Fill(&foundGateway), ) } } func TestGatewayRemove(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { + gateways := createNGateways(keeper, ctx, 10) + for _, gateway := range gateways { keeper.RemoveGateway(ctx, - item.Address, + gateway.Address, ) _, found := keeper.GetGateway(ctx, - item.Address, + gateway.Address, ) require.False(t, found) } } -func TestGatewayGetAll(t *testing.T) { +func TestGatewaysGetAll(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) + gateways := createNGateways(keeper, ctx, 10) require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllGateway(ctx)), + nullify.Fill(gateways), + nullify.Fill(keeper.GetAllGateways(ctx)), ) } diff --git a/x/gateway/keeper/msg_server.go b/x/gateway/keeper/msg_server.go index fafeff27b..4ee089512 100644 --- a/x/gateway/keeper/msg_server.go +++ b/x/gateway/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) +import "github.com/pokt-network/poktroll/x/gateway/types" type msgServer struct { Keeper diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 1a08d0049..9f257a98f 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" @@ -37,12 +36,16 @@ func (k msgServer) StakeGateway( if err = k.updateGateway(ctx, &gateway, msg); err != nil { return nil, err } - coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) + coinsToDelegate, err = (*msg.Stake).SafeSub(currGatewayStake) + if err != nil { + return nil, err + } } // Retrieve the address of the gateway gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { + // TODO_TECHDEBT(#384): determine whether to continue using cosmos logger for debug level. logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) return nil, err } @@ -50,6 +53,7 @@ func (k msgServer) StakeGateway( // Send the coins from the gateway to the staked gateway pool err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) if err != nil { + // TODO_TECHDEBT(#384): determine whether to continue using cosmos logger for debug level. logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) return nil, err } @@ -78,13 +82,13 @@ func (k msgServer) updateGateway( ) error { // Checks if the the msg address is the same as the current owner if msg.Address != gateway.Address { - return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) + return types.ErrGatewayUnauthorized.Wrapf("msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) } if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") + return types.ErrGatewayInvalidStake.Wrapf("stake amount cannot be nil") } if msg.Stake.IsLTE(*gateway.Stake) { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) + return types.ErrGatewayInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) } gateway.Stake = msg.Stake return nil diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go index 113304ee9..9645c1a0a 100644 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, @@ -42,7 +42,7 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) // Prepare an updated gateway with a higher stake - updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(200)) + updatedStake := sdk.NewCoin("upokt", math.NewInt(200)) updateMsg := &types.MsgStakeGateway{ Address: addr, Stake: &updatedStake, @@ -62,7 +62,7 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { // Prepare the gateway addr := sample.AccAddress() - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, @@ -75,7 +75,7 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { require.True(t, isGatewayFound) // Prepare an updated gateway with a lower stake - updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(50)) + updatedStake := sdk.NewCoin("upokt", math.NewInt(50)) updateMsg := &types.MsgStakeGateway{ Address: addr, Stake: &updatedStake, diff --git a/x/gateway/keeper/msg_server_test.go b/x/gateway/keeper/msg_server_test.go index 64fa7a9d3..c754e676a 100644 --- a/x/gateway/keeper/msg_server_test.go +++ b/x/gateway/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.GatewayKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go index 8f1dcf351..4c977ef3c 100644 --- a/x/gateway/keeper/msg_server_unstake_gateway_test.go +++ b/x/gateway/keeper/msg_server_unstake_gateway_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestMsgServer_UnstakeGateway_Success(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, diff --git a/x/gateway/keeper/msg_update_params.go b/x/gateway/keeper/msg_update_params.go index abfd5938d..029af5719 100644 --- a/x/gateway/keeper/msg_update_params.go +++ b/x/gateway/keeper/msg_update_params.go @@ -3,7 +3,6 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" @@ -14,10 +13,11 @@ func (k msgServer) UpdateParams( req *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrGatewayInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrGatewayInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) + // NOTE(#322): Omitted parameters will be set to their zero value. if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/gateway/keeper/msg_update_params_test.go b/x/gateway/keeper/msg_update_params_test.go index 80ab28696..29bea2bb2 100644 --- a/x/gateway/keeper/msg_update_params_test.go +++ b/x/gateway/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/gateway/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + input *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", + desc: "invalid authority", input: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", + desc: "send enabled param", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", + desc: "all good", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.input) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/gateway/keeper/params.go b/x/gateway/keeper/params.go index 7a720a898..5ae1c1146 100644 --- a/x/gateway/keeper/params.go +++ b/x/gateway/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/gateway/keeper/query.go b/x/gateway/keeper/query.go index ffa80d00d..034222910 100644 --- a/x/gateway/keeper/query.go +++ b/x/gateway/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) +import "github.com/pokt-network/poktroll/x/gateway/types" var _ types.QueryServer = Keeper{} diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go index 06712114c..0b6d2ab2a 100644 --- a/x/gateway/keeper/query_gateway.go +++ b/x/gateway/keeper/query_gateway.go @@ -13,7 +13,7 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { +func (k Keeper) AllGateways(ctx context.Context, req *types.QueryAllGatewaysRequest) (*types.QueryAllGatewaysResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -37,7 +37,7 @@ func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayReques return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil + return &types.QueryAllGatewaysResponse{Gateways: gateways, Pagination: pageRes}, nil } func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { @@ -45,12 +45,12 @@ func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) return nil, status.Error(codes.InvalidArgument, "invalid request") } - val, found := k.GetGateway( + gateway, found := k.GetGateway( ctx, req.Address, ) if !found { return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) } - return &types.QueryGetGatewayResponse{Gateway: val}, nil + return &types.QueryGetGatewayResponse{Gateway: gateway}, nil } diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go index ff5146f60..c3f4dcf78 100644 --- a/x/gateway/keeper/query_gateway_test.go +++ b/x/gateway/keeper/query_gateway_test.go @@ -20,48 +20,48 @@ var _ = strconv.IntSize func TestGatewayQuerySingle(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - msgs := createNGateway(keeper, ctx, 2) + gateways := createNGateways(keeper, ctx, 2) tests := []struct { - desc string - request *types.QueryGetGatewayRequest - response *types.QueryGetGatewayResponse - err error + desc string + request *types.QueryGetGatewayRequest + response *types.QueryGetGatewayResponse + expectedErr error }{ { desc: "First", request: &types.QueryGetGatewayRequest{ - Address: msgs[0].Address, + Address: gateways[0].Address, }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[0]}, + response: &types.QueryGetGatewayResponse{Gateway: gateways[0]}, }, { desc: "Second", request: &types.QueryGetGatewayRequest{ - Address: msgs[1].Address, + Address: gateways[1].Address, }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[1]}, + response: &types.QueryGetGatewayResponse{Gateway: gateways[1]}, }, { desc: "KeyNotFound", request: &types.QueryGetGatewayRequest{ Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", strconv.Itoa(100000))), + expectedErr: status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", strconv.Itoa(100000))), }, { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Gateway(ctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Gateway(ctx, test.request) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } @@ -71,10 +71,10 @@ func TestGatewayQuerySingle(t *testing.T) { func TestGatewayQueryPaginated(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - msgs := createNGateway(keeper, ctx, 5) + gateways := createNGateways(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewayRequest { - return &types.QueryAllGatewayRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewaysRequest { + return &types.QueryAllGatewaysRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -85,41 +85,41 @@ func TestGatewayQueryPaginated(t *testing.T) { } t.Run("ByOffset", func(t *testing.T) { step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(ctx, request(nil, uint64(i), uint64(step), false)) + for i := 0; i < len(gateways); i += step { + resp, err := keeper.AllGateways(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) } }) t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(ctx, request(next, 0, uint64(step), false)) + for i := 0; i < len(gateways); i += step { + resp, err := keeper.AllGateways(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.GatewayAll(ctx, request(nil, 0, 0, true)) + resp, err := keeper.AllGateways(ctx, request(nil, 0, 0, true)) require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.Equal(t, len(gateways), int(resp.Pagination.Total)) require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.GatewayAll(ctx, nil) + _, err := keeper.AllGateways(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/gateway/keeper/query_params.go b/x/gateway/keeper/query_params.go index 8d3afe26d..311c6a70a 100644 --- a/x/gateway/keeper/query_params.go +++ b/x/gateway/keeper/query_params.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index 8506d3c82..f8551e6ab 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -10,47 +10,47 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - }, - { - RpcMethod: "GatewayAll", - Use: "list-gateway", - Short: "List all gateway", - }, - { - RpcMethod: "Gateway", - Use: "show-gateway [id]", - Short: "Shows a gateway", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, - }, + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "AllGateways", + // Use: "list-gateway", + // Short: "List all gateway", + // }, + // { + // RpcMethod: "Gateway", + // Use: "show-gateway [id]", + // Short: "Shows a gateway", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, + // }, // this line is used by ignite scaffolding # autocli/query }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, - { - RpcMethod: "StakeGateway", - Use: "stake-gateway [stake]", - Short: "Send a stake_gateway tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, - }, - { - RpcMethod: "UnstakeGateway", - Use: "unstake-gateway", - Short: "Send a unstake_gateway tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "StakeGateway", + // Use: "stake-gateway [stake]", + // Short: "Send a stake_gateway tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, + // }, + // { + // RpcMethod: "UnstakeGateway", + // Use: "unstake-gateway", + // Short: "Send a unstake_gateway tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + // }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/gateway/module/config/errors.go b/x/gateway/module/config/errors.go index aa01b3a46..690565d36 100644 --- a/x/gateway/module/config/errors.go +++ b/x/gateway/module/config/errors.go @@ -1,10 +1,13 @@ package config -import sdkerrors "cosmossdk.io/errors" +import ( + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/x/gateway/types" +) var ( - codespace = "gatewayconfig" - ErrGatewayConfigEmptyContent = sdkerrors.Register(codespace, 1, "empty gateway staking config content") - ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(codespace, 2, "config reader cannot unmarshal yaml content") - ErrGatewayConfigInvalidStake = sdkerrors.Register(codespace, 3, "invalid stake in gateway stake config") + ErrGatewayConfigEmptyContent = sdkerrors.Register(types.ModuleName, 2100, "empty gateway staking config content") + ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(types.ModuleName, 2101, "config reader cannot unmarshal yaml content") + ErrGatewayConfigInvalidStake = sdkerrors.Register(types.ModuleName, 2102, "invalid stake in gateway stake config") ) diff --git a/x/gateway/module/config/gateway_config_reader_test.go b/x/gateway/module/config/gateway_config_reader_test.go index 11c632cc8..6de1f1151 100644 --- a/x/gateway/module/config/gateway_config_reader_test.go +++ b/x/gateway/module/config/gateway_config_reader_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -15,7 +15,7 @@ import ( func Test_ParseGatewayStakeConfig(t *testing.T) { tests := []struct { desc string - expectedError *sdkerrors.Error + expectedErr *sdkerrors.Error expectedConfig *config.GatewayStakeConfig inputConfig string }{ @@ -25,57 +25,57 @@ func Test_ParseGatewayStakeConfig(t *testing.T) { inputConfig: ` stake_amount: 1000upokt `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.GatewayStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdkmath.NewInt(1000)), + StakeAmount: sdk.NewCoin("upokt", math.NewInt(1000)), }, }, // Invalid Configs { - desc: "services_test: invalid service config with empty content", - expectedError: config.ErrGatewayConfigEmptyContent, - inputConfig: ``, + desc: "services_test: invalid service config with empty content", + expectedErr: config.ErrGatewayConfigEmptyContent, + inputConfig: ``, }, { desc: "invalid stake denom", inputConfig: ` stake_amount: 1000invalid `, - expectedError: config.ErrGatewayConfigInvalidStake, + expectedErr: config.ErrGatewayConfigInvalidStake, }, { desc: "negative stake amount", inputConfig: ` stake_amount: -1000upokt `, - expectedError: config.ErrGatewayConfigInvalidStake, + expectedErr: config.ErrGatewayConfigInvalidStake, }, { desc: "zero stake amount", inputConfig: ` stake_amount: 0upokt `, - expectedError: config.ErrGatewayConfigInvalidStake, + expectedErr: config.ErrGatewayConfigInvalidStake, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(test.inputConfig) supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) - if tt.expectedError != nil { + if test.expectedErr != nil { require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - require.Contains(t, err.Error(), tt.expectedError.Error()) + require.ErrorIs(t, err, test.expectedErr) + require.Contains(t, err.Error(), test.expectedErr.Error()) require.Nil(t, supplierServiceConfig) return } require.NoError(t, err) - require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) + require.Equal(t, test.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) + require.Equal(t, test.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) }) } } diff --git a/x/gateway/module/genesis.go b/x/gateway/module/genesis.go index 302f2a1cc..5c192dfea 100644 --- a/x/gateway/module/genesis.go +++ b/x/gateway/module/genesis.go @@ -1,28 +1,30 @@ package gateway import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // Set all the gateway - for _, elem := range genState.GatewayList { - k.SetGateway(ctx, elem) + for _, gateway := range genState.GatewayList { + k.SetGateway(ctx, gateway) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.GatewayList = k.GetAllGateway(ctx) + genesis.GatewayList = k.GetAllGateways(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go index 0d9ac318d..e58f2550b 100644 --- a/x/gateway/module/genesis_test.go +++ b/x/gateway/module/genesis_test.go @@ -3,170 +3,37 @@ package gateway_test import ( "testing" - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/testutil/sample" + gateway "github.com/pokt-network/poktroll/x/gateway/module" "github.com/pokt-network/poktroll/x/gateway/types" + "github.com/stretchr/testify/require" ) -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &stake2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - duplicated gateway address", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr1, - Stake: &stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - nil gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: nil, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - // Stake: stake2, - }, - }, + GatewayList: []types.Gateway{ + { + Address: sample.AccAddress(), }, - valid: false, - }, - { - desc: "invalid - zero gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, - }, - }, + { + Address: sample.AccAddress(), }, - valid: false, }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) + // this line is used by starport scaffolding # genesis/test/state } + + k, ctx := keepertest.GatewayKeeper(t) + gateway.InitGenesis(ctx, k, genesisState) + got := gateway.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.GatewayList, got.GatewayList) + // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/gateway/module/helpers_test.go b/x/gateway/module/helpers_test.go index 45f9c42a8..cb271b445 100644 --- a/x/gateway/module/helpers_test.go +++ b/x/gateway/module/helpers_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/network" "github.com/pokt-network/poktroll/x/gateway/types" ) @@ -14,11 +13,6 @@ import ( // Dummy variable to avoid unused import error. var _ = strconv.IntSize -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - // networkWithGatewayObjects creates a network with a populated gateway state of n gateway objects func networkWithGatewayObjects(t *testing.T, n int) (*network.Network, []types.Gateway) { t.Helper() diff --git a/x/gateway/module/module.go b/x/gateway/module/module.go index 0294e85cc..ffa418184 100644 --- a/x/gateway/module/module.go +++ b/x/gateway/module/module.go @@ -141,6 +141,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion is a sequence number for state-breaking change of the module. // It should be incremented on each consensus-breaking change introduced by the module. // To avoid wrong/empty versions, the initial version should be set to 1. +// TODO_TECHDEBT(#395): Make consensus version configurable func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block. @@ -166,10 +167,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/gateway/module/query.go b/x/gateway/module/query.go index 4c3856f0e..f4dc50d24 100644 --- a/x/gateway/module/query.go +++ b/x/gateway/module/query.go @@ -10,7 +10,8 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func (am AppModule) GetQueryCmd(queryRoute string) *cobra.Command { +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. +func (am AppModule) GetQueryCmd() *cobra.Command { // Group gateway queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/gateway/module/query_gateway.go b/x/gateway/module/query_gateway.go index be7cdaa23..88a39e4eb 100644 --- a/x/gateway/module/query_gateway.go +++ b/x/gateway/module/query_gateway.go @@ -15,7 +15,7 @@ func CmdListGateway() *cobra.Command { Long: `List all the gateways that the node being queried has in its state. Example: -$ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -29,11 +29,11 @@ $ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home=$(POKTROLLD_HOME queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllGatewayRequest{ + params := &types.QueryAllGatewaysRequest{ Pagination: pageReq, } - res, err := queryClient.GatewayAll(cmd.Context(), params) + res, err := queryClient.AllGateways(cmd.Context(), params) if err != nil { return err } diff --git a/x/gateway/module/query_gateway_test.go b/x/gateway/module/query_gateway_test.go index fd2d12d5a..e9b4d07b8 100644 --- a/x/gateway/module/query_gateway_test.go +++ b/x/gateway/module/query_gateway_test.go @@ -21,7 +21,7 @@ import ( var _ = strconv.IntSize func TestShowGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 2) + net, gateways := networkWithGatewayObjects(t, 2) ctx := net.Validators[0].ClientCtx common := []string{ @@ -31,43 +31,43 @@ func TestShowGateway(t *testing.T) { desc string idAddress string - args []string - err error - obj types.Gateway + args []string + expectedErr error + gateway types.Gateway }{ { desc: "found", - idAddress: objs[0].Address, + idAddress: gateways[0].Address, - args: common, - obj: objs[0], + args: common, + gateway: gateways[0], }, { desc: "not found", idAddress: strconv.Itoa(100000), - args: common, - err: status.Error(codes.NotFound, "not found"), + args: common, + expectedErr: status.Error(codes.NotFound, "not found"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { args := []string{ - tc.idAddress, + test.idAddress, } - args = append(args, tc.args...) + args = append(args, test.args...) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdShowGateway(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) + require.ErrorIs(t, stat.Err(), test.expectedErr) } else { require.NoError(t, err) var resp types.QueryGetGatewayResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NotNil(t, resp.Gateway) require.Equal(t, - nullify.Fill(&tc.obj), + nullify.Fill(&test.gateway), nullify.Fill(&resp.Gateway), ) } @@ -76,7 +76,7 @@ func TestShowGateway(t *testing.T) { } func TestListGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 5) + net, gateways := networkWithGatewayObjects(t, 5) ctx := net.Validators[0].ClientCtx request := func(next []byte, offset, limit uint64, total bool) []string { @@ -96,47 +96,47 @@ func TestListGateway(t *testing.T) { } t.Run("ByOffset", func(t *testing.T) { step := 2 - for i := 0; i < len(objs); i += step { + for i := 0; i < len(gateways); i += step { args := request(nil, uint64(i), uint64(step), false) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) require.NoError(t, err) - var resp types.QueryAllGatewayResponse + var resp types.QueryAllGatewaysResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) } }) t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte - for i := 0; i < len(objs); i += step { + for i := 0; i < len(gateways); i += step { args := request(next, 0, uint64(step), false) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) require.NoError(t, err) - var resp types.QueryAllGatewayResponse + var resp types.QueryAllGatewaysResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) + args := request(nil, 0, uint64(len(gateways)), true) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) require.NoError(t, err) - var resp types.QueryAllGatewayResponse + var resp types.QueryAllGatewaysResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.Equal(t, len(gateways), int(resp.Pagination.Total)) require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) }) } diff --git a/x/gateway/module/query_params.go b/x/gateway/module/query_params.go index cdca5a567..1c61165ec 100644 --- a/x/gateway/module/query_params.go +++ b/x/gateway/module/query_params.go @@ -15,7 +15,7 @@ func CmdQueryParams() *cobra.Command { Long: `Shows all the parameters related to the Gateway module. Example: -$ poktrolld q gateway params --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld q gateway params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) diff --git a/x/gateway/module/tx.go b/x/gateway/module/tx.go index 3f6b0060a..1792814fa 100644 --- a/x/gateway/module/tx.go +++ b/x/gateway/module/tx.go @@ -2,7 +2,6 @@ package gateway import ( "fmt" - "time" "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" @@ -10,14 +9,8 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/gateway/module/tx_stake_gateway.go b/x/gateway/module/tx_stake_gateway.go index e9e02dcef..ec259351e 100644 --- a/x/gateway/module/tx_stake_gateway.go +++ b/x/gateway/module/tx_stake_gateway.go @@ -25,7 +25,7 @@ func CmdStakeGateway() *cobra.Command { Long: `Stake a gateway with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the gateway specified by the 'from' address. Example: -$ poktrolld tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/gateway/module/tx_stake_gateway_test.go b/x/gateway/module/tx_stake_gateway_test.go index 5a2f82f21..583189dc1 100644 --- a/x/gateway/module/tx_stake_gateway_test.go +++ b/x/gateway/module/tx_stake_gateway_test.go @@ -6,7 +6,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -30,6 +30,9 @@ func TestCLI_StakeGateway(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) gatewayAccount := accounts[0] + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -37,14 +40,14 @@ func TestCLI_StakeGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { - desc string - address string - inputConfig string - expectedError *sdkerrors.Error + desc string + address string + inputConfig string + expectedErr *sdkerrors.Error }{ { desc: "stake gateway: invalid address", @@ -52,7 +55,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000upokt `, - expectedError: types.ErrGatewayInvalidAddress, + expectedErr: types.ErrGatewayInvalidAddress, }, { desc: "stake gateway: missing address", @@ -60,7 +63,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000upokt `, - expectedError: types.ErrGatewayInvalidAddress, + expectedErr: types.ErrGatewayInvalidAddress, }, { desc: "stake gateway: invalid stake amount (zero)", @@ -68,7 +71,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 0upokt `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: invalid stake amount (negative)", @@ -76,7 +79,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: -1000upokt `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: invalid stake denom", @@ -84,7 +87,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000invalid `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: invalid stake missing denom", @@ -92,13 +95,13 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000 `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { - desc: "stake gateway: invalid stake missing stake", - address: gatewayAccount.Address.String(), - inputConfig: ``, - expectedError: types.ErrGatewayInvalidStake, + desc: "stake gateway: invalid stake missing stake", + address: gatewayAccount.Address.String(), + inputConfig: ``, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: valid", @@ -109,32 +112,29 @@ func TestCLI_StakeGateway(t *testing.T) { }, } - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(test.inputConfig)).Name() t.Cleanup(func() { os.Remove(configPath) }) // Prepare the arguments for the CLI command args := []string{ fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.address), } args = append(args, commonArgs...) // Execute the command outStake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdStakeGateway(), args) - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/gateway/module/tx_unstake_gateway.go b/x/gateway/module/tx_unstake_gateway.go index a5760aa1a..d5bc25018 100644 --- a/x/gateway/module/tx_unstake_gateway.go +++ b/x/gateway/module/tx_unstake_gateway.go @@ -21,7 +21,7 @@ func CmdUnstakeGateway() *cobra.Command { Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. Example: -$ poktrolld tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/gateway/module/tx_unstake_gateway_test.go b/x/gateway/module/tx_unstake_gateway_test.go index fb2e1cc07..0a240ca4f 100644 --- a/x/gateway/module/tx_unstake_gateway_test.go +++ b/x/gateway/module/tx_unstake_gateway_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -28,6 +28,9 @@ func TestCLI_UnstakeGateway(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) gatewayAccount := accounts[0] + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -35,13 +38,13 @@ func TestCLI_UnstakeGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { - desc string - address string - err *sdkerrors.Error + desc string + address string + expectedErr *sdkerrors.Error }{ { desc: "unstake gateway: valid", @@ -49,28 +52,25 @@ func TestCLI_UnstakeGateway(t *testing.T) { }, { desc: "unstake gateway: missing address", - // address: gatewayAccount.Address.String(), - err: types.ErrGatewayInvalidAddress, + // address explicitly omitted + expectedErr: types.ErrGatewayInvalidAddress, }, { - desc: "unstake gateway: invalid address", - address: "invalid", - err: types.ErrGatewayInvalidAddress, + desc: "unstake gateway: invalid address", + address: "invalid", + expectedErr: types.ErrGatewayInvalidAddress, }, } - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.address), } args = append(args, commonArgs...) @@ -78,10 +78,10 @@ func TestCLI_UnstakeGateway(t *testing.T) { outUnstake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdUnstakeGateway(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go index ea7474891..d7a818c5b 100644 --- a/x/gateway/simulation/stake_gateway.go +++ b/x/gateway/simulation/stake_gateway.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) diff --git a/x/gateway/simulation/unstake_gateway.go b/x/gateway/simulation/unstake_gateway.go index 69bc3233b..0f1f2f29c 100644 --- a/x/gateway/simulation/unstake_gateway.go +++ b/x/gateway/simulation/unstake_gateway.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go index 298df8889..54bf3f388 100644 --- a/x/gateway/types/errors.go +++ b/x/gateway/types/errors.go @@ -2,16 +2,13 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/gateway module sentinel errors var ( ErrGatewayInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrGatewaySample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid gateway address") - ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1103, "invalid gateway stake") - ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized signer") - ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1105, "gateway not found") + ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1101, "invalid gateway address") + ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1102, "invalid gateway stake") + ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized signer") + ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1104, "gateway not found") ) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go index 10cde1203..ca22179fc 100644 --- a/x/gateway/types/expected_keepers.go +++ b/x/gateway/types/expected_keepers.go @@ -1,7 +1,7 @@ -package types - //go:generate mockgen -destination ../../../testutil/gateway/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper +package types + import ( "context" @@ -29,9 +29,3 @@ type BankKeeper interface { amt sdk.Coins, ) error } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go index 5cb161252..6ec98e8bf 100644 --- a/x/gateway/types/genesis.go +++ b/x/gateway/types/genesis.go @@ -1,12 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 +import sdk "github.com/cosmos/cosmos-sdk/types" // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { @@ -20,31 +14,31 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - gatewayIndexMap := make(map[string]struct{}) + gatewayAddrMap := make(map[string]struct{}) for _, gateway := range gs.GatewayList { - // Check for duplicated index in gateway - index := string(GatewayKey(gateway.Address)) - if _, ok := gatewayIndexMap[index]; ok { - return sdkerrors.Wrap(ErrGatewayInvalidAddress, "duplicated index for gateway") + // Check for duplicated address in gateway + address := string(GatewayKey(gateway.Address)) + if _, ok := gatewayAddrMap[address]; ok { + return ErrGatewayInvalidAddress.Wrap("duplicated index for gateway") } - gatewayIndexMap[index] = struct{}{} + gatewayAddrMap[address] = struct{}{} // Validate the stake of each gateway if gateway.Stake == nil { - return sdkerrors.Wrap(ErrGatewayInvalidStake, "nil stake amount for gateway") + return ErrGatewayInvalidStake.Wrap("nil stake amount for gateway") } stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) + return ErrGatewayInvalidStake.Wrapf("cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway: %v <= 0", gateway.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", gateway.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount denom for gateway %v", gateway.Stake) } } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go new file mode 100644 index 000000000..357176de1 --- /dev/null +++ b/x/gateway/types/genesis_test.go @@ -0,0 +1,172 @@ +package types_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", math.NewInt(100)) + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", math.NewInt(100)) + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &stake2, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid - duplicated gateway address", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr1, + Stake: &stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - nil gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: nil, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + // Stake: stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - zero gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + }, + }, + }, + valid: false, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go index 8fe1e65f7..7ddecd943 100644 --- a/x/gateway/types/key_gateway.go +++ b/x/gateway/types/key_gateway.go @@ -6,17 +6,15 @@ var _ binary.ByteOrder const ( // GatewayKeyPrefix is the prefix to retrieve all Gateways - GatewayKeyPrefix = "Gateway/value/" + GatewayKeyPrefix = "Gateway/address/" ) // GatewayKey returns the store key to retrieve a Gateway from the index fields -func GatewayKey( - address string, -) []byte { +func GatewayKey(gatewayAddr string) []byte { var key []byte - addressBytes := []byte(address) - key = append(key, addressBytes...) + gatewayAddrBz := []byte(gatewayAddr) + key = append(key, gatewayAddrBz...) key = append(key, []byte("/")...) return key diff --git a/x/gateway/types/keys.go b/x/gateway/types/keys.go index 4d65ff460..1cc1ef654 100644 --- a/x/gateway/types/keys.go +++ b/x/gateway/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_gateway" ) -var ( - ParamsKey = []byte("p_gateway") -) +var ParamsKey = []byte("p_gateway") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go index 9f349cf16..7bdf8dfbc 100644 --- a/x/gateway/types/message_stake_gateway.go +++ b/x/gateway/types/message_stake_gateway.go @@ -1,9 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgStakeGateway)(nil) @@ -17,25 +14,25 @@ func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { func (msg *MsgStakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) + return ErrGatewayInvalidAddress.Wrapf("invalid gateway address %s; (%v)", msg.Address, err) } // Validate the stake amount if msg.Stake == nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "nil gateway stake; (%v)", err) + return ErrGatewayInvalidStake.Wrapf("nil gateway stake; (%v)", err) } stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) + return ErrGatewayInvalidStake.Wrapf("invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse gateway stake %v; (%v)", msg.Stake, err) + return ErrGatewayInvalidStake.Wrapf("cannot parse gateway stake %v; (%v)", msg.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", msg.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway: %v <= 0", msg.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", msg.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount denom for gateway %v", msg.Stake) } return nil } diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go index d1cb20902..cda4abbaf 100644 --- a/x/gateway/types/message_stake_gateway_test.go +++ b/x/gateway/types/message_stake_gateway_test.go @@ -3,7 +3,7 @@ package types import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -11,56 +11,56 @@ import ( ) func TestMsgStakeGateway_ValidateBasic(t *testing.T) { - coins := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + coins := sdk.NewCoin("upokt", math.NewInt(100)) tests := []struct { - name string - msg MsgStakeGateway - err error + desc string + msg MsgStakeGateway + expectedErr error }{ { - name: "invalid address - no stake", + desc: "invalid address - no stake", msg: MsgStakeGateway{ Address: "invalid_address", // Stake explicitly nil }, - err: ErrGatewayInvalidAddress, + expectedErr: ErrGatewayInvalidAddress, }, { - name: "valid address - nil stake", + desc: "valid address - nil stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), // Stake explicitly nil }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - zero stake", + desc: "valid address - zero stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - negative stake", + desc: "valid address - negative stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - invalid stake denom", + desc: "valid address - invalid stake denom", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - invalid stake missing denom", + desc: "valid address - invalid stake missing denom", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - valid stake", + desc: "valid address - valid stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), Stake: &coins, @@ -68,11 +68,11 @@ func TestMsgStakeGateway_ValidateBasic(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go index fc163d022..e4e6142f2 100644 --- a/x/gateway/types/message_unstake_gateway.go +++ b/x/gateway/types/message_unstake_gateway.go @@ -1,9 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgUnstakeGateway)(nil) @@ -16,7 +13,7 @@ func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { func (msg *MsgUnstakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) + return ErrGatewayInvalidAddress.Wrapf("invalid gateway address %s; (%v)", msg.Address, err) } return nil } diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go index 301ad05ef..9e343dbad 100644 --- a/x/gateway/types/message_unstake_gateway_test.go +++ b/x/gateway/types/message_unstake_gateway_test.go @@ -9,34 +9,34 @@ import ( func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUnstakeGateway - err error + desc string + msg MsgUnstakeGateway + expectedErr error }{ { - name: "invalid address", + desc: "invalid address", msg: MsgUnstakeGateway{ Address: "invalid_address", }, - err: ErrGatewayInvalidAddress, + expectedErr: ErrGatewayInvalidAddress, }, { - name: "missing address", - msg: MsgUnstakeGateway{}, - err: ErrGatewayInvalidAddress, + desc: "missing address", + msg: MsgUnstakeGateway{}, + expectedErr: ErrGatewayInvalidAddress, }, { - name: "valid address", + desc: "valid address", msg: MsgUnstakeGateway{ Address: sample.AccAddress(), }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/gateway/types/msg_update_params.go b/x/gateway/types/message_update_params.go similarity index 100% rename from x/gateway/types/msg_update_params.go rename to x/gateway/types/message_update_params.go diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index 4f3215e35..95b0cf8a2 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -1,8 +1,6 @@ package types -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" var _ paramtypes.ParamSet = (*Params)(nil) From 36ad3dda7cf74cf01a3dd55b241c3375d2679b5b Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Tue, 20 Feb 2024 10:11:22 +0100 Subject: [PATCH 39/54] chore: service module review improvements --- api/poktroll/service/params.pulsar.go | 3 + api/poktroll/service/query.pulsar.go | 541 +++++++++--------- api/poktroll/service/tx.pulsar.go | 1 + api/poktroll/shared/service.pulsar.go | 4 +- proto/poktroll/service/genesis.proto | 5 +- proto/poktroll/service/params.proto | 7 +- proto/poktroll/service/query.proto | 17 +- proto/poktroll/service/tx.proto | 18 +- proto/poktroll/shared/service.proto | 4 +- testutil/keeper/service.go | 48 +- x/service/keeper/msg_server.go | 4 +- x/service/keeper/msg_server_add_service.go | 10 +- .../keeper/msg_server_add_service_test.go | 113 ++-- x/service/keeper/msg_server_test.go | 4 + x/service/keeper/msg_update_params.go | 8 +- x/service/keeper/msg_update_params_test.go | 36 +- x/service/keeper/params.go | 10 +- x/service/keeper/query.go | 4 +- x/service/keeper/query_params.go | 4 +- x/service/keeper/query_service.go | 16 +- x/service/keeper/query_service_test.go | 48 +- x/service/keeper/service.go | 12 +- x/service/keeper/service_test.go | 23 +- x/service/module/autocli.go | 81 +-- x/service/module/genesis.go | 10 +- x/service/module/module.go | 6 +- x/service/module/tx.go | 11 +- x/service/module/tx_add_service.go | 5 +- x/service/module/tx_add_service_test.go | 30 +- x/service/simulation/add_service.go | 1 + x/service/types/errors.go | 24 +- x/service/types/expected_keepers.go | 7 +- x/service/types/genesis.go | 23 +- x/service/types/genesis_test.go | 36 +- x/service/types/key_service.go | 2 +- x/service/types/keys.go | 8 +- x/service/types/message_add_service.go | 4 +- x/service/types/message_add_service_test.go | 14 +- ...ate_params.go => message_update_params.go} | 0 x/service/types/params.go | 8 +- x/service/types/types.go | 2 + x/shared/helpers/service_test.go | 140 ++--- 42 files changed, 660 insertions(+), 692 deletions(-) rename x/service/types/{msg_update_params.go => message_update_params.go} (100%) diff --git a/api/poktroll/service/params.pulsar.go b/api/poktroll/service/params.pulsar.go index d85bbf213..346acdd52 100644 --- a/api/poktroll/service/params.pulsar.go +++ b/api/poktroll/service/params.pulsar.go @@ -437,6 +437,9 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // The amount of uPOKT required to add a new service. + // This will be deducted from the signer's account balance, + // and transferred to the pocket network foundation. AddServiceFee uint64 `protobuf:"varint,1,opt,name=add_service_fee,json=addServiceFee,proto3" json:"add_service_fee,omitempty"` } diff --git a/api/poktroll/service/query.pulsar.go b/api/poktroll/service/query.pulsar.go index 1b1039159..2f313aef1 100644 --- a/api/poktroll/service/query.pulsar.go +++ b/api/poktroll/service/query.pulsar.go @@ -809,14 +809,14 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } var ( - md_QueryGetServiceRequest protoreflect.MessageDescriptor - fd_QueryGetServiceRequest_index protoreflect.FieldDescriptor + md_QueryGetServiceRequest protoreflect.MessageDescriptor + fd_QueryGetServiceRequest_id protoreflect.FieldDescriptor ) func init() { file_poktroll_service_query_proto_init() md_QueryGetServiceRequest = File_poktroll_service_query_proto.Messages().ByName("QueryGetServiceRequest") - fd_QueryGetServiceRequest_index = md_QueryGetServiceRequest.Fields().ByName("index") + fd_QueryGetServiceRequest_id = md_QueryGetServiceRequest.Fields().ByName("id") } var _ protoreflect.Message = (*fastReflection_QueryGetServiceRequest)(nil) @@ -884,9 +884,9 @@ func (x *fastReflection_QueryGetServiceRequest) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QueryGetServiceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Index != "" { - value := protoreflect.ValueOfString(x.Index) - if !f(fd_QueryGetServiceRequest_index, value) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_QueryGetServiceRequest_id, value) { return } } @@ -905,8 +905,8 @@ func (x *fastReflection_QueryGetServiceRequest) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_QueryGetServiceRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.service.QueryGetServiceRequest.index": - return x.Index != "" + case "poktroll.service.QueryGetServiceRequest.id": + return x.Id != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) @@ -923,8 +923,8 @@ func (x *fastReflection_QueryGetServiceRequest) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryGetServiceRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.service.QueryGetServiceRequest.index": - x.Index = "" + case "poktroll.service.QueryGetServiceRequest.id": + x.Id = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) @@ -941,8 +941,8 @@ func (x *fastReflection_QueryGetServiceRequest) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_QueryGetServiceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.service.QueryGetServiceRequest.index": - value := x.Index + case "poktroll.service.QueryGetServiceRequest.id": + value := x.Id return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { @@ -964,8 +964,8 @@ func (x *fastReflection_QueryGetServiceRequest) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryGetServiceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.service.QueryGetServiceRequest.index": - x.Index = value.Interface().(string) + case "poktroll.service.QueryGetServiceRequest.id": + x.Id = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) @@ -986,8 +986,8 @@ func (x *fastReflection_QueryGetServiceRequest) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryGetServiceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.QueryGetServiceRequest.index": - panic(fmt.Errorf("field index of message poktroll.service.QueryGetServiceRequest is not mutable")) + case "poktroll.service.QueryGetServiceRequest.id": + panic(fmt.Errorf("field id of message poktroll.service.QueryGetServiceRequest is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryGetServiceRequest")) @@ -1001,7 +1001,7 @@ func (x *fastReflection_QueryGetServiceRequest) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_QueryGetServiceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.QueryGetServiceRequest.index": + case "poktroll.service.QueryGetServiceRequest.id": return protoreflect.ValueOfString("") default: if fd.IsExtension() { @@ -1072,7 +1072,7 @@ func (x *fastReflection_QueryGetServiceRequest) ProtoMethods() *protoiface.Metho var n int var l int _ = l - l = len(x.Index) + l = len(x.Id) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -1105,10 +1105,10 @@ func (x *fastReflection_QueryGetServiceRequest) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Index) > 0 { - i -= len(x.Index) - copy(dAtA[i:], x.Index) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Index))) + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) i-- dAtA[i] = 0xa } @@ -1163,7 +1163,7 @@ func (x *fastReflection_QueryGetServiceRequest) ProtoMethods() *protoiface.Metho switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1191,7 +1191,7 @@ func (x *fastReflection_QueryGetServiceRequest) ProtoMethods() *protoiface.Metho if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Index = string(dAtA[iNdEx:postIndex]) + x.Id = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1664,25 +1664,25 @@ func (x *fastReflection_QueryGetServiceResponse) ProtoMethods() *protoiface.Meth } var ( - md_QueryAllServiceRequest protoreflect.MessageDescriptor - fd_QueryAllServiceRequest_pagination protoreflect.FieldDescriptor + md_QueryAllServicesRequest protoreflect.MessageDescriptor + fd_QueryAllServicesRequest_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_service_query_proto_init() - md_QueryAllServiceRequest = File_poktroll_service_query_proto.Messages().ByName("QueryAllServiceRequest") - fd_QueryAllServiceRequest_pagination = md_QueryAllServiceRequest.Fields().ByName("pagination") + md_QueryAllServicesRequest = File_poktroll_service_query_proto.Messages().ByName("QueryAllServicesRequest") + fd_QueryAllServicesRequest_pagination = md_QueryAllServicesRequest.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllServiceRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllServicesRequest)(nil) -type fastReflection_QueryAllServiceRequest QueryAllServiceRequest +type fastReflection_QueryAllServicesRequest QueryAllServicesRequest -func (x *QueryAllServiceRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllServiceRequest)(x) +func (x *QueryAllServicesRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllServicesRequest)(x) } -func (x *QueryAllServiceRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryAllServicesRequest) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_service_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1694,43 +1694,43 @@ func (x *QueryAllServiceRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllServiceRequest_messageType fastReflection_QueryAllServiceRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllServiceRequest_messageType{} +var _fastReflection_QueryAllServicesRequest_messageType fastReflection_QueryAllServicesRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllServicesRequest_messageType{} -type fastReflection_QueryAllServiceRequest_messageType struct{} +type fastReflection_QueryAllServicesRequest_messageType struct{} -func (x fastReflection_QueryAllServiceRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllServiceRequest)(nil) +func (x fastReflection_QueryAllServicesRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllServicesRequest)(nil) } -func (x fastReflection_QueryAllServiceRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllServiceRequest) +func (x fastReflection_QueryAllServicesRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesRequest) } -func (x fastReflection_QueryAllServiceRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllServiceRequest +func (x fastReflection_QueryAllServicesRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllServiceRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllServiceRequest +func (x *fastReflection_QueryAllServicesRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesRequest } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllServiceRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryAllServiceRequest_messageType +func (x *fastReflection_QueryAllServicesRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllServicesRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllServiceRequest) New() protoreflect.Message { - return new(fastReflection_QueryAllServiceRequest) +func (x *fastReflection_QueryAllServicesRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllServiceRequest) Interface() protoreflect.ProtoMessage { - return (*QueryAllServiceRequest)(x) +func (x *fastReflection_QueryAllServicesRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllServicesRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1738,10 +1738,10 @@ func (x *fastReflection_QueryAllServiceRequest) Interface() protoreflect.ProtoMe // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllServiceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllServicesRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllServiceRequest_pagination, value) { + if !f(fd_QueryAllServicesRequest_pagination, value) { return } } @@ -1758,15 +1758,15 @@ func (x *fastReflection_QueryAllServiceRequest) Range(f func(protoreflect.FieldD // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllServiceRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllServicesRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.service.QueryAllServiceRequest.pagination": + case "poktroll.service.QueryAllServicesRequest.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) } } @@ -1776,15 +1776,15 @@ func (x *fastReflection_QueryAllServiceRequest) Has(fd protoreflect.FieldDescrip // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllServicesRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.service.QueryAllServiceRequest.pagination": + case "poktroll.service.QueryAllServicesRequest.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) } } @@ -1794,16 +1794,16 @@ func (x *fastReflection_QueryAllServiceRequest) Clear(fd protoreflect.FieldDescr // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllServiceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllServicesRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.service.QueryAllServiceRequest.pagination": + case "poktroll.service.QueryAllServicesRequest.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", descriptor.FullName())) } } @@ -1817,15 +1817,15 @@ func (x *fastReflection_QueryAllServiceRequest) Get(descriptor protoreflect.Fiel // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllServicesRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.service.QueryAllServiceRequest.pagination": + case "poktroll.service.QueryAllServicesRequest.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) } } @@ -1839,44 +1839,44 @@ func (x *fastReflection_QueryAllServiceRequest) Set(fd protoreflect.FieldDescrip // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllServicesRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.QueryAllServiceRequest.pagination": + case "poktroll.service.QueryAllServicesRequest.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageRequest) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllServiceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllServicesRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.QueryAllServiceRequest.pagination": + case "poktroll.service.QueryAllServicesRequest.pagination": m := new(v1beta1.PageRequest) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesRequest")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesRequest does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllServiceRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllServicesRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServiceRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServicesRequest", d.FullName())) } panic("unreachable") } @@ -1884,7 +1884,7 @@ func (x *fastReflection_QueryAllServiceRequest) WhichOneof(d protoreflect.OneofD // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllServiceRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllServicesRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1895,7 +1895,7 @@ func (x *fastReflection_QueryAllServiceRequest) GetUnknown() protoreflect.RawFie // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllServicesRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1907,7 +1907,7 @@ func (x *fastReflection_QueryAllServiceRequest) SetUnknown(fields protoreflect.R // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllServiceRequest) IsValid() bool { +func (x *fastReflection_QueryAllServicesRequest) IsValid() bool { return x != nil } @@ -1917,9 +1917,9 @@ func (x *fastReflection_QueryAllServiceRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllServiceRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllServicesRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllServiceRequest) + x := input.Message.Interface().(*QueryAllServicesRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1945,7 +1945,7 @@ func (x *fastReflection_QueryAllServiceRequest) ProtoMethods() *protoiface.Metho } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllServiceRequest) + x := input.Message.Interface().(*QueryAllServicesRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1989,7 +1989,7 @@ func (x *fastReflection_QueryAllServiceRequest) ProtoMethods() *protoiface.Metho }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllServiceRequest) + x := input.Message.Interface().(*QueryAllServicesRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2021,10 +2021,10 @@ func (x *fastReflection_QueryAllServiceRequest) ProtoMethods() *protoiface.Metho fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2098,79 +2098,79 @@ func (x *fastReflection_QueryAllServiceRequest) ProtoMethods() *protoiface.Metho } } -var _ protoreflect.List = (*_QueryAllServiceResponse_1_list)(nil) +var _ protoreflect.List = (*_QueryAllServicesResponse_1_list)(nil) -type _QueryAllServiceResponse_1_list struct { +type _QueryAllServicesResponse_1_list struct { list *[]*shared.Service } -func (x *_QueryAllServiceResponse_1_list) Len() int { +func (x *_QueryAllServicesResponse_1_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_QueryAllServiceResponse_1_list) Get(i int) protoreflect.Value { +func (x *_QueryAllServicesResponse_1_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_QueryAllServiceResponse_1_list) Set(i int, value protoreflect.Value) { +func (x *_QueryAllServicesResponse_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*shared.Service) (*x.list)[i] = concreteValue } -func (x *_QueryAllServiceResponse_1_list) Append(value protoreflect.Value) { +func (x *_QueryAllServicesResponse_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*shared.Service) *x.list = append(*x.list, concreteValue) } -func (x *_QueryAllServiceResponse_1_list) AppendMutable() protoreflect.Value { +func (x *_QueryAllServicesResponse_1_list) AppendMutable() protoreflect.Value { v := new(shared.Service) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllServiceResponse_1_list) Truncate(n int) { +func (x *_QueryAllServicesResponse_1_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_QueryAllServiceResponse_1_list) NewElement() protoreflect.Value { +func (x *_QueryAllServicesResponse_1_list) NewElement() protoreflect.Value { v := new(shared.Service) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllServiceResponse_1_list) IsValid() bool { +func (x *_QueryAllServicesResponse_1_list) IsValid() bool { return x.list != nil } var ( - md_QueryAllServiceResponse protoreflect.MessageDescriptor - fd_QueryAllServiceResponse_service protoreflect.FieldDescriptor - fd_QueryAllServiceResponse_pagination protoreflect.FieldDescriptor + md_QueryAllServicesResponse protoreflect.MessageDescriptor + fd_QueryAllServicesResponse_service protoreflect.FieldDescriptor + fd_QueryAllServicesResponse_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_service_query_proto_init() - md_QueryAllServiceResponse = File_poktroll_service_query_proto.Messages().ByName("QueryAllServiceResponse") - fd_QueryAllServiceResponse_service = md_QueryAllServiceResponse.Fields().ByName("service") - fd_QueryAllServiceResponse_pagination = md_QueryAllServiceResponse.Fields().ByName("pagination") + md_QueryAllServicesResponse = File_poktroll_service_query_proto.Messages().ByName("QueryAllServicesResponse") + fd_QueryAllServicesResponse_service = md_QueryAllServicesResponse.Fields().ByName("service") + fd_QueryAllServicesResponse_pagination = md_QueryAllServicesResponse.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllServiceResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllServicesResponse)(nil) -type fastReflection_QueryAllServiceResponse QueryAllServiceResponse +type fastReflection_QueryAllServicesResponse QueryAllServicesResponse -func (x *QueryAllServiceResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllServiceResponse)(x) +func (x *QueryAllServicesResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllServicesResponse)(x) } -func (x *QueryAllServiceResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryAllServicesResponse) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_service_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2182,43 +2182,43 @@ func (x *QueryAllServiceResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllServiceResponse_messageType fastReflection_QueryAllServiceResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllServiceResponse_messageType{} +var _fastReflection_QueryAllServicesResponse_messageType fastReflection_QueryAllServicesResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllServicesResponse_messageType{} -type fastReflection_QueryAllServiceResponse_messageType struct{} +type fastReflection_QueryAllServicesResponse_messageType struct{} -func (x fastReflection_QueryAllServiceResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllServiceResponse)(nil) +func (x fastReflection_QueryAllServicesResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllServicesResponse)(nil) } -func (x fastReflection_QueryAllServiceResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllServiceResponse) +func (x fastReflection_QueryAllServicesResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesResponse) } -func (x fastReflection_QueryAllServiceResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllServiceResponse +func (x fastReflection_QueryAllServicesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllServiceResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllServiceResponse +func (x *fastReflection_QueryAllServicesResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllServicesResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllServiceResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryAllServiceResponse_messageType +func (x *fastReflection_QueryAllServicesResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllServicesResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllServiceResponse) New() protoreflect.Message { - return new(fastReflection_QueryAllServiceResponse) +func (x *fastReflection_QueryAllServicesResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllServicesResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllServiceResponse) Interface() protoreflect.ProtoMessage { - return (*QueryAllServiceResponse)(x) +func (x *fastReflection_QueryAllServicesResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllServicesResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2226,16 +2226,16 @@ func (x *fastReflection_QueryAllServiceResponse) Interface() protoreflect.ProtoM // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllServiceResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllServicesResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if len(x.Service) != 0 { - value := protoreflect.ValueOfList(&_QueryAllServiceResponse_1_list{list: &x.Service}) - if !f(fd_QueryAllServiceResponse_service, value) { + value := protoreflect.ValueOfList(&_QueryAllServicesResponse_1_list{list: &x.Service}) + if !f(fd_QueryAllServicesResponse_service, value) { return } } if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllServiceResponse_pagination, value) { + if !f(fd_QueryAllServicesResponse_pagination, value) { return } } @@ -2252,17 +2252,17 @@ func (x *fastReflection_QueryAllServiceResponse) Range(f func(protoreflect.Field // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllServiceResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllServicesResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.service.QueryAllServiceResponse.service": + case "poktroll.service.QueryAllServicesResponse.service": return len(x.Service) != 0 - case "poktroll.service.QueryAllServiceResponse.pagination": + case "poktroll.service.QueryAllServicesResponse.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) } } @@ -2272,17 +2272,17 @@ func (x *fastReflection_QueryAllServiceResponse) Has(fd protoreflect.FieldDescri // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllServicesResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.service.QueryAllServiceResponse.service": + case "poktroll.service.QueryAllServicesResponse.service": x.Service = nil - case "poktroll.service.QueryAllServiceResponse.pagination": + case "poktroll.service.QueryAllServicesResponse.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) } } @@ -2292,22 +2292,22 @@ func (x *fastReflection_QueryAllServiceResponse) Clear(fd protoreflect.FieldDesc // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllServiceResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllServicesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.service.QueryAllServiceResponse.service": + case "poktroll.service.QueryAllServicesResponse.service": if len(x.Service) == 0 { - return protoreflect.ValueOfList(&_QueryAllServiceResponse_1_list{}) + return protoreflect.ValueOfList(&_QueryAllServicesResponse_1_list{}) } - listValue := &_QueryAllServiceResponse_1_list{list: &x.Service} + listValue := &_QueryAllServicesResponse_1_list{list: &x.Service} return protoreflect.ValueOfList(listValue) - case "poktroll.service.QueryAllServiceResponse.pagination": + case "poktroll.service.QueryAllServicesResponse.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", descriptor.FullName())) } } @@ -2321,19 +2321,19 @@ func (x *fastReflection_QueryAllServiceResponse) Get(descriptor protoreflect.Fie // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllServicesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.service.QueryAllServiceResponse.service": + case "poktroll.service.QueryAllServicesResponse.service": lv := value.List() - clv := lv.(*_QueryAllServiceResponse_1_list) + clv := lv.(*_QueryAllServicesResponse_1_list) x.Service = *clv.list - case "poktroll.service.QueryAllServiceResponse.pagination": + case "poktroll.service.QueryAllServicesResponse.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) } } @@ -2347,53 +2347,53 @@ func (x *fastReflection_QueryAllServiceResponse) Set(fd protoreflect.FieldDescri // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllServicesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.QueryAllServiceResponse.service": + case "poktroll.service.QueryAllServicesResponse.service": if x.Service == nil { x.Service = []*shared.Service{} } - value := &_QueryAllServiceResponse_1_list{list: &x.Service} + value := &_QueryAllServicesResponse_1_list{list: &x.Service} return protoreflect.ValueOfList(value) - case "poktroll.service.QueryAllServiceResponse.pagination": + case "poktroll.service.QueryAllServicesResponse.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageResponse) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllServiceResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllServicesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.service.QueryAllServiceResponse.service": + case "poktroll.service.QueryAllServicesResponse.service": list := []*shared.Service{} - return protoreflect.ValueOfList(&_QueryAllServiceResponse_1_list{list: &list}) - case "poktroll.service.QueryAllServiceResponse.pagination": + return protoreflect.ValueOfList(&_QueryAllServicesResponse_1_list{list: &list}) + case "poktroll.service.QueryAllServicesResponse.pagination": m := new(v1beta1.PageResponse) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServiceResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.service.QueryAllServicesResponse")) } - panic(fmt.Errorf("message poktroll.service.QueryAllServiceResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.service.QueryAllServicesResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllServiceResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllServicesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServiceResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.service.QueryAllServicesResponse", d.FullName())) } panic("unreachable") } @@ -2401,7 +2401,7 @@ func (x *fastReflection_QueryAllServiceResponse) WhichOneof(d protoreflect.Oneof // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllServiceResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllServicesResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2412,7 +2412,7 @@ func (x *fastReflection_QueryAllServiceResponse) GetUnknown() protoreflect.RawFi // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllServiceResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllServicesResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2424,7 +2424,7 @@ func (x *fastReflection_QueryAllServiceResponse) SetUnknown(fields protoreflect. // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllServiceResponse) IsValid() bool { +func (x *fastReflection_QueryAllServicesResponse) IsValid() bool { return x != nil } @@ -2434,9 +2434,9 @@ func (x *fastReflection_QueryAllServiceResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllServiceResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllServicesResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllServiceResponse) + x := input.Message.Interface().(*QueryAllServicesResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2468,7 +2468,7 @@ func (x *fastReflection_QueryAllServiceResponse) ProtoMethods() *protoiface.Meth } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllServiceResponse) + x := input.Message.Interface().(*QueryAllServicesResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2528,7 +2528,7 @@ func (x *fastReflection_QueryAllServiceResponse) ProtoMethods() *protoiface.Meth }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllServiceResponse) + x := input.Message.Interface().(*QueryAllServicesResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2560,10 +2560,10 @@ func (x *fastReflection_QueryAllServiceResponse) ProtoMethods() *protoiface.Meth fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2753,7 +2753,8 @@ type QueryGetServiceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + // TODO: We could support getting services by name. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *QueryGetServiceRequest) Reset() { @@ -2776,9 +2777,9 @@ func (*QueryGetServiceRequest) Descriptor() ([]byte, []int) { return file_poktroll_service_query_proto_rawDescGZIP(), []int{2} } -func (x *QueryGetServiceRequest) GetIndex() string { +func (x *QueryGetServiceRequest) GetId() string { if x != nil { - return x.Index + return x.Id } return "" } @@ -2818,7 +2819,7 @@ func (x *QueryGetServiceResponse) GetService() *shared.Service { return nil } -type QueryAllServiceRequest struct { +type QueryAllServicesRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2826,8 +2827,8 @@ type QueryAllServiceRequest struct { Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllServiceRequest) Reset() { - *x = QueryAllServiceRequest{} +func (x *QueryAllServicesRequest) Reset() { + *x = QueryAllServicesRequest{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_service_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2835,25 +2836,25 @@ func (x *QueryAllServiceRequest) Reset() { } } -func (x *QueryAllServiceRequest) String() string { +func (x *QueryAllServicesRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllServiceRequest) ProtoMessage() {} +func (*QueryAllServicesRequest) ProtoMessage() {} -// Deprecated: Use QueryAllServiceRequest.ProtoReflect.Descriptor instead. -func (*QueryAllServiceRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllServicesRequest.ProtoReflect.Descriptor instead. +func (*QueryAllServicesRequest) Descriptor() ([]byte, []int) { return file_poktroll_service_query_proto_rawDescGZIP(), []int{4} } -func (x *QueryAllServiceRequest) GetPagination() *v1beta1.PageRequest { +func (x *QueryAllServicesRequest) GetPagination() *v1beta1.PageRequest { if x != nil { return x.Pagination } return nil } -type QueryAllServiceResponse struct { +type QueryAllServicesResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2862,8 +2863,8 @@ type QueryAllServiceResponse struct { Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllServiceResponse) Reset() { - *x = QueryAllServiceResponse{} +func (x *QueryAllServicesResponse) Reset() { + *x = QueryAllServicesResponse{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_service_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2871,25 +2872,25 @@ func (x *QueryAllServiceResponse) Reset() { } } -func (x *QueryAllServiceResponse) String() string { +func (x *QueryAllServicesResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllServiceResponse) ProtoMessage() {} +func (*QueryAllServicesResponse) ProtoMessage() {} -// Deprecated: Use QueryAllServiceResponse.ProtoReflect.Descriptor instead. -func (*QueryAllServiceResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllServicesResponse.ProtoReflect.Descriptor instead. +func (*QueryAllServicesResponse) Descriptor() ([]byte, []int) { return file_poktroll_service_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryAllServiceResponse) GetService() []*shared.Service { +func (x *QueryAllServicesResponse) GetService() []*shared.Service { if x != nil { return x.Service } return nil } -func (x *QueryAllServiceResponse) GetPagination() *v1beta1.PageResponse { +func (x *QueryAllServicesResponse) GetPagination() *v1beta1.PageResponse { if x != nil { return x.Pagination } @@ -2919,70 +2920,70 @@ var file_poktroll_service_query_proto_rawDesc = []byte{ 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, - 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x2e, 0x0a, 0x16, 0x51, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x28, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x53, 0x0a, 0x17, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, - 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x32, 0xbb, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, - 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x96, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x28, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x53, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, + 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbb, 0x03, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x70, 0x6f, - 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x0a, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x93, + 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, - 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, - 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, - 0x3a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0xa6, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0xca, 0x02, + 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2999,29 +3000,29 @@ func file_poktroll_service_query_proto_rawDescGZIP() []byte { var file_poktroll_service_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_service_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.service.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.service.QueryParamsResponse - (*QueryGetServiceRequest)(nil), // 2: poktroll.service.QueryGetServiceRequest - (*QueryGetServiceResponse)(nil), // 3: poktroll.service.QueryGetServiceResponse - (*QueryAllServiceRequest)(nil), // 4: poktroll.service.QueryAllServiceRequest - (*QueryAllServiceResponse)(nil), // 5: poktroll.service.QueryAllServiceResponse - (*Params)(nil), // 6: poktroll.service.Params - (*shared.Service)(nil), // 7: poktroll.shared.Service - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.service.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.service.QueryParamsResponse + (*QueryGetServiceRequest)(nil), // 2: poktroll.service.QueryGetServiceRequest + (*QueryGetServiceResponse)(nil), // 3: poktroll.service.QueryGetServiceResponse + (*QueryAllServicesRequest)(nil), // 4: poktroll.service.QueryAllServicesRequest + (*QueryAllServicesResponse)(nil), // 5: poktroll.service.QueryAllServicesResponse + (*Params)(nil), // 6: poktroll.service.Params + (*shared.Service)(nil), // 7: poktroll.shared.Service + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_service_query_proto_depIdxs = []int32{ 6, // 0: poktroll.service.QueryParamsResponse.params:type_name -> poktroll.service.Params 7, // 1: poktroll.service.QueryGetServiceResponse.service:type_name -> poktroll.shared.Service - 8, // 2: poktroll.service.QueryAllServiceRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.service.QueryAllServiceResponse.service:type_name -> poktroll.shared.Service - 9, // 4: poktroll.service.QueryAllServiceResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 8, // 2: poktroll.service.QueryAllServicesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.service.QueryAllServicesResponse.service:type_name -> poktroll.shared.Service + 9, // 4: poktroll.service.QueryAllServicesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 0, // 5: poktroll.service.Query.Params:input_type -> poktroll.service.QueryParamsRequest 2, // 6: poktroll.service.Query.Service:input_type -> poktroll.service.QueryGetServiceRequest - 4, // 7: poktroll.service.Query.ServiceAll:input_type -> poktroll.service.QueryAllServiceRequest + 4, // 7: poktroll.service.Query.AllServices:input_type -> poktroll.service.QueryAllServicesRequest 1, // 8: poktroll.service.Query.Params:output_type -> poktroll.service.QueryParamsResponse 3, // 9: poktroll.service.Query.Service:output_type -> poktroll.service.QueryGetServiceResponse - 5, // 10: poktroll.service.Query.ServiceAll:output_type -> poktroll.service.QueryAllServiceResponse + 5, // 10: poktroll.service.Query.AllServices:output_type -> poktroll.service.QueryAllServicesResponse 8, // [8:11] is the sub-list for method output_type 5, // [5:8] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -3085,7 +3086,7 @@ func file_poktroll_service_query_proto_init() { } } file_poktroll_service_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllServiceRequest); i { + switch v := v.(*QueryAllServicesRequest); i { case 0: return &v.state case 1: @@ -3097,7 +3098,7 @@ func file_poktroll_service_query_proto_init() { } } file_poktroll_service_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllServiceResponse); i { + switch v := v.(*QueryAllServicesResponse); i { case 0: return &v.state case 1: diff --git a/api/poktroll/service/tx.pulsar.go b/api/poktroll/service/tx.pulsar.go index 0cd43516f..b756d9c17 100644 --- a/api/poktroll/service/tx.pulsar.go +++ b/api/poktroll/service/tx.pulsar.go @@ -1748,6 +1748,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/service parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } diff --git a/api/poktroll/shared/service.pulsar.go b/api/poktroll/shared/service.pulsar.go index 6af7bca5b..a5b89fb9e 100644 --- a/api/poktroll/shared/service.pulsar.go +++ b/api/poktroll/shared/service.pulsar.go @@ -2585,7 +2585,7 @@ func (x *fastReflection_ConfigOption) ProtoMethods() *protoiface.Methods { // source: poktroll/shared/service.proto // NOTE that the `shared` package is not a Cosmos module, -// but rather a manually created package to resolve circular dependencies. +// but rather a manually created package to resolve circular type dependencies. const ( // Verify that this generated code is sufficiently up-to-date. @@ -2706,7 +2706,7 @@ type Service struct { // For example, what if we want to request a session for a certain service but with some additional configs that identify it? Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the service - // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary + // TODO_TECHDEBT: Name is currently unused but acts as a reminder that an optional onchain representation of the service is necessary Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // (Optional) Semantic human readable name for the service } diff --git a/proto/poktroll/service/genesis.proto b/proto/poktroll/service/genesis.proto index c563bf3a7..698660b69 100644 --- a/proto/poktroll/service/genesis.proto +++ b/proto/poktroll/service/genesis.proto @@ -1,13 +1,14 @@ syntax = "proto3"; - package poktroll.service; +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/service/params.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/service/types"; // GenesisState defines the service module's genesis state. message GenesisState { diff --git a/proto/poktroll/service/params.proto b/proto/poktroll/service/params.proto index ab19273e8..aa963aba5 100644 --- a/proto/poktroll/service/params.proto +++ b/proto/poktroll/service/params.proto @@ -1,16 +1,19 @@ syntax = "proto3"; package poktroll.service; +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/service/types"; // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/service/Params"; option (gogoproto.equal) = true; - + // The amount of uPOKT required to add a new service. + // This will be deducted from the signer's account balance, + // and transferred to the pocket network foundation. uint64 add_service_fee = 1 [(gogoproto.moretags) = "yaml:\"add_service_fee\""]; } \ No newline at end of file diff --git a/proto/poktroll/service/query.proto b/proto/poktroll/service/query.proto index ca2dacb7c..909394ed6 100644 --- a/proto/poktroll/service/query.proto +++ b/proto/poktroll/service/query.proto @@ -1,16 +1,16 @@ syntax = "proto3"; - package poktroll.service; +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; + import "poktroll/service/params.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/service/types"; - // Query defines the gRPC querier service. service Query { @@ -22,10 +22,10 @@ service Query { // Queries a list of Service items. rpc Service (QueryGetServiceRequest) returns (QueryGetServiceResponse) { - option (google.api.http).get = "/pokt-network/poktroll/service/service/{index}"; + option (google.api.http).get = "/pokt-network/poktroll/service/service/{id}"; } - rpc ServiceAll (QueryAllServiceRequest) returns (QueryAllServiceResponse) { + rpc AllServices (QueryAllServicesRequest) returns (QueryAllServicesResponse) { option (google.api.http).get = "/pokt-network/poktroll/service/service"; } @@ -41,18 +41,19 @@ message QueryParamsResponse { } message QueryGetServiceRequest { - string index = 1; + // TODO: We could support getting services by name. + string id = 1; } message QueryGetServiceResponse { poktroll.shared.Service service = 1 [(gogoproto.nullable) = false]; } -message QueryAllServiceRequest { +message QueryAllServicesRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllServiceResponse { +message QueryAllServicesResponse { repeated poktroll.shared.Service service = 1 [(gogoproto.nullable) = false]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/poktroll/service/tx.proto b/proto/poktroll/service/tx.proto index 26b4b3400..469c47b1e 100644 --- a/proto/poktroll/service/tx.proto +++ b/proto/poktroll/service/tx.proto @@ -1,20 +1,21 @@ syntax = "proto3"; - package poktroll.service; +option go_package = "github.com/pokt-network/poktroll/x/service/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; + import "poktroll/service/params.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/service/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); @@ -22,14 +23,17 @@ service Msg { } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/service/MsgUpdateParams"; - + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the module parameters to update. - + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + + // params defines the x/service parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/proto/poktroll/shared/service.proto b/proto/poktroll/shared/service.proto index 15c434d5f..3b0849600 100644 --- a/proto/poktroll/shared/service.proto +++ b/proto/poktroll/shared/service.proto @@ -1,7 +1,7 @@ syntax = "proto3"; // NOTE that the `shared` package is not a Cosmos module, -// but rather a manually created package to resolve circular dependencies. +// but rather a manually created package to resolve circular type dependencies. package poktroll.shared; option go_package = "github.com/pokt-network/poktroll/x/shared/types"; @@ -13,7 +13,7 @@ message Service { // For example, what if we want to request a session for a certain service but with some additional configs that identify it? string id = 1; // Unique identifier for the service - // TODO_TECHDEBT: Name is currently unused but acts as a reminder than an optional onchain representation of the service is necessary + // TODO_TECHDEBT: Name is currently unused but acts as a reminder that an optional onchain representation of the service is necessary string name = 2; // (Optional) Semantic human readable name for the service } diff --git a/testutil/keeper/service.go b/testutil/keeper/service.go index d6bf955d5..74a88169d 100644 --- a/testutil/keeper/service.go +++ b/testutil/keeper/service.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "sync" "testing" @@ -32,7 +33,8 @@ var ( mapMu = sync.RWMutex{} ) -func ServiceKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func ServiceKeeper(t testing.TB) (keeper.Keeper, context.Context) { + t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() @@ -48,28 +50,30 @@ func ServiceKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { mockBankKeeper := mocks.NewMockBankKeeper(ctrl) mockBankKeeper.EXPECT(). SpendableCoins(gomock.Any(), gomock.Any()). - DoAndReturn(func(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { - mapMu.RLock() - defer mapMu.RUnlock() - if coins, ok := mapAccAddrCoins[addr.String()]; ok { - return coins - } - return sdk.Coins{} - }). - AnyTimes() + DoAndReturn( + func(ctx context.Context, addr sdk.AccAddress) sdk.Coins { + mapMu.RLock() + defer mapMu.RUnlock() + if coins, ok := mapAccAddrCoins[addr.String()]; ok { + return coins + } + return sdk.Coins{} + }, + ).AnyTimes() mockBankKeeper.EXPECT(). SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()). - DoAndReturn(func(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { - mapMu.Lock() - defer mapMu.Unlock() - coins := mapAccAddrCoins[senderAddr.String()] - if coins.AmountOf("upokt").GT(amt.AmountOf("upokt")) { - mapAccAddrCoins[senderAddr.String()] = coins.Sub(amt...) - return nil - } - return types.ErrServiceNotEnoughFunds - }). - AnyTimes() + DoAndReturn( + func(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error { + mapMu.Lock() + defer mapMu.Unlock() + coins := mapAccAddrCoins[senderAddr.String()] + if coins.AmountOf("upokt").GT(amt.AmountOf("upokt")) { + mapAccAddrCoins[senderAddr.String()] = coins.Sub(amt...) + return nil + } + return types.ErrServiceNotEnoughFunds + }, + ).AnyTimes() k := keeper.NewKeeper( cdc, @@ -82,7 +86,7 @@ func ServiceKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } diff --git a/x/service/keeper/msg_server.go b/x/service/keeper/msg_server.go index e5f891b01..070f36dd6 100644 --- a/x/service/keeper/msg_server.go +++ b/x/service/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/service/types" -) +import "github.com/pokt-network/poktroll/x/service/types" type msgServer struct { Keeper diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index 0b3c9c718..f22f15438 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -10,12 +10,10 @@ import ( "github.com/pokt-network/poktroll/x/service/types" ) -// AddService handles MsgAddService and adds a service to the network storing -// it in the service keeper's store using the provided ID from the message. -// If the transaction's signer does not have enough funds (upokt) to cover the -// AddServiceFee service module's governance parameter, it will not be able to -// add the service. If it does, the fee will be deducted and debited to the -// service module's account, then the service will be added on-chain. +// AddService adds a service to the network. +// The operation checks if the signer has enough funds (upokt) to pay the AddServiceFee. +// If funds are insufficient, the service won't be added. Otherwise, the fee is transferred from +// the signer to the service module's account, afterwards the service will be present on-chain. func (k msgServer) AddService( goCtx context.Context, msg *types.MsgAddService, diff --git a/x/service/keeper/msg_server_add_service_test.go b/x/service/keeper/msg_server_add_service_test.go index d1bfbfedd..0930ede44 100644 --- a/x/service/keeper/msg_server_add_service_test.go +++ b/x/service/keeper/msg_server_add_service_test.go @@ -19,27 +19,30 @@ func TestMsgServer_AddService(t *testing.T) { k, ctx := keepertest.ServiceKeeper(t) srv := keeper.NewMsgServerImpl(k) - // Create a service + // Declare test services svc1 := sharedtypes.Service{ Id: "svc1", Name: "service 1", } - // Generate a valid address - addr := sample.AccAddress() - // Create a service preExistingService := sharedtypes.Service{ Id: "svc2", Name: "service 2", } + + // Generate a valid address + addr := sample.AccAddress() + // Mock adding a balance to the account keepertest.AddAccToAccMapCoins(t, addr, "upokt", oneUPOKTGreaterThanFee) + // Add the service to the store _, err := srv.AddService(ctx, &types.MsgAddService{ Address: addr, Service: preExistingService, }) require.NoError(t, err) + // Validate the service was added serviceFound, found := k.GetService(ctx, preExistingService.Id) require.True(t, found) @@ -49,11 +52,11 @@ func TestMsgServer_AddService(t *testing.T) { validAddr2 := sample.AccAddress() tests := []struct { - desc string - setup func(t *testing.T) - address string - service sharedtypes.Service - expectedError error + desc string + setup func(t *testing.T) + address string + service sharedtypes.Service + expectedErr error }{ { desc: "valid - service added successfully", @@ -61,9 +64,9 @@ func TestMsgServer_AddService(t *testing.T) { // Add 10000000001 upokt to the account keepertest.AddAccToAccMapCoins(t, validAddr1, "upokt", oneUPOKTGreaterThanFee) }, - address: validAddr1, - service: svc1, - expectedError: nil, + address: validAddr1, + service: svc1, + expectedErr: nil, }, { desc: "invalid - service supplier address is empty", @@ -73,14 +76,14 @@ func TestMsgServer_AddService(t *testing.T) { Id: "svc1", Name: "service 1", }, - expectedError: types.ErrServiceInvalidAddress, + expectedErr: types.ErrServiceInvalidAddress, }, { - desc: "invalid - invalid service supplier address", - setup: func(t *testing.T) {}, - address: "invalid address", - service: svc1, - expectedError: types.ErrServiceInvalidAddress, + desc: "invalid - invalid service supplier address", + setup: func(t *testing.T) {}, + address: "invalid address", + service: svc1, + expectedErr: types.ErrServiceInvalidAddress, }, { desc: "invalid - missing service ID", @@ -90,7 +93,7 @@ func TestMsgServer_AddService(t *testing.T) { // Explicitly omitting Id field Name: "service 1", }, - expectedError: types.ErrServiceMissingID, + expectedErr: types.ErrServiceMissingID, }, { desc: "invalid - empty service ID", @@ -100,7 +103,7 @@ func TestMsgServer_AddService(t *testing.T) { Id: "", // explicitly set to empty string Name: "service 1", }, - expectedError: types.ErrServiceMissingID, + expectedErr: types.ErrServiceMissingID, }, { desc: "invalid - missing service name", @@ -110,7 +113,7 @@ func TestMsgServer_AddService(t *testing.T) { Id: "svc1", // Explicitly omitting Name field }, - expectedError: types.ErrServiceMissingName, + expectedErr: types.ErrServiceMissingName, }, { desc: "invalid - empty service name", @@ -120,28 +123,28 @@ func TestMsgServer_AddService(t *testing.T) { Id: "svc1", Name: "", // explicitly set to empty string }, - expectedError: types.ErrServiceMissingName, + expectedErr: types.ErrServiceMissingName, }, { - desc: "invalid - service already exists (same service supplier)", - setup: func(t *testing.T) {}, - address: addr, - service: preExistingService, - expectedError: types.ErrServiceAlreadyExists, + desc: "invalid - service already exists (same service supplier)", + setup: func(t *testing.T) {}, + address: addr, + service: preExistingService, + expectedErr: types.ErrServiceAlreadyExists, }, { - desc: "invalid - service already exists (different service supplier)", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: preExistingService, - expectedError: types.ErrServiceAlreadyExists, + desc: "invalid - service already exists (different service supplier)", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: preExistingService, + expectedErr: types.ErrServiceAlreadyExists, }, { - desc: "invalid - no spendable coins", - setup: func(t *testing.T) {}, - address: sample.AccAddress(), - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + desc: "invalid - no spendable coins", + setup: func(t *testing.T) {}, + address: sample.AccAddress(), + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, { desc: "invalid - insufficient upokt balance", @@ -149,9 +152,9 @@ func TestMsgServer_AddService(t *testing.T) { // Add 999999999 upokt to the account (one less than AddServiceFee) keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", oneUPOKTGreaterThanFee-2) }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + address: validAddr2, + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, { desc: "invalid - account has exactly AddServiceFee", @@ -159,9 +162,9 @@ func TestMsgServer_AddService(t *testing.T) { // Add the exact fee in upokt to the account keepertest.AddAccToAccMapCoins(t, validAddr2, "upokt", types.DefaultAddServiceFee) }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + address: validAddr2, + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, { desc: "invalid - sufficient balance of different denom", @@ -169,29 +172,29 @@ func TestMsgServer_AddService(t *testing.T) { // Adds 10000000001 wrong coins to the account keepertest.AddAccToAccMapCoins(t, validAddr2, "wrong", oneUPOKTGreaterThanFee) }, - address: validAddr2, - service: svc1, - expectedError: types.ErrServiceNotEnoughFunds, + address: validAddr2, + service: svc1, + expectedErr: types.ErrServiceNotEnoughFunds, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - tt.setup(t) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + test.setup(t) _, err := srv.AddService(ctx, &types.MsgAddService{ - Address: tt.address, - Service: tt.service, + Address: test.address, + Service: test.service, }) - if tt.expectedError != nil { + if test.expectedErr != nil { // Using ErrorAs as wrapping the error sometimes gives errors with ErrorIs - require.ErrorAs(t, err, &tt.expectedError) + require.ErrorAs(t, err, &test.expectedErr) return } require.NoError(t, err) // Validate the service was added - serviceFound, found := k.GetService(ctx, tt.service.Id) + serviceFound, found := k.GetService(ctx, test.service.Id) require.True(t, found) - require.Equal(t, tt.service, serviceFound) + require.Equal(t, test.service, serviceFound) }) } } diff --git a/x/service/keeper/msg_server_test.go b/x/service/keeper/msg_server_test.go index a2aed4881..0bda2a3f4 100644 --- a/x/service/keeper/msg_server_test.go +++ b/x/service/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.ServiceKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/service/keeper/msg_update_params.go b/x/service/keeper/msg_update_params.go index e7fc8cc1f..a926bc1dd 100644 --- a/x/service/keeper/msg_update_params.go +++ b/x/service/keeper/msg_update_params.go @@ -3,18 +3,14 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/service/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrServiceInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/service/keeper/msg_update_params_test.go b/x/service/keeper/msg_update_params_test.go index b9cc12a59..8fe9ecfb1 100644 --- a/x/service/keeper/msg_update_params_test.go +++ b/x/service/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/service/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + input *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", + desc: "invalid authority", input: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", + desc: "send enabled param", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", + desc: "all good", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.input) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/service/keeper/params.go b/x/service/keeper/params.go index e980f9ec4..564b30b2b 100644 --- a/x/service/keeper/params.go +++ b/x/service/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/service/keeper/query.go b/x/service/keeper/query.go index ac3116f9a..48d9d1663 100644 --- a/x/service/keeper/query.go +++ b/x/service/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/service/types" -) +import "github.com/pokt-network/poktroll/x/service/types" var _ types.QueryServer = Keeper{} diff --git a/x/service/keeper/query_params.go b/x/service/keeper/query_params.go index c04f32dd9..397ea09c4 100644 --- a/x/service/keeper/query_params.go +++ b/x/service/keeper/query_params.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/service/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/service/keeper/query_service.go b/x/service/keeper/query_service.go index d308e0038..94a0e4ad3 100644 --- a/x/service/keeper/query_service.go +++ b/x/service/keeper/query_service.go @@ -6,16 +6,15 @@ import ( "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) -// ServiceAll queries all services. -func (k Keeper) ServiceAll(ctx context.Context, req *types.QueryAllServiceRequest) (*types.QueryAllServiceResponse, error) { +// AllServices queries all services. +func (k Keeper) AllServices(ctx context.Context, req *types.QueryAllServicesRequest) (*types.QueryAllServicesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -39,7 +38,7 @@ func (k Keeper) ServiceAll(ctx context.Context, req *types.QueryAllServiceReques return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryAllServiceResponse{Service: services, Pagination: pageRes}, nil + return &types.QueryAllServicesResponse{Service: services, Pagination: pageRes}, nil } // Service returns the requested service if it exists. @@ -48,10 +47,7 @@ func (k Keeper) Service(ctx context.Context, req *types.QueryGetServiceRequest) return nil, status.Error(codes.InvalidArgument, "invalid request") } - service, found := k.GetService( - ctx, - req.Index, - ) + service, found := k.GetService(ctx, req.Id) if !found { return nil, status.Error(codes.NotFound, "not found") } diff --git a/x/service/keeper/query_service_test.go b/x/service/keeper/query_service_test.go index 50ba3117c..f1f968fd6 100644 --- a/x/service/keeper/query_service_test.go +++ b/x/service/keeper/query_service_test.go @@ -19,48 +19,48 @@ var _ = strconv.IntSize func TestServiceQuerySingle(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) - msgs := createNService(keeper, ctx, 2) + msgs := createNServices(keeper, ctx, 2) tests := []struct { - desc string - request *types.QueryGetServiceRequest - response *types.QueryGetServiceResponse - err error + desc string + request *types.QueryGetServiceRequest + response *types.QueryGetServiceResponse + expectedErr error }{ { desc: "First", request: &types.QueryGetServiceRequest{ - Index: msgs[0].Id, + Id: msgs[0].Id, }, response: &types.QueryGetServiceResponse{Service: msgs[0]}, }, { desc: "Second", request: &types.QueryGetServiceRequest{ - Index: msgs[1].Id, + Id: msgs[1].Id, }, response: &types.QueryGetServiceResponse{Service: msgs[1]}, }, { desc: "KeyNotFound", request: &types.QueryGetServiceRequest{ - Index: strconv.Itoa(100000), + Id: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "not found"), + expectedErr: status.Error(codes.NotFound, "not found"), }, { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Service(ctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Service(ctx, test.request) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } @@ -70,10 +70,10 @@ func TestServiceQuerySingle(t *testing.T) { func TestServiceQueryPaginated(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) - msgs := createNService(keeper, ctx, 5) + msgs := createNServices(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllServiceRequest { - return &types.QueryAllServiceRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllServicesRequest { + return &types.QueryAllServicesRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -85,7 +85,7 @@ func TestServiceQueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.ServiceAll(ctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.AllServices(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.Service), step) require.Subset(t, @@ -98,7 +98,7 @@ func TestServiceQueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.ServiceAll(ctx, request(next, 0, uint64(step), false)) + resp, err := keeper.AllServices(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.Service), step) require.Subset(t, @@ -109,7 +109,7 @@ func TestServiceQueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.ServiceAll(ctx, request(nil, 0, 0, true)) + resp, err := keeper.AllServices(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -118,7 +118,7 @@ func TestServiceQueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.ServiceAll(ctx, nil) + _, err := keeper.AllServices(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/service/keeper/service.go b/x/service/keeper/service.go index 38c5b9a96..fe060e9a7 100644 --- a/x/service/keeper/service.go +++ b/x/service/keeper/service.go @@ -16,9 +16,7 @@ func (k Keeper) SetService(ctx context.Context, service sharedtypes.Service) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) serviceBz := k.cdc.MustMarshal(&service) - store.Set(types.ServiceKey( - service.Id, - ), serviceBz) + store.Set(types.ServiceKey(service.Id), serviceBz) } // GetService returns a service from its index @@ -29,9 +27,7 @@ func (k Keeper) GetService( storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) - serviceBz := store.Get(types.ServiceKey( - serviceId, - )) + serviceBz := store.Get(types.ServiceKey(serviceId)) if serviceBz == nil { return service, false } @@ -47,9 +43,7 @@ func (k Keeper) RemoveService( ) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ServiceKeyPrefix)) - store.Delete(types.ServiceKey( - serviceId, - )) + store.Delete(types.ServiceKey(serviceId)) } // GetAllService returns all service diff --git a/x/service/keeper/service_test.go b/x/service/keeper/service_test.go index 231f8c151..d3a37f6e6 100644 --- a/x/service/keeper/service_test.go +++ b/x/service/keeper/service_test.go @@ -7,6 +7,7 @@ import ( "testing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" keepertest "github.com/pokt-network/poktroll/testutil/keeper" @@ -14,8 +15,6 @@ import ( "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - - "github.com/stretchr/testify/require" ) // Prevent strconv unused error @@ -25,7 +24,7 @@ func init() { cmd.InitSDKConfig() } -func createNService(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Service { +func createNServices(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Service { services := make([]sharedtypes.Service, n) for i := range services { services[i].Id = strconv.Itoa(i) @@ -43,11 +42,9 @@ func TestServiceModuleAddress(t *testing.T) { func TestServiceGet(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) - services := createNService(keeper, ctx, 10) + services := createNServices(keeper, ctx, 10) for _, service := range services { - foundService, found := keeper.GetService(ctx, - service.Id, - ) + foundService, found := keeper.GetService(ctx, service.Id) require.True(t, found) require.Equal(t, nullify.Fill(&service), @@ -57,21 +54,17 @@ func TestServiceGet(t *testing.T) { } func TestServiceRemove(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) - services := createNService(keeper, ctx, 10) + services := createNServices(keeper, ctx, 10) for _, service := range services { - keeper.RemoveService(ctx, - service.Id, - ) - _, found := keeper.GetService(ctx, - service.Id, - ) + keeper.RemoveService(ctx, service.Id) + _, found := keeper.GetService(ctx, service.Id) require.False(t, found) } } func TestServiceGetAll(t *testing.T) { keeper, ctx := keepertest.ServiceKeeper(t) - services := createNService(keeper, ctx, 10) + services := createNServices(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(services), nullify.Fill(keeper.GetAllService(ctx)), diff --git a/x/service/module/autocli.go b/x/service/module/autocli.go index cb9fa8e88..287cbbcbc 100644 --- a/x/service/module/autocli.go +++ b/x/service/module/autocli.go @@ -2,50 +2,51 @@ package service import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/service" ) // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ - // TODO_TECHDEBT(#370): Integrate with AutoCLI - // Query: &autocliv1.ServiceCommandDescriptor{ - // Service: modulev1.Query_ServiceDesc.ServiceName, - // RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - // { - // RpcMethod: "Params", - // Use: "params", - // Short: "Shows the parameters of the module", - // }, - // { - // RpcMethod: "ServiceAll", - // Use: "list-service", - // Short: "List all service", - // }, - // { - // RpcMethod: "Service", - // Use: "show-service [id]", - // Short: "Shows a service", - // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, - // }, - // // this line is used by ignite scaffolding # autocli/query - // }, - // }, - // Tx: &autocliv1.ServiceCommandDescriptor{ - // Service: modulev1.Msg_ServiceDesc.ServiceName, - // EnhanceCustomCommand: true, // only required if you want to use the custom command - // RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - // { - // RpcMethod: "UpdateParams", - // Skip: true, // skipped because authority gated - // }, - // { - // RpcMethod: "AddService", - // Use: "add-service", - // Short: "Send a add-service tx", - // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, - // }, - // // this line is used by ignite scaffolding # autocli/tx - // }, - // }, + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "AllServices", + // Use: "list-service", + // Short: "List all service", + // }, + // { + // RpcMethod: "Service", + // Use: "show-service [id]", + // Short: "Shows a service", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + // }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "AddService", + // Use: "add-service", + // Short: "Send a add-service tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + // }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, } } diff --git a/x/service/module/genesis.go b/x/service/module/genesis.go index d3bdb9acd..fded93481 100644 --- a/x/service/module/genesis.go +++ b/x/service/module/genesis.go @@ -1,24 +1,26 @@ package service import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // Set all the service for _, service := range genState.ServiceList { k.SetService(ctx, service) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) diff --git a/x/service/module/module.go b/x/service/module/module.go index 6a733dd22..e57949906 100644 --- a/x/service/module/module.go +++ b/x/service/module/module.go @@ -141,6 +141,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion is a sequence number for state-breaking change of the module. // It should be incremented on each consensus-breaking change introduced by the module. // To avoid wrong/empty versions, the initial version should be set to 1. +// TODO_TECHDEBT(#395): Make consensus version configurable func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block. @@ -166,10 +167,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/service/module/tx.go b/x/service/module/tx.go index ccbad12ed..48abdd9cc 100644 --- a/x/service/module/tx.go +++ b/x/service/module/tx.go @@ -2,7 +2,6 @@ package service import ( "fmt" - "time" "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" @@ -10,16 +9,8 @@ import ( "github.com/pokt-network/poktroll/x/service/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/service/module/tx_add_service.go b/x/service/module/tx_add_service.go index 5676fc440..48ed62ccb 100644 --- a/x/service/module/tx_add_service.go +++ b/x/service/module/tx_add_service.go @@ -18,11 +18,10 @@ func CmdAddService() *cobra.Command { Use: "add-service ", Short: "Add a new service to the network", Long: `Add a new service to the network that will be available for applications, -gateways and suppliers to use. The service id MUST be unique - or the command -will fail, however the name you use to describe it does not have to be unique. +gateways and suppliers to use. The service id MUST be unique but the service name doesn't have to be. Example: -$ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { serviceIdStr := args[0] diff --git a/x/service/module/tx_add_service_test.go b/x/service/module/tx_add_service_test.go index 9a1bc3ace..bd2b2131f 100644 --- a/x/service/module/tx_add_service_test.go +++ b/x/service/module/tx_add_service_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -39,7 +39,7 @@ func TestCLI_AddService(t *testing.T) { fmt.Sprintf( "--%s=%s", flags.FlagFees, - sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String(), ), } @@ -74,7 +74,7 @@ func TestCLI_AddService(t *testing.T) { desc string supplierAddress string service sharedtypes.Service - err *sdkerrors.Error + expectedErr *sdkerrors.Error }{ { desc: "valid - add new service", @@ -85,39 +85,39 @@ func TestCLI_AddService(t *testing.T) { desc: "invalid - missing service id", supplierAddress: account.Address.String(), service: sharedtypes.Service{Name: "service name"}, // ID intentionally omitted - err: types.ErrServiceMissingID, + expectedErr: types.ErrServiceMissingID, }, { desc: "invalid - missing service name", supplierAddress: account.Address.String(), service: sharedtypes.Service{Id: "svc1"}, // Name intentionally omitted - err: types.ErrServiceMissingName, + expectedErr: types.ErrServiceMissingName, }, { desc: "invalid - invalid supplier address", supplierAddress: "invalid address", service: svc1, - err: types.ErrServiceInvalidAddress, + expectedErr: types.ErrServiceInvalidAddress, }, { desc: "invalid - service already staked", supplierAddress: account.Address.String(), service: svc2, - err: types.ErrServiceAlreadyExists, + expectedErr: types.ErrServiceAlreadyExists, }, } // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - tt.service.Id, - tt.service.Name, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.supplierAddress), + test.service.Id, + test.service.Name, + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.supplierAddress), } args = append(args, commonArgs...) @@ -125,10 +125,10 @@ func TestCLI_AddService(t *testing.T) { addServiceOutput, err := clitestutil.ExecTestCLICmd(ctx, service.CmdAddService(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/service/simulation/add_service.go b/x/service/simulation/add_service.go index 4872ab877..d7647d639 100644 --- a/x/service/simulation/add_service.go +++ b/x/service/simulation/add_service.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" ) diff --git a/x/service/types/errors.go b/x/service/types/errors.go index 4a8ad050e..cd4ea82b6 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -2,20 +2,18 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/service module sentinel errors var ( - ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1, "duplicate index when adding a new service") - ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address when adding a new service") - ErrServiceMissingID = sdkerrors.Register(ModuleName, 3, "missing service ID") - ErrServiceMissingName = sdkerrors.Register(ModuleName, 4, "missing service name") - ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 5, "service already exists") - ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 6, "invalid service fee") - ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found") - ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 8, "not enough funds to add service") - ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 9, "failed to deduct fee") - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrServiceInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrServiceDuplicateIndex = sdkerrors.Register(ModuleName, 1101, "duplicate index when adding a new service") + ErrServiceInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid address when adding a new service") + ErrServiceMissingID = sdkerrors.Register(ModuleName, 1103, "missing service ID") + ErrServiceMissingName = sdkerrors.Register(ModuleName, 1104, "missing service name") + ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 1105, "service already exists") + ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 1106, "invalid service fee") + ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 1107, "account not found") + ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 1108, "not enough funds to add service") + ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 1109, "failed to deduct fee") ) diff --git a/x/service/types/expected_keepers.go b/x/service/types/expected_keepers.go index 5f5c88175..ca6a8da01 100644 --- a/x/service/types/expected_keepers.go +++ b/x/service/types/expected_keepers.go @@ -1,4 +1,5 @@ //go:generate mockgen -destination ../../../testutil/service/mocks/expected_keepers_mock.go -package mocks . BankKeeper + package types import ( @@ -25,9 +26,3 @@ type BankKeeper interface { amt sdk.Coins, ) error } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/service/types/genesis.go b/x/service/types/genesis.go index 06cc3f252..4c324a41f 100644 --- a/x/service/types/genesis.go +++ b/x/service/types/genesis.go @@ -1,11 +1,6 @@ package types -import ( - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 +import sharedtypes "github.com/pokt-network/poktroll/x/shared/types" // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { @@ -20,19 +15,19 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in services - serviceIDIndexMap := make(map[string]struct{}) - serviceNameIndexMap := make(map[string]struct{}) + serviceIDMap := make(map[string]struct{}) + serviceNameMap := make(map[string]struct{}) for _, service := range gs.ServiceList { - idIndex := string(ServiceKey(service.Id)) - if _, ok := serviceIDIndexMap[idIndex]; ok { + serviceID := string(ServiceKey(service.Id)) + if _, ok := serviceIDMap[serviceID]; ok { return ErrServiceDuplicateIndex.Wrapf("duplicated ID for service: %v", service) } - serviceIDIndexMap[idIndex] = struct{}{} - nameIndex := string(ServiceKey(service.Name)) - if _, ok := serviceNameIndexMap[nameIndex]; ok { + serviceIDMap[serviceID] = struct{}{} + serviceName := string(ServiceKey(service.Name)) + if _, ok := serviceNameMap[serviceName]; ok { return ErrServiceDuplicateIndex.Wrapf("duplicated name for service: %v", service) } - serviceNameIndexMap[nameIndex] = struct{}{} + serviceNameMap[serviceName] = struct{}{} } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index 149d004e8..d6abdd42d 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -3,10 +3,10 @@ package types_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - - "github.com/stretchr/testify/require" ) func TestGenesisState_Validate(t *testing.T) { @@ -22,18 +22,18 @@ func TestGenesisState_Validate(t *testing.T) { svc3 := &sharedtypes.Service{ Id: "svcId3", - Name: "svcName1", + Name: svc1.Name, } tests := []struct { - desc string - genState *types.GenesisState - expectedError error + desc string + genState *types.GenesisState + expectedErr error }{ { - desc: "default is valid", - genState: types.DefaultGenesis(), - expectedError: nil, + desc: "default is valid", + genState: types.DefaultGenesis(), + expectedErr: nil, }, { desc: "valid genesis state", @@ -44,7 +44,7 @@ func TestGenesisState_Validate(t *testing.T) { }, // this line is used by starport scaffolding # types/genesis/validField }, - expectedError: nil, + expectedErr: nil, }, { desc: "invalid - duplicate service ID", @@ -54,7 +54,7 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc1, }, }, - expectedError: types.ErrServiceDuplicateIndex, + expectedErr: types.ErrServiceDuplicateIndex, }, { desc: "invalid - duplicate service name", @@ -64,7 +64,7 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc3, }, }, - expectedError: types.ErrServiceDuplicateIndex, + expectedErr: types.ErrServiceDuplicateIndex, }, { desc: "invalid - invalid add service fee parameter (below minimum)", @@ -76,18 +76,18 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc2, }, }, - expectedError: types.ErrServiceInvalidServiceFee, + expectedErr: types.ErrServiceInvalidServiceFee, }, // this line is used by starport scaffolding # types/genesis/testcase } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.expectedError == nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.expectedErr == nil { require.NoError(t, err) } else { - require.ErrorIs(t, err, tc.expectedError) + require.ErrorIs(t, err, test.expectedErr) } }) } diff --git a/x/service/types/key_service.go b/x/service/types/key_service.go index cf6a10a79..168955896 100644 --- a/x/service/types/key_service.go +++ b/x/service/types/key_service.go @@ -6,7 +6,7 @@ var _ binary.ByteOrder const ( // ServiceKeyPrefix is the prefix to retrieve all Service - ServiceKeyPrefix = "Service/value/" + ServiceKeyPrefix = "Service/id/" ) // ServiceKey returns the store key to retrieve a Service from the index fields diff --git a/x/service/types/keys.go b/x/service/types/keys.go index 24ab75ebb..0025cbba8 100644 --- a/x/service/types/keys.go +++ b/x/service/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_service" ) -var ( - ParamsKey = []byte("p_service") -) +var ParamsKey = []byte("p_service") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/service/types/message_add_service.go b/x/service/types/message_add_service.go index efd2d2f9f..eaed93489 100644 --- a/x/service/types/message_add_service.go +++ b/x/service/types/message_add_service.go @@ -21,9 +21,7 @@ func NewMsgAddService(address, serviceId, serviceName string) *MsgAddService { // ValidateBasic performs basic validation of the message and its fields func (msg *MsgAddService) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { - return ErrServiceInvalidAddress.Wrapf( - "invalid supplier address %s; (%v)", msg.Address, err, - ) + return ErrServiceInvalidAddress.Wrapf("invalid supplier address %s; (%v)", msg.Address, err) } // TODO_TECHDEBT: Add a validate basic function to the `Service` object if msg.Service.Id == "" { diff --git a/x/service/types/message_add_service_test.go b/x/service/types/message_add_service_test.go index 6a44da578..05fd283c1 100644 --- a/x/service/types/message_add_service_test.go +++ b/x/service/types/message_add_service_test.go @@ -3,10 +3,10 @@ package types import ( "testing" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - - "github.com/stretchr/testify/require" ) func TestMsgAddService_ValidateBasic(t *testing.T) { @@ -45,11 +45,11 @@ func TestMsgAddService_ValidateBasic(t *testing.T) { expectedErr: nil, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/service/types/msg_update_params.go b/x/service/types/message_update_params.go similarity index 100% rename from x/service/types/msg_update_params.go rename to x/service/types/message_update_params.go diff --git a/x/service/types/params.go b/x/service/types/params.go index 90201e142..fd0b612ad 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -12,9 +12,9 @@ import ( // TODO_BLOCKER: Revisit default param values for service fee const DefaultAddServiceFee = 1000000000 // 1000 POKT -var _ paramtypes.ParamSet = (*Params)(nil) - var ( + _ paramtypes.ParamSet = (*Params)(nil) + KeyAddServiceFee = []byte("AddServiceFee") ) @@ -24,9 +24,7 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams( - addServiceFee uint64, -) Params { +func NewParams(addServiceFee uint64) Params { return Params{ AddServiceFee: addServiceFee, } diff --git a/x/service/types/types.go b/x/service/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/service/types/types.go +++ b/x/service/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs diff --git a/x/shared/helpers/service_test.go b/x/shared/helpers/service_test.go index e3dcf57d6..c917c4d4a 100644 --- a/x/shared/helpers/service_test.go +++ b/x/shared/helpers/service_test.go @@ -73,59 +73,59 @@ func TestIsValidService(t *testing.T) { Id: test.serviceId, Name: test.serviceName, } - result := IsValidService(service) - require.Equal(t, test.expectedIsValid, result) + isValid := IsValidService(service) + require.Equal(t, test.expectedIsValid, isValid) }) } } func TestIsValidServiceName(t *testing.T) { tests := []struct { - desc string - input string - expected bool + desc string + serviceName string + expectedIsValid bool }{ { - desc: "Valid with hyphen and number", - input: "ValidName-1", - expected: true, + desc: "Valid with hyphen and number", + serviceName: "ValidName-1", + expectedIsValid: true, }, { - desc: "Valid with space and underscore", - input: "Valid Name_1", - expected: true, + desc: "Valid with space and underscore", + serviceName: "Valid Name_1", + expectedIsValid: true, }, { - desc: "Valid name with spaces", - input: "valid name with spaces", - expected: true, + desc: "Valid name with spaces", + serviceName: "valid name with spaces", + expectedIsValid: true, }, { - desc: "Invalid character '@'", - input: "invalid@name", - expected: false, + desc: "Invalid character '@'", + serviceName: "invalid@name", + expectedIsValid: false, }, { - desc: "Invalid character '.'", - input: "Valid.Name", - expected: false, + desc: "Invalid character '.'", + serviceName: "Valid.Name", + expectedIsValid: false, }, { - desc: "Empty string", - input: "", - expected: true, + desc: "Empty string", + serviceName: "", + expectedIsValid: true, }, { - desc: "Exceeds maximum length", - input: "validnamebuttoolongvalidnamebuttoolongvalidnamebuttoolong", - expected: false, + desc: "Exceeds maximum length", + serviceName: "validnamebuttoolongvalidnamebuttoolongvalidnamebuttoolong", + expectedIsValid: false, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { - result := IsValidServiceName(test.input) - require.Equal(t, test.expected, result) + isValid := IsValidServiceName(test.serviceName) + require.Equal(t, test.expectedIsValid, isValid) }) } } @@ -134,69 +134,69 @@ func TestIsValidServiceId(t *testing.T) { tests := []struct { desc string - input string - expected bool + serviceId string + expectedIsValid bool }{ { desc: "Valid alphanumeric with hyphen", - input: "Hello-1", - expected: true, + serviceId: "Hello-1", + expectedIsValid: true, }, { desc: "Valid alphanumeric with underscore", - input: "Hello_2", - expected: true, + serviceId: "Hello_2", + expectedIsValid: true, }, { desc: "Exceeds maximum length", - input: "hello-world", - expected: false, // exceeds maxServiceIdLength + serviceId: "hello-world", + expectedIsValid: false, // exceeds maxServiceIdLength }, { desc: "Contains invalid character '@'", - input: "Hello@", - expected: false, // contains invalid character '@' + serviceId: "Hello@", + expectedIsValid: false, // contains invalid character '@' }, { desc: "All uppercase", - input: "HELLO", - expected: true, + serviceId: "HELLO", + expectedIsValid: true, }, { desc: "Maximum length boundary", - input: "12345678", - expected: true, // exactly maxServiceIdLength + serviceId: "12345678", + expectedIsValid: true, // exactly maxServiceIdLength }, { desc: "Above maximum length boundary", - input: "123456789", - expected: false, // exceeds maxServiceIdLength + serviceId: "123456789", + expectedIsValid: false, // exceeds maxServiceIdLength }, { desc: "Contains invalid character '.'", - input: "Hello.World", - expected: false, // contains invalid character '.' + serviceId: "Hello.World", + expectedIsValid: false, // contains invalid character '.' }, { desc: "Empty string", - input: "", - expected: false, // empty string + serviceId: "", + expectedIsValid: false, // empty string }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { - result := IsValidServiceId(test.input) - require.Equal(t, test.expected, result) + isValid := IsValidServiceId(test.serviceId) + require.Equal(t, test.expectedIsValid, isValid) }) } } @@ -205,57 +205,57 @@ func TestIsValidEndpointUrl(t *testing.T) { tests := []struct { desc string - input string - expected bool + endpointURL string + expectedIsValid bool }{ { desc: "valid http URL", - input: "http://example.com", - expected: true, + endpointURL: "http://example.com", + expectedIsValid: true, }, { desc: "valid https URL", - input: "https://example.com/path?query=value#fragment", - expected: true, + endpointURL: "https://example.com/path?query=value#fragment", + expectedIsValid: true, }, { desc: "valid localhost URL with scheme", - input: "https://localhost:8081", - expected: true, + endpointURL: "https://localhost:8081", + expectedIsValid: true, }, { desc: "valid loopback URL with scheme", - input: "http://127.0.0.1:8081", - expected: true, + endpointURL: "http://127.0.0.1:8081", + expectedIsValid: true, }, { desc: "invalid scheme", - input: "ftp://example.com", - expected: false, + endpointURL: "ftp://example.com", + expectedIsValid: false, }, { desc: "missing scheme", - input: "example.com", - expected: false, + endpointURL: "example.com", + expectedIsValid: false, }, { desc: "invalid URL", - input: "not-a-valid-url", - expected: false, + endpointURL: "not-a-valid-url", + expectedIsValid: false, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - got := IsValidEndpointUrl(tt.input) - require.Equal(t, tt.expected, got) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + isValid := IsValidEndpointUrl(test.endpointURL) + require.Equal(t, test.expectedIsValid, isValid) }) } } From 275387adfeffa81c2b257bbbab5aa62b2ccf3251 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 21 Feb 2024 14:50:38 +0100 Subject: [PATCH 40/54] chore: application module review improvements --- api/poktroll/application/event.pulsar.go | 47 +- api/poktroll/application/query.pulsar.go | 535 +++++++++--------- api/poktroll/application/tx.pulsar.go | 1 + proto/poktroll/application/application.proto | 1 + proto/poktroll/application/event.proto | 6 +- proto/poktroll/application/genesis.proto | 10 +- proto/poktroll/application/params.proto | 4 +- proto/poktroll/application/query.proto | 17 +- proto/poktroll/application/tx.proto | 14 +- testutil/keeper/application.go | 12 +- x/application/keeper/application.go | 35 +- x/application/keeper/application_test.go | 27 +- x/application/keeper/msg_server.go | 4 +- .../keeper/msg_server_delegate_to_gateway.go | 17 +- .../msg_server_delegate_to_gateway_test.go | 31 +- .../keeper/msg_server_stake_application.go | 37 +- .../msg_server_stake_application_test.go | 74 +-- x/application/keeper/msg_server_test.go | 4 + .../msg_server_undelegate_from_gateway.go | 26 +- ...msg_server_undelegate_from_gateway_test.go | 41 +- .../keeper/msg_server_unstake_application.go | 12 +- .../msg_server_unstake_application_test.go | 26 +- x/application/keeper/msg_update_params.go | 8 +- .../keeper/msg_update_params_test.go | 36 +- x/application/keeper/params.go | 10 +- x/application/keeper/query.go | 4 +- x/application/keeper/query_application.go | 15 +- .../keeper/query_application_test.go | 64 +-- x/application/keeper/query_params.go | 4 +- x/application/module/autocli.go | 160 +++--- .../config/application_configs_reader_test.go | 42 +- x/application/module/config/errors.go | 15 +- x/application/module/genesis.go | 12 +- x/application/module/genesis_test.go | 414 +------------- x/application/module/helpers_test.go | 6 - x/application/module/module.go | 5 +- x/application/module/query.go | 3 +- x/application/module/query_application.go | 4 +- .../module/query_application_test.go | 64 +-- x/application/module/tx.go | 6 +- .../module/tx_delegate_to_gateway_test.go | 32 +- .../module/tx_stake_application_test.go | 90 +-- .../module/tx_undelegate_from_gateway_test.go | 32 +- .../module/tx_unstake_application.go | 2 +- .../module/tx_unstake_application_test.go | 40 +- x/application/simulation/stake_application.go | 1 + x/application/types/errors.go | 27 +- x/application/types/expected_keepers.go | 10 +- x/application/types/genesis.go | 26 +- x/application/types/genesis_test.go | 409 +++++++++++++ x/application/types/key_application.go | 10 +- x/application/types/keys.go | 8 +- .../types/message_delegate_to_gateway.go | 9 +- .../types/message_delegate_to_gateway_test.go | 34 +- .../types/message_stake_application.go | 19 +- .../types/message_stake_application_test.go | 94 +-- .../types/message_undelegate_from_gateway.go | 9 +- .../message_undelegate_from_gateway_test.go | 34 +- .../types/message_unstake_application.go | 10 +- .../types/message_unstake_application_test.go | 28 +- ...ate_params.go => message_update_params.go} | 0 x/application/types/params.go | 15 +- 62 files changed, 1409 insertions(+), 1383 deletions(-) create mode 100644 x/application/types/genesis_test.go rename x/application/types/{msg_update_params.go => message_update_params.go} (100%) diff --git a/api/poktroll/application/event.pulsar.go b/api/poktroll/application/event.pulsar.go index 9a53ee35e..755da9625 100644 --- a/api/poktroll/application/event.pulsar.go +++ b/api/poktroll/application/event.pulsar.go @@ -519,6 +519,7 @@ type EventRedelegation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // TODO: Check if this tag is relevant for events: (gogoproto.jsontag) = "app_address" AppAddress string `protobuf:"bytes,1,opt,name=app_address,json=appAddress,proto3" json:"app_address,omitempty"` // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding GatewayAddress string `protobuf:"bytes,2,opt,name=gateway_address,json=gatewayAddress,proto3" json:"gateway_address,omitempty"` // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding } @@ -566,31 +567,29 @@ var file_poktroll_application_event_proto_rawDesc = []byte{ 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x11, 0x45, 0x76, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x01, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x48, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xea, 0xde, 0x1f, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0a, 0x61, - 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x54, 0x0a, 0x0f, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x2b, 0xea, 0xde, 0x1f, 0x0f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x0e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, - 0xbe, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, - 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x39, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0a, + 0x61, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0xbe, 0x01, + 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, + 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/application/query.pulsar.go b/api/poktroll/application/query.pulsar.go index 8447e3de9..b1f59e350 100644 --- a/api/poktroll/application/query.pulsar.go +++ b/api/poktroll/application/query.pulsar.go @@ -1665,25 +1665,25 @@ func (x *fastReflection_QueryGetApplicationResponse) ProtoMethods() *protoiface. } var ( - md_QueryAllApplicationRequest protoreflect.MessageDescriptor - fd_QueryAllApplicationRequest_pagination protoreflect.FieldDescriptor + md_QueryAllApplicationsRequest protoreflect.MessageDescriptor + fd_QueryAllApplicationsRequest_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_application_query_proto_init() - md_QueryAllApplicationRequest = File_poktroll_application_query_proto.Messages().ByName("QueryAllApplicationRequest") - fd_QueryAllApplicationRequest_pagination = md_QueryAllApplicationRequest.Fields().ByName("pagination") + md_QueryAllApplicationsRequest = File_poktroll_application_query_proto.Messages().ByName("QueryAllApplicationsRequest") + fd_QueryAllApplicationsRequest_pagination = md_QueryAllApplicationsRequest.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllApplicationRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllApplicationsRequest)(nil) -type fastReflection_QueryAllApplicationRequest QueryAllApplicationRequest +type fastReflection_QueryAllApplicationsRequest QueryAllApplicationsRequest -func (x *QueryAllApplicationRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllApplicationRequest)(x) +func (x *QueryAllApplicationsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllApplicationsRequest)(x) } -func (x *QueryAllApplicationRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryAllApplicationsRequest) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_application_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1695,43 +1695,43 @@ func (x *QueryAllApplicationRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllApplicationRequest_messageType fastReflection_QueryAllApplicationRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllApplicationRequest_messageType{} +var _fastReflection_QueryAllApplicationsRequest_messageType fastReflection_QueryAllApplicationsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllApplicationsRequest_messageType{} -type fastReflection_QueryAllApplicationRequest_messageType struct{} +type fastReflection_QueryAllApplicationsRequest_messageType struct{} -func (x fastReflection_QueryAllApplicationRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllApplicationRequest)(nil) +func (x fastReflection_QueryAllApplicationsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllApplicationsRequest)(nil) } -func (x fastReflection_QueryAllApplicationRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllApplicationRequest) +func (x fastReflection_QueryAllApplicationsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationsRequest) } -func (x fastReflection_QueryAllApplicationRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllApplicationRequest +func (x fastReflection_QueryAllApplicationsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationsRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllApplicationRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllApplicationRequest +func (x *fastReflection_QueryAllApplicationsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationsRequest } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllApplicationRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryAllApplicationRequest_messageType +func (x *fastReflection_QueryAllApplicationsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllApplicationsRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllApplicationRequest) New() protoreflect.Message { - return new(fastReflection_QueryAllApplicationRequest) +func (x *fastReflection_QueryAllApplicationsRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationsRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllApplicationRequest) Interface() protoreflect.ProtoMessage { - return (*QueryAllApplicationRequest)(x) +func (x *fastReflection_QueryAllApplicationsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllApplicationsRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1739,10 +1739,10 @@ func (x *fastReflection_QueryAllApplicationRequest) Interface() protoreflect.Pro // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllApplicationRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllApplicationsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllApplicationRequest_pagination, value) { + if !f(fd_QueryAllApplicationsRequest_pagination, value) { return } } @@ -1759,15 +1759,15 @@ func (x *fastReflection_QueryAllApplicationRequest) Range(f func(protoreflect.Fi // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllApplicationRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllApplicationsRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.QueryAllApplicationRequest.pagination": + case "poktroll.QueryAllApplicationsRequest.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsRequest")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsRequest does not contain field %s", fd.FullName())) } } @@ -1777,15 +1777,15 @@ func (x *fastReflection_QueryAllApplicationRequest) Has(fd protoreflect.FieldDes // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllApplicationsRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.QueryAllApplicationRequest.pagination": + case "poktroll.QueryAllApplicationsRequest.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsRequest")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsRequest does not contain field %s", fd.FullName())) } } @@ -1795,16 +1795,16 @@ func (x *fastReflection_QueryAllApplicationRequest) Clear(fd protoreflect.FieldD // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllApplicationRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllApplicationsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.QueryAllApplicationRequest.pagination": + case "poktroll.QueryAllApplicationsRequest.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsRequest")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsRequest does not contain field %s", descriptor.FullName())) } } @@ -1818,15 +1818,15 @@ func (x *fastReflection_QueryAllApplicationRequest) Get(descriptor protoreflect. // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllApplicationsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.QueryAllApplicationRequest.pagination": + case "poktroll.QueryAllApplicationsRequest.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsRequest")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsRequest does not contain field %s", fd.FullName())) } } @@ -1840,44 +1840,44 @@ func (x *fastReflection_QueryAllApplicationRequest) Set(fd protoreflect.FieldDes // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllApplicationsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.QueryAllApplicationRequest.pagination": + case "poktroll.QueryAllApplicationsRequest.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageRequest) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsRequest")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsRequest does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllApplicationRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllApplicationsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.QueryAllApplicationRequest.pagination": + case "poktroll.QueryAllApplicationsRequest.pagination": m := new(v1beta1.PageRequest) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsRequest")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsRequest does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllApplicationRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllApplicationsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryAllApplicationRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryAllApplicationsRequest", d.FullName())) } panic("unreachable") } @@ -1885,7 +1885,7 @@ func (x *fastReflection_QueryAllApplicationRequest) WhichOneof(d protoreflect.On // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllApplicationRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllApplicationsRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1896,7 +1896,7 @@ func (x *fastReflection_QueryAllApplicationRequest) GetUnknown() protoreflect.Ra // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllApplicationsRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1908,7 +1908,7 @@ func (x *fastReflection_QueryAllApplicationRequest) SetUnknown(fields protorefle // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllApplicationRequest) IsValid() bool { +func (x *fastReflection_QueryAllApplicationsRequest) IsValid() bool { return x != nil } @@ -1918,9 +1918,9 @@ func (x *fastReflection_QueryAllApplicationRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllApplicationRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllApplicationsRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllApplicationRequest) + x := input.Message.Interface().(*QueryAllApplicationsRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1946,7 +1946,7 @@ func (x *fastReflection_QueryAllApplicationRequest) ProtoMethods() *protoiface.M } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllApplicationRequest) + x := input.Message.Interface().(*QueryAllApplicationsRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1990,7 +1990,7 @@ func (x *fastReflection_QueryAllApplicationRequest) ProtoMethods() *protoiface.M }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllApplicationRequest) + x := input.Message.Interface().(*QueryAllApplicationsRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2022,10 +2022,10 @@ func (x *fastReflection_QueryAllApplicationRequest) ProtoMethods() *protoiface.M fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2099,79 +2099,79 @@ func (x *fastReflection_QueryAllApplicationRequest) ProtoMethods() *protoiface.M } } -var _ protoreflect.List = (*_QueryAllApplicationResponse_1_list)(nil) +var _ protoreflect.List = (*_QueryAllApplicationsResponse_1_list)(nil) -type _QueryAllApplicationResponse_1_list struct { +type _QueryAllApplicationsResponse_1_list struct { list *[]*Application } -func (x *_QueryAllApplicationResponse_1_list) Len() int { +func (x *_QueryAllApplicationsResponse_1_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_QueryAllApplicationResponse_1_list) Get(i int) protoreflect.Value { +func (x *_QueryAllApplicationsResponse_1_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_QueryAllApplicationResponse_1_list) Set(i int, value protoreflect.Value) { +func (x *_QueryAllApplicationsResponse_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*Application) (*x.list)[i] = concreteValue } -func (x *_QueryAllApplicationResponse_1_list) Append(value protoreflect.Value) { +func (x *_QueryAllApplicationsResponse_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*Application) *x.list = append(*x.list, concreteValue) } -func (x *_QueryAllApplicationResponse_1_list) AppendMutable() protoreflect.Value { +func (x *_QueryAllApplicationsResponse_1_list) AppendMutable() protoreflect.Value { v := new(Application) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllApplicationResponse_1_list) Truncate(n int) { +func (x *_QueryAllApplicationsResponse_1_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_QueryAllApplicationResponse_1_list) NewElement() protoreflect.Value { +func (x *_QueryAllApplicationsResponse_1_list) NewElement() protoreflect.Value { v := new(Application) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllApplicationResponse_1_list) IsValid() bool { +func (x *_QueryAllApplicationsResponse_1_list) IsValid() bool { return x.list != nil } var ( - md_QueryAllApplicationResponse protoreflect.MessageDescriptor - fd_QueryAllApplicationResponse_application protoreflect.FieldDescriptor - fd_QueryAllApplicationResponse_pagination protoreflect.FieldDescriptor + md_QueryAllApplicationsResponse protoreflect.MessageDescriptor + fd_QueryAllApplicationsResponse_applications protoreflect.FieldDescriptor + fd_QueryAllApplicationsResponse_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_application_query_proto_init() - md_QueryAllApplicationResponse = File_poktroll_application_query_proto.Messages().ByName("QueryAllApplicationResponse") - fd_QueryAllApplicationResponse_application = md_QueryAllApplicationResponse.Fields().ByName("application") - fd_QueryAllApplicationResponse_pagination = md_QueryAllApplicationResponse.Fields().ByName("pagination") + md_QueryAllApplicationsResponse = File_poktroll_application_query_proto.Messages().ByName("QueryAllApplicationsResponse") + fd_QueryAllApplicationsResponse_applications = md_QueryAllApplicationsResponse.Fields().ByName("applications") + fd_QueryAllApplicationsResponse_pagination = md_QueryAllApplicationsResponse.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllApplicationResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllApplicationsResponse)(nil) -type fastReflection_QueryAllApplicationResponse QueryAllApplicationResponse +type fastReflection_QueryAllApplicationsResponse QueryAllApplicationsResponse -func (x *QueryAllApplicationResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllApplicationResponse)(x) +func (x *QueryAllApplicationsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllApplicationsResponse)(x) } -func (x *QueryAllApplicationResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryAllApplicationsResponse) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_application_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2183,43 +2183,43 @@ func (x *QueryAllApplicationResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllApplicationResponse_messageType fastReflection_QueryAllApplicationResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllApplicationResponse_messageType{} +var _fastReflection_QueryAllApplicationsResponse_messageType fastReflection_QueryAllApplicationsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllApplicationsResponse_messageType{} -type fastReflection_QueryAllApplicationResponse_messageType struct{} +type fastReflection_QueryAllApplicationsResponse_messageType struct{} -func (x fastReflection_QueryAllApplicationResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllApplicationResponse)(nil) +func (x fastReflection_QueryAllApplicationsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllApplicationsResponse)(nil) } -func (x fastReflection_QueryAllApplicationResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllApplicationResponse) +func (x fastReflection_QueryAllApplicationsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationsResponse) } -func (x fastReflection_QueryAllApplicationResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllApplicationResponse +func (x fastReflection_QueryAllApplicationsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationsResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllApplicationResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllApplicationResponse +func (x *fastReflection_QueryAllApplicationsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllApplicationsResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryAllApplicationResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryAllApplicationResponse_messageType +func (x *fastReflection_QueryAllApplicationsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllApplicationsResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllApplicationResponse) New() protoreflect.Message { - return new(fastReflection_QueryAllApplicationResponse) +func (x *fastReflection_QueryAllApplicationsResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllApplicationsResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllApplicationResponse) Interface() protoreflect.ProtoMessage { - return (*QueryAllApplicationResponse)(x) +func (x *fastReflection_QueryAllApplicationsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllApplicationsResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2227,16 +2227,16 @@ func (x *fastReflection_QueryAllApplicationResponse) Interface() protoreflect.Pr // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllApplicationResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Application) != 0 { - value := protoreflect.ValueOfList(&_QueryAllApplicationResponse_1_list{list: &x.Application}) - if !f(fd_QueryAllApplicationResponse_application, value) { +func (x *fastReflection_QueryAllApplicationsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Applications) != 0 { + value := protoreflect.ValueOfList(&_QueryAllApplicationsResponse_1_list{list: &x.Applications}) + if !f(fd_QueryAllApplicationsResponse_applications, value) { return } } if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllApplicationResponse_pagination, value) { + if !f(fd_QueryAllApplicationsResponse_pagination, value) { return } } @@ -2253,17 +2253,17 @@ func (x *fastReflection_QueryAllApplicationResponse) Range(f func(protoreflect.F // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllApplicationResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllApplicationsResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.QueryAllApplicationResponse.application": - return len(x.Application) != 0 - case "poktroll.QueryAllApplicationResponse.pagination": + case "poktroll.QueryAllApplicationsResponse.applications": + return len(x.Applications) != 0 + case "poktroll.QueryAllApplicationsResponse.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsResponse")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsResponse does not contain field %s", fd.FullName())) } } @@ -2273,17 +2273,17 @@ func (x *fastReflection_QueryAllApplicationResponse) Has(fd protoreflect.FieldDe // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllApplicationsResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.QueryAllApplicationResponse.application": - x.Application = nil - case "poktroll.QueryAllApplicationResponse.pagination": + case "poktroll.QueryAllApplicationsResponse.applications": + x.Applications = nil + case "poktroll.QueryAllApplicationsResponse.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsResponse")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsResponse does not contain field %s", fd.FullName())) } } @@ -2293,22 +2293,22 @@ func (x *fastReflection_QueryAllApplicationResponse) Clear(fd protoreflect.Field // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllApplicationResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllApplicationsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.QueryAllApplicationResponse.application": - if len(x.Application) == 0 { - return protoreflect.ValueOfList(&_QueryAllApplicationResponse_1_list{}) + case "poktroll.QueryAllApplicationsResponse.applications": + if len(x.Applications) == 0 { + return protoreflect.ValueOfList(&_QueryAllApplicationsResponse_1_list{}) } - listValue := &_QueryAllApplicationResponse_1_list{list: &x.Application} + listValue := &_QueryAllApplicationsResponse_1_list{list: &x.Applications} return protoreflect.ValueOfList(listValue) - case "poktroll.QueryAllApplicationResponse.pagination": + case "poktroll.QueryAllApplicationsResponse.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsResponse")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsResponse does not contain field %s", descriptor.FullName())) } } @@ -2322,19 +2322,19 @@ func (x *fastReflection_QueryAllApplicationResponse) Get(descriptor protoreflect // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllApplicationsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.QueryAllApplicationResponse.application": + case "poktroll.QueryAllApplicationsResponse.applications": lv := value.List() - clv := lv.(*_QueryAllApplicationResponse_1_list) - x.Application = *clv.list - case "poktroll.QueryAllApplicationResponse.pagination": + clv := lv.(*_QueryAllApplicationsResponse_1_list) + x.Applications = *clv.list + case "poktroll.QueryAllApplicationsResponse.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsResponse")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsResponse does not contain field %s", fd.FullName())) } } @@ -2348,53 +2348,53 @@ func (x *fastReflection_QueryAllApplicationResponse) Set(fd protoreflect.FieldDe // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllApplicationsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.QueryAllApplicationResponse.application": - if x.Application == nil { - x.Application = []*Application{} + case "poktroll.QueryAllApplicationsResponse.applications": + if x.Applications == nil { + x.Applications = []*Application{} } - value := &_QueryAllApplicationResponse_1_list{list: &x.Application} + value := &_QueryAllApplicationsResponse_1_list{list: &x.Applications} return protoreflect.ValueOfList(value) - case "poktroll.QueryAllApplicationResponse.pagination": + case "poktroll.QueryAllApplicationsResponse.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageResponse) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsResponse")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryAllApplicationResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllApplicationsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.QueryAllApplicationResponse.application": + case "poktroll.QueryAllApplicationsResponse.applications": list := []*Application{} - return protoreflect.ValueOfList(&_QueryAllApplicationResponse_1_list{list: &list}) - case "poktroll.QueryAllApplicationResponse.pagination": + return protoreflect.ValueOfList(&_QueryAllApplicationsResponse_1_list{list: &list}) + case "poktroll.QueryAllApplicationsResponse.pagination": m := new(v1beta1.PageResponse) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.QueryAllApplicationsResponse")) } - panic(fmt.Errorf("message poktroll.QueryAllApplicationResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.QueryAllApplicationsResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryAllApplicationResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllApplicationsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryAllApplicationResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.QueryAllApplicationsResponse", d.FullName())) } panic("unreachable") } @@ -2402,7 +2402,7 @@ func (x *fastReflection_QueryAllApplicationResponse) WhichOneof(d protoreflect.O // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllApplicationResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllApplicationsResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2413,7 +2413,7 @@ func (x *fastReflection_QueryAllApplicationResponse) GetUnknown() protoreflect.R // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllApplicationResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllApplicationsResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2425,7 +2425,7 @@ func (x *fastReflection_QueryAllApplicationResponse) SetUnknown(fields protorefl // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllApplicationResponse) IsValid() bool { +func (x *fastReflection_QueryAllApplicationsResponse) IsValid() bool { return x != nil } @@ -2435,9 +2435,9 @@ func (x *fastReflection_QueryAllApplicationResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllApplicationsResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllApplicationResponse) + x := input.Message.Interface().(*QueryAllApplicationsResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2449,8 +2449,8 @@ func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface. var n int var l int _ = l - if len(x.Application) > 0 { - for _, e := range x.Application { + if len(x.Applications) > 0 { + for _, e := range x.Applications { l = options.Size(e) n += 1 + l + runtime.Sov(uint64(l)) } @@ -2469,7 +2469,7 @@ func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface. } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllApplicationResponse) + x := input.Message.Interface().(*QueryAllApplicationsResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2502,9 +2502,9 @@ func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface. i-- dAtA[i] = 0x12 } - if len(x.Application) > 0 { - for iNdEx := len(x.Application) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Application[iNdEx]) + if len(x.Applications) > 0 { + for iNdEx := len(x.Applications) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Applications[iNdEx]) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2529,7 +2529,7 @@ func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface. }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllApplicationResponse) + x := input.Message.Interface().(*QueryAllApplicationsResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2561,15 +2561,15 @@ func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface. fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllApplicationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Application", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Applications", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2596,8 +2596,8 @@ func (x *fastReflection_QueryAllApplicationResponse) ProtoMethods() *protoiface. if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Application = append(x.Application, &Application{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Application[len(x.Application)-1]); err != nil { + x.Applications = append(x.Applications, &Application{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Applications[len(x.Applications)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2819,7 +2819,7 @@ func (x *QueryGetApplicationResponse) GetApplication() *Application { return nil } -type QueryAllApplicationRequest struct { +type QueryAllApplicationsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2827,8 +2827,8 @@ type QueryAllApplicationRequest struct { Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllApplicationRequest) Reset() { - *x = QueryAllApplicationRequest{} +func (x *QueryAllApplicationsRequest) Reset() { + *x = QueryAllApplicationsRequest{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_application_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2836,35 +2836,35 @@ func (x *QueryAllApplicationRequest) Reset() { } } -func (x *QueryAllApplicationRequest) String() string { +func (x *QueryAllApplicationsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllApplicationRequest) ProtoMessage() {} +func (*QueryAllApplicationsRequest) ProtoMessage() {} -// Deprecated: Use QueryAllApplicationRequest.ProtoReflect.Descriptor instead. -func (*QueryAllApplicationRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllApplicationsRequest.ProtoReflect.Descriptor instead. +func (*QueryAllApplicationsRequest) Descriptor() ([]byte, []int) { return file_poktroll_application_query_proto_rawDescGZIP(), []int{4} } -func (x *QueryAllApplicationRequest) GetPagination() *v1beta1.PageRequest { +func (x *QueryAllApplicationsRequest) GetPagination() *v1beta1.PageRequest { if x != nil { return x.Pagination } return nil } -type QueryAllApplicationResponse struct { +type QueryAllApplicationsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Application []*Application `protobuf:"bytes,1,rep,name=application,proto3" json:"application,omitempty"` - Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + Applications []*Application `protobuf:"bytes,1,rep,name=applications,proto3" json:"applications,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllApplicationResponse) Reset() { - *x = QueryAllApplicationResponse{} +func (x *QueryAllApplicationsResponse) Reset() { + *x = QueryAllApplicationsResponse{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_application_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2872,25 +2872,25 @@ func (x *QueryAllApplicationResponse) Reset() { } } -func (x *QueryAllApplicationResponse) String() string { +func (x *QueryAllApplicationsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllApplicationResponse) ProtoMessage() {} +func (*QueryAllApplicationsResponse) ProtoMessage() {} -// Deprecated: Use QueryAllApplicationResponse.ProtoReflect.Descriptor instead. -func (*QueryAllApplicationResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllApplicationsResponse.ProtoReflect.Descriptor instead. +func (*QueryAllApplicationsResponse) Descriptor() ([]byte, []int) { return file_poktroll_application_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryAllApplicationResponse) GetApplication() []*Application { +func (x *QueryAllApplicationsResponse) GetApplications() []*Application { if x != nil { - return x.Application + return x.Applications } return nil } -func (x *QueryAllApplicationResponse) GetPagination() *v1beta1.PageResponse { +func (x *QueryAllApplicationsResponse) GetPagination() *v1beta1.PageResponse { if x != nil { return x.Pagination } @@ -2910,13 +2910,13 @@ var file_poktroll_application_query_proto_rawDesc = []byte{ 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6f, 0x6b, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, - 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x56, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, @@ -2934,69 +2934,70 @@ var file_poktroll_application_query_proto_rawDesc = []byte{ 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, - 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb1, 0x01, 0x0a, - 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0b, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x32, 0x81, 0x04, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x90, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0xb4, 0x01, - 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3a, 0x12, 0x38, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x7d, 0x12, 0xad, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6c, 0x6c, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb4, 0x01, + 0x0a, 0x1c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, + 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x84, 0x04, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x90, + 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xbe, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0xb4, 0x01, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x30, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, + 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3a, 0x12, 0x38, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xb0, 0x01, 0x0a, 0x0f, 0x41, 0x6c, 0x6c, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xbe, 0x01, 0x0a, 0x18, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, + 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3013,29 +3014,29 @@ func file_poktroll_application_query_proto_rawDescGZIP() []byte { var file_poktroll_application_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_application_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.QueryParamsResponse - (*QueryGetApplicationRequest)(nil), // 2: poktroll.QueryGetApplicationRequest - (*QueryGetApplicationResponse)(nil), // 3: poktroll.QueryGetApplicationResponse - (*QueryAllApplicationRequest)(nil), // 4: poktroll.QueryAllApplicationRequest - (*QueryAllApplicationResponse)(nil), // 5: poktroll.QueryAllApplicationResponse - (*Params)(nil), // 6: poktroll.Params - (*Application)(nil), // 7: poktroll.Application - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.QueryParamsResponse + (*QueryGetApplicationRequest)(nil), // 2: poktroll.QueryGetApplicationRequest + (*QueryGetApplicationResponse)(nil), // 3: poktroll.QueryGetApplicationResponse + (*QueryAllApplicationsRequest)(nil), // 4: poktroll.QueryAllApplicationsRequest + (*QueryAllApplicationsResponse)(nil), // 5: poktroll.QueryAllApplicationsResponse + (*Params)(nil), // 6: poktroll.Params + (*Application)(nil), // 7: poktroll.Application + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_application_query_proto_depIdxs = []int32{ 6, // 0: poktroll.QueryParamsResponse.params:type_name -> poktroll.Params 7, // 1: poktroll.QueryGetApplicationResponse.application:type_name -> poktroll.Application - 8, // 2: poktroll.QueryAllApplicationRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.QueryAllApplicationResponse.application:type_name -> poktroll.Application - 9, // 4: poktroll.QueryAllApplicationResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 8, // 2: poktroll.QueryAllApplicationsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.QueryAllApplicationsResponse.applications:type_name -> poktroll.Application + 9, // 4: poktroll.QueryAllApplicationsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 0, // 5: poktroll.Query.Params:input_type -> poktroll.QueryParamsRequest 2, // 6: poktroll.Query.Application:input_type -> poktroll.QueryGetApplicationRequest - 4, // 7: poktroll.Query.ApplicationAll:input_type -> poktroll.QueryAllApplicationRequest + 4, // 7: poktroll.Query.AllApplications:input_type -> poktroll.QueryAllApplicationsRequest 1, // 8: poktroll.Query.Params:output_type -> poktroll.QueryParamsResponse 3, // 9: poktroll.Query.Application:output_type -> poktroll.QueryGetApplicationResponse - 5, // 10: poktroll.Query.ApplicationAll:output_type -> poktroll.QueryAllApplicationResponse + 5, // 10: poktroll.Query.AllApplications:output_type -> poktroll.QueryAllApplicationsResponse 8, // [8:11] is the sub-list for method output_type 5, // [5:8] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -3099,7 +3100,7 @@ func file_poktroll_application_query_proto_init() { } } file_poktroll_application_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllApplicationRequest); i { + switch v := v.(*QueryAllApplicationsRequest); i { case 0: return &v.state case 1: @@ -3111,7 +3112,7 @@ func file_poktroll_application_query_proto_init() { } } file_poktroll_application_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllApplicationResponse); i { + switch v := v.(*QueryAllApplicationsResponse); i { case 0: return &v.state case 1: diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index 865bf664f..001bc03ec 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -4343,6 +4343,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/application parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } diff --git a/proto/poktroll/application/application.proto b/proto/poktroll/application/application.proto index 4a3cb74e8..b9a7d0a18 100644 --- a/proto/poktroll/application/application.proto +++ b/proto/poktroll/application/application.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package poktroll.application; option go_package = "github.com/pokt-network/poktroll/x/application/types"; + import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; diff --git a/proto/poktroll/application/event.proto b/proto/poktroll/application/event.proto index 86502955e..8602c195e 100644 --- a/proto/poktroll/application/event.proto +++ b/proto/poktroll/application/event.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package poktroll.application; option go_package = "github.com/pokt-network/poktroll/x/application/types"; + import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -9,6 +10,7 @@ import "gogoproto/gogo.proto"; // delegatee gateways on chain. This is in response to both a DelegateToGateway // and UndelegateFromGateway message. message EventRedelegation { - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "app_address"]; // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding - string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "gateway_address"]; // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding + // TODO: Check if this tag is relevant for events: (gogoproto.jsontag) = "app_address" + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application, using cosmos' ScalarDescriptor to ensure deterministic encoding + string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application has changed their delegation of, using cosmos' ScalarDescriptor to ensure deterministic encoding } \ No newline at end of file diff --git a/proto/poktroll/application/genesis.proto b/proto/poktroll/application/genesis.proto index e9cb2d6c1..98d681851 100644 --- a/proto/poktroll/application/genesis.proto +++ b/proto/poktroll/application/genesis.proto @@ -1,19 +1,19 @@ syntax = "proto3"; - package poktroll.application; +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/application/params.proto"; import "poktroll/application/application.proto"; -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - // GenesisState defines the application module's genesis state. message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; repeated Application application_list = 2 [(gogoproto.nullable) = false] ; } diff --git a/proto/poktroll/application/params.proto b/proto/poktroll/application/params.proto index a1ecf959b..a09ebd7f4 100644 --- a/proto/poktroll/application/params.proto +++ b/proto/poktroll/application/params.proto @@ -1,11 +1,11 @@ syntax = "proto3"; package poktroll.application; +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/application/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/application/Params"; diff --git a/proto/poktroll/application/query.proto b/proto/poktroll/application/query.proto index bf38d13dd..71e0536c7 100644 --- a/proto/poktroll/application/query.proto +++ b/proto/poktroll/application/query.proto @@ -1,16 +1,17 @@ syntax = "proto3"; - package poktroll.application; +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/application/params.proto"; import "poktroll/application/application.proto"; -import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/pokt-network/poktroll/x/application/types"; // Query defines the gRPC querier service. service Query { @@ -26,7 +27,7 @@ service Query { option (google.api.http).get = "/pokt-network/poktroll/application/application/{address}"; } - rpc ApplicationAll (QueryAllApplicationRequest) returns (QueryAllApplicationResponse) { + rpc AllApplications (QueryAllApplicationsRequest) returns (QueryAllApplicationsResponse) { option (google.api.http).get = "/pokt-network/poktroll/application/application"; } @@ -49,12 +50,12 @@ message QueryGetApplicationResponse { Application application = 1 [(gogoproto.nullable) = false]; } -message QueryAllApplicationRequest { +message QueryAllApplicationsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllApplicationResponse { - repeated Application application = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; +message QueryAllApplicationsResponse { + repeated Application applications = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto index 886bc43a7..f76eaa8af 100644 --- a/proto/poktroll/application/tx.proto +++ b/proto/poktroll/application/tx.proto @@ -1,16 +1,17 @@ syntax = "proto3"; - package poktroll.application; +option go_package = "github.com/pokt-network/poktroll/x/application/types"; + import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; + import "poktroll/application/params.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/application/types"; // Msg defines the Msg service. service Msg { @@ -26,14 +27,17 @@ service Msg { } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/application/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/application/MsgUpdateParams"; // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the module parameters to update. + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + // params defines the x/application parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go index 8d07cb131..f266a72c8 100644 --- a/testutil/keeper/application.go +++ b/testutil/keeper/application.go @@ -1,10 +1,11 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "cosmossdk.io/store" "cosmossdk.io/store/metrics" storetypes "cosmossdk.io/store/types" @@ -31,7 +32,8 @@ import ( // WARNING: Using this map may cause issues if running multiple tests in parallel var stakedGatewayMap = make(map[string]struct{}) -func ApplicationKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func ApplicationKeeper(t testing.TB) (keeper.Keeper, context.Context) { + t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() @@ -53,11 +55,11 @@ func ApplicationKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { mockGatewayKeeper := mocks.NewMockGatewayKeeper(ctrl) mockGatewayKeeper.EXPECT().GetGateway(gomock.Any(), gomock.Any()).DoAndReturn( - func(_ sdk.Context, addr string) (gatewaytypes.Gateway, bool) { + func(_ context.Context, addr string) (gatewaytypes.Gateway, bool) { if _, ok := stakedGatewayMap[addr]; !ok { return gatewaytypes.Gateway{}, false } - stake := sdk.NewCoin("upokt", sdkmath.NewInt(10000)) + stake := sdk.NewCoin("upokt", math.NewInt(10000)) return gatewaytypes.Gateway{ Address: addr, Stake: &stake, @@ -78,7 +80,7 @@ func ApplicationKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } diff --git a/x/application/keeper/application.go b/x/application/keeper/application.go index 817499c86..032d74128 100644 --- a/x/application/keeper/application.go +++ b/x/application/keeper/application.go @@ -14,47 +14,36 @@ import ( func (k Keeper) SetApplication(ctx context.Context, application types.Application) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) - b := k.cdc.MustMarshal(&application) - store.Set(types.ApplicationKey( - application.Address, - ), b) + appBz := k.cdc.MustMarshal(&application) + store.Set(types.ApplicationKey(application.Address), appBz) } // GetApplication returns a application from its index func (k Keeper) GetApplication( ctx context.Context, appAddr string, - ) (app types.Application, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) - b := store.Get(types.ApplicationKey( - appAddr, - )) - if b == nil { + appBz := store.Get(types.ApplicationKey(appAddr)) + if appBz == nil { return app, false } - k.cdc.MustUnmarshal(b, &app) + k.cdc.MustUnmarshal(appBz, &app) return app, true } // RemoveApplication removes a application from the store -func (k Keeper) RemoveApplication( - ctx context.Context, - appAddr string, - -) { +func (k Keeper) RemoveApplication(ctx context.Context, appAddr string) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) - store.Delete(types.ApplicationKey( - appAddr, - )) + store.Delete(types.ApplicationKey(appAddr)) } -// GetAllApplication returns all application -func (k Keeper) GetAllApplication(ctx context.Context) (apps []types.Application) { +// GetAllApplications returns all application +func (k Keeper) GetAllApplications(ctx context.Context) (apps []types.Application) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ApplicationKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) @@ -62,9 +51,9 @@ func (k Keeper) GetAllApplication(ctx context.Context) (apps []types.Application defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Application - k.cdc.MustUnmarshal(iterator.Value(), &val) - apps = append(apps, val) + var app types.Application + k.cdc.MustUnmarshal(iterator.Value(), &app) + apps = append(apps, app) } return diff --git a/x/application/keeper/application_test.go b/x/application/keeper/application_test.go index e871cf75d..e2775d9a0 100644 --- a/x/application/keeper/application_test.go +++ b/x/application/keeper/application_test.go @@ -5,17 +5,18 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/x/application/keeper" "github.com/pokt-network/poktroll/x/application/types" - "github.com/stretchr/testify/require" ) // Prevent strconv unused error var _ = strconv.IntSize -func createNApplication(keeper keeper.Keeper, ctx context.Context, n int) []types.Application { +func createNApplications(keeper keeper.Keeper, ctx context.Context, n int) []types.Application { apps := make([]types.Application, n) for i := range apps { apps[i].Address = strconv.Itoa(i) @@ -27,37 +28,31 @@ func createNApplication(keeper keeper.Keeper, ctx context.Context, n int) []type func TestApplicationGet(t *testing.T) { keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) + apps := createNApplications(keeper, ctx, 10) for _, app := range apps { - rst, found := keeper.GetApplication(ctx, - app.Address, - ) + foundApp, found := keeper.GetApplication(ctx, app.Address) require.True(t, found) require.Equal(t, nullify.Fill(&app), - nullify.Fill(&rst), + nullify.Fill(&foundApp), ) } } func TestApplicationRemove(t *testing.T) { keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) + apps := createNApplications(keeper, ctx, 10) for _, app := range apps { - keeper.RemoveApplication(ctx, - app.Address, - ) - _, found := keeper.GetApplication(ctx, - app.Address, - ) + keeper.RemoveApplication(ctx, app.Address) + _, found := keeper.GetApplication(ctx, app.Address) require.False(t, found) } } func TestApplicationGetAll(t *testing.T) { keeper, ctx := keepertest.ApplicationKeeper(t) - apps := createNApplication(keeper, ctx, 10) + apps := createNApplications(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(apps), - nullify.Fill(keeper.GetAllApplication(ctx)), + nullify.Fill(keeper.GetAllApplications(ctx)), ) } diff --git a/x/application/keeper/msg_server.go b/x/application/keeper/msg_server.go index 8f740e15c..b907fabac 100644 --- a/x/application/keeper/msg_server.go +++ b/x/application/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/application/types" -) +import "github.com/pokt-network/poktroll/x/application/types" type msgServer struct { Keeper diff --git a/x/application/keeper/msg_server_delegate_to_gateway.go b/x/application/keeper/msg_server_delegate_to_gateway.go index 305b48baf..656dbf023 100644 --- a/x/application/keeper/msg_server_delegate_to_gateway.go +++ b/x/application/keeper/msg_server_delegate_to_gateway.go @@ -4,15 +4,12 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/application/types" ) -func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelegateToGateway) (*types.MsgDelegateToGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - +func (k msgServer) DelegateToGateway(ctx context.Context, msg *types.MsgDelegateToGateway) (*types.MsgDelegateToGatewayResponse, error) { logger := k.Logger().With("method", "DelegateToGateway") logger.Info(fmt.Sprintf("About to delegate application to gateway with msg: %v", msg)) @@ -25,28 +22,28 @@ func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelega app, found := k.GetApplication(ctx, msg.AppAddress) if !found { logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) + return nil, types.ErrAppNotFound.Wrapf("application not found with address: %s", msg.AppAddress) } logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) // Check if the gateway is staked if _, found := k.gatewayKeeper.GetGateway(ctx, msg.GatewayAddress); !found { logger.Info(fmt.Sprintf("Gateway not found with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppGatewayNotFound, "gateway not found with address: %s", msg.GatewayAddress) + return nil, types.ErrAppGatewayNotFound.Wrapf("gateway not found with address: %s", msg.GatewayAddress) } // Ensure the application is not already delegated to the maximum number of gateways maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways if uint64(len(app.DelegateeGatewayAddresses)) >= maxDelegatedParam { logger.Info(fmt.Sprintf("Application already delegated to maximum number of gateways: %d", maxDelegatedParam)) - return nil, sdkerrors.Wrapf(types.ErrAppMaxDelegatedGateways, "application already delegated to %d gateways", maxDelegatedParam) + return nil, types.ErrAppMaxDelegatedGateways.Wrapf("application already delegated to %d gateways", maxDelegatedParam) } // Check if the application is already delegated to the gateway for _, gatewayAddr := range app.DelegateeGatewayAddresses { if gatewayAddr == msg.GatewayAddress { logger.Info(fmt.Sprintf("Application already delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppAlreadyDelegated, "application already delegated to gateway with address: %s", msg.GatewayAddress) + return nil, types.ErrAppAlreadyDelegated.Wrapf("application already delegated to gateway with address: %s", msg.GatewayAddress) } } @@ -61,7 +58,9 @@ func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelega // Emit the application redelegation event event := msg.NewRedelegationEvent() logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) - if err := ctx.EventManager().EmitTypedEvent(event); err != nil { + + sdkCtx := sdk.UnwrapSDKContext(ctx) + if err := sdkCtx.EventManager().EmitTypedEvent(event); err != nil { logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) return nil, err } diff --git a/x/application/keeper/msg_server_delegate_to_gateway_test.go b/x/application/keeper/msg_server_delegate_to_gateway_test.go index 36081a290..05a2c6271 100644 --- a/x/application/keeper/msg_server_delegate_to_gateway_test.go +++ b/x/application/keeper/msg_server_delegate_to_gateway_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -30,7 +30,7 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -53,7 +53,10 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { // Delegate the application to the gateway _, err = srv.DelegateToGateway(ctx, delegateMsg) require.NoError(t, err) - events := ctx.EventManager().Events() + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + events := sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) require.Equal(t, "app_address", events[0].Attributes[0].Key) @@ -77,7 +80,8 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { // Delegate the application to the second gateway _, err = srv.DelegateToGateway(ctx, delegateMsg2) require.NoError(t, err) - events = ctx.EventManager().Events() + + events = sdkCtx.EventManager().Events() require.Equal(t, 2, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[1].Type) require.Equal(t, "app_address", events[1].Attributes[0].Key) @@ -106,7 +110,7 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -129,7 +133,10 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { // Delegate the application to the gateway _, err = srv.DelegateToGateway(ctx, delegateMsg) require.NoError(t, err) - events := ctx.EventManager().Events() + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + events := sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) require.Equal(t, "app_address", events[0].Attributes[0].Key) @@ -153,7 +160,7 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { // Attempt to delegate the application to the gateway again _, err = srv.DelegateToGateway(ctx, delegateMsg2) require.ErrorIs(t, err, types.ErrAppAlreadyDelegated) - events = ctx.EventManager().Events() + events = sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) @@ -172,7 +179,7 @@ func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -210,7 +217,7 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -246,7 +253,9 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { require.Equal(t, int(i+1), len(foundApp.DelegateeGatewayAddresses)) } - events := ctx.EventManager().Events() + sdkCtx := sdk.UnwrapSDKContext(ctx) + + events := sdkCtx.EventManager().Events() require.Equal(t, int(maxDelegatedParam), len(events)) for i, event := range events { require.Equal(t, "poktroll.application.EventRedelegation", event.Type) @@ -269,7 +278,7 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { // Attempt to delegate the application when the max is already reached _, err = srv.DelegateToGateway(ctx, delegateMsg) require.ErrorIs(t, err, types.ErrAppMaxDelegatedGateways) - events = ctx.EventManager().Events() + events = sdkCtx.EventManager().Events() require.Equal(t, int(maxDelegatedParam), len(events)) foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index b8eb5757d..387372d76 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -4,14 +4,12 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/application/types" ) -func (k msgServer) StakeApplication(goCtx context.Context, msg *types.MsgStakeApplication) (*types.MsgStakeApplicationResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - +func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeApplication) (*types.MsgStakeApplicationResponse, error) { logger := k.Logger().With("method", "StakeApplication") logger.Info(fmt.Sprintf("About to stake application with msg: %v", msg)) @@ -21,17 +19,20 @@ func (k msgServer) StakeApplication(goCtx context.Context, msg *types.MsgStakeAp } // Check if the application already exists or not - var err error - var coinsToDelegate sdk.Coin - app, isAppFound := k.GetApplication(ctx, msg.Address) + var ( + err error + coinsToDelegate sdk.Coin + ) + + foundApp, isAppFound := k.GetApplication(ctx, msg.Address) if !isAppFound { logger.Info(fmt.Sprintf("Application not found. Creating new application for address %s", msg.Address)) - app = k.createApplication(ctx, msg) + foundApp = k.createApplication(ctx, msg) coinsToDelegate = *msg.Stake } else { logger.Info(fmt.Sprintf("Application found. Updating application for address %s", msg.Address)) - currAppStake := *app.Stake - if err = k.updateApplication(ctx, &app, msg); err != nil { + currAppStake := *foundApp.Stake + if err = k.updateApplication(ctx, &foundApp, msg); err != nil { return nil, err } coinsToDelegate = (*msg.Stake).Sub(currAppStake) @@ -53,14 +54,14 @@ func (k msgServer) StakeApplication(goCtx context.Context, msg *types.MsgStakeAp } // Update the Application in the store - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully updated application stake for app: %+v", app)) + k.SetApplication(ctx, foundApp) + logger.Info(fmt.Sprintf("Successfully updated application stake for app: %+v", foundApp)) return &types.MsgStakeApplicationResponse{}, nil } func (k msgServer) createApplication( - ctx sdk.Context, + _ context.Context, msg *types.MsgStakeApplication, ) types.Application { return types.Application{ @@ -72,28 +73,28 @@ func (k msgServer) createApplication( } func (k msgServer) updateApplication( - ctx sdk.Context, + _ context.Context, app *types.Application, msg *types.MsgStakeApplication, ) error { // Checks if the the msg address is the same as the current owner if msg.Address != app.Address { - return sdkerrors.Wrapf(types.ErrAppUnauthorized, "msg Address (%s) != application address (%s)", msg.Address, app.Address) + return types.ErrAppUnauthorized.Wrapf("msg Address (%s) != application address (%s)", msg.Address, app.Address) } // Validate that the stake is not being lowered if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount cannot be nil") + return types.ErrAppInvalidStake.Wrapf("stake amount cannot be nil") } if msg.Stake.IsLTE(*app.Stake) { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake) + return types.ErrAppInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake) } app.Stake = msg.Stake // Validate that the service configs maintain at least one service. // Additional validation is done in `msg.ValidateBasic` above. if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrAppInvalidServiceConfigs, "must have at least one service") + return types.ErrAppInvalidServiceConfigs.Wrapf("must have at least one service") } app.ServiceConfigs = msg.Services diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go index f25079592..1e97a4c80 100644 --- a/x/application/keeper/msg_server_stake_application_test.go +++ b/x/application/keeper/msg_server_stake_application_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -19,16 +19,16 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the application - addr := sample.AccAddress() + appAddr := sample.AccAddress() // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) + _, isAppFound := k.GetApplication(ctx, appAddr) require.False(t, isAppFound) // Prepare the application stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -41,17 +41,17 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.NoError(t, err) // Verify that the application exists - appFound, isAppFound := k.GetApplication(ctx, addr) + foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, addr, appFound.Address) - require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) - require.Len(t, appFound.ServiceConfigs, 1) - require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) + require.Equal(t, appAddr, foundApp.Address) + require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) + require.Len(t, foundApp.ServiceConfigs, 1) + require.Equal(t, "svc1", foundApp.ServiceConfigs[0].Service.Id) // Prepare an updated application with a higher stake and another service updateStakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(200)}, + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -65,12 +65,12 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { // Update the staked application _, err = srv.StakeApplication(ctx, updateStakeMsg) require.NoError(t, err) - appFound, isAppFound = k.GetApplication(ctx, addr) + foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, int64(200), appFound.Stake.Amount.Int64()) - require.Len(t, appFound.ServiceConfigs, 2) - require.Equal(t, "svc1", appFound.ServiceConfigs[0].Service.Id) - require.Equal(t, "svc2", appFound.ServiceConfigs[1].Service.Id) + require.Equal(t, int64(200), foundApp.Stake.Amount.Int64()) + require.Len(t, foundApp.ServiceConfigs, 2) + require.Equal(t, "svc1", foundApp.ServiceConfigs[0].Service.Id) + require.Equal(t, "svc2", foundApp.ServiceConfigs[1].Service.Id) } func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing.T) { @@ -82,7 +82,7 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing // Prepare the application stake message stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -97,7 +97,7 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing // Prepare the application stake message without any services updateStakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{}, } @@ -105,17 +105,17 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing _, err = srv.StakeApplication(ctx, updateStakeMsg) require.Error(t, err) - // Verify the app still exists and is staked for svc1 - app, isAppFound := k.GetApplication(ctx, appAddr) + // Verify the foundApp still exists and is staked for svc1 + foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, appAddr, app.Address) - require.Len(t, app.ServiceConfigs, 1) - require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) + require.Equal(t, appAddr, foundApp.Address) + require.Len(t, foundApp.ServiceConfigs, 1) + require.Equal(t, "svc1", foundApp.ServiceConfigs[0].Service.Id) // Prepare the application stake message with an invalid service ID updateStakeMsg = &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1 INVALID ! & *"}, @@ -128,11 +128,11 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing require.Error(t, err) // Verify the app still exists and is staked for svc1 - app, isAppFound = k.GetApplication(ctx, appAddr) + foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, appAddr, app.Address) - require.Len(t, app.ServiceConfigs, 1) - require.Equal(t, "svc1", app.ServiceConfigs[0].Service.Id) + require.Equal(t, appAddr, foundApp.Address) + require.Len(t, foundApp.ServiceConfigs, 1) + require.Equal(t, "svc1", foundApp.ServiceConfigs[0].Service.Id) } func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { @@ -140,10 +140,10 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Prepare the application - addr := sample.AccAddress() + appAddr := sample.AccAddress() stakeMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -154,13 +154,13 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { // Stake the application & verify that the application exists _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) - _, isAppFound := k.GetApplication(ctx, addr) + _, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) // Prepare an updated application with a lower stake updateMsg := &types.MsgStakeApplication{ - Address: addr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(50)}, + Address: appAddr, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -173,7 +173,7 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { require.Error(t, err) // Verify that the application stake is unchanged - appFound, isAppFound := k.GetApplication(ctx, addr) + foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, int64(100), appFound.Stake.Amount.Int64()) + require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) } diff --git a/x/application/keeper/msg_server_test.go b/x/application/keeper/msg_server_test.go index 02d1f03bc..4ce76d847 100644 --- a/x/application/keeper/msg_server_test.go +++ b/x/application/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.ApplicationKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/application/keeper/msg_server_undelegate_from_gateway.go b/x/application/keeper/msg_server_undelegate_from_gateway.go index e414c9216..b265893d7 100644 --- a/x/application/keeper/msg_server_undelegate_from_gateway.go +++ b/x/application/keeper/msg_server_undelegate_from_gateway.go @@ -4,14 +4,11 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/application/types" ) -func (k msgServer) UndelegateFromGateway(goCtx context.Context, msg *types.MsgUndelegateFromGateway) (*types.MsgUndelegateFromGatewayResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - +func (k msgServer) UndelegateFromGateway(ctx context.Context, msg *types.MsgUndelegateFromGateway) (*types.MsgUndelegateFromGatewayResponse, error) { logger := k.Logger().With("method", "UndelegateFromGateway") logger.Info(fmt.Sprintf("About to undelegate application from gateway with msg: %v", msg)) @@ -21,36 +18,39 @@ func (k msgServer) UndelegateFromGateway(goCtx context.Context, msg *types.MsgUn } // Retrieve the application from the store - app, found := k.GetApplication(ctx, msg.AppAddress) - if !found { + foundApp, isAppFound := k.GetApplication(ctx, msg.AppAddress) + if !isAppFound { logger.Info(fmt.Sprintf("Application not found with address [%s]", msg.AppAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotFound, "application not found with address: %s", msg.AppAddress) + return nil, types.ErrAppNotFound.Wrapf("application not found with address: %s", msg.AppAddress) } logger.Info(fmt.Sprintf("Application found with address [%s]", msg.AppAddress)) // Check if the application is already delegated to the gateway foundIdx := -1 - for i, gatewayAddr := range app.DelegateeGatewayAddresses { + for i, gatewayAddr := range foundApp.DelegateeGatewayAddresses { if gatewayAddr == msg.GatewayAddress { foundIdx = i } } if foundIdx == -1 { logger.Info(fmt.Sprintf("Application not delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotDelegated, "application not delegated to gateway with address: %s", msg.GatewayAddress) + return nil, types.ErrAppNotDelegated.Wrapf("application not delegated to gateway with address: %s", msg.GatewayAddress) } // Remove the gateway from the application's delegatee gateway public keys - app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses[:foundIdx], app.DelegateeGatewayAddresses[foundIdx+1:]...) + foundApp.DelegateeGatewayAddresses = append(foundApp.DelegateeGatewayAddresses[:foundIdx], foundApp.DelegateeGatewayAddresses[foundIdx+1:]...) // Update the application store with the new delegation - k.SetApplication(ctx, app) - logger.Info(fmt.Sprintf("Successfully undelegated application from gateway for app: %+v", app)) + k.SetApplication(ctx, foundApp) + logger.Info(fmt.Sprintf("Successfully undelegated application from gateway for app: %+v", foundApp)) // Emit the application redelegation event event := msg.NewRedelegationEvent() logger.Info(fmt.Sprintf("Emitting application redelegation event %v", event)) - if err := ctx.EventManager().EmitTypedEvent(event); err != nil { + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + if err := sdkCtx.EventManager().EmitTypedEvent(event); err != nil { logger.Error(fmt.Sprintf("Failed to emit application redelegation event: %v", err)) return nil, err } diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go index 408d3869d..aba13dd99 100644 --- a/x/application/keeper/msg_server_undelegate_from_gateway_test.go +++ b/x/application/keeper/msg_server_undelegate_from_gateway_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -33,7 +33,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -44,6 +44,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { // Stake the application & verify that the application exists _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) @@ -57,8 +58,12 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { _, err = srv.DelegateToGateway(ctx, delegateMsg) require.NoError(t, err) } - events := ctx.EventManager().Events() + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + events := sdkCtx.EventManager().Events() require.Equal(t, int(maxDelegatedGateways), len(events)) + for i, event := range events { require.Equal(t, "poktroll.application.EventRedelegation", event.Type) require.Equal(t, "app_address", event.Attributes[0].Key) @@ -72,6 +77,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { require.True(t, isAppFound) require.Equal(t, appAddr, foundApp.Address) require.Equal(t, maxDelegatedGateways, uint64(len(foundApp.DelegateeGatewayAddresses))) + for i, gatewayAddr := range gatewayAddresses { require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) } @@ -85,7 +91,8 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { // Undelegate the application from the gateway _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) require.NoError(t, err) - events = ctx.EventManager().Events() + + events = sdkCtx.EventManager().Events() require.Equal(t, int(maxDelegatedGateways)+1, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[7].Type) require.Equal(t, "app_address", events[7].Attributes[0].Key) @@ -98,6 +105,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { require.True(t, isAppFound) require.Equal(t, appAddr, foundApp.Address) require.Equal(t, maxDelegatedGateways-1, uint64(len(foundApp.DelegateeGatewayAddresses))) + gatewayAddresses = append(gatewayAddresses[:3], gatewayAddresses[4:]...) for i, gatewayAddr := range gatewayAddresses { require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[i]) @@ -119,7 +127,7 @@ func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -146,7 +154,10 @@ func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { require.True(t, isAppFound) require.Equal(t, appAddr, foundApp.Address) require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) - events := ctx.EventManager().Events() + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + events := sdkCtx.EventManager().Events() require.Equal(t, 0, len(events)) // Prepare a delegation message @@ -158,7 +169,8 @@ func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { // Delegate the application to the gateway _, err = srv.DelegateToGateway(ctx, delegateMsg) require.NoError(t, err) - events = ctx.EventManager().Events() + + events = sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) require.Equal(t, "app_address", events[0].Attributes[0].Key) @@ -169,8 +181,10 @@ func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { // Ensure the failed undelegation did not affect the application _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) require.ErrorIs(t, err, types.ErrAppNotDelegated) - events = ctx.EventManager().Events() + + events = sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) + foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) require.Equal(t, 1, len(foundApp.DelegateeGatewayAddresses)) @@ -190,7 +204,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGatew // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -201,6 +215,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGatew // Stake the application & verify that the application exists _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) + _, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) @@ -212,7 +227,10 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGatew // Delegate the application to the gateway _, err = srv.DelegateToGateway(ctx, delegateMsg) require.NoError(t, err) - events := ctx.EventManager().Events() + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + events := sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[0].Type) require.Equal(t, "app_address", events[0].Attributes[0].Key) @@ -239,7 +257,8 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGatew // Undelegate the application from the gateway _, err = srv.UndelegateFromGateway(ctx, undelegateMsg) require.NoError(t, err) - events = ctx.EventManager().Events() + + events = sdkCtx.EventManager().Events() require.Equal(t, 2, len(events)) require.Equal(t, "poktroll.application.EventRedelegation", events[1].Type) require.Equal(t, "app_address", events[1].Attributes[0].Key) diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go index 48b6bf41d..5965adc31 100644 --- a/x/application/keeper/msg_server_unstake_application.go +++ b/x/application/keeper/msg_server_unstake_application.go @@ -9,15 +9,13 @@ import ( ) // TODO(#73): Determine if an application needs an unbonding period after unstaking. -func (k msgServer) UnstakeApplication(goCtx context.Context, msg *types.MsgUnstakeApplication) (*types.MsgUnstakeApplicationResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - +func (k msgServer) UnstakeApplication(ctx context.Context, msg *types.MsgUnstakeApplication) (*types.MsgUnstakeApplicationResponse, error) { logger := k.Logger().With("method", "UnstakeApplication") logger.Info(fmt.Sprintf("About to unstake application with msg: %v", msg)) // Check if the application already exists or not var err error - app, isAppFound := k.GetApplication(ctx, msg.Address) + foundApp, isAppFound := k.GetApplication(ctx, msg.Address) if !isAppFound { logger.Info(fmt.Sprintf("Application not found. Cannot unstake address %s", msg.Address)) return nil, types.ErrAppNotFound @@ -32,15 +30,15 @@ func (k msgServer) UnstakeApplication(goCtx context.Context, msg *types.MsgUnsta } // Send the coins from the application pool back to the application - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, appAddress, []sdk.Coin{*app.Stake}) + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, appAddress, []sdk.Coin{*foundApp.Stake}) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", app.Stake, appAddress, types.ModuleName, err)) + logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", foundApp.Stake, appAddress, types.ModuleName, err)) return nil, err } // Update the Application in the store k.RemoveApplication(ctx, appAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the application: %+v", app)) + logger.Info(fmt.Sprintf("Successfully removed the application: %+v", foundApp)) return &types.MsgUnstakeApplicationResponse{}, nil } diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go index 82effa708..23f3c1e0c 100644 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -19,16 +19,16 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the application - addr := sample.AccAddress() + appAddr := sample.AccAddress() // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) + _, isAppFound := k.GetApplication(ctx, appAddr) require.False(t, isAppFound) // Prepare the application - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeApplication{ - Address: addr, + Address: appAddr, Stake: &initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ { @@ -42,19 +42,19 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.NoError(t, err) // Verify that the application exists - appFound, isAppFound := k.GetApplication(ctx, addr) + appFound, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, addr, appFound.Address) + require.Equal(t, appAddr, appFound.Address) require.Equal(t, initialStake.Amount, appFound.Stake.Amount) require.Len(t, appFound.ServiceConfigs, 1) // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: addr} + unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) // Make sure the app can no longer be found after unstaking - _, isAppFound = k.GetApplication(ctx, addr) + _, isAppFound = k.GetApplication(ctx, appAddr) require.False(t, isAppFound) } @@ -63,18 +63,18 @@ func TestMsgServer_UnstakeApplication_FailIfNotStaked(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the application - addr := sample.AccAddress() + appAddr := sample.AccAddress() // Verify that the app does not exist yet - _, isAppFound := k.GetApplication(ctx, addr) + _, isAppFound := k.GetApplication(ctx, appAddr) require.False(t, isAppFound) // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: addr} + unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} _, err := srv.UnstakeApplication(ctx, unstakeMsg) require.Error(t, err) require.ErrorIs(t, err, types.ErrAppNotFound) - _, isAppFound = k.GetApplication(ctx, addr) + _, isAppFound = k.GetApplication(ctx, appAddr) require.False(t, isAppFound) } diff --git a/x/application/keeper/msg_update_params.go b/x/application/keeper/msg_update_params.go index c5aeb7407..2602c878a 100644 --- a/x/application/keeper/msg_update_params.go +++ b/x/application/keeper/msg_update_params.go @@ -3,18 +3,14 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/application/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrAppInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrAppInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/application/keeper/msg_update_params_test.go b/x/application/keeper/msg_update_params_test.go index 1906f0338..900e49cad 100644 --- a/x/application/keeper/msg_update_params_test.go +++ b/x/application/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/application/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + input *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", + desc: "invalid authority", input: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", + desc: "send enabled param", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", + desc: "all good", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.input) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/application/keeper/params.go b/x/application/keeper/params.go index 7e302935d..55ae5cb04 100644 --- a/x/application/keeper/params.go +++ b/x/application/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/application/keeper/query.go b/x/application/keeper/query.go index 288fcb527..c26970dd5 100644 --- a/x/application/keeper/query.go +++ b/x/application/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/application/types" -) +import "github.com/pokt-network/poktroll/x/application/types" var _ types.QueryServer = Keeper{} diff --git a/x/application/keeper/query_application.go b/x/application/keeper/query_application.go index 405f8cff6..466710696 100644 --- a/x/application/keeper/query_application.go +++ b/x/application/keeper/query_application.go @@ -11,12 +11,12 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) ApplicationAll(ctx context.Context, req *types.QueryAllApplicationRequest) (*types.QueryAllApplicationResponse, error) { +func (k Keeper) AllApplications(ctx context.Context, req *types.QueryAllApplicationsRequest) (*types.QueryAllApplicationsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - var applications []types.Application + var apps []types.Application store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) applicationStore := prefix.NewStore(store, types.KeyPrefix(types.ApplicationKeyPrefix)) @@ -27,7 +27,7 @@ func (k Keeper) ApplicationAll(ctx context.Context, req *types.QueryAllApplicati return err } - applications = append(applications, application) + apps = append(apps, application) return nil }) @@ -35,7 +35,7 @@ func (k Keeper) ApplicationAll(ctx context.Context, req *types.QueryAllApplicati return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryAllApplicationResponse{Application: applications, Pagination: pageRes}, nil + return &types.QueryAllApplicationsResponse{Applications: apps, Pagination: pageRes}, nil } func (k Keeper) Application(ctx context.Context, req *types.QueryGetApplicationRequest) (*types.QueryGetApplicationResponse, error) { @@ -43,13 +43,10 @@ func (k Keeper) Application(ctx context.Context, req *types.QueryGetApplicationR return nil, status.Error(codes.InvalidArgument, "invalid request") } - val, found := k.GetApplication( - ctx, - req.Address, - ) + app, found := k.GetApplication(ctx, req.Address) if !found { return nil, status.Error(codes.NotFound, "application not found") } - return &types.QueryGetApplicationResponse{Application: val}, nil + return &types.QueryGetApplicationResponse{Application: app}, nil } diff --git a/x/application/keeper/query_application_test.go b/x/application/keeper/query_application_test.go index 9eba83def..e5d3d0fed 100644 --- a/x/application/keeper/query_application_test.go +++ b/x/application/keeper/query_application_test.go @@ -19,12 +19,12 @@ var _ = strconv.IntSize func TestApplicationQuerySingle(t *testing.T) { keeper, ctx := keepertest.ApplicationKeeper(t) - msgs := createNApplication(keeper, ctx, 2) + msgs := createNApplications(keeper, ctx, 2) tests := []struct { - desc string - request *types.QueryGetApplicationRequest - response *types.QueryGetApplicationResponse - err error + desc string + request *types.QueryGetApplicationRequest + response *types.QueryGetApplicationResponse + expectedErr error }{ { desc: "First", @@ -45,22 +45,22 @@ func TestApplicationQuerySingle(t *testing.T) { request: &types.QueryGetApplicationRequest{ Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "application not found"), + expectedErr: status.Error(codes.NotFound, "application not found"), }, { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Application(ctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Application(ctx, test.request) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } @@ -70,10 +70,10 @@ func TestApplicationQuerySingle(t *testing.T) { func TestApplicationQueryPaginated(t *testing.T) { keeper, ctx := keepertest.ApplicationKeeper(t) - msgs := createNApplication(keeper, ctx, 5) + apps := createNApplications(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllApplicationRequest { - return &types.QueryAllApplicationRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllApplicationsRequest { + return &types.QueryAllApplicationsRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -84,41 +84,41 @@ func TestApplicationQueryPaginated(t *testing.T) { } t.Run("ByOffset", func(t *testing.T) { step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ApplicationAll(ctx, request(nil, uint64(i), uint64(step), false)) + for i := 0; i < len(apps); i += step { + resp, err := keeper.AllApplications(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Application), step) + require.LessOrEqual(t, len(resp.Applications), step) require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), + nullify.Fill(apps), + nullify.Fill(resp.Applications), ) } }) t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ApplicationAll(ctx, request(next, 0, uint64(step), false)) + for i := 0; i < len(apps); i += step { + resp, err := keeper.AllApplications(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Application), step) + require.LessOrEqual(t, len(resp.Applications), step) require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), + nullify.Fill(apps), + nullify.Fill(resp.Applications), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.ApplicationAll(ctx, request(nil, 0, 0, true)) + resp, err := keeper.AllApplications(ctx, request(nil, 0, 0, true)) require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.Equal(t, len(apps), int(resp.Pagination.Total)) require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Application), + nullify.Fill(apps), + nullify.Fill(resp.Applications), ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.ApplicationAll(ctx, nil) + _, err := keeper.AllApplications(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/application/keeper/query_params.go b/x/application/keeper/query_params.go index b0c717d4f..13f4b1f47 100644 --- a/x/application/keeper/query_params.go +++ b/x/application/keeper/query_params.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/application/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/application/module/autocli.go b/x/application/module/autocli.go index 919f4b944..404c8a366 100644 --- a/x/application/module/autocli.go +++ b/x/application/module/autocli.go @@ -10,93 +10,93 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - Long: `Shows all the parameters related to the application module. - -Example: -$ poktrolld q application params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - }, - { - RpcMethod: "ApplicationAll", - Use: "list-application", - Short: "List all application", - Long: `List all the applications that staked in the network. - -Example: -$ poktrolld q application list-application --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - }, - { - RpcMethod: "Application", - Use: "show-application [address]", - Short: "Shows a application", - Long: `Finds a staked application given its address. - -Example: -$ poktrolld q application show-application $(APP_ADDRESS) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, - }, + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // Long: `Shows all the parameters related to the application module. + // + // Example: + // $ poktrolld q application params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // }, + // { + // RpcMethod: "AllApplications", + // Use: "list-application", + // Short: "List all application", + // Long: `List all the applications that staked in the network. + // + // Example: + // $ poktrolld q application list-application --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // }, + // { + // RpcMethod: "Application", + // Use: "show-application [address]", + // Short: "Shows a application", + // Long: `Finds a staked application given its address. + // + // Example: + // $ poktrolld q application show-application $(APP_ADDRESS) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, + // }, // this line is used by ignite scaffolding # autocli/query }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, - { - RpcMethod: "StakeApplication", - Use: "stake-application [stake] [services]", - Short: "Send a stake-application tx", - Long: `Stake an application using a config file. This is a broadcast operation that will stake -the tokens and serviceIds and associate them with the application specified by the 'from' address. - -Example: -$ poktrolld tx application stake-application --config app_stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, - }, - { - RpcMethod: "UnstakeApplication", - Use: "unstake-application", - Short: "Send a unstake-application tx", - Long: `Unstake an application. This is a broadcast operation that will unstake -the application specified by the 'from' address. - -Example: -$ poktrolld tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, - }, - { - RpcMethod: "DelegateToGateway", - Use: "delegate-to-gateway [gateway-address]", - Short: "Send a delegate-to-gateway tx", - Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation -that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway -act on the behalf of the application during a session. - -Example: -$ poktrolld tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "gateway_address"}}, - }, - { - RpcMethod: "UndelegateFromGateway", - Use: "undelegate-from-gateway [gateway-address]", - Short: "Send a undelegate-from-gateway tx", - Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation -that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway -act on the behalf of the application during a session. - -Example: -$ poktrolld tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "gateway_address"}}, - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "StakeApplication", + // Use: "stake-application [stake] [services]", + // Short: "Send a stake-application tx", + // Long: `Stake an application using a config file. This is a broadcast operation that will stake + // the tokens and serviceIds and associate them with the application specified by the 'from' address. + // + // Example: + // $ poktrolld tx application stake-application --config app_stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, + // }, + // { + // RpcMethod: "UnstakeApplication", + // Use: "unstake-application", + // Short: "Send a unstake-application tx", + // Long: `Unstake an application. This is a broadcast operation that will unstake + // the application specified by the 'from' address. + // + // Example: + // $ poktrolld tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + // }, + // { + // RpcMethod: "DelegateToGateway", + // Use: "delegate-to-gateway [gateway-address]", + // Short: "Send a delegate-to-gateway tx", + // Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation + // that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway + // act on the behalf of the application during a session. + // + // Example: + // $ poktrolld tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "gateway_address"}}, + // }, + // { + // RpcMethod: "UndelegateFromGateway", + // Use: "undelegate-from-gateway [gateway-address]", + // Short: "Send a undelegate-from-gateway tx", + // Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation + // that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway + // act on the behalf of the application during a session. + // + // Example: + // $ poktrolld tx application undelegate-from-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "gateway_address"}}, + // }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/application/module/config/application_configs_reader_test.go b/x/application/module/config/application_configs_reader_test.go index 1f951e8ba..571af114c 100644 --- a/x/application/module/config/application_configs_reader_test.go +++ b/x/application/module/config/application_configs_reader_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -19,7 +19,7 @@ func Test_ParseApplicationConfigs(t *testing.T) { inputConfig string - expectedError *sdkerrors.Error + expectedErr *sdkerrors.Error expectedConfig *config.ApplicationStakeConfig }{ // Valid Configs @@ -33,9 +33,9 @@ func Test_ParseApplicationConfigs(t *testing.T) { - svc2 `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.ApplicationStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdkmath.NewInt(1000)), + StakeAmount: sdk.NewCoin("upokt", math.NewInt(1000)), Services: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: "svc1"}, @@ -52,7 +52,7 @@ func Test_ParseApplicationConfigs(t *testing.T) { inputConfig: ``, - expectedError: config.ErrApplicationConfigEmptyContent, + expectedErr: config.ErrApplicationConfigEmptyContent, }, { desc: "invalid: no service ids", @@ -62,7 +62,7 @@ func Test_ParseApplicationConfigs(t *testing.T) { service_ids: # explicitly omitting service ids `, - expectedError: config.ErrApplicationConfigInvalidServiceId, + expectedErr: config.ErrApplicationConfigInvalidServiceId, }, { desc: "invalid: invalid serviceId", @@ -73,7 +73,7 @@ func Test_ParseApplicationConfigs(t *testing.T) { - sv c1 `, - expectedError: config.ErrApplicationConfigInvalidServiceId, + expectedErr: config.ErrApplicationConfigInvalidServiceId, }, { desc: "invalid: no stake amount", @@ -85,7 +85,7 @@ func Test_ParseApplicationConfigs(t *testing.T) { - svc2 `, - expectedError: config.ErrApplicationConfigInvalidStake, + expectedErr: config.ErrApplicationConfigInvalidStake, }, { desc: "invalid: non-positive stake amount", @@ -97,7 +97,7 @@ func Test_ParseApplicationConfigs(t *testing.T) { - svc2 `, - expectedError: config.ErrApplicationConfigInvalidStake, + expectedErr: config.ErrApplicationConfigInvalidStake, }, { desc: "invalid: unsupported stake denom", @@ -109,31 +109,31 @@ func Test_ParseApplicationConfigs(t *testing.T) { - svc2 `, - expectedError: config.ErrApplicationConfigInvalidStake, + expectedErr: config.ErrApplicationConfigInvalidStake, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(test.inputConfig) appServiceConfig, err := config.ParseApplicationConfigs([]byte(normalizedConfig)) - if tt.expectedError != nil { + if test.expectedErr != nil { require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - require.Contains(t, err.Error(), tt.expectedError.Error()) + require.ErrorIs(t, err, test.expectedErr) + require.Contains(t, err.Error(), test.expectedErr.Error()) require.Nil(t, appServiceConfig) return } require.NoError(t, err) - require.Equal(t, tt.expectedConfig.StakeAmount.Amount, appServiceConfig.StakeAmount.Amount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, appServiceConfig.StakeAmount.Denom) + require.Equal(t, test.expectedConfig.StakeAmount.Amount, appServiceConfig.StakeAmount.Amount) + require.Equal(t, test.expectedConfig.StakeAmount.Denom, appServiceConfig.StakeAmount.Denom) - t.Logf("serviceIds: %v", tt.expectedConfig.Services) - require.Equal(t, len(tt.expectedConfig.Services), len(appServiceConfig.Services)) - for i, expected := range tt.expectedConfig.Services { + t.Logf("serviceIds: %v", test.expectedConfig.Services) + require.Equal(t, len(test.expectedConfig.Services), len(appServiceConfig.Services)) + for i, expected := range test.expectedConfig.Services { require.Equal(t, expected.Service.Id, appServiceConfig.Services[i].Service.Id) } }) diff --git a/x/application/module/config/errors.go b/x/application/module/config/errors.go index cc009197e..53343de5c 100644 --- a/x/application/module/config/errors.go +++ b/x/application/module/config/errors.go @@ -1,11 +1,14 @@ package config -import sdkerrors "cosmossdk.io/errors" +import ( + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/x/application/types" +) var ( - codespace = "applicationconfig" - ErrApplicationConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrApplicationConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in application config") - ErrApplicationConfigEmptyContent = sdkerrors.Register(codespace, 3, "empty application config content") - ErrApplicationConfigInvalidStake = sdkerrors.Register(codespace, 4, "invalid stake amount in application config") + ErrApplicationConfigUnmarshalYAML = sdkerrors.Register(types.ModuleName, 2100, "config reader cannot unmarshal yaml content") + ErrApplicationConfigInvalidServiceId = sdkerrors.Register(types.ModuleName, 2101, "invalid serviceId in application config") + ErrApplicationConfigEmptyContent = sdkerrors.Register(types.ModuleName, 2102, "empty application config content") + ErrApplicationConfigInvalidStake = sdkerrors.Register(types.ModuleName, 2103, "invalid stake amount in application config") ) diff --git a/x/application/module/genesis.go b/x/application/module/genesis.go index e7f65df01..b9e18709b 100644 --- a/x/application/module/genesis.go +++ b/x/application/module/genesis.go @@ -1,28 +1,30 @@ package application import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/application/keeper" "github.com/pokt-network/poktroll/x/application/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // Set all the application for _, app := range genState.ApplicationList { k.SetApplication(ctx, app) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.ApplicationList = k.GetAllApplication(ctx) + genesis.ApplicationList = k.GetAllApplications(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/application/module/genesis_test.go b/x/application/module/genesis_test.go index 9bcfc6502..efc992dd0 100644 --- a/x/application/module/genesis_test.go +++ b/x/application/module/genesis_test.go @@ -3,407 +3,53 @@ package application_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/testutil/sample" + application "github.com/pokt-network/poktroll/x/application/module" "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - svc1AppConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: "svc1"}, - } - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - svc2AppConfig := &sharedtypes.ApplicationServiceConfig{ - Service: &sharedtypes.Service{Id: "svc2"}, - } - - emptyDelegatees := make([]string, 0) - gatewayAddr1 := sample.AccAddress() - gatewayAddr2 := sample.AccAddress() +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, - }, + ApplicationList: []types.Application{ + { + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, + Service: &sharedtypes.Service{Id: "svc1"}, }, }, - // this line is used by starport scaffolding # types/genesis/validField }, - valid: true, - }, - { - desc: "invalid - zero app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, + { + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, + Service: &sharedtypes.Service{Id: "svc2"}, }, }, }, - valid: false, }, - { - desc: "invalid - negative application stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to duplicated app address", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr1, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to nil app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: nil, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to missing app stake", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - // Explicitly missing stake - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to invalid delegatee pub key", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{"invalid address"}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - due to invalid delegatee pub keys", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1}, - }, - { - Address: addr2, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{"invalid address", gatewayAddr2}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service config not present", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - // ServiceConfigs: omitted - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - empty service config", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{}, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service ID too long", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12345678901"}}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service name too long", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{ - Id: "123", - Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", - }}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - service ID with invalid characters", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ - {Service: &sharedtypes.Service{Id: "12 45 !"}}, - }, - DelegateeGatewayAddresses: emptyDelegatees, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - MaxDelegatedGateways less than 1", - genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 0, - }, - }, - valid: false, - }, - { - desc: "duplicated application", - genState: &types.GenesisState{ - ApplicationList: []types.Application{ - { - Address: addr1, - Stake: &stake1, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, - }, - { - Address: addr1, - Stake: &stake2, - ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, - DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, - }, - }, - }, - valid: false, - }, - - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) + // this line is used by starport scaffolding # genesis/test/state } + + k, ctx := keepertest.ApplicationKeeper(t) + application.InitGenesis(ctx, k, genesisState) + got := application.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.ApplicationList, got.ApplicationList) + // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/application/module/helpers_test.go b/x/application/module/helpers_test.go index 84b7b82e7..24fca8ccd 100644 --- a/x/application/module/helpers_test.go +++ b/x/application/module/helpers_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/network" "github.com/pokt-network/poktroll/x/application/types" ) @@ -15,11 +14,6 @@ import ( // Dummy variable to avoid unused import error. var _ = strconv.IntSize -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - // networkWithApplicationObjects creates a new network with a given number of application objects. // It returns the network and a slice of the created application objects. func networkWithApplicationObjects(t *testing.T, n int) (*network.Network, []types.Application) { diff --git a/x/application/module/module.go b/x/application/module/module.go index 5efac2d46..e817ddf53 100644 --- a/x/application/module/module.go +++ b/x/application/module/module.go @@ -166,10 +166,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/application/module/query.go b/x/application/module/query.go index e09436dac..c23fe79ae 100644 --- a/x/application/module/query.go +++ b/x/application/module/query.go @@ -11,7 +11,8 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func (am AppModule) GetQueryCmd(queryRoute string) *cobra.Command { +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. +func (am AppModule) GetQueryCmd() *cobra.Command { // Group application queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/application/module/query_application.go b/x/application/module/query_application.go index ff6250de2..b1a371c8e 100644 --- a/x/application/module/query_application.go +++ b/x/application/module/query_application.go @@ -29,11 +29,11 @@ $ poktrolld q application list-application --node $(POCKET_NODE) --home $(POKTRO queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllApplicationRequest{ + params := &types.QueryAllApplicationsRequest{ Pagination: pageReq, } - res, err := queryClient.ApplicationAll(cmd.Context(), params) + res, err := queryClient.AllApplications(cmd.Context(), params) if err != nil { return err } diff --git a/x/application/module/query_application_test.go b/x/application/module/query_application_test.go index 557514282..b97fcf71b 100644 --- a/x/application/module/query_application_test.go +++ b/x/application/module/query_application_test.go @@ -18,7 +18,7 @@ import ( ) func TestShowApplication(t *testing.T) { - net, objs := networkWithApplicationObjects(t, 2) + net, apps := networkWithApplicationObjects(t, 2) ctx := net.Validators[0].ClientCtx common := []string{ @@ -28,43 +28,43 @@ func TestShowApplication(t *testing.T) { desc string idAddress string - args []string - err error - obj types.Application + args []string + expectedErr error + app types.Application }{ { desc: "found", - idAddress: objs[0].Address, + idAddress: apps[0].Address, args: common, - obj: objs[0], + app: apps[0], }, { desc: "not found", idAddress: strconv.Itoa(100000), - args: common, - err: status.Error(codes.NotFound, "not found"), + args: common, + expectedErr: status.Error(codes.NotFound, "not found"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { args := []string{ - tc.idAddress, + test.idAddress, } - args = append(args, tc.args...) + args = append(args, test.args...) out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdShowApplication(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) + require.ErrorIs(t, stat.Err(), test.expectedErr) } else { require.NoError(t, err) var resp types.QueryGetApplicationResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NotNil(t, resp.Application) require.Equal(t, - nullify.Fill(&tc.obj), + nullify.Fill(&test.app), nullify.Fill(&resp.Application), ) } @@ -73,7 +73,7 @@ func TestShowApplication(t *testing.T) { } func TestListApplication(t *testing.T) { - net, objs := networkWithApplicationObjects(t, 5) + net, apps := networkWithApplicationObjects(t, 5) ctx := net.Validators[0].ClientCtx request := func(next []byte, offset, limit uint64, total bool) []string { @@ -93,47 +93,47 @@ func TestListApplication(t *testing.T) { } t.Run("ByOffset", func(t *testing.T) { step := 2 - for i := 0; i < len(objs); i += step { + for i := 0; i < len(apps); i += step { args := request(nil, uint64(i), uint64(step), false) out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdListApplication(), args) require.NoError(t, err) - var resp types.QueryAllApplicationResponse + var resp types.QueryAllApplicationsResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Application), step) + require.LessOrEqual(t, len(resp.Applications), step) require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), + nullify.Fill(apps), + nullify.Fill(resp.Applications), ) } }) t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte - for i := 0; i < len(objs); i += step { + for i := 0; i < len(apps); i += step { args := request(next, 0, uint64(step), false) out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdListApplication(), args) require.NoError(t, err) - var resp types.QueryAllApplicationResponse + var resp types.QueryAllApplicationsResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Application), step) + require.LessOrEqual(t, len(resp.Applications), step) require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), + nullify.Fill(apps), + nullify.Fill(resp.Applications), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) + args := request(nil, 0, uint64(len(apps)), true) out, err := clitestutil.ExecTestCLICmd(ctx, application.CmdListApplication(), args) require.NoError(t, err) - var resp types.QueryAllApplicationResponse + var resp types.QueryAllApplicationsResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.Equal(t, len(apps), int(resp.Pagination.Total)) require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Application), + nullify.Fill(apps), + nullify.Fill(resp.Applications), ) }) } diff --git a/x/application/module/tx.go b/x/application/module/tx.go index 8c849b64d..0d3edf22d 100644 --- a/x/application/module/tx.go +++ b/x/application/module/tx.go @@ -2,7 +2,6 @@ package application import ( "fmt" - "time" "github.com/spf13/cobra" @@ -10,11 +9,8 @@ import ( "github.com/pokt-network/poktroll/x/application/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/application/module/tx_delegate_to_gateway_test.go b/x/application/module/tx_delegate_to_gateway_test.go index 7344f76a2..7bfd55701 100644 --- a/x/application/module/tx_delegate_to_gateway_test.go +++ b/x/application/module/tx_delegate_to_gateway_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -37,14 +37,14 @@ func TestCLI_DelegateToGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { desc string appAddress string gatewayAddress string - err *sdkerrors.Error + expectedErr *sdkerrors.Error }{ { desc: "delegate to gateway: valid", @@ -53,27 +53,27 @@ func TestCLI_DelegateToGateway(t *testing.T) { }, { desc: "invalid - missing app address", - // appAddress: appAccount.Address.String(), + // appAddress explicitly omitted gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, + expectedErr: types.ErrAppInvalidAddress, }, { desc: "invalid - invalid app address", appAddress: "invalid address", gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, + expectedErr: types.ErrAppInvalidAddress, }, { desc: "invalid - missing gateway address", appAddress: appAccount.Address.String(), - // gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidGatewayAddress, + // gatewayAddress explicitly omitted + expectedErr: types.ErrAppInvalidGatewayAddress, }, { desc: "invalid - invalid gateway address", appAddress: appAccount.Address.String(), gatewayAddress: "invalid address", - err: types.ErrAppInvalidGatewayAddress, + expectedErr: types.ErrAppInvalidGatewayAddress, }, } @@ -82,15 +82,15 @@ func TestCLI_DelegateToGateway(t *testing.T) { network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - tt.gatewayAddress, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), + test.gatewayAddress, + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.appAddress), } args = append(args, commonArgs...) @@ -98,10 +98,10 @@ func TestCLI_DelegateToGateway(t *testing.T) { delegateOutput, err := clitestutil.ExecTestCLICmd(ctx, application.CmdDelegateToGateway(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/application/module/tx_stake_application_test.go b/x/application/module/tx_stake_application_test.go index 2b88144a9..9c73ef1ac 100644 --- a/x/application/module/tx_stake_application_test.go +++ b/x/application/module/tx_stake_application_test.go @@ -6,7 +6,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -37,7 +37,7 @@ func TestCLI_StakeApplication(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } defaultConfig := ` @@ -51,44 +51,44 @@ func TestCLI_StakeApplication(t *testing.T) { tests := []struct { desc string - inputConfig string - inputAddress string + appConfig string + appAddr string - expectedError *sdkerrors.Error + expectedErr *sdkerrors.Error }{ // Happy Paths { desc: "valid", - inputAddress: appAccount.Address.String(), - inputConfig: defaultConfig, + appAddr: appAccount.Address.String(), + appConfig: defaultConfig, - expectedError: nil, + expectedErr: nil, }, // Error Paths - Address Related { desc: "invalid: missing address", - // inputAddress: "explicitly missing", - inputConfig: defaultConfig, + // inputAddress explicitly omitted + appConfig: defaultConfig, - expectedError: types.ErrAppInvalidAddress, + expectedErr: types.ErrAppInvalidAddress, }, { desc: "invalid: invalid address", - inputAddress: "invalid", - inputConfig: defaultConfig, + appAddr: "invalid", + appConfig: defaultConfig, - expectedError: types.ErrAppInvalidAddress, + expectedErr: types.ErrAppInvalidAddress, }, // Error Paths - Stake Related { desc: "invalid: missing stake", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: # explicitly missing service_ids: - svc1 @@ -96,13 +96,13 @@ func TestCLI_StakeApplication(t *testing.T) { - svc3 `, - expectedError: types.ErrAppInvalidStake, + expectedErr: types.ErrAppInvalidStake, }, { desc: "invalid: invalid stake denom", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: 1000invalid service_ids: - svc1 @@ -110,13 +110,13 @@ func TestCLI_StakeApplication(t *testing.T) { - svc3 `, - expectedError: types.ErrAppInvalidStake, + expectedErr: types.ErrAppInvalidStake, }, { desc: "invalid: stake amount (zero)", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: 0upokt service_ids: - svc1 @@ -124,13 +124,13 @@ func TestCLI_StakeApplication(t *testing.T) { - svc3 `, - expectedError: types.ErrAppInvalidStake, + expectedErr: types.ErrAppInvalidStake, }, { desc: "invalid: stake amount (negative)", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: -1000upokt service_ids: - svc1 @@ -138,57 +138,57 @@ func TestCLI_StakeApplication(t *testing.T) { - svc3 `, - expectedError: types.ErrAppInvalidStake, + expectedErr: types.ErrAppInvalidStake, }, // Error Paths - Service Related { desc: "invalid: services (empty string)", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: 1000upokt `, - expectedError: types.ErrAppInvalidServiceConfigs, + expectedErr: types.ErrAppInvalidServiceConfigs, }, { desc: "invalid: single invalid service contains spaces", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: 1000upokt service_ids: - svc1 svc1_part2 svc1_part3 `, - expectedError: types.ErrAppInvalidServiceConfigs, + expectedErr: types.ErrAppInvalidServiceConfigs, }, { desc: "invalid: one of two services is invalid because it contains spaces", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: 1000upokt service_ids: - svc1 svc1_part2 - svc2 `, - expectedError: types.ErrAppInvalidServiceConfigs, + expectedErr: types.ErrAppInvalidServiceConfigs, }, { desc: "invalid: service ID is too long (8 chars is the max)", - inputAddress: appAccount.Address.String(), - inputConfig: ` + appAddr: appAccount.Address.String(), + appConfig: ` stake_amount: 1000upokt service_ids: - svc1, - abcdefghi `, - expectedError: types.ErrAppInvalidServiceConfigs, + expectedErr: types.ErrAppInvalidServiceConfigs, }, } @@ -196,19 +196,19 @@ func TestCLI_StakeApplication(t *testing.T) { network.InitAccount(t, net, appAccount.Address) // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(test.appConfig)).Name() t.Cleanup(func() { os.Remove(configPath) }) // Prepare the arguments for the CLI command args := []string{ fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.inputAddress), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.appAddr), } args = append(args, commonArgs...) @@ -216,10 +216,10 @@ func TestCLI_StakeApplication(t *testing.T) { outStake, err := clitestutil.ExecTestCLICmd(ctx, application.CmdStakeApplication(), args) // Validate the error if one is expected - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/application/module/tx_undelegate_from_gateway_test.go b/x/application/module/tx_undelegate_from_gateway_test.go index 7c510f8f2..1a09b47fa 100644 --- a/x/application/module/tx_undelegate_from_gateway_test.go +++ b/x/application/module/tx_undelegate_from_gateway_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -37,14 +37,14 @@ func TestCLI_UndelegateFromGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { desc string appAddress string gatewayAddress string - err *sdkerrors.Error + expectedErr *sdkerrors.Error }{ { desc: "undelegate from gateway: valid", @@ -53,27 +53,27 @@ func TestCLI_UndelegateFromGateway(t *testing.T) { }, { desc: "invalid - missing app address", - // appAddress: appAccount.Address.String(), + // appAddress explicitly omitted gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, + expectedErr: types.ErrAppInvalidAddress, }, { desc: "invalid - invalid app address", appAddress: "invalid address", gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidAddress, + expectedErr: types.ErrAppInvalidAddress, }, { desc: "invalid - missing gateway address", appAddress: appAccount.Address.String(), - // gatewayAddress: gatewayAccount.Address.String(), - err: types.ErrAppInvalidGatewayAddress, + // gatewayAddress explicitly omitted + expectedErr: types.ErrAppInvalidGatewayAddress, }, { desc: "invalid - invalid gateway address", appAddress: appAccount.Address.String(), gatewayAddress: "invalid address", - err: types.ErrAppInvalidGatewayAddress, + expectedErr: types.ErrAppInvalidGatewayAddress, }, } @@ -82,15 +82,15 @@ func TestCLI_UndelegateFromGateway(t *testing.T) { network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - tt.gatewayAddress, - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.appAddress), + test.gatewayAddress, + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.appAddress), } args = append(args, commonArgs...) @@ -98,10 +98,10 @@ func TestCLI_UndelegateFromGateway(t *testing.T) { undelegateOutput, err := clitestutil.ExecTestCLICmd(ctx, application.CmdUndelegateFromGateway(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/application/module/tx_unstake_application.go b/x/application/module/tx_unstake_application.go index 25f36e6d4..b7c2f5e75 100644 --- a/x/application/module/tx_unstake_application.go +++ b/x/application/module/tx_unstake_application.go @@ -22,7 +22,7 @@ func CmdUnstakeApplication() *cobra.Command { the application specified by the 'from' address. Example: -$ poktrolld tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { diff --git a/x/application/module/tx_unstake_application_test.go b/x/application/module/tx_unstake_application_test.go index 6aad0f5a5..09ec3d505 100644 --- a/x/application/module/tx_unstake_application_test.go +++ b/x/application/module/tx_unstake_application_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -28,6 +28,9 @@ func TestCLI_UnstakeApplication(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) appAccount := accounts[0] + // Initialize the App Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, appAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -35,42 +38,39 @@ func TestCLI_UnstakeApplication(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { - desc string - address string - err *sdkerrors.Error + desc string + appAddr string + expectedErr *sdkerrors.Error }{ { desc: "unstake application: valid", - address: appAccount.Address.String(), + appAddr: appAccount.Address.String(), }, { desc: "unstake application: missing address", - // address: "explicitly missing", - err: types.ErrAppInvalidAddress, + // address explicitly omitted + expectedErr: types.ErrAppInvalidAddress, }, { - desc: "unstake application: invalid address", - address: "invalid", - err: types.ErrAppInvalidAddress, + desc: "unstake application: invalid address", + appAddr: "invalid", + expectedErr: types.ErrAppInvalidAddress, }, } - // Initialize the App Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, appAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.appAddr), } args = append(args, commonArgs...) @@ -78,10 +78,10 @@ func TestCLI_UnstakeApplication(t *testing.T) { outUnstake, err := clitestutil.ExecTestCLICmd(ctx, application.CmdUnstakeApplication(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/application/simulation/stake_application.go b/x/application/simulation/stake_application.go index 286f94230..5b9b7b21d 100644 --- a/x/application/simulation/stake_application.go +++ b/x/application/simulation/stake_application.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/application/keeper" "github.com/pokt-network/poktroll/x/application/types" ) diff --git a/x/application/types/errors.go b/x/application/types/errors.go index eabbba623..981a11a3c 100644 --- a/x/application/types/errors.go +++ b/x/application/types/errors.go @@ -2,23 +2,20 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/application module sentinel errors var ( ErrAppInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrAppSample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1102, "invalid application stake") - ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 1103, "invalid application address") - ErrAppUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized application signer") - ErrAppNotFound = sdkerrors.Register(ModuleName, 1105, "application not found") - ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 1107, "invalid service configs") - ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 1108, "gateway not found") - ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 1109, "invalid gateway address") - ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 1110, "application already delegated to gateway") - ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1111, "maximum number of delegated gateways reached") - ErrAppInvalidMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1112, "invalid MaxDelegatedGateways parameter") - ErrAppNotDelegated = sdkerrors.Register(ModuleName, 1113, "application not delegated to gateway") + ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1101, "invalid application stake") + ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid application address") + ErrAppUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized application signer") + ErrAppNotFound = sdkerrors.Register(ModuleName, 1104, "application not found") + ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 1106, "invalid service configs") + ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 1107, "gateway not found") + ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 1108, "invalid gateway address") + ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 1109, "application already delegated to gateway") + ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1110, "maximum number of delegated gateways reached") + ErrAppInvalidMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1111, "invalid MaxDelegatedGateways parameter") + ErrAppNotDelegated = sdkerrors.Register(ModuleName, 1112, "application not delegated to gateway") ) diff --git a/x/application/types/expected_keepers.go b/x/application/types/expected_keepers.go index bf19c659b..69fb7ac82 100644 --- a/x/application/types/expected_keepers.go +++ b/x/application/types/expected_keepers.go @@ -1,7 +1,7 @@ -package types - //go:generate mockgen -destination ../../../testutil/application/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,GatewayKeeper +package types + import ( "context" @@ -26,9 +26,3 @@ type BankKeeper interface { type GatewayKeeper interface { GetGateway(ctx context.Context, addr string) (gatewaytypes.Gateway, bool) } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/application/types/genesis.go b/x/application/types/genesis.go index 1e47c655b..7052405e9 100644 --- a/x/application/types/genesis.go +++ b/x/application/types/genesis.go @@ -3,15 +3,11 @@ package types import ( "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" ) -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ @@ -25,14 +21,14 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in application - applicationIndexMap := make(map[string]struct{}) + applicationAddrMap := make(map[string]struct{}) for _, app := range gs.ApplicationList { - index := string(ApplicationKey(app.Address)) - if _, ok := applicationIndexMap[index]; ok { + appAddr := string(ApplicationKey(app.Address)) + if _, ok := applicationAddrMap[appAddr]; ok { return fmt.Errorf("duplicated index for application") } - applicationIndexMap[index] = struct{}{} + applicationAddrMap[appAddr] = struct{}{} } // Check that the stake value for the apps is valid and that the delegatee addresses are valid @@ -40,32 +36,32 @@ func (gs GenesisState) Validate() error { // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, // similar to how we have `ValidateAppServiceConfigs` below if app.Stake == nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "nil stake amount for application") + return ErrAppInvalidStake.Wrapf("nil stake amount for application") } stake, err := sdk.ParseCoinNormalized(app.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) + return ErrAppInvalidStake.Wrapf("invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse stake amount for application %v; (%v)", app.Stake, err) + return ErrAppInvalidStake.Wrapf("cannot parse stake amount for application %v; (%v)", app.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", app.Stake) + return ErrAppInvalidStake.Wrapf("invalid stake amount for application: %v <= 0", app.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application %v", app.Stake) + return ErrAppInvalidStake.Wrapf("invalid stake amount denom for application %v", app.Stake) } // Check that the application's delegated gateway addresses are valid for _, gatewayAddr := range app.DelegateeGatewayAddresses { if _, err := sdk.AccAddressFromBech32(gatewayAddr); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", gatewayAddr, err) + return ErrAppInvalidGatewayAddress.Wrapf("invalid gateway address %s; (%v)", gatewayAddr, err) } } // Validate the application service configs if err := servicehelpers.ValidateAppServiceConfigs(app.ServiceConfigs); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) + return ErrAppInvalidServiceConfigs.Wrapf(err.Error()) } } diff --git a/x/application/types/genesis_test.go b/x/application/types/genesis_test.go new file mode 100644 index 000000000..8c300c093 --- /dev/null +++ b/x/application/types/genesis_test.go @@ -0,0 +1,409 @@ +package types_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/application/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", math.NewInt(100)) + svc1AppConfig := &sharedtypes.ApplicationServiceConfig{ + Service: &sharedtypes.Service{Id: "svc1"}, + } + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", math.NewInt(100)) + svc2AppConfig := &sharedtypes.ApplicationServiceConfig{ + Service: &sharedtypes.Service{Id: "svc2"}, + } + + emptyDelegatees := make([]string, 0) + gatewayAddr1 := sample.AccAddress() + gatewayAddr2 := sample.AccAddress() + + tests := []struct { + desc string + genState *types.GenesisState + isValid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + isValid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, + }, + { + Address: addr2, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + isValid: true, + }, + { + desc: "invalid - zero app stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - negative application stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - due to duplicated app address", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr1, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - due to nil app stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: nil, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - due to missing app stake", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + // Stake explicitly omitted + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - due to invalid delegatee pub key", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + { + Address: addr2, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{"invalid address"}, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - due to invalid delegatee pub keys", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr1}, + }, + { + Address: addr2, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{"invalid address", gatewayAddr2}, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - service config not present", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + // ServiceConfigs explicitly omitted + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - empty service config", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{}, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - service ID too long", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "12345678901"}}, + }, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - service name too long", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{ + Id: "123", + Name: "abcdefghijklmnopqrstuvwxyzab-abcdefghijklmnopqrstuvwxyzab", + }}, + }, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - service ID with invalid characters", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 7, + }, + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ + {Service: &sharedtypes.Service{Id: "12 45 !"}}, + }, + DelegateeGatewayAddresses: emptyDelegatees, + }, + }, + }, + isValid: false, + }, + { + desc: "invalid - MaxDelegatedGateways less than 1", + genState: &types.GenesisState{ + Params: types.Params{ + MaxDelegatedGateways: 0, + }, + }, + isValid: false, + }, + { + desc: "duplicated application", + genState: &types.GenesisState{ + ApplicationList: []types.Application{ + { + Address: addr1, + Stake: &stake1, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc1AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr1, gatewayAddr2}, + }, + { + Address: addr1, + Stake: &stake2, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{svc2AppConfig}, + DelegateeGatewayAddresses: []string{gatewayAddr2, gatewayAddr1}, + }, + }, + }, + isValid: false, + }, + + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.isValid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/application/types/key_application.go b/x/application/types/key_application.go index 02cbefc4e..cb11774ec 100644 --- a/x/application/types/key_application.go +++ b/x/application/types/key_application.go @@ -6,17 +6,15 @@ var _ binary.ByteOrder const ( // ApplicationKeyPrefix is the prefix to retrieve all Application - ApplicationKeyPrefix = "Application/value/" + ApplicationKeyPrefix = "Application/address/" ) // ApplicationKey returns the store key to retrieve a Application from the index fields -func ApplicationKey( - address string, -) []byte { +func ApplicationKey(appAddr string) []byte { var key []byte - addressBytes := []byte(address) - key = append(key, addressBytes...) + appAddrBz := []byte(appAddr) + key = append(key, appAddrBz...) key = append(key, []byte("/")...) return key diff --git a/x/application/types/keys.go b/x/application/types/keys.go index aad5dc550..15d80a2a9 100644 --- a/x/application/types/keys.go +++ b/x/application/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_application" ) -var ( - ParamsKey = []byte("p_application") -) +var ParamsKey = []byte("p_application") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/application/types/message_delegate_to_gateway.go b/x/application/types/message_delegate_to_gateway.go index cc505287f..4f82237eb 100644 --- a/x/application/types/message_delegate_to_gateway.go +++ b/x/application/types/message_delegate_to_gateway.go @@ -1,9 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgDelegateToGateway)(nil) @@ -24,11 +21,11 @@ func (msg *MsgDelegateToGateway) NewRedelegationEvent() *EventRedelegation { func (msg *MsgDelegateToGateway) ValidateBasic() error { // Validate the application address if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) + return ErrAppInvalidAddress.Wrapf("invalid application address %s; (%v)", msg.AppAddress, err) } // Validate the gateway address if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) + return ErrAppInvalidGatewayAddress.Wrapf("invalid gateway address %s; (%v)", msg.GatewayAddress, err) } return nil } diff --git a/x/application/types/message_delegate_to_gateway_test.go b/x/application/types/message_delegate_to_gateway_test.go index 3d0f88b6b..9eef80ec5 100644 --- a/x/application/types/message_delegate_to_gateway_test.go +++ b/x/application/types/message_delegate_to_gateway_test.go @@ -9,47 +9,47 @@ import ( func TestMsgDelegateToGateway_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgDelegateToGateway - err error + desc string + msg MsgDelegateToGateway + expectedErr error }{ { - name: "invalid app address - no gateway address", + desc: "invalid app address - no gateway address", msg: MsgDelegateToGateway{ AppAddress: "invalid_address", - // GatewayAddress: intentionally omitted, + // GatewayAddress explicitly omitted, }, - err: ErrAppInvalidAddress, + expectedErr: ErrAppInvalidAddress, }, { - name: "valid app address - no gateway address", + desc: "valid app address - no gateway address", msg: MsgDelegateToGateway{ AppAddress: sample.AccAddress(), - // GatewayAddress: intentionally omitted, + // GatewayAddress explicitly omitted, }, - err: ErrAppInvalidGatewayAddress, + expectedErr: ErrAppInvalidGatewayAddress, }, { - name: "valid app address - invalid gateway address", + desc: "valid app address - invalid gateway address", msg: MsgDelegateToGateway{ AppAddress: sample.AccAddress(), GatewayAddress: "invalid_address", }, - err: ErrAppInvalidGatewayAddress, + expectedErr: ErrAppInvalidGatewayAddress, }, { - name: "valid address", + desc: "valid address", msg: MsgDelegateToGateway{ AppAddress: sample.AccAddress(), GatewayAddress: sample.AccAddress(), }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/application/types/message_stake_application.go b/x/application/types/message_stake_application.go index f7c739fcc..7631b161d 100644 --- a/x/application/types/message_stake_application.go +++ b/x/application/types/message_stake_application.go @@ -1,7 +1,6 @@ package types import ( - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" @@ -12,12 +11,12 @@ var _ sdk.Msg = (*MsgStakeApplication)(nil) // TODO_TECHDEBT: See `NewMsgStakeSupplier` and follow the same pattern for the `Services` parameter func NewMsgStakeApplication( - address string, + appAddr string, stake sdk.Coin, appServiceConfigs []*sharedtypes.ApplicationServiceConfig, ) *MsgStakeApplication { return &MsgStakeApplication{ - Address: address, + Address: appAddr, Stake: &stake, Services: appServiceConfigs, } @@ -27,31 +26,31 @@ func (msg *MsgStakeApplication) ValidateBasic() error { // Validate the address _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.Address, err) + return ErrAppInvalidAddress.Wrapf("invalid application address %s; (%v)", msg.Address, err) } // TODO_TECHDEBT: Centralize stake related verification and share across different parts of the source code // Validate the stake amount if msg.Stake == nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "nil application stake; (%v)", err) + return ErrAppInvalidStake.Wrapf("nil application stake; (%v)", err) } stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid application stake %v; (%v)", msg.Stake, stake.Validate()) + return ErrAppInvalidStake.Wrapf("invalid application stake %v; (%v)", msg.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse application stake %v; (%v)", msg.Stake, err) + return ErrAppInvalidStake.Wrapf("cannot parse application stake %v; (%v)", msg.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", msg.Stake) + return ErrAppInvalidStake.Wrapf("invalid stake amount for application: %v <= 0", msg.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount denom for application: %v", msg.Stake) + return ErrAppInvalidStake.Wrapf("invalid stake amount denom for application: %v", msg.Stake) } // Validate the application service configs if err := servicehelpers.ValidateAppServiceConfigs(msg.Services); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidServiceConfigs, err.Error()) + return ErrAppInvalidServiceConfigs.Wrapf(err.Error()) } return nil diff --git a/x/application/types/message_stake_application_test.go b/x/application/types/message_stake_application_test.go index 155986110..697e40997 100644 --- a/x/application/types/message_stake_application_test.go +++ b/x/application/types/message_stake_application_test.go @@ -3,7 +3,7 @@ package types import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -13,91 +13,91 @@ import ( func TestMsgStakeApplication_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgStakeApplication - err error + desc string + msg MsgStakeApplication + expectedErr error }{ // address related tests { - name: "invalid address - nil stake", + desc: "invalid address - nil stake", msg: MsgStakeApplication{ Address: "invalid_address", - // Stake explicitly nil + // Stake explicitly omitted Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - err: ErrAppInvalidAddress, + expectedErr: ErrAppInvalidAddress, }, // stake related tests { - name: "valid address - nil stake", + desc: "valid address - nil stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), - // Stake explicitly nil + // Stake explicitly omitted Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - err: ErrAppInvalidStake, + expectedErr: ErrAppInvalidStake, }, { - name: "valid address - valid stake", + desc: "valid address - valid stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, }, { - name: "valid address - zero stake", + desc: "valid address - zero stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - err: ErrAppInvalidStake, + expectedErr: ErrAppInvalidStake, }, { - name: "valid address - negative stake", + desc: "valid address - negative stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - err: ErrAppInvalidStake, + expectedErr: ErrAppInvalidStake, }, { - name: "valid address - invalid stake denom", + desc: "valid address - invalid stake denom", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - err: ErrAppInvalidStake, + expectedErr: ErrAppInvalidStake, }, { - name: "valid address - invalid stake missing denom", + desc: "valid address - invalid stake missing denom", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - err: ErrAppInvalidStake, + expectedErr: ErrAppInvalidStake, }, // service related tests { - name: "valid service configs - multiple services", + desc: "valid service configs - multiple services", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "svc1"}}, {Service: &sharedtypes.Service{Id: "svc2"}}, @@ -105,39 +105,39 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { }, }, { - name: "invalid service configs - not present", + desc: "invalid service configs - not present", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, - // Services: omitted + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + // Services explicitly omitted }, - err: ErrAppInvalidServiceConfigs, + expectedErr: ErrAppInvalidServiceConfigs, }, { - name: "invalid service configs - empty", + desc: "invalid service configs - empty", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{}, }, - err: ErrAppInvalidServiceConfigs, + expectedErr: ErrAppInvalidServiceConfigs, }, { - name: "invalid service configs - invalid service ID that's too long", + desc: "invalid service configs - invalid service ID that's too long", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "123456790"}}, }, }, - err: ErrAppInvalidServiceConfigs, + expectedErr: ErrAppInvalidServiceConfigs, }, { - name: "invalid service configs - invalid service Name that's too long", + desc: "invalid service configs - invalid service Name that's too long", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{ Id: "123", @@ -145,26 +145,26 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { }}, }, }, - err: ErrAppInvalidServiceConfigs, + expectedErr: ErrAppInvalidServiceConfigs, }, { - name: "invalid service configs - invalid service ID that contains invalid characters", + desc: "invalid service configs - invalid service ID that contains invalid characters", msg: MsgStakeApplication{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.ApplicationServiceConfig{ {Service: &sharedtypes.Service{Id: "12 45 !"}}, }, }, - err: ErrAppInvalidServiceConfigs, + expectedErr: ErrAppInvalidServiceConfigs, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/application/types/message_undelegate_from_gateway.go b/x/application/types/message_undelegate_from_gateway.go index e2bf8ac44..e0e8af45c 100644 --- a/x/application/types/message_undelegate_from_gateway.go +++ b/x/application/types/message_undelegate_from_gateway.go @@ -1,9 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgUndelegateFromGateway)(nil) @@ -24,11 +21,11 @@ func (msg *MsgUndelegateFromGateway) NewRedelegationEvent() *EventRedelegation { func (msg *MsgUndelegateFromGateway) ValidateBasic() error { // Validate the application address if _, err := sdk.AccAddressFromBech32(msg.AppAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidAddress, "invalid application address %s; (%v)", msg.AppAddress, err) + return ErrAppInvalidAddress.Wrapf("invalid application address %s; (%v)", msg.AppAddress, err) } // Validate the gateway address if _, err := sdk.AccAddressFromBech32(msg.GatewayAddress); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", msg.GatewayAddress, err) + return ErrAppInvalidGatewayAddress.Wrapf("invalid gateway address %s; (%v)", msg.GatewayAddress, err) } return nil } diff --git a/x/application/types/message_undelegate_from_gateway_test.go b/x/application/types/message_undelegate_from_gateway_test.go index 87ad660c9..b1ce71f17 100644 --- a/x/application/types/message_undelegate_from_gateway_test.go +++ b/x/application/types/message_undelegate_from_gateway_test.go @@ -10,44 +10,44 @@ import ( func TestMsgUndelegateFromGateway_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUndelegateFromGateway - err error + desc string + msg MsgUndelegateFromGateway + expectedErr error }{ { - name: "invalid app address - no gateway address", + desc: "invalid app address - no gateway address", msg: MsgUndelegateFromGateway{ AppAddress: "invalid_address", - // GatewayAddress: sample.AccAddress(), + // GatewayAddress explicitly omitted }, - err: ErrAppInvalidAddress, + expectedErr: ErrAppInvalidAddress, }, { - name: "valid app address - no gateway address", + desc: "valid app address - no gateway address", msg: MsgUndelegateFromGateway{ AppAddress: sample.AccAddress(), - // GatewayAddress: sample.AccAddress(), + // GatewayAddress explicitly omitted }, - err: ErrAppInvalidGatewayAddress, + expectedErr: ErrAppInvalidGatewayAddress, }, { - name: "valid app address - invalid gateway address", + desc: "valid app address - invalid gateway address", msg: MsgUndelegateFromGateway{ AppAddress: sample.AccAddress(), GatewayAddress: "invalid_address", }, - err: ErrAppInvalidGatewayAddress, + expectedErr: ErrAppInvalidGatewayAddress, }, { - name: "valid address", + desc: "valid address", msg: MsgUndelegateFromGateway{ AppAddress: sample.AccAddress(), GatewayAddress: sample.AccAddress(), }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/application/types/message_unstake_application.go b/x/application/types/message_unstake_application.go index bceeda6d7..19b1f24e9 100644 --- a/x/application/types/message_unstake_application.go +++ b/x/application/types/message_unstake_application.go @@ -1,22 +1,20 @@ package types import ( - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) var _ sdk.Msg = (*MsgUnstakeApplication)(nil) -func NewMsgUnstakeApplication(address string) *MsgUnstakeApplication { +func NewMsgUnstakeApplication(appAddr string) *MsgUnstakeApplication { return &MsgUnstakeApplication{ - Address: address, + Address: appAddr, } } func (msg *MsgUnstakeApplication) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - return errorsmod.Wrapf(ErrAppInvalidAddress, "invalid address address (%s)", err) + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return ErrAppInvalidAddress.Wrapf("invalid address address (%s)", err) } return nil } diff --git a/x/application/types/message_unstake_application_test.go b/x/application/types/message_unstake_application_test.go index fdc9a5a91..b695356eb 100644 --- a/x/application/types/message_unstake_application_test.go +++ b/x/application/types/message_unstake_application_test.go @@ -10,34 +10,34 @@ import ( func TestMsgUnstakeApplication_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUnstakeApplication - err error + desc string + msg MsgUnstakeApplication + expectedErr error }{ { - name: "valid", + desc: "valid", msg: MsgUnstakeApplication{ Address: sample.AccAddress(), }, }, { - name: "invalid - missing address", - msg: MsgUnstakeApplication{}, - err: ErrAppInvalidAddress, + desc: "invalid - missing address", + msg: MsgUnstakeApplication{}, + expectedErr: ErrAppInvalidAddress, }, { - name: "invalid - invalid address", + desc: "invalid - invalid address", msg: MsgUnstakeApplication{ Address: "invalid_address", }, - err: ErrAppInvalidAddress, + expectedErr: ErrAppInvalidAddress, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/application/types/msg_update_params.go b/x/application/types/message_update_params.go similarity index 100% rename from x/application/types/msg_update_params.go rename to x/application/types/message_update_params.go diff --git a/x/application/types/params.go b/x/application/types/params.go index 2efad3990..7542f35ac 100644 --- a/x/application/types/params.go +++ b/x/application/types/params.go @@ -3,13 +3,12 @@ package types import ( "fmt" - sdkerrors "cosmossdk.io/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -var _ paramtypes.ParamSet = (*Params)(nil) - var ( + _ paramtypes.ParamSet = (*Params)(nil) + KeyMaxDelegatedGateways = []byte("MaxDelegatedGateways") // TODO: Determine the default value DefaultMaxDelegatedGateways uint64 = 7 @@ -21,9 +20,7 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams( - maxDelegatedGateways uint64, -) Params { +func NewParams(maxDelegatedGateways uint64) Params { return Params{ MaxDelegatedGateways: maxDelegatedGateways, } @@ -31,9 +28,7 @@ func NewParams( // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams( - DefaultMaxDelegatedGateways, - ) + return NewParams(DefaultMaxDelegatedGateways) } // ParamSetPairs get the params.ParamSet @@ -62,7 +57,7 @@ func validateMaxDelegatedGateways(v interface{}) error { // Hard-coding a value of 1 because we never expect this to change. // If an application choses to delegate, at least one is required. if maxDelegatedGateways < 1 { - return sdkerrors.Wrapf(ErrAppInvalidMaxDelegatedGateways, "MaxDelegatedGateways param < 1: got %d", maxDelegatedGateways) + return ErrAppInvalidMaxDelegatedGateways.Wrapf("MaxDelegatedGateways param < 1: got %d", maxDelegatedGateways) } return nil From e71f512ceba9db6d1e2e26c2ce67bd899e1340a2 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Tue, 20 Feb 2024 10:14:35 +0100 Subject: [PATCH 41/54] chore: supplier module review improvements --- api/poktroll/shared/supplier.pulsar.go | 59 +++++----- api/poktroll/supplier/tx.pulsar.go | 1 + proto/poktroll/shared/supplier.proto | 3 +- proto/poktroll/supplier/genesis.proto | 6 +- proto/poktroll/supplier/params.proto | 6 +- proto/poktroll/supplier/query.proto | 6 +- proto/poktroll/supplier/tx.proto | 26 +++-- testutil/keeper/supplier.go | 8 +- x/supplier/config/errors.go | 23 ++-- .../config/supplier_configs_reader_test.go | 82 ++++++++++++- x/supplier/keeper/msg_server.go | 4 +- .../keeper/msg_server_stake_supplier.go | 18 ++- .../keeper/msg_server_stake_supplier_test.go | 51 ++++---- x/supplier/keeper/msg_server_test.go | 4 + .../keeper/msg_server_unstake_supplier.go | 5 +- .../msg_server_unstake_supplier_test.go | 22 ++-- x/supplier/keeper/msg_update_params.go | 11 +- x/supplier/keeper/msg_update_params_test.go | 42 ++++--- x/supplier/keeper/params.go | 10 +- x/supplier/keeper/query.go | 4 +- x/supplier/keeper/query_params.go | 7 +- x/supplier/keeper/query_supplier.go | 37 +++--- x/supplier/keeper/query_supplier_test.go | 30 ++--- x/supplier/keeper/supplier.go | 24 ++-- x/supplier/keeper/supplier_test.go | 14 +-- x/supplier/module/autocli.go | 68 +++++------ x/supplier/module/genesis.go | 16 +-- x/supplier/module/helpers_test.go | 1 - x/supplier/module/module.go | 5 +- x/supplier/module/query.go | 3 +- x/supplier/module/query_supplier.go | 2 +- x/supplier/module/query_supplier_test.go | 41 ++++--- x/supplier/module/tx.go | 11 +- x/supplier/module/tx_stake_supplier.go | 2 +- x/supplier/module/tx_stake_supplier_test.go | 109 +++++++++--------- x/supplier/module/tx_unstake_supplier_test.go | 39 ++++--- x/supplier/simulation/stake_supplier.go | 2 + x/supplier/simulation/unstake_supplier.go | 1 + x/supplier/types/errors.go | 30 ++--- x/supplier/types/expected_keepers.go | 6 - x/supplier/types/genesis.go | 24 ++-- x/supplier/types/genesis_test.go | 40 +++---- x/supplier/types/key_supplier.go | 10 +- x/supplier/types/keys.go | 8 +- x/supplier/types/message_stake_supplier.go | 2 +- .../types/message_stake_supplier_test.go | 92 +++++++-------- x/supplier/types/message_unstake_supplier.go | 6 +- .../types/message_unstake_supplier_test.go | 28 ++--- ...ate_params.go => message_update_params.go} | 2 +- x/supplier/types/params.go | 4 +- x/supplier/types/types.go | 2 + 51 files changed, 555 insertions(+), 502 deletions(-) rename x/supplier/types/{msg_update_params.go => message_update_params.go} (91%) diff --git a/api/poktroll/shared/supplier.pulsar.go b/api/poktroll/shared/supplier.pulsar.go index a0e0c637e..ac65f36e6 100644 --- a/api/poktroll/shared/supplier.pulsar.go +++ b/api/poktroll/shared/supplier.pulsar.go @@ -6,7 +6,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -723,36 +722,34 @@ var file_poktroll_shared_supplier_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, - 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x08, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x32, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x6b, 0x65, 0x12, 0x42, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, - 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x01, 0x0a, 0x08, + 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x12, 0x42, 0x0a, + 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x42, 0xa3, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x42, 0x0d, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, 0x03, 0x50, + 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index 362a13a3b..d35e3f491 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -2663,6 +2663,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/supplier parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } diff --git a/proto/poktroll/shared/supplier.proto b/proto/poktroll/shared/supplier.proto index 42c65eb67..5553f5673 100644 --- a/proto/poktroll/shared/supplier.proto +++ b/proto/poktroll/shared/supplier.proto @@ -2,9 +2,10 @@ syntax = "proto3"; package poktroll.shared; option go_package = "github.com/pokt-network/poktroll/x/shared/types"; -import "gogoproto/gogo.proto"; + import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/shared/service.proto"; // Supplier is the type defining the actor in Pocket Network that provides RPC services. diff --git a/proto/poktroll/supplier/genesis.proto b/proto/poktroll/supplier/genesis.proto index 5970cc005..dbda0e28a 100644 --- a/proto/poktroll/supplier/genesis.proto +++ b/proto/poktroll/supplier/genesis.proto @@ -1,14 +1,14 @@ syntax = "proto3"; - package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/supplier/params.proto"; import "poktroll/shared/supplier.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - // GenesisState defines the supplier module's genesis state. message GenesisState { diff --git a/proto/poktroll/supplier/params.proto b/proto/poktroll/supplier/params.proto index 031afe85a..a27a7ba7c 100644 --- a/proto/poktroll/supplier/params.proto +++ b/proto/poktroll/supplier/params.proto @@ -1,15 +1,13 @@ syntax = "proto3"; package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/supplier/Params"; option (gogoproto.equal) = true; - - } \ No newline at end of file diff --git a/proto/poktroll/supplier/query.proto b/proto/poktroll/supplier/query.proto index 8d3ad532d..4220f9a39 100644 --- a/proto/poktroll/supplier/query.proto +++ b/proto/poktroll/supplier/query.proto @@ -1,18 +1,18 @@ syntax = "proto3"; - package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/supplier/params.proto"; import "poktroll/shared/supplier.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; - // Query defines the gRPC querier service. service Query { diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 79ed6f5c3..ef75baa2f 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -1,21 +1,22 @@ syntax = "proto3"; - package poktroll.supplier; +option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; + import "poktroll/supplier/params.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); @@ -24,14 +25,17 @@ service Msg { } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the module parameters to update. - + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + + // params defines the x/supplier parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -42,8 +46,8 @@ message MsgUpdateParamsResponse {} message MsgStakeSupplier { option (cosmos.msg.v1.signer) = "address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) repeated poktroll.shared.SupplierServiceConfig services = 3; // The list of services this supplier is staked to provide service for } @@ -51,7 +55,7 @@ message MsgStakeSupplierResponse {} message MsgUnstakeSupplier { option (cosmos.msg.v1.signer) = "address"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the supplier using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding using cosmos' ScalarDescriptor to ensure deterministic deterministic encoding } message MsgUnstakeSupplierResponse {} diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go index ba9cb9b46..85c1cdff1 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" @@ -23,7 +24,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func SupplierKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func SupplierKeeper(t testing.TB) (keeper.Keeper, context.Context) { t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) @@ -53,7 +54,10 @@ func SupplierKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } + +// TODO_OPTIMIZE: Index suppliers by service so we can easily query k.GetAllSuppliers(ctx, Service) +// func (k Keeper) GetAllSuppliers(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/config/errors.go b/x/supplier/config/errors.go index 6a0194a75..80be44969 100644 --- a/x/supplier/config/errors.go +++ b/x/supplier/config/errors.go @@ -1,15 +1,18 @@ package config -import sdkerrors "cosmossdk.io/errors" +import ( + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/x/supplier/types" +) var ( - codespace = "supplierconfig" - ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrSupplierConfigInvalidServiceId = sdkerrors.Register(codespace, 2, "invalid serviceId in supplier config") - ErrSupplierConfigNoEndpoints = sdkerrors.Register(codespace, 3, "no endpoints defined for serviceId in supplier config") - ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(codespace, 4, "invalid endpoint config in supplier config") - ErrSupplierConfigInvalidRPCType = sdkerrors.Register(codespace, 5, "invalid rpc type in supplier config") - ErrSupplierConfigInvalidURL = sdkerrors.Register(codespace, 6, "invalid endpoint url in supplier config") - ErrSupplierConfigEmptyContent = sdkerrors.Register(codespace, 7, "empty supplier config content") - ErrSupplierConfigInvalidStake = sdkerrors.Register(codespace, 8, "invalid stake amount in supplier config") + ErrSupplierConfigUnmarshalYAML = sdkerrors.Register(types.ModuleName, 2100, "config reader cannot unmarshal yaml content") + ErrSupplierConfigInvalidServiceId = sdkerrors.Register(types.ModuleName, 2101, "invalid serviceId in supplier config") + ErrSupplierConfigNoEndpoints = sdkerrors.Register(types.ModuleName, 2102, "no endpoints defined for serviceId in supplier config") + ErrSupplierConfigInvalidEndpointConfig = sdkerrors.Register(types.ModuleName, 2103, "invalid endpoint config in supplier config") + ErrSupplierConfigInvalidRPCType = sdkerrors.Register(types.ModuleName, 2104, "invalid rpc type in supplier config") + ErrSupplierConfigInvalidURL = sdkerrors.Register(types.ModuleName, 2105, "invalid endpoint url in supplier config") + ErrSupplierConfigEmptyContent = sdkerrors.Register(types.ModuleName, 2106, "empty supplier config content") + ErrSupplierConfigInvalidStake = sdkerrors.Register(types.ModuleName, 2107, "invalid stake amount in supplier config") ) diff --git a/x/supplier/config/supplier_configs_reader_test.go b/x/supplier/config/supplier_configs_reader_test.go index d912156be..28d567fbb 100644 --- a/x/supplier/config/supplier_configs_reader_test.go +++ b/x/supplier/config/supplier_configs_reader_test.go @@ -1 +1,81 @@ -package config +package config_test + +import ( + "testing" + + sdkerrors "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/yaml" + "github.com/pokt-network/poktroll/x/gateway/module/config" +) + +func Test_ParseGatewayStakeConfig(t *testing.T) { + tests := []struct { + desc string + expectedErr *sdkerrors.Error + expectedConfig *config.GatewayStakeConfig + inputConfig string + }{ + // Valid Configs + { + desc: "valid gateway stake config", + inputConfig: ` + stake_amount: 1000upokt + `, + expectedErr: nil, + expectedConfig: &config.GatewayStakeConfig{ + StakeAmount: sdk.NewCoin("upokt", math.NewInt(1000)), + }, + }, + // Invalid Configs + { + desc: "services_test: invalid service config with empty content", + expectedErr: config.ErrGatewayConfigEmptyContent, + inputConfig: ``, + }, + { + desc: "invalid stake denom", + inputConfig: ` + stake_amount: 1000invalid + `, + expectedErr: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "negative stake amount", + inputConfig: ` + stake_amount: -1000upokt + `, + expectedErr: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "zero stake amount", + inputConfig: ` + stake_amount: 0upokt + `, + expectedErr: config.ErrGatewayConfigInvalidStake, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) + + if tt.expectedErr != nil { + require.Error(t, err) + require.ErrorIs(t, err, tt.expectedErr) + require.Contains(t, err.Error(), tt.expectedErr.Error()) + require.Nil(t, supplierServiceConfig) + return + } + + require.NoError(t, err) + + require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) + require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) + }) + } +} diff --git a/x/supplier/keeper/msg_server.go b/x/supplier/keeper/msg_server.go index 83879071c..fc7ad310a 100644 --- a/x/supplier/keeper/msg_server.go +++ b/x/supplier/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) +import "github.com/pokt-network/poktroll/x/supplier/types" type msgServer struct { Keeper diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index d99447da1..3d6101f97 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -4,16 +4,13 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - +func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplier) (*types.MsgStakeSupplierResponse, error) { logger := k.Logger().With("method", "StakeSupplier") logger.Info(fmt.Sprintf("About to stake supplier with msg: %v", msg)) @@ -26,6 +23,7 @@ func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSuppl var err error var coinsToDelegate sdk.Coin supplier, isSupplierFound := k.GetSupplier(ctx, msg.Address) + if !isSupplierFound { logger.Info(fmt.Sprintf("Supplier not found. Creating new supplier for address %s", msg.Address)) supplier = k.createSupplier(ctx, msg) @@ -62,7 +60,7 @@ func (k msgServer) StakeSupplier(goCtx context.Context, msg *types.MsgStakeSuppl } func (k msgServer) createSupplier( - ctx sdk.Context, + _ context.Context, msg *types.MsgStakeSupplier, ) sharedtypes.Supplier { return sharedtypes.Supplier{ @@ -73,29 +71,29 @@ func (k msgServer) createSupplier( } func (k msgServer) updateSupplier( - ctx sdk.Context, + _ context.Context, supplier *sharedtypes.Supplier, msg *types.MsgStakeSupplier, ) error { // Checks if the the msg address is the same as the current owner if msg.Address != supplier.Address { - return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) + return types.ErrSupplierUnauthorized.Wrapf("msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) } // Validate that the stake is not being lowered if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") + return types.ErrSupplierInvalidStake.Wrapf("stake amount cannot be nil") } if msg.Stake.IsLTE(*supplier.Stake) { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) + return types.ErrSupplierInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) } supplier.Stake = msg.Stake // Validate that the service configs maintain at least one service. // Additional validation is done in `msg.ValidateBasic` above. if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrSupplierInvalidServiceConfig, "must have at least one service") + return types.ErrSupplierInvalidServiceConfig.Wrapf("must have at least one service") } supplier.Services = msg.Services diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index c97ee5558..b0d3f1d50 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -17,18 +17,17 @@ import ( func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { k, ctx := keepertest.SupplierKeeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) // Generate an address for the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) // Prepare the stakeMsg stakeMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -47,22 +46,22 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { } // Stake the supplier - _, err := srv.StakeSupplier(wctx, stakeMsg) + _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Verify that the supplier exists - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) + foundSupplier, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) - require.Equal(t, addr, supplierFound.Address) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8080", supplierFound.Services[0].Endpoints[0].Url) + require.Equal(t, supplierAddr, foundSupplier.Address) + require.Equal(t, int64(100), foundSupplier.Stake.Amount.Int64()) + require.Len(t, foundSupplier.Services, 1) + require.Equal(t, "svcId", foundSupplier.Services[0].Service.Id) + require.Len(t, foundSupplier.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8080", foundSupplier.Services[0].Endpoints[0].Url) // Prepare an updated supplier with a higher stake and a different URL for the service updateMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -81,15 +80,16 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { } // Update the staked supplier - _, err = srv.StakeSupplier(wctx, updateMsg) + _, err = srv.StakeSupplier(ctx, updateMsg) require.NoError(t, err) - supplierFound, isSupplierFound = k.GetSupplier(ctx, addr) + + foundSupplier, isSupplierFound = k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) - require.Equal(t, int64(200), supplierFound.Stake.Amount.Int64()) - require.Len(t, supplierFound.Services, 1) - require.Equal(t, "svcId2", supplierFound.Services[0].Service.Id) - require.Len(t, supplierFound.Services[0].Endpoints, 1) - require.Equal(t, "http://localhost:8082", supplierFound.Services[0].Endpoints[0].Url) + require.Equal(t, int64(200), foundSupplier.Stake.Amount.Int64()) + require.Len(t, foundSupplier.Services, 1) + require.Equal(t, "svcId2", foundSupplier.Services[0].Service.Id) + require.Len(t, foundSupplier.Services[0].Endpoints, 1) + require.Equal(t, "http://localhost:8082", foundSupplier.Services[0].Endpoints[0].Url) } func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) { @@ -177,9 +177,9 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Prepare the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() stakeMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -200,12 +200,13 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { // Stake the supplier & verify that the supplier exists _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) - _, isSupplierFound := k.GetSupplier(ctx, addr) + + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) // Prepare an updated supplier with a lower stake updateMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -228,7 +229,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { require.Error(t, err) // Verify that the supplier stake is unchanged - supplierFound, isSupplierFound := k.GetSupplier(ctx, addr) + supplierFound, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) require.Len(t, supplierFound.Services, 1) diff --git a/x/supplier/keeper/msg_server_test.go b/x/supplier/keeper/msg_server_test.go index 480dd0262..e9ef42753 100644 --- a/x/supplier/keeper/msg_server_test.go +++ b/x/supplier/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.SupplierKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go index 41f3de736..cb9c6230c 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ b/x/supplier/keeper/msg_server_unstake_supplier.go @@ -9,12 +9,11 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) +// TODO(#73): Determine if an application needs an unbonding period after unstaking. func (k msgServer) UnstakeSupplier( - goCtx context.Context, + ctx context.Context, msg *types.MsgUnstakeSupplier, ) (*types.MsgUnstakeSupplierResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - logger := k.Logger().With("method", "UnstakeSupplier") logger.Info(fmt.Sprintf("About to unstake supplier with msg: %v", msg)) diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go index c3b9d9144..fc601f9d9 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ b/x/supplier/keeper/msg_server_unstake_supplier_test.go @@ -19,16 +19,16 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) // Prepare the supplier initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeSupplier{ - Address: addr, + Address: supplierAddr, Stake: &initialStake, Services: []*sharedtypes.SupplierServiceConfig{ { @@ -51,19 +51,19 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { require.NoError(t, err) // Verify that the supplier exists - foundSupplier, isSupplierFound := k.GetSupplier(ctx, addr) + foundSupplier, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.True(t, isSupplierFound) - require.Equal(t, addr, foundSupplier.Address) + require.Equal(t, supplierAddr, foundSupplier.Address) require.Equal(t, initialStake.Amount, foundSupplier.Stake.Amount) require.Len(t, foundSupplier.Services, 1) // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} + unstakeMsg := &types.MsgUnstakeSupplier{Address: supplierAddr} _, err = srv.UnstakeSupplier(ctx, unstakeMsg) require.NoError(t, err) // Make sure the supplier can no longer be found after unstaking - _, isSupplierFound = k.GetSupplier(ctx, addr) + _, isSupplierFound = k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) } @@ -72,18 +72,18 @@ func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Generate an address for the supplier - addr := sample.AccAddress() + supplierAddr := sample.AccAddress() // Verify that the supplier does not exist yet - _, isSupplierFound := k.GetSupplier(ctx, addr) + _, isSupplierFound := k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) // Unstake the supplier - unstakeMsg := &types.MsgUnstakeSupplier{Address: addr} + unstakeMsg := &types.MsgUnstakeSupplier{Address: supplierAddr} _, err := srv.UnstakeSupplier(ctx, unstakeMsg) require.Error(t, err) require.ErrorIs(t, err, types.ErrSupplierNotFound) - _, isSupplierFound = k.GetSupplier(ctx, addr) + _, isSupplierFound = k.GetSupplier(ctx, supplierAddr) require.False(t, isSupplierFound) } diff --git a/x/supplier/keeper/msg_update_params.go b/x/supplier/keeper/msg_update_params.go index 01aaace7c..dbec01545 100644 --- a/x/supplier/keeper/msg_update_params.go +++ b/x/supplier/keeper/msg_update_params.go @@ -3,18 +3,17 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams( + ctx context.Context, + req *types.MsgUpdateParams, +) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/supplier/keeper/msg_update_params_test.go b/x/supplier/keeper/msg_update_params_test.go index 2e179b220..ccbb6ef2e 100644 --- a/x/supplier/keeper/msg_update_params_test.go +++ b/x/supplier/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/supplier/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + params *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", - input: &types.MsgUpdateParams{ + desc: "invalid authority", + params: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", - input: &types.MsgUpdateParams{ + desc: "send enabled param", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", - input: &types.MsgUpdateParams{ + desc: "all good", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.params) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/supplier/keeper/params.go b/x/supplier/keeper/params.go index 6e3162e05..4e7dab63d 100644 --- a/x/supplier/keeper/params.go +++ b/x/supplier/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/supplier/keeper/query.go b/x/supplier/keeper/query.go index 2d1d5c18e..ff0dc934d 100644 --- a/x/supplier/keeper/query.go +++ b/x/supplier/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/supplier/types" -) +import "github.com/pokt-network/poktroll/x/supplier/types" var _ types.QueryServer = Keeper{} diff --git a/x/supplier/keeper/query_params.go b/x/supplier/keeper/query_params.go index 67e2a17f4..234f4c50b 100644 --- a/x/supplier/keeper/query_params.go +++ b/x/supplier/keeper/query_params.go @@ -3,18 +3,19 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params( + ctx context.Context, + req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go index d364ede93..f1f5f21c8 100644 --- a/x/supplier/keeper/query_supplier.go +++ b/x/supplier/keeper/query_supplier.go @@ -14,7 +14,10 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRequest) (*types.QueryAllSuppliersResponse, error) { +func (k Keeper) AllSuppliers( + ctx context.Context, + req *types.QueryAllSuppliersRequest, +) (*types.QueryAllSuppliersResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -24,15 +27,19 @@ func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRe store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) supplierStore := prefix.NewStore(store, types.KeyPrefix(types.SupplierKeyPrefix)) - pageRes, err := query.Paginate(supplierStore, req.Pagination, func(key []byte, value []byte) error { - var supplier sharedtypes.Supplier - if err := k.cdc.Unmarshal(value, &supplier); err != nil { - return err - } + pageRes, err := query.Paginate( + supplierStore, + req.Pagination, + func(key []byte, value []byte) error { + var supplier sharedtypes.Supplier + if err := k.cdc.Unmarshal(value, &supplier); err != nil { + return err + } - suppliers = append(suppliers, supplier) - return nil - }) + suppliers = append(suppliers, supplier) + return nil + }, + ) if err != nil { return nil, status.Error(codes.Internal, err.Error()) @@ -41,17 +48,17 @@ func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRe return &types.QueryAllSuppliersResponse{Supplier: suppliers, Pagination: pageRes}, nil } -func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { +func (k Keeper) Supplier( + ctx context.Context, + req *types.QueryGetSupplierRequest, +) (*types.QueryGetSupplierResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - supplier, found := k.GetSupplier( - ctx, - req.Address, - ) + supplier, found := k.GetSupplier(ctx, req.Address) if !found { - // TODO_TECHDEBT(#181): conform to logging conventions once established + // TODO_TECHDEBT(#384): conform to logging conventions once established msg := fmt.Sprintf("supplier with address %q", req.GetAddress()) return nil, status.Error(codes.NotFound, msg) } diff --git a/x/supplier/keeper/query_supplier_test.go b/x/supplier/keeper/query_supplier_test.go index ca80180c3..268390cf5 100644 --- a/x/supplier/keeper/query_supplier_test.go +++ b/x/supplier/keeper/query_supplier_test.go @@ -19,12 +19,12 @@ var _ = strconv.IntSize func TestSupplierQuerySingle(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 2) + suppliers := createNSuppliers(keeper, ctx, 2) tests := []struct { - desc string - request *types.QueryGetSupplierRequest - response *types.QueryGetSupplierResponse - err error + desc string + request *types.QueryGetSupplierRequest + response *types.QueryGetSupplierResponse + expectedErr error }{ { desc: "First", @@ -45,22 +45,22 @@ func TestSupplierQuerySingle(t *testing.T) { request: &types.QueryGetSupplierRequest{ Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "supplier with address \"100000\""), + expectedErr: status.Error(codes.NotFound, "supplier with address \"100000\""), }, { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Supplier(ctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Supplier(ctx, test.request) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } @@ -70,7 +70,7 @@ func TestSupplierQuerySingle(t *testing.T) { func TestSupplierQueryPaginated(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - msgs := createNSupplier(keeper, ctx, 5) + msgs := createNSuppliers(keeper, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllSuppliersRequest { return &types.QueryAllSuppliersRequest{ diff --git a/x/supplier/keeper/supplier.go b/x/supplier/keeper/supplier.go index 9f2ba9eb3..af9f8778b 100644 --- a/x/supplier/keeper/supplier.go +++ b/x/supplier/keeper/supplier.go @@ -24,15 +24,12 @@ func (k Keeper) SetSupplier(ctx context.Context, supplier sharedtypes.Supplier) // GetSupplier returns a supplier from its index func (k Keeper) GetSupplier( ctx context.Context, - address string, - + supplierAddr string, ) (supplier sharedtypes.Supplier, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) - supplierBz := store.Get(types.SupplierKey( - address, - )) + supplierBz := store.Get(types.SupplierKey(supplierAddr)) if supplierBz == nil { return supplier, false } @@ -42,20 +39,14 @@ func (k Keeper) GetSupplier( } // RemoveSupplier removes a supplier from the store -func (k Keeper) RemoveSupplier( - ctx context.Context, - address string, - -) { +func (k Keeper) RemoveSupplier(ctx context.Context, address string) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) - store.Delete(types.SupplierKey( - address, - )) + store.Delete(types.SupplierKey(address)) } -// GetAllSupplier returns all supplier -func (k Keeper) GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Supplier) { +// GetAllSuppliers returns all supplier +func (k Keeper) GetAllSuppliers(ctx context.Context) (suppliers []sharedtypes.Supplier) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.SupplierKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) @@ -70,3 +61,6 @@ func (k Keeper) GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Sup return } + +// TODO_OPTIMIZE: Index suppliers by service so we can easily query k.GetAllSuppliers(ctx, Service) +// func (k Keeper) GetAllSuppliers(ctx, sdkContext, serviceId string) (suppliers []sharedtypes.Supplier) {} diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go index 28e324e07..c30d8a083 100644 --- a/x/supplier/keeper/supplier_test.go +++ b/x/supplier/keeper/supplier_test.go @@ -27,7 +27,7 @@ func init() { cmd.InitSDKConfig() } -func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Supplier { +func createNSuppliers(keeper keeper.Keeper, ctx context.Context, n int) []sharedtypes.Supplier { suppliers := make([]sharedtypes.Supplier, n) for i := range suppliers { supplier := &suppliers[i] @@ -53,7 +53,7 @@ func createNSupplier(keeper keeper.Keeper, ctx context.Context, n int) []sharedt func TestSupplierGet(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 10) + suppliers := createNSuppliers(keeper, ctx, 10) for _, supplier := range suppliers { supplierFound, isSupplierFound := keeper.GetSupplier(ctx, supplier.Address, @@ -68,11 +68,9 @@ func TestSupplierGet(t *testing.T) { func TestSupplierRemove(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 10) + suppliers := createNSuppliers(keeper, ctx, 10) for _, supplier := range suppliers { - keeper.RemoveSupplier(ctx, - supplier.Address, - ) + keeper.RemoveSupplier(ctx, supplier.Address) _, isSupplierFound := keeper.GetSupplier(ctx, supplier.Address, ) @@ -82,10 +80,10 @@ func TestSupplierRemove(t *testing.T) { func TestSupplierGetAll(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t) - suppliers := createNSupplier(keeper, ctx, 10) + suppliers := createNSuppliers(keeper, ctx, 10) require.ElementsMatch(t, nullify.Fill(suppliers), - nullify.Fill(keeper.GetAllSupplier(ctx)), + nullify.Fill(keeper.GetAllSuppliers(ctx)), ) } diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index ec75e7031..6a3afe3a9 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -10,47 +10,47 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - }, - { - RpcMethod: "AllSuppliers", - Use: "list-supplier", - Short: "List all supplier", - }, - { - RpcMethod: "Supplier", - Use: "show-supplier [id]", - Short: "Shows a supplier", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, - }, + //{ + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + //}, + //{ + // RpcMethod: "AllSuppliers", + // Use: "list-supplier", + // Short: "List all supplier", + //}, + //{ + // RpcMethod: "Supplier", + // Use: "show-supplier [id]", + // Short: "Shows a supplier", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + //}, // this line is used by ignite scaffolding # autocli/query }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, - { - RpcMethod: "StakeSupplier", - Use: "stake-supplier [stake] [services]", - Short: "Send a stake-supplier tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, - }, - { - RpcMethod: "UnstakeSupplier", - Use: "unstake-supplier", - Short: "Send a unstake-supplier tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + //{ + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + //}, + //{ + // RpcMethod: "StakeSupplier", + // Use: "stake-supplier [stake] [services]", + // Short: "Send a stake-supplier tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}, {ProtoField: "services"}}, + //}, + //{ + // RpcMethod: "UnstakeSupplier", + // Use: "unstake-supplier", + // Short: "Send a unstake-supplier tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + //}, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/supplier/module/genesis.go b/x/supplier/module/genesis.go index f0a857fe4..d6d7d1b34 100644 --- a/x/supplier/module/genesis.go +++ b/x/supplier/module/genesis.go @@ -1,28 +1,30 @@ package supplier import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // Set all the supplier - for _, elem := range genState.SupplierList { - k.SetSupplier(ctx, elem) + for _, supplier := range genState.SupplierList { + k.SetSupplier(ctx, supplier) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.SupplierList = k.GetAllSupplier(ctx) + genesis.SupplierList = k.GetAllSuppliers(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/supplier/module/helpers_test.go b/x/supplier/module/helpers_test.go index 19f64b683..c31fd1839 100644 --- a/x/supplier/module/helpers_test.go +++ b/x/supplier/module/helpers_test.go @@ -18,7 +18,6 @@ var _ = strconv.IntSize // It returns the network and a slice of the created supplier objects. func networkWithSupplierObjects(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier) { t.Helper() - cfg := network.DefaultConfig() supplierGenesisState := network.DefaultSupplierModuleGenesisState(t, n) buf, err := cfg.Codec.MarshalJSON(supplierGenesisState) diff --git a/x/supplier/module/module.go b/x/supplier/module/module.go index 6cb134ae6..8ac44e592 100644 --- a/x/supplier/module/module.go +++ b/x/supplier/module/module.go @@ -166,10 +166,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/supplier/module/query.go b/x/supplier/module/query.go index 5fbb0b8f9..b49ebf142 100644 --- a/x/supplier/module/query.go +++ b/x/supplier/module/query.go @@ -10,6 +10,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetQueryCmd() *cobra.Command { // Group supplier queries under a subcommand cmd := &cobra.Command{ @@ -21,7 +22,7 @@ func (am AppModule) GetQueryCmd() *cobra.Command { } cmd.AddCommand(CmdQueryParams()) - cmd.AddCommand(CmdListSupplier()) + cmd.AddCommand(CmdListSuppliers()) cmd.AddCommand(CmdShowSupplier()) // this line is used by starport scaffolding # 1 diff --git a/x/supplier/module/query_supplier.go b/x/supplier/module/query_supplier.go index 4ddaefabd..bf565e651 100644 --- a/x/supplier/module/query_supplier.go +++ b/x/supplier/module/query_supplier.go @@ -8,7 +8,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func CmdListSupplier() *cobra.Command { +func CmdListSuppliers() *cobra.Command { cmd := &cobra.Command{ Use: "list-supplier", Short: "list all supplier", diff --git a/x/supplier/module/query_supplier_test.go b/x/supplier/module/query_supplier_test.go index 1cca10675..6cb48bf5d 100644 --- a/x/supplier/module/query_supplier_test.go +++ b/x/supplier/module/query_supplier_test.go @@ -13,9 +13,8 @@ import ( "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/testutil/nullify" - supplier "github.com/pokt-network/poktroll/x/supplier/module" - sharedtypes "github.com/pokt-network/poktroll/x/shared/types" + supplier "github.com/pokt-network/poktroll/x/supplier/module" "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -30,43 +29,43 @@ func TestShowSupplier(t *testing.T) { desc string idAddress string - args []string - err error - obj sharedtypes.Supplier + args []string + expectedErr error + supplier sharedtypes.Supplier }{ { desc: "supplier found", idAddress: suppliers[0].Address, - args: common, - obj: suppliers[0], + args: common, + supplier: suppliers[0], }, { desc: "supplier not found", idAddress: strconv.Itoa(100000), - args: common, - err: status.Error(codes.NotFound, "not found"), + args: common, + expectedErr: status.Error(codes.NotFound, "not found"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { args := []string{ - tc.idAddress, + test.idAddress, } - args = append(args, tc.args...) + args = append(args, test.args...) out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdShowSupplier(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) + require.ErrorIs(t, stat.Err(), test.expectedErr) } else { require.NoError(t, err) var resp types.QueryGetSupplierResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NotNil(t, resp.Supplier) require.Equal(t, - nullify.Fill(&tc.obj), + nullify.Fill(&test.supplier), nullify.Fill(&resp.Supplier), ) } @@ -74,7 +73,7 @@ func TestShowSupplier(t *testing.T) { } } -func TestListSupplier(t *testing.T) { +func TestListSuppliers(t *testing.T) { net, suppliers := networkWithSupplierObjects(t, 5) ctx := net.Validators[0].ClientCtx @@ -97,7 +96,7 @@ func TestListSupplier(t *testing.T) { step := 2 for i := 0; i < len(suppliers); i += step { args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSupplier(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSuppliers(), args) require.NoError(t, err) var resp types.QueryAllSuppliersResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) @@ -113,7 +112,7 @@ func TestListSupplier(t *testing.T) { var next []byte for i := 0; i < len(suppliers); i += step { args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSupplier(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSuppliers(), args) require.NoError(t, err) var resp types.QueryAllSuppliersResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) @@ -127,7 +126,7 @@ func TestListSupplier(t *testing.T) { }) t.Run("Total", func(t *testing.T) { args := request(nil, 0, uint64(len(suppliers)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSupplier(), args) + out, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdListSuppliers(), args) require.NoError(t, err) var resp types.QueryAllSuppliersResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) diff --git a/x/supplier/module/tx.go b/x/supplier/module/tx.go index 86a9438ae..535cfa1f7 100644 --- a/x/supplier/module/tx.go +++ b/x/supplier/module/tx.go @@ -2,7 +2,6 @@ package supplier import ( "fmt" - "time" "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" @@ -10,16 +9,8 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/supplier/module/tx_stake_supplier.go b/x/supplier/module/tx_stake_supplier.go index 5923e06ec..a9dd920cf 100644 --- a/x/supplier/module/tx_stake_supplier.go +++ b/x/supplier/module/tx_stake_supplier.go @@ -27,7 +27,7 @@ func CmdStakeSupplier() *cobra.Command { will stake the tokens and associate them with the supplier specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, +$ poktrolld tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { diff --git a/x/supplier/module/tx_stake_supplier_test.go b/x/supplier/module/tx_stake_supplier_test.go index e7423b0d9..44b0c5122 100644 --- a/x/supplier/module/tx_stake_supplier_test.go +++ b/x/supplier/module/tx_stake_supplier_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -29,6 +29,9 @@ func TestCLI_StakeSupplier(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) supplierAccount := accounts[0] + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -36,7 +39,7 @@ func TestCLI_StakeSupplier(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } defaultConfig := ` @@ -49,10 +52,10 @@ func TestCLI_StakeSupplier(t *testing.T) { ` tests := []struct { - desc string - address string - config string - err *sdkerrors.Error + desc string + address string + config string + expectedErr *sdkerrors.Error }{ // Happy Paths { @@ -65,21 +68,21 @@ func TestCLI_StakeSupplier(t *testing.T) { { desc: "stake supplier: missing address", // address: "explicitly missing", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, + expectedErr: types.ErrSupplierInvalidAddress, + config: defaultConfig, }, { - desc: "stake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, - config: defaultConfig, + desc: "stake supplier: invalid address", + address: "invalid", + expectedErr: types.ErrSupplierInvalidAddress, + config: defaultConfig, }, // Error Paths - Stake Related { - desc: "stake supplier: missing stake", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: missing stake", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` # explicitly omitted stake services: @@ -90,9 +93,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "stake supplier: invalid stake denom", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: invalid stake denom", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` stake_amount: 1000invalid services: @@ -103,9 +106,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "stake supplier: invalid stake amount (zero)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: invalid stake amount (zero)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` stake_amount: 0upokt services: @@ -116,9 +119,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "stake supplier: invalid stake amount (negative)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidStake, + desc: "stake supplier: invalid stake amount (negative)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidStake, config: ` stake_amount: -1000upokt services: @@ -185,27 +188,27 @@ func TestCLI_StakeSupplier(t *testing.T) { // Error Paths - Service Related { - desc: "services_test: invalid services (missing argument)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, - // servicesString: "explicitly omitted", + desc: "services_test: invalid services (missing argument)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, + // servicesString explicitly omitted config: ` stake_amount: 1000upokt `, }, { - desc: "services_test: invalid services (empty string)", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: invalid services (empty string)", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: `, }, { - desc: "services_test: invalid URL", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: invalid URL", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -216,9 +219,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "services_test: missing URLs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: missing URLs", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -227,9 +230,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "services_test: missing service IDs", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: missing service IDs", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -242,9 +245,9 @@ func TestCLI_StakeSupplier(t *testing.T) { `, }, { - desc: "services_test: missing rpc type", - address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidServiceConfig, + desc: "services_test: missing rpc type", + address: supplierAccount.Address.String(), + expectedErr: types.ErrSupplierInvalidServiceConfig, config: ` stake_amount: 1000upokt services: @@ -255,22 +258,19 @@ func TestCLI_StakeSupplier(t *testing.T) { }, } - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.config)).Name() + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(test.config)).Name() // Prepare the arguments for the CLI command args := []string{ fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.address), } args = append(args, commonArgs...) @@ -278,15 +278,16 @@ func TestCLI_StakeSupplier(t *testing.T) { outStake, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdStakeSupplier(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) - // Check the response + // Check the response, this test only asserts CLI command success and not + // the actual supplier module state. var resp sdk.TxResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) require.NotNil(t, resp) diff --git a/x/supplier/module/tx_unstake_supplier_test.go b/x/supplier/module/tx_unstake_supplier_test.go index 75644f58f..2d13d8797 100644 --- a/x/supplier/module/tx_unstake_supplier_test.go +++ b/x/supplier/module/tx_unstake_supplier_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -28,6 +28,9 @@ func TestCLI_UnstakeSupplier(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) supplierAccount := accounts[0] + // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, supplierAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -35,13 +38,13 @@ func TestCLI_UnstakeSupplier(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { - desc string - address string - err *sdkerrors.Error + desc string + address string + expectedErr *sdkerrors.Error }{ { desc: "unstake supplier: valid", @@ -50,27 +53,24 @@ func TestCLI_UnstakeSupplier(t *testing.T) { { desc: "unstake supplier: missing address", // address: supplierAccount.Address.String(), - err: types.ErrSupplierInvalidAddress, + expectedErr: types.ErrSupplierInvalidAddress, }, { - desc: "unstake supplier: invalid address", - address: "invalid", - err: types.ErrSupplierInvalidAddress, + desc: "unstake supplier: invalid address", + address: "invalid", + expectedErr: types.ErrSupplierInvalidAddress, }, } - // Initialize the Supplier Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, supplierAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.address), } args = append(args, commonArgs...) @@ -78,15 +78,16 @@ func TestCLI_UnstakeSupplier(t *testing.T) { outUnstake, err := clitestutil.ExecTestCLICmd(ctx, supplier.CmdUnstakeSupplier(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) - // Check the response + // Check the response, this test only asserts CLI command success and not + // the actual supplier module state. var resp sdk.TxResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) require.NotNil(t, resp) diff --git a/x/supplier/simulation/stake_supplier.go b/x/supplier/simulation/stake_supplier.go index a6f79739c..29acc1fd4 100644 --- a/x/supplier/simulation/stake_supplier.go +++ b/x/supplier/simulation/stake_supplier.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -20,6 +21,7 @@ func SimulateMsgStakeSupplier( simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgStakeSupplier{ Address: simAccount.Address.String(), + // TODO: Update all stake message fields } // TODO: Handling the StakeSupplier simulation diff --git a/x/supplier/simulation/unstake_supplier.go b/x/supplier/simulation/unstake_supplier.go index 377b74176..06a2a38c3 100644 --- a/x/supplier/simulation/unstake_supplier.go +++ b/x/supplier/simulation/unstake_supplier.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/supplier/keeper" "github.com/pokt-network/poktroll/x/supplier/types" ) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go index b6424cc9f..c89c13e39 100644 --- a/x/supplier/types/errors.go +++ b/x/supplier/types/errors.go @@ -2,26 +2,18 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/supplier module sentinel errors var ( - ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake") - ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") - ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") - ErrSupplierNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") - ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") - ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") - ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") - ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") - ErrSupplierInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") - ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") - ErrSupplierInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") - ErrSupplierClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") - ErrSupplierProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") - ErrSupplierInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") - ErrSupplierInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSupplierInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1101, "invalid supplier stake") + ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid address") + ErrSupplierUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized supplier signer") + ErrSupplierNotFound = sdkerrors.Register(ModuleName, 1104, "supplier not found") + ErrSupplierInvalidServiceConfig = sdkerrors.Register(ModuleName, 1105, "invalid service config") + ErrSupplierInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 1106, "invalid session start height") + ErrSupplierInvalidSessionId = sdkerrors.Register(ModuleName, 1107, "invalid session ID") + ErrSupplierInvalidService = sdkerrors.Register(ModuleName, 1108, "invalid service in supplier") + ErrSupplierInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 1109, "invalid session ending height") ) diff --git a/x/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go index 6680b26e0..c0d57d5d4 100644 --- a/x/supplier/types/expected_keepers.go +++ b/x/supplier/types/expected_keepers.go @@ -19,9 +19,3 @@ type BankKeeper interface { DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go index 9d06b42ff..d7d3a341a 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/types/genesis.go @@ -3,16 +3,12 @@ package types import ( "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" servicehelpers "github.com/pokt-network/poktroll/x/shared/helpers" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ @@ -26,13 +22,13 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in supplier - supplierIndexMap := make(map[string]struct{}) + supplierAddrMap := make(map[string]struct{}) for _, supplier := range gs.SupplierList { - index := string(SupplierKey(supplier.Address)) - if _, ok := supplierIndexMap[index]; ok { + supplierAddr := string(SupplierKey(supplier.Address)) + if _, ok := supplierAddrMap[supplierAddr]; ok { return fmt.Errorf("duplicated index for supplier") } - supplierIndexMap[index] = struct{}{} + supplierAddrMap[supplierAddr] = struct{}{} } // Check that the stake value for the suppliers is valid @@ -40,25 +36,25 @@ func (gs GenesisState) Validate() error { // TODO_TECHDEBT: Consider creating shared helpers across the board for stake validation, // similar to how we have `ValidateAppServiceConfigs` below if supplier.Stake == nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "nil stake amount for supplier") + return ErrSupplierInvalidStake.Wrapf("nil stake amount for supplier") } stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) + return ErrSupplierInvalidStake.Wrapf("invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) + return ErrSupplierInvalidStake.Wrapf("cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) + return ErrSupplierInvalidStake.Wrapf("invalid stake amount for supplier: %v <= 0", supplier.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) + return ErrSupplierInvalidStake.Wrapf("invalid stake amount denom for supplier %v", supplier.Stake) } // Validate the application service configs if err := servicehelpers.ValidateSupplierServiceConfigs(supplier.Services); err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidServiceConfig, err.Error()) + return ErrSupplierInvalidServiceConfig.Wrapf(err.Error()) } } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index 282c2b01d..23b16b327 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -48,12 +48,12 @@ func TestGenesisState_Validate(t *testing.T) { tests := []struct { desc string genState *types.GenesisState - valid bool + isValid bool }{ { desc: "default is valid", genState: types.DefaultGenesis(), - valid: true, + isValid: true, }, { desc: "valid genesis state", @@ -73,7 +73,7 @@ func TestGenesisState_Validate(t *testing.T) { }, // this line is used by starport scaffolding # types/genesis/validField }, - valid: true, + isValid: true, }, { desc: "invalid - zero supplier stake", @@ -91,7 +91,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - negative supplier stake", @@ -109,7 +109,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - wrong stake denom", @@ -127,7 +127,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - missing denom", @@ -145,7 +145,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - due to duplicated supplier address", @@ -163,7 +163,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - due to nil supplier stake", @@ -181,7 +181,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - due to missing supplier stake", @@ -194,12 +194,12 @@ func TestGenesisState_Validate(t *testing.T) { }, { Address: addr2, - // Explicitly missing stake + // Stake explicitly omitted Services: serviceList2, }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - missing services list", @@ -213,11 +213,11 @@ func TestGenesisState_Validate(t *testing.T) { { Address: addr2, Stake: &stake2, - // Services: intentionally omitted + // Services explicitly omitted }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - empty services list", @@ -235,7 +235,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - invalid URL", @@ -266,7 +266,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "invalid - invalid RPC Type", @@ -297,14 +297,14 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, // this line is used by starport scaffolding # types/genesis/testcase } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.isValid { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/supplier/types/key_supplier.go b/x/supplier/types/key_supplier.go index e91fd76e4..b23c0ec8b 100644 --- a/x/supplier/types/key_supplier.go +++ b/x/supplier/types/key_supplier.go @@ -6,17 +6,15 @@ var _ binary.ByteOrder const ( // SupplierKeyPrefix is the prefix to retrieve all Supplier - SupplierKeyPrefix = "Supplier/value/" + SupplierKeyPrefix = "Supplier/address/" ) // SupplierKey returns the store key to retrieve a Supplier from the index fields -func SupplierKey( - index string, -) []byte { +func SupplierKey(supplierAddr string) []byte { var key []byte - indexBytes := []byte(index) - key = append(key, indexBytes...) + supplierAddrBz := []byte(supplierAddr) + key = append(key, supplierAddrBz...) key = append(key, []byte("/")...) return key diff --git a/x/supplier/types/keys.go b/x/supplier/types/keys.go index fe2ebecc7..4c3838de8 100644 --- a/x/supplier/types/keys.go +++ b/x/supplier/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_supplier" ) -var ( - ParamsKey = []byte("p_supplier") -) +var ParamsKey = []byte("p_supplier") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/supplier/types/message_stake_supplier.go b/x/supplier/types/message_stake_supplier.go index 44589187d..535fa0d57 100644 --- a/x/supplier/types/message_stake_supplier.go +++ b/x/supplier/types/message_stake_supplier.go @@ -9,7 +9,7 @@ import ( const TypeMsgStakeSupplier = "stake_supplier" -var _ sdk.Msg = &MsgStakeSupplier{} +var _ sdk.Msg = (*MsgStakeSupplier)(nil) func NewMsgStakeSupplier( address string, diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go index 76798c98a..1a340fae8 100644 --- a/x/supplier/types/message_stake_supplier_test.go +++ b/x/supplier/types/message_stake_supplier_test.go @@ -5,13 +5,15 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - - "github.com/stretchr/testify/require" ) +// TODO_CLEANUP: This test has a lot of copy-pasted code from test to test. +// It can be simplified by splitting it into smaller tests where the common +// fields don't need to be explicitly specified from test to test. func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { defaultServicesList := []*sharedtypes.SupplierServiceConfig{ { @@ -28,74 +30,74 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }} tests := []struct { - name string - msg MsgStakeSupplier - err error + desc string + msg MsgStakeSupplier + expectedErr error }{ // address related tests { - name: "invalid address - nil stake", + desc: "invalid address - nil stake", msg: MsgStakeSupplier{ Address: "invalid_address", - // Stake explicitly nil + // Stake explicitly omitted Services: defaultServicesList, }, - err: ErrSupplierInvalidAddress, + expectedErr: ErrSupplierInvalidAddress, }, // stake related tests { - name: "valid address - nil stake", + desc: "valid address - nil stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), - // Stake explicitly nil + // Stake explicitly omitted Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - valid stake", + desc: "valid address - valid stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: defaultServicesList, }, }, { - name: "valid address - zero stake", + desc: "valid address - zero stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - negative stake", + desc: "valid address - negative stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - invalid stake denom", + desc: "valid address - invalid stake denom", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, { - name: "valid address - invalid stake missing denom", + desc: "valid address - invalid stake missing denom", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, Services: defaultServicesList, }, - err: ErrSupplierInvalidStake, + expectedErr: ErrSupplierInvalidStake, }, // service related tests { - name: "valid service configs - multiple services", + desc: "valid service configs - multiple services", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -128,25 +130,25 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, { - name: "invalid service configs - omitted", + desc: "invalid service configs - omitted", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, - // Services: intentionally omitted + // Services explicitly omitted }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - empty", + desc: "invalid service configs - empty", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{}, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid service ID that's too long", + desc: "invalid service configs - invalid service ID that's too long", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -165,10 +167,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid service Name that's too long", + desc: "invalid service configs - invalid service Name that's too long", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -188,10 +190,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid service ID that contains invalid characters", + desc: "invalid service configs - invalid service ID that contains invalid characters", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -210,10 +212,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - missing url", + desc: "invalid service configs - missing url", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -225,7 +227,7 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, Endpoints: []*sharedtypes.SupplierEndpoint{ { - // Url: intentionally omitted + // Url explicitly omitted RpcType: sharedtypes.RPCType_JSON_RPC, Configs: make([]*sharedtypes.ConfigOption, 0), }, @@ -233,10 +235,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - invalid url", + desc: "invalid service configs - invalid url", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -256,10 +258,10 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, { - name: "invalid service configs - missing rpc type", + desc: "invalid service configs - missing rpc type", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, @@ -272,23 +274,23 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Endpoints: []*sharedtypes.SupplierEndpoint{ { Url: "http://localhost:8080", - // RpcType: intentionally omitted, + // RpcType explicitly omitted, Configs: make([]*sharedtypes.ConfigOption, 0), }, }, }, }, }, - err: ErrSupplierInvalidServiceConfig, + expectedErr: ErrSupplierInvalidServiceConfig, }, // TODO_TEST: Need to add more tests around config types } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/supplier/types/message_unstake_supplier.go b/x/supplier/types/message_unstake_supplier.go index 4a5226ee5..245317ebf 100644 --- a/x/supplier/types/message_unstake_supplier.go +++ b/x/supplier/types/message_unstake_supplier.go @@ -1,12 +1,10 @@ package types -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" const TypeMsgUnstakeSupplier = "unstake_supplier" -var _ sdk.Msg = &MsgUnstakeSupplier{} +var _ sdk.Msg = (*MsgUnstakeSupplier)(nil) func NewMsgUnstakeSupplier(address string) *MsgUnstakeSupplier { return &MsgUnstakeSupplier{ diff --git a/x/supplier/types/message_unstake_supplier_test.go b/x/supplier/types/message_unstake_supplier_test.go index b447397ed..b99a9186e 100644 --- a/x/supplier/types/message_unstake_supplier_test.go +++ b/x/supplier/types/message_unstake_supplier_test.go @@ -10,32 +10,32 @@ import ( func TestMsgUnstakeSupplier_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUnstakeSupplier - err error + desc string + msg MsgUnstakeSupplier + expectedErr error }{ { - name: "invalid address", + desc: "invalid address", msg: MsgUnstakeSupplier{ Address: "invalid_address", }, - err: ErrSupplierInvalidAddress, + expectedErr: ErrSupplierInvalidAddress, }, { - name: "missing address", - msg: MsgUnstakeSupplier{}, - err: ErrSupplierInvalidAddress, + desc: "missing address", + msg: MsgUnstakeSupplier{}, + expectedErr: ErrSupplierInvalidAddress, }, { - name: "valid address", + desc: "valid address", msg: MsgUnstakeSupplier{ Address: sample.AccAddress(), }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/supplier/types/msg_update_params.go b/x/supplier/types/message_update_params.go similarity index 91% rename from x/supplier/types/msg_update_params.go rename to x/supplier/types/message_update_params.go index e36d023de..aeed4a633 100644 --- a/x/supplier/types/msg_update_params.go +++ b/x/supplier/types/message_update_params.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUpdateParams{} +var _ sdk.Msg = (*MsgUpdateParams)(nil) // ValidateBasic does a sanity check on the provided data. func (m *MsgUpdateParams) ValidateBasic() error { diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go index 4f3215e35..95b0cf8a2 100644 --- a/x/supplier/types/params.go +++ b/x/supplier/types/params.go @@ -1,8 +1,6 @@ package types -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" var _ paramtypes.ParamSet = (*Params)(nil) diff --git a/x/supplier/types/types.go b/x/supplier/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/supplier/types/types.go +++ b/x/supplier/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs From 1df7a6a7249e9d10b155c91406b8ab9743ed4fb7 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sun, 18 Feb 2024 03:54:11 +0100 Subject: [PATCH 42/54] chore: session module review improvements --- api/poktroll/session/query.pulsar.go | 2 +- api/poktroll/session/tx.pulsar.go | 3 +- proto/poktroll/session/genesis.proto | 10 +- proto/poktroll/session/params.proto | 4 +- proto/poktroll/session/query.proto | 9 +- proto/poktroll/session/session.proto | 1 + proto/poktroll/session/tx.proto | 17 +-- testutil/keeper/session.go | 15 +-- x/session/keeper/keeper.go | 13 +- x/session/keeper/msg_server.go | 4 +- x/session/keeper/msg_server_test.go | 4 + x/session/keeper/msg_update_params.go | 8 +- x/session/keeper/msg_update_params_test.go | 42 ++++--- x/session/keeper/params.go | 10 +- x/session/keeper/query.go | 4 +- x/session/keeper/query_get_session.go | 5 +- x/session/keeper/query_get_session_test.go | 75 ++++++------ x/session/keeper/query_params.go | 7 +- x/session/keeper/session_hydrator.go | 85 ++++++++------ x/session/keeper/session_hydrator_test.go | 111 +++++++++--------- x/session/module/autocli.go | 47 ++++---- x/session/module/genesis.go | 10 +- x/session/module/genesis_test.go | 14 +-- x/session/module/helpers_test.go | 12 +- x/session/module/module.go | 15 +-- x/session/module/query_get_session_test.go | 28 ++--- x/session/module/tx.go | 6 +- x/session/types/errors.go | 21 ++-- x/session/types/expected_keepers.go | 12 +- x/session/types/genesis.go | 5 - x/session/types/key_block_hash.go | 4 +- x/session/types/keys.go | 8 +- ...ate_params.go => message_update_params.go} | 0 x/session/types/params.go | 4 +- x/session/types/session_header.go | 13 +- x/session/types/session_header_test.go | 36 +++--- x/session/types/types.go | 2 + 37 files changed, 323 insertions(+), 343 deletions(-) rename x/session/types/{msg_update_params.go => message_update_params.go} (100%) diff --git a/api/poktroll/session/query.pulsar.go b/api/poktroll/session/query.pulsar.go index 95fe25015..dc8b2cf41 100644 --- a/api/poktroll/session/query.pulsar.go +++ b/api/poktroll/session/query.pulsar.go @@ -1874,7 +1874,7 @@ type QueryGetSessionRequest struct { unknownFields protoimpl.UnknownFields ApplicationAddress string `protobuf:"bytes,1,opt,name=application_address,json=applicationAddress,proto3" json:"application_address,omitempty"` // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The service id to query the session for + Service *shared.Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` // The service to query the session for BlockHeight int64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // The block height to query the session for } diff --git a/api/poktroll/session/tx.pulsar.go b/api/poktroll/session/tx.pulsar.go index 20ba9d62e..deb862e76 100644 --- a/api/poktroll/session/tx.pulsar.go +++ b/api/poktroll/session/tx.pulsar.go @@ -892,8 +892,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the module parameters to update. - // + // params defines the x/session parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } diff --git a/proto/poktroll/session/genesis.proto b/proto/poktroll/session/genesis.proto index bd2f42a8e..263c0d0ef 100644 --- a/proto/poktroll/session/genesis.proto +++ b/proto/poktroll/session/genesis.proto @@ -1,17 +1,15 @@ syntax = "proto3"; package poktroll.session; +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -import "poktroll/session/params.proto"; -option go_package = "github.com/pokt-network/poktroll/x/session/types"; +import "poktroll/session/params.proto"; // GenesisState defines the session module's genesis state. message GenesisState { // params defines all the parameters of the module. - Params params = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/proto/poktroll/session/params.proto b/proto/poktroll/session/params.proto index 9616a05d7..cbe3559dc 100644 --- a/proto/poktroll/session/params.proto +++ b/proto/poktroll/session/params.proto @@ -1,11 +1,11 @@ syntax = "proto3"; package poktroll.session; +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/session/Params"; diff --git a/proto/poktroll/session/query.proto b/proto/poktroll/session/query.proto index 89fbb144e..f695a5fc6 100644 --- a/proto/poktroll/session/query.proto +++ b/proto/poktroll/session/query.proto @@ -1,18 +1,17 @@ syntax = "proto3"; package poktroll.session; +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; - import "poktroll/session/params.proto"; import "poktroll/session/session.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/session/types"; - // Query defines the gRPC querier service. service Query { @@ -21,7 +20,7 @@ service Query { option (google.api.http).get = "/pokt-network/poktroll/session/params"; } - // Queries a list of GetSession items. + // Queries the session given app_address, service and block_height. rpc GetSession (QueryGetSessionRequest) returns (QueryGetSessionResponse) { option (google.api.http).get = "/pokt-network/poktroll/session/get_session"; } @@ -38,7 +37,7 @@ message QueryParamsResponse { message QueryGetSessionRequest { string application_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application using cosmos' ScalarDescriptor to ensure deterministic encoding - poktroll.shared.Service service = 2; // The service id to query the session for + poktroll.shared.Service service = 2; // The service to query the session for int64 block_height = 3; // The block height to query the session for } diff --git a/proto/poktroll/session/session.proto b/proto/poktroll/session/session.proto index 2c03af313..071fbb6e2 100644 --- a/proto/poktroll/session/session.proto +++ b/proto/poktroll/session/session.proto @@ -4,6 +4,7 @@ package poktroll.session; option go_package = "github.com/pokt-network/poktroll/x/session/types"; import "cosmos_proto/cosmos.proto"; + import "poktroll/shared/service.proto"; import "poktroll/application/application.proto"; import "poktroll/shared/supplier.proto"; diff --git a/proto/poktroll/session/tx.proto b/proto/poktroll/session/tx.proto index 37e78c39a..747ed8888 100644 --- a/proto/poktroll/session/tx.proto +++ b/proto/poktroll/session/tx.proto @@ -1,13 +1,14 @@ syntax = "proto3"; package poktroll.session; +option go_package = "github.com/pokt-network/poktroll/x/session/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "poktroll/session/params.proto"; -option go_package = "github.com/pokt-network/poktroll/x/session/types"; +import "poktroll/session/params.proto"; // Msg defines the Msg service. service Msg { @@ -26,13 +27,13 @@ message MsgUpdateParams { // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the module parameters to update. - // + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + + // params defines the x/session parameters to update. // NOTE: All parameters must be supplied. - Params params = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/testutil/keeper/session.go b/testutil/keeper/session.go index 0687016c8..35845cad5 100644 --- a/testutil/keeper/session.go +++ b/testutil/keeper/session.go @@ -6,7 +6,7 @@ import ( "testing" "cosmossdk.io/log" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "cosmossdk.io/store" "cosmossdk.io/store/metrics" "cosmossdk.io/store/prefix" @@ -42,7 +42,7 @@ var ( TestApp1Address = "pokt1mdccn4u38eyjdxkk4h0jaddw4n3c72u82m5m9e" // Generated via sample.AccAddress() TestApp1 = apptypes.Application{ Address: TestApp1Address, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: TestServiceId1}, @@ -59,7 +59,7 @@ var ( TestApp2Address = "pokt133amv5suh75zwkxxcq896azvmmwszg99grvk9f" // Generated via sample.AccAddress() TestApp2 = apptypes.Application{ Address: TestApp1Address, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{ { Service: &sharedtypes.Service{Id: TestServiceId2}, @@ -77,7 +77,7 @@ var ( TestSupplierAddress = sample.AccAddress() TestSupplier = sharedtypes.Supplier{ Address: TestSupplierAddress, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, Services: []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{Id: TestServiceId1}, @@ -113,7 +113,8 @@ var ( } ) -func SessionKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func SessionKeeper(t testing.TB) (keeper.Keeper, context.Context) { + t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() @@ -154,7 +155,7 @@ func SessionKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) // In prod, the hashes of all block heights are stored in the hash store while // the block hashes below are hardcoded to match the hardcoded session IDs used @@ -209,7 +210,7 @@ func defaultSupplierKeeperMock(t testing.TB) types.SupplierKeeper { allSuppliers := []sharedtypes.Supplier{TestSupplier} mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) - mockSupplierKeeper.EXPECT().GetAllSupplier(gomock.Any()).AnyTimes().Return(allSuppliers) + mockSupplierKeeper.EXPECT().GetAllSuppliers(gomock.Any()).AnyTimes().Return(allSuppliers) return mockSupplierKeeper } diff --git a/x/session/keeper/keeper.go b/x/session/keeper/keeper.go index 1c321b13f..45b6b0d20 100644 --- a/x/session/keeper/keeper.go +++ b/x/session/keeper/keeper.go @@ -69,16 +69,17 @@ func (k Keeper) Logger() log.Logger { return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// BeginBlocker is called at the beginning of every block. +// StoreBlockHash is called at the end of every block. // It fetches the block hash from the committed block ans saves its hash // in the store. -func (k Keeper) BeginBlocker(goCtx context.Context) { +func (k Keeper) StoreBlockHash(goCtx context.Context) { ctx := sdk.UnwrapSDKContext(goCtx) - // ctx.BlockHeader().AppHash is the hash of the last block committed - hash := ctx.BlockHeader().AppHash - // ctx.BlockHeader().Height is the height of the last committed block. - height := ctx.BlockHeader().Height + // ctx.HeaderHash() is the hash of the block being validated. + hash := ctx.HeaderHash() + + // ctx.BlocHeight() is the height of the block being validated. + height := ctx.BlockHeight() storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(goCtx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.BlockHashKeyPrefix)) diff --git a/x/session/keeper/msg_server.go b/x/session/keeper/msg_server.go index 6dbe55462..65ddfeec7 100644 --- a/x/session/keeper/msg_server.go +++ b/x/session/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/session/types" -) +import "github.com/pokt-network/poktroll/x/session/types" type msgServer struct { Keeper diff --git a/x/session/keeper/msg_server_test.go b/x/session/keeper/msg_server_test.go index d3c3bd5bd..a47fa7cf4 100644 --- a/x/session/keeper/msg_server_test.go +++ b/x/session/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.SessionKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/session/keeper/msg_update_params.go b/x/session/keeper/msg_update_params.go index e483b7984..2e1050043 100644 --- a/x/session/keeper/msg_update_params.go +++ b/x/session/keeper/msg_update_params.go @@ -3,18 +3,14 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/session/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrSessionInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrSessionInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/session/keeper/msg_update_params_test.go b/x/session/keeper/msg_update_params_test.go index d645dac66..43fe64482 100644 --- a/x/session/keeper/msg_update_params_test.go +++ b/x/session/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/session/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + params *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", - input: &types.MsgUpdateParams{ + desc: "invalid authority", + params: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", - input: &types.MsgUpdateParams{ + desc: "send enabled param", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", - input: &types.MsgUpdateParams{ + desc: "all good", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.params) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/session/keeper/params.go b/x/session/keeper/params.go index deb132ff1..90dc1cea1 100644 --- a/x/session/keeper/params.go +++ b/x/session/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/session/keeper/query.go b/x/session/keeper/query.go index 700ec87e8..c8c803ba1 100644 --- a/x/session/keeper/query.go +++ b/x/session/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/session/types" -) +import "github.com/pokt-network/poktroll/x/session/types" var _ types.QueryServer = Keeper{} diff --git a/x/session/keeper/query_get_session.go b/x/session/keeper/query_get_session.go index 8d365f171..a8901b6cb 100644 --- a/x/session/keeper/query_get_session.go +++ b/x/session/keeper/query_get_session.go @@ -3,7 +3,6 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -12,7 +11,7 @@ import ( // GetSession should be deterministic and always return the same session for // the same block height. -func (k Keeper) GetSession(goCtx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error) { +func (k Keeper) GetSession(ctx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -21,8 +20,6 @@ func (k Keeper) GetSession(goCtx context.Context, req *types.QueryGetSessionRequ return nil, status.Error(codes.InvalidArgument, err.Error()) } - ctx := sdk.UnwrapSDKContext(goCtx) - // Note that `GetSession` is called via the `Query` service rather than the `Msg` server. // The former is stateful but does not lead to state transitions, while the latter one // does. The request height depends on how much the node has synched and only acts as a read, diff --git a/x/session/keeper/query_get_session_test.go b/x/session/keeper/query_get_session_test.go index 597095833..2ffab5cad 100644 --- a/x/session/keeper/query_get_session_test.go +++ b/x/session/keeper/query_get_session_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" @@ -22,12 +23,12 @@ func init() { func TestSession_GetSession_Success(t *testing.T) { keeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors // TODO_TECHDEBT(#377): These test assume that the genesis block has a height of 0, // rewrite them in terms of height = 1 genesis. - type test struct { - name string + tests := []struct { + desc string appAddr string serviceId string @@ -36,11 +37,9 @@ func TestSession_GetSession_Success(t *testing.T) { expectedSessionId string expectedSessionNumber int64 expectedNumSuppliers int - } - - tests := []test{ + }{ { - name: "valid - app1 svc1 at height=1", + desc: "valid - app1 svc1 at height=1", appAddr: keepertest.TestApp1Address, serviceId: keepertest.TestServiceId1, @@ -53,12 +52,12 @@ func TestSession_GetSession_Success(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { req := &types.QueryGetSessionRequest{ - ApplicationAddress: tt.appAddr, + ApplicationAddress: test.appAddr, Service: &sharedtypes.Service{ - Id: tt.serviceId, + Id: test.serviceId, }, BlockHeight: 1, } @@ -67,99 +66,97 @@ func TestSession_GetSession_Success(t *testing.T) { require.NoError(t, err) require.NotNil(t, response) - require.Equal(t, tt.expectedSessionId, response.Session.SessionId) - require.Equal(t, tt.expectedSessionNumber, response.Session.SessionNumber) - require.Len(t, response.Session.Suppliers, tt.expectedNumSuppliers) + require.Equal(t, test.expectedSessionId, response.Session.SessionId) + require.Equal(t, test.expectedSessionNumber, response.Session.SessionNumber) + require.Len(t, response.Session.Suppliers, test.expectedNumSuppliers) }) } } func TestSession_GetSession_Failure(t *testing.T) { keeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - type test struct { - name string + tests := []struct { + desc string appAddr string serviceId string blockHeight int64 - expectedErrContains string - } - - tests := []test{ + expectedErrMsg string + }{ { - name: "application address does not reflected a staked application", + desc: "application address does not reflected a staked application", appAddr: sample.AccAddress(), // a random (valid) app address that's not staked serviceId: keepertest.TestServiceId1, blockHeight: 1, - expectedErrContains: types.ErrSessionAppNotFound.Error(), + expectedErrMsg: types.ErrSessionAppNotFound.Error(), }, { - name: "application staked for service that has no available suppliers", + desc: "application staked for service that has no available suppliers", appAddr: keepertest.TestApp1Address, serviceId: keepertest.TestServiceId11, blockHeight: 1, - expectedErrContains: types.ErrSessionSuppliersNotFound.Error(), + expectedErrMsg: types.ErrSessionSuppliersNotFound.Error(), }, { - name: "application is valid but not staked for the specified service", + desc: "application is valid but not staked for the specified service", appAddr: keepertest.TestApp1Address, serviceId: "svc9001", // App1 is not staked for service over 9000 blockHeight: 1, - expectedErrContains: types.ErrSessionAppNotStakedForService.Error(), + expectedErrMsg: types.ErrSessionAppNotStakedForService.Error(), }, { - name: "application address is invalid format", + desc: "application address is invalid format", appAddr: "invalid_app_address", serviceId: keepertest.TestServiceId1, blockHeight: 1, - expectedErrContains: types.ErrSessionInvalidAppAddress.Error(), + expectedErrMsg: types.ErrSessionInvalidAppAddress.Error(), }, { - name: "service ID is invalid", + desc: "service ID is invalid", appAddr: keepertest.TestApp1Address, serviceId: "service_id_is_too_long_to_be_valid", blockHeight: 1, - expectedErrContains: "invalid service in session", + expectedErrMsg: "invalid service in session", }, { - name: "negative block height", + desc: "negative block height", appAddr: keepertest.TestApp1Address, serviceId: keepertest.TestServiceId1, blockHeight: -1, - expectedErrContains: "invalid block height for session being retrieved", + expectedErrMsg: "invalid block height for session being retrieved", }, } expectedRes := (*types.QueryGetSessionResponse)(nil) - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { req := &types.QueryGetSessionRequest{ - ApplicationAddress: tt.appAddr, + ApplicationAddress: test.appAddr, Service: &sharedtypes.Service{ - Id: tt.serviceId, + Id: test.serviceId, }, - BlockHeight: tt.blockHeight, + BlockHeight: test.blockHeight, } res, err := keeper.GetSession(ctx, req) require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErrContains) + require.Contains(t, err.Error(), test.expectedErrMsg) require.Equal(t, expectedRes, res) }) } diff --git a/x/session/keeper/query_params.go b/x/session/keeper/query_params.go index 75734ad7a..89f4256f4 100644 --- a/x/session/keeper/query_params.go +++ b/x/session/keeper/query_params.go @@ -3,18 +3,19 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/session/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params( + ctx context.Context, + req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go index 6a36309c7..6b3621000 100644 --- a/x/session/keeper/session_hydrator.go +++ b/x/session/keeper/session_hydrator.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "crypto" "encoding/binary" "encoding/hex" @@ -8,9 +9,9 @@ import ( "math/rand" sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" _ "golang.org/x/crypto/sha3" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/session/types" sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -44,7 +45,7 @@ type sessionHydrator struct { blockHeight int64 // A redundant helper that maintains a hex decoded copy of `session.Id` used for session hydration - sessionIdBz []byte + sessionIDBz []byte } func NewSessionHydrator( @@ -60,32 +61,32 @@ func NewSessionHydrator( sessionHeader: sessionHeader, session: &types.Session{}, blockHeight: blockHeight, - sessionIdBz: make([]byte, 0), + sessionIDBz: make([]byte, 0), } } // GetSession implements of the exposed `UtilityModule.GetSession` function -// TECHDEBT(#519): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. -func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Session, error) { +// TECHDEBT(#519,#348): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. +func (k Keeper) HydrateSession(ctx context.Context, sh *sessionHydrator) (*types.Session, error) { logger := k.Logger().With("method", "hydrateSession") if err := k.hydrateSessionMetadata(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session metadata: %v", err) + return nil, types.ErrSessionHydration.Wrapf("failed to hydrate the session metadata: %v", err) } logger.Debug("Finished hydrating session metadata") if err := k.hydrateSessionID(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate the session ID: %v", err) + return nil, types.ErrSessionHydration.Wrapf("failed to hydrate the session ID: %v", err) } logger.Info(fmt.Sprintf("Finished hydrating session ID: %s", sh.sessionHeader.SessionId)) if err := k.hydrateSessionApplication(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate application for session: %v", err) + return nil, types.ErrSessionHydration.Wrapf("failed to hydrate application for session: %v", err) } logger.Debug("Finished hydrating session application: %+v", sh.session.Application) if err := k.hydrateSessionSuppliers(ctx, sh); err != nil { - return nil, sdkerrors.Wrapf(types.ErrSessionHydration, "failed to hydrate suppliers for session: %v", err) + return nil, types.ErrSessionHydration.Wrapf("failed to hydrate suppliers for session: %v", err) } logger.Debug("Finished hydrating session suppliers: %+v") @@ -96,14 +97,15 @@ func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Ses } // hydrateSessionMetadata hydrates metadata related to the session such as the height at which the session started, its number, the number of blocks per session, etc.. -func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) error { +func (k Keeper) hydrateSessionMetadata(ctx context.Context, sh *sessionHydrator) error { // TODO_TECHDEBT: Add a test if `blockHeight` is ahead of the current chain or what this node is aware of - if sh.blockHeight > ctx.BlockHeight() { + lastCommittedBlockHeight := sdk.UnwrapSDKContext(ctx).BlockHeight() + if sh.blockHeight > lastCommittedBlockHeight { return sdkerrors.Wrapf( types.ErrSessionHydration, "block height %d is ahead of the last committed block height %d", - sh.blockHeight, ctx.BlockHeight(), + sh.blockHeight, lastCommittedBlockHeight, ) } @@ -116,17 +118,17 @@ func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) err } // hydrateSessionID use both session and on-chain data to determine a unique session ID -func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { +func (k Keeper) hydrateSessionID(ctx context.Context, sh *sessionHydrator) error { prevHashBz := k.GetBlockHash(ctx, sh.sessionHeader.SessionStartBlockHeight) - // TODO_TECHDEBT: In the future, we will need to valid that the Service is a valid service depending on whether + // TODO_TECHDEBT: In the future, we will need to validate that the Service is a valid service depending on whether // or not its permissioned or permissionless if !sharedhelpers.IsValidService(sh.sessionHeader.Service) { - return sdkerrors.Wrapf(types.ErrSessionHydration, "invalid service: %v", sh.sessionHeader.Service) + return types.ErrSessionHydration.Wrapf("invalid service: %v", sh.sessionHeader.Service) } - sh.sessionHeader.SessionId, sh.sessionIdBz = GetSessionId( + sh.sessionHeader.SessionId, sh.sessionIDBz = GetSessionId( sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id, prevHashBz, @@ -137,24 +139,33 @@ func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { } // hydrateSessionApplication hydrates the full Application actor based on the address provided -func (k Keeper) hydrateSessionApplication(ctx sdk.Context, sh *sessionHydrator) error { - app, appIsFound := k.applicationKeeper.GetApplication(ctx, sh.sessionHeader.ApplicationAddress) +func (k Keeper) hydrateSessionApplication(ctx context.Context, sh *sessionHydrator) error { + foundApp, appIsFound := k.applicationKeeper.GetApplication(ctx, sh.sessionHeader.ApplicationAddress) if !appIsFound { - return sdkerrors.Wrapf(types.ErrSessionAppNotFound, "could not find app with address: %s at height %d", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.SessionStartBlockHeight) + return types.ErrSessionAppNotFound.Wrapf( + "could not find app with address: %s at height %d", + sh.sessionHeader.ApplicationAddress, + sh.sessionHeader.SessionStartBlockHeight, + ) } - for _, appServiceConfig := range app.ServiceConfigs { + for _, appServiceConfig := range foundApp.ServiceConfigs { if appServiceConfig.Service.Id == sh.sessionHeader.Service.Id { - sh.session.Application = &app + sh.session.Application = &foundApp return nil } } - return sdkerrors.Wrapf(types.ErrSessionAppNotStakedForService, "application %s not staked for service %s", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id) + return types.ErrSessionAppNotStakedForService.Wrapf( + "application %s not staked for service %s", + sh.sessionHeader.ApplicationAddress, + sh.sessionHeader.Service.Id, + ) } -// hydrateSessionSuppliers finds the suppliers that are staked at the session height and populates the session with them -func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) error { +// hydrateSessionSuppliers finds the suppliers that are staked at the session +// height and populates the session with them. +func (k Keeper) hydrateSessionSuppliers(ctx context.Context, sh *sessionHydrator) error { logger := k.Logger().With("method", "hydrateSessionSuppliers") // TODO_TECHDEBT(@Olshansk, @bryanchriswhite): Need to retrieve the suppliers at SessionStartBlockHeight, @@ -162,7 +173,7 @@ func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) er // only retrieving the suppliers at the current block height which could create a discrepancy // if new suppliers were staked mid session. // TODO(@bryanchriswhite): Investigate if `BlockClient` + `ReplayObservable` where `N = SessionLength` could be used here.` - suppliers := k.supplierKeeper.GetAllSupplier(ctx) + suppliers := k.supplierKeeper.GetAllSuppliers(ctx) candidateSuppliers := make([]*sharedtypes.Supplier, 0) for _, s := range suppliers { @@ -181,14 +192,22 @@ func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) er if len(candidateSuppliers) == 0 { logger.Error("[ERROR] no suppliers found for session") - return sdkerrors.Wrapf(types.ErrSessionSuppliersNotFound, "could not find suppliers for service %s at height %d", sh.sessionHeader.Service, sh.sessionHeader.SessionStartBlockHeight) + return types.ErrSessionSuppliersNotFound.Wrapf( + "could not find suppliers for service %s at height %d", + sh.sessionHeader.Service, + sh.sessionHeader.SessionStartBlockHeight, + ) } if len(candidateSuppliers) < NumSupplierPerSession { - logger.Info(fmt.Sprintf("[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", len(candidateSuppliers), NumSupplierPerSession)) + logger.Info(fmt.Sprintf( + "[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", + len(candidateSuppliers), + NumSupplierPerSession, + )) sh.session.Suppliers = candidateSuppliers } else { - sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIdBz) + sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIDBz) } return nil @@ -197,10 +216,10 @@ func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) er // TODO_INVESTIGATE: We are using a `Go` native implementation for a pseudo-random number generator. In order // for it to be language agnostic, a general purpose algorithm MUST be used. // pseudoRandomSelection returns a random subset of the candidates. -func pseudoRandomSelection(candidates []*sharedtypes.Supplier, numTarget int, sessionIdBz []byte) []*sharedtypes.Supplier { +func pseudoRandomSelection(candidates []*sharedtypes.Supplier, numTarget int, sessionIDBz []byte) []*sharedtypes.Supplier { // Take the first 8 bytes of sessionId to use as the seed // NB: There is specific reason why `BigEndian` was chosen over `LittleEndian` in this specific context. - seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIdBz)[:8])) + seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIDBz)[:8])) // Retrieve the indices for the candidates actors := make([]*sharedtypes.Supplier, 0) @@ -236,9 +255,9 @@ func uniqueRandomIndices(seed, maxIndex, numIndices int64) map[int64]struct{} { return indicesMap } -func concatWithDelimiter(delimiter string, b ...[]byte) (result []byte) { - for _, bz := range b { - result = append(result, bz...) +func concatWithDelimiter(delimiter string, bz ...[]byte) (result []byte) { + for _, b := range bz { + result = append(result, b...) result = append(result, []byte(delimiter)...) } return result diff --git a/x/session/keeper/session_hydrator_test.go b/x/session/keeper/session_hydrator_test.go index e914ca0ea..ab9eb96ac 100644 --- a/x/session/keeper/session_hydrator_test.go +++ b/x/session/keeper/session_hydrator_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" @@ -16,7 +17,8 @@ import ( func TestSession_HydrateSession_Success_BaseCase(t *testing.T) { sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors blockHeight := int64(10) sessionHydrator := keeper.NewSessionHydrator(keepertest.TestApp1Address, keepertest.TestServiceId1, blockHeight) @@ -45,13 +47,16 @@ func TestSession_HydrateSession_Success_BaseCase(t *testing.T) { // Check the suppliers suppliers := session.Suppliers require.Len(t, suppliers, 1) + supplier := suppliers[0] require.Equal(t, keepertest.TestSupplierAddress, supplier.Address) require.Len(t, supplier.Services, 3) } func TestSession_HydrateSession_Metadata(t *testing.T) { - type test struct { + // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. + // Currently assumes NumBlocksPerSession=4 + tests := []struct { desc string blockHeight int64 @@ -59,12 +64,8 @@ func TestSession_HydrateSession_Metadata(t *testing.T) { expectedSessionNumber int64 expectedSessionStartBlock int64 expectedSessionEndBlock int64 - errExpected error - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumBlocksPerSession=4 - tests := []test{ + expectedErr error + }{ { desc: "blockHeight = 0", blockHeight: 0, @@ -73,7 +74,7 @@ func TestSession_HydrateSession_Metadata(t *testing.T) { expectedSessionNumber: 0, expectedSessionStartBlock: 0, expectedSessionEndBlock: 3, - errExpected: nil, + expectedErr: nil, }, { desc: "blockHeight = 1", @@ -83,7 +84,7 @@ func TestSession_HydrateSession_Metadata(t *testing.T) { expectedSessionNumber: 0, expectedSessionStartBlock: 0, expectedSessionEndBlock: 3, - errExpected: nil, + expectedErr: nil, }, { desc: "blockHeight = sessionHeight", @@ -93,7 +94,7 @@ func TestSession_HydrateSession_Metadata(t *testing.T) { expectedSessionNumber: 1, expectedSessionStartBlock: 4, expectedSessionEndBlock: 7, - errExpected: nil, + expectedErr: nil, }, { desc: "blockHeight != sessionHeight", @@ -103,42 +104,44 @@ func TestSession_HydrateSession_Metadata(t *testing.T) { expectedSessionNumber: 1, expectedSessionStartBlock: 4, expectedSessionEndBlock: 7, - errExpected: nil, + expectedErr: nil, }, { desc: "blockHeight > contextHeight", blockHeight: 9001, // block height over 9000 is too high given that the context height is 100 - errExpected: types.ErrSessionHydration, + expectedErr: types.ErrSessionHydration, }, } appAddr := keepertest.TestApp1Address serviceId := keepertest.TestServiceId1 sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator := keeper.NewSessionHydrator(appAddr, serviceId, tt.blockHeight) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + sessionHydrator := keeper.NewSessionHydrator(appAddr, serviceId, test.blockHeight) session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - if tt.errExpected != nil { - require.ErrorIs(t, tt.errExpected, err) + if test.expectedErr != nil { + require.ErrorIs(t, test.expectedErr, err) return } require.NoError(t, err) - require.Equal(t, tt.expectedNumBlocksPerSession, session.NumBlocksPerSession) - require.Equal(t, tt.expectedSessionNumber, session.SessionNumber) - require.Equal(t, tt.expectedSessionStartBlock, session.Header.SessionStartBlockHeight) - require.Equal(t, tt.expectedSessionEndBlock, session.Header.SessionEndBlockHeight) + require.Equal(t, test.expectedNumBlocksPerSession, session.NumBlocksPerSession) + require.Equal(t, test.expectedSessionNumber, session.SessionNumber) + require.Equal(t, test.expectedSessionStartBlock, session.Header.SessionStartBlockHeight) + require.Equal(t, test.expectedSessionEndBlock, session.Header.SessionEndBlockHeight) }) } } func TestSession_HydrateSession_SessionId(t *testing.T) { - type test struct { + // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. + // Currently assumes NumBlocksPerSession=4 + tests := []struct { desc string blockHeight1 int64 @@ -152,11 +155,7 @@ func TestSession_HydrateSession_SessionId(t *testing.T) { expectedSessionId1 string expectedSessionId2 string - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumBlocksPerSession=4 - tests := []test{ + }{ { desc: "(app1, svc1): sessionId at first session block != sessionId at next session block", @@ -205,28 +204,28 @@ func TestSession_HydrateSession_SessionId(t *testing.T) { } sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator1 := keeper.NewSessionHydrator(tt.appAddr1, tt.serviceId1, tt.blockHeight1) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + sessionHydrator1 := keeper.NewSessionHydrator(test.appAddr1, test.serviceId1, test.blockHeight1) session1, err := sessionKeeper.HydrateSession(ctx, sessionHydrator1) require.NoError(t, err) - sessionHydrator2 := keeper.NewSessionHydrator(tt.appAddr2, tt.serviceId2, tt.blockHeight2) + sessionHydrator2 := keeper.NewSessionHydrator(test.appAddr2, test.serviceId2, test.blockHeight2) session2, err := sessionKeeper.HydrateSession(ctx, sessionHydrator2) require.NoError(t, err) require.NotEqual(t, session1.Header.SessionId, session2.Header.SessionId) - require.Equal(t, tt.expectedSessionId1, session1.Header.SessionId) - require.Equal(t, tt.expectedSessionId2, session2.Header.SessionId) + require.Equal(t, test.expectedSessionId1, session1.Header.SessionId) + require.Equal(t, test.expectedSessionId2, session2.Header.SessionId) }) } } // TODO_TECHDEBT: Expand these tests to account for application joining/leaving the network at different heights as well changing the services they support func TestSession_HydrateSession_Application(t *testing.T) { - type test struct { + tests := []struct { // Description desc string // Inputs @@ -235,9 +234,7 @@ func TestSession_HydrateSession_Application(t *testing.T) { // Outputs expectedErr error - } - - tests := []test{ + }{ { desc: "app is found", @@ -278,13 +275,13 @@ func TestSession_HydrateSession_Application(t *testing.T) { blockHeight := int64(10) sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + sessionHydrator := keeper.NewSessionHydrator(test.appAddr, test.serviceId, blockHeight) _, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - if tt.expectedErr != nil { + if test.expectedErr != nil { require.Error(t, err) } else { require.NoError(t, err) @@ -295,7 +292,9 @@ func TestSession_HydrateSession_Application(t *testing.T) { // TODO_TECHDEBT: Expand these tests to account for supplier joining/leaving the network at different heights as well changing the services they support func TestSession_HydrateSession_Suppliers(t *testing.T) { - type test struct { + // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. + // Currently assumes NumSupplierPerSession=15 + tests := []struct { // Description desc string @@ -306,11 +305,7 @@ func TestSession_HydrateSession_Suppliers(t *testing.T) { // Outputs numExpectedSuppliers int expectedErr error - } - - // TODO_TECHDEBT: Extend these tests once `NumBlocksPerSession` is configurable. - // Currently assumes NumSupplierPerSession=15 - tests := []test{ + }{ { desc: "num_suppliers_available = 0", @@ -341,19 +336,19 @@ func TestSession_HydrateSession_Suppliers(t *testing.T) { blockHeight := int64(10) sessionKeeper, ctx := keepertest.SessionKeeper(t) - ctx = ctx.WithBlockHeight(100) // provide a sufficiently large block height to avoid errors + ctx = sdk.UnwrapSDKContext(ctx).WithBlockHeight(100) // provide a sufficiently large block height to avoid errors - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) {}) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) {}) - sessionHydrator := keeper.NewSessionHydrator(tt.appAddr, tt.serviceId, blockHeight) + sessionHydrator := keeper.NewSessionHydrator(test.appAddr, test.serviceId, blockHeight) session, err := sessionKeeper.HydrateSession(ctx, sessionHydrator) - if tt.expectedErr != nil { - require.ErrorContains(t, err, tt.expectedErr.Error()) + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) continue } require.NoError(t, err) - require.Len(t, session.Suppliers, tt.numExpectedSuppliers) + require.Len(t, session.Suppliers, test.numExpectedSuppliers) } } diff --git a/x/session/module/autocli.go b/x/session/module/autocli.go index bf35f4984..75f59bd46 100644 --- a/x/session/module/autocli.go +++ b/x/session/module/autocli.go @@ -10,25 +10,25 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - }, - { - RpcMethod: "GetSession", - Use: "get-session [application-address] [service] [block-height]", - Short: "Query get-session", - Long: `Query the session data for a specific (app, service, height) tuple. - -This is a query operation that will not result in a state transition but simply gives a view into the chain state. - -Example: -$ poktrolld q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE) --home $(POKTROLLD_HOME) `, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "application_address"}, {ProtoField: "service"}, {ProtoField: "block_height"}}, - }, + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "GetSession", + // Use: "get-session [application-address] [service] [block-height]", + // Short: "Query get-session", + // Long: `Query the session data for a specific (app, service, height) tuple. + // + // This is a query operation that will not result in a state transition but simply gives a view into the chain state. + // + // Example: + // $ poktrolld q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE) --home $(POKTROLLD_HOME) `, + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "application_address"}, {ProtoField: "service"}, {ProtoField: "block_height"}}, + // }, // this line is used by ignite scaffolding # autocli/query }, @@ -36,11 +36,12 @@ $ poktrolld q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 sv Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/session/module/genesis.go b/x/session/module/genesis.go index 2007b8a74..0e0430eac 100644 --- a/x/session/module/genesis.go +++ b/x/session/module/genesis.go @@ -1,20 +1,22 @@ package session import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/session/keeper" "github.com/pokt-network/poktroll/x/session/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) diff --git a/x/session/module/genesis_test.go b/x/session/module/genesis_test.go index 0c9b49159..91b8cc149 100644 --- a/x/session/module/genesis_test.go +++ b/x/session/module/genesis_test.go @@ -12,12 +12,12 @@ func TestGenesisState_Validate(t *testing.T) { tests := []struct { desc string genState *types.GenesisState - valid bool + isValid bool }{ { desc: "default is valid", genState: types.DefaultGenesis(), - valid: true, + isValid: true, }, { desc: "valid genesis state", @@ -25,14 +25,14 @@ func TestGenesisState_Validate(t *testing.T) { // this line is used by starport scaffolding # types/genesis/validField }, - valid: true, + isValid: true, }, // this line is used by starport scaffolding # types/genesis/testcase } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.isValid { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/session/module/helpers_test.go b/x/session/module/helpers_test.go index 7a2cf436e..a010d5e15 100644 --- a/x/session/module/helpers_test.go +++ b/x/session/module/helpers_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/network" apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -17,14 +16,13 @@ import ( // Dummy variable to avoid unused import error. var _ = strconv.IntSize -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - // networkWithApplicationsAndSupplier creates a new network with a given number of supplier & application objects. // It returns the network and a slice of the created supplier & application objects. -func networkWithApplicationsAndSupplier(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier, []apptypes.Application) { +func networkWithApplicationsAndSupplier(t *testing.T, n int) ( + *network.Network, + []sharedtypes.Supplier, + []apptypes.Application, +) { t.Helper() cfg := network.DefaultConfig() diff --git a/x/session/module/module.go b/x/session/module/module.go index a7f99ea0d..a8c55809b 100644 --- a/x/session/module/module.go +++ b/x/session/module/module.go @@ -145,14 +145,18 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block. // The begin block implementation is optional. -func (am AppModule) BeginBlock(ctx context.Context) error { - am.keeper.BeginBlocker(ctx) +func (am AppModule) BeginBlock(_ context.Context) error { return nil } // EndBlock contains the logic that is automatically triggered at the end of each block. // The end block implementation is optional. -func (am AppModule) EndBlock(_ context.Context) error { +func (am AppModule) EndBlock(ctx context.Context) error { + // Store the block hash at the end of every block, so we can query the block hash + // to construct the SessionID. + // EndBlock is preferred over BeginBlock to avoid wasting resources if the block + // does not get committed. + am.keeper.StoreBlockHash(ctx) return nil } @@ -167,10 +171,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/session/module/query_get_session_test.go b/x/session/module/query_get_session_test.go index 4a482afda..f2b230d1e 100644 --- a/x/session/module/query_get_session_test.go +++ b/x/session/module/query_get_session_test.go @@ -82,7 +82,7 @@ func TestCLI_GetSession(t *testing.T) { appAddress: appSvc0.Address, serviceId: "svc0", - // blockHeight: intentionally omitted, + // blockHeight explicitly omitted, expectedErr: nil, expectedNumSuppliers: 1, @@ -129,7 +129,7 @@ func TestCLI_GetSession(t *testing.T) { }, { desc: "invalid - missing appAddress", - // appAddress: intentionally omitted + // appAddress explicitly omitted serviceId: "svc0", blockHeight: 0, @@ -148,7 +148,7 @@ func TestCLI_GetSession(t *testing.T) { { desc: "invalid - missing service ID", appAddress: appSvc0.Address, // dynamically getting address from applications - // serviceId: intentionally omitted + // serviceId explicitly omitted blockHeight: 0, expectedErr: sessiontypes.ErrSessionInvalidService, @@ -161,22 +161,22 @@ func TestCLI_GetSession(t *testing.T) { } // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Prepare the arguments for the CLI command args := []string{ - tt.appAddress, - tt.serviceId, - fmt.Sprintf("%d", tt.blockHeight), + test.appAddress, + test.serviceId, + fmt.Sprintf("%d", test.blockHeight), } args = append(args, common...) // Execute the command getSessionOut, err := clitestutil.ExecTestCLICmd(ctx, session.CmdGetSession(), args) - if tt.expectedErr != nil { - stat, ok := status.FromError(tt.expectedErr) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedErr.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) @@ -190,9 +190,9 @@ func TestCLI_GetSession(t *testing.T) { require.NotNil(t, session) // Verify some data about the session - require.Equal(t, tt.appAddress, session.Application.Address) - require.Equal(t, tt.serviceId, session.Header.Service.Id) - require.Len(t, session.Suppliers, tt.expectedNumSuppliers) + require.Equal(t, test.appAddress, session.Application.Address) + require.Equal(t, test.serviceId, session.Header.Service.Id) + require.Len(t, session.Suppliers, test.expectedNumSuppliers) }) } } diff --git a/x/session/module/tx.go b/x/session/module/tx.go index 638661956..e17d16773 100644 --- a/x/session/module/tx.go +++ b/x/session/module/tx.go @@ -2,7 +2,6 @@ package session import ( "fmt" - "time" "github.com/spf13/cobra" @@ -11,11 +10,8 @@ import ( "github.com/pokt-network/poktroll/x/session/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/session/types/errors.go b/x/session/types/errors.go index 8e6993f6f..6ffff939c 100644 --- a/x/session/types/errors.go +++ b/x/session/types/errors.go @@ -2,20 +2,17 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/session module sentinel errors var ( ErrSessionInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSessionSample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrSessionHydration = sdkerrors.Register(ModuleName, 1102, "error during session hydration") - ErrSessionAppNotFound = sdkerrors.Register(ModuleName, 1103, "application for session not found not found ") - ErrSessionAppNotStakedForService = sdkerrors.Register(ModuleName, 1104, "application in session not staked for requested service") - ErrSessionSuppliersNotFound = sdkerrors.Register(ModuleName, 1105, "no suppliers not found for session") - ErrSessionInvalidAppAddress = sdkerrors.Register(ModuleName, 1106, "invalid application address for session") - ErrSessionInvalidService = sdkerrors.Register(ModuleName, 1107, "invalid service in session") - ErrSessionInvalidBlockHeight = sdkerrors.Register(ModuleName, 1108, "invalid block height for session") - ErrSessionInvalidSessionId = sdkerrors.Register(ModuleName, 1109, "invalid sessionId") + ErrSessionHydration = sdkerrors.Register(ModuleName, 1101, "error during session hydration") + ErrSessionAppNotFound = sdkerrors.Register(ModuleName, 1102, "application for session not found not found ") + ErrSessionAppNotStakedForService = sdkerrors.Register(ModuleName, 1103, "application in session not staked for requested service") + ErrSessionSuppliersNotFound = sdkerrors.Register(ModuleName, 1104, "no suppliers not found for session") + ErrSessionInvalidAppAddress = sdkerrors.Register(ModuleName, 1105, "invalid application address for session") + ErrSessionInvalidService = sdkerrors.Register(ModuleName, 1106, "invalid service in session") + ErrSessionInvalidBlockHeight = sdkerrors.Register(ModuleName, 1107, "invalid block height for session") + ErrSessionInvalidSessionId = sdkerrors.Register(ModuleName, 1108, "invalid sessionId") ) diff --git a/x/session/types/expected_keepers.go b/x/session/types/expected_keepers.go index 7d06db3bc..560226293 100644 --- a/x/session/types/expected_keepers.go +++ b/x/session/types/expected_keepers.go @@ -1,7 +1,7 @@ -package types - //go:generate mockgen -destination ../../../testutil/session/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper +package types + import ( "context" @@ -27,11 +27,5 @@ type ApplicationKeeper interface { } type SupplierKeeper interface { - GetAllSupplier(ctx context.Context) (suppliers []sharedtypes.Supplier) -} - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) + GetAllSuppliers(ctx context.Context) (suppliers []sharedtypes.Supplier) } diff --git a/x/session/types/genesis.go b/x/session/types/genesis.go index 0af9b4416..a88ab1682 100644 --- a/x/session/types/genesis.go +++ b/x/session/types/genesis.go @@ -1,11 +1,6 @@ package types -import ( // this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { diff --git a/x/session/types/key_block_hash.go b/x/session/types/key_block_hash.go index 56472742a..a692cf4c4 100644 --- a/x/session/types/key_block_hash.go +++ b/x/session/types/key_block_hash.go @@ -2,14 +2,14 @@ package types import ( "encoding/binary" - fmt "fmt" + "fmt" ) var _ binary.ByteOrder const ( // BlockHashKeyPrefix is the prefix to retrieve all BlockHash - BlockHashKeyPrefix = "BlockHash/value/" + BlockHashKeyPrefix = "BlockHash/height/" ) // BlockHashKey returns the store key to retrieve a BlockHash from the index fields diff --git a/x/session/types/keys.go b/x/session/types/keys.go index c798c9a12..6c4bececc 100644 --- a/x/session/types/keys.go +++ b/x/session/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_session" ) -var ( - ParamsKey = []byte("p_session") -) +var ParamsKey = []byte("p_session") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/session/types/msg_update_params.go b/x/session/types/message_update_params.go similarity index 100% rename from x/session/types/msg_update_params.go rename to x/session/types/message_update_params.go diff --git a/x/session/types/params.go b/x/session/types/params.go index 4f3215e35..95b0cf8a2 100644 --- a/x/session/types/params.go +++ b/x/session/types/params.go @@ -1,8 +1,6 @@ package types -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" var _ paramtypes.ParamSet = (*Params)(nil) diff --git a/x/session/types/session_header.go b/x/session/types/session_header.go index adcb3b040..6e3daa1d0 100644 --- a/x/session/types/session_header.go +++ b/x/session/types/session_header.go @@ -1,33 +1,30 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" // TODO_TECHDEBT: Make sure this is used everywhere we validate components // of the session header. func (sh *SessionHeader) ValidateBasic() error { // Validate the application address if _, err := sdk.AccAddressFromBech32(sh.ApplicationAddress); err != nil { - return sdkerrors.Wrapf(ErrSessionInvalidAppAddress, "invalid application address: %s; (%v)", sh.ApplicationAddress, err) + return ErrSessionInvalidAppAddress.Wrapf("invalid application address: %s; (%v)", sh.ApplicationAddress, err) } // Validate the session ID // TODO_TECHDEBT: Introduce a `SessionId#ValidateBasic` method. if sh.SessionId == "" { - return sdkerrors.Wrapf(ErrSessionInvalidSessionId, "invalid session ID: %s", sh.SessionId) + return ErrSessionInvalidSessionId.Wrapf("invalid session ID: %s", sh.SessionId) } // Validate the service // TODO_TECHDEBT: Introduce a `Service#ValidateBasic` method. if sh.Service == nil { - return sdkerrors.Wrapf(ErrSessionInvalidService, "invalid service: %s", sh.Service) + return ErrSessionInvalidService.Wrapf("invalid service: %s", sh.Service) } // Check if session end height is greater than session start height if sh.SessionEndBlockHeight <= sh.SessionStartBlockHeight { - return sdkerrors.Wrapf(ErrSessionInvalidBlockHeight, "session end block height cannot be less than or equal to session start block height") + return ErrSessionInvalidBlockHeight.Wrapf("session end block height cannot be less than or equal to session start block height") } return nil diff --git a/x/session/types/session_header_test.go b/x/session/types/session_header_test.go index e0e60ce93..5d952be42 100644 --- a/x/session/types/session_header_test.go +++ b/x/session/types/session_header_test.go @@ -12,72 +12,72 @@ import ( func TestSessionHeader_ValidateBasic(t *testing.T) { tests := []struct { - desc string - sh types.SessionHeader - err error + desc string + sessionHeader types.SessionHeader + expectedErr error }{ { desc: "invalid - invalid application address", - sh: types.SessionHeader{ + sessionHeader: types.SessionHeader{ ApplicationAddress: "invalid_address", SessionId: "valid_session_id", Service: &sharedtypes.Service{}, SessionStartBlockHeight: 100, SessionEndBlockHeight: 101, }, - err: types.ErrSessionInvalidAppAddress, + expectedErr: types.ErrSessionInvalidAppAddress, }, { desc: "invalid - empty session id", - sh: types.SessionHeader{ + sessionHeader: types.SessionHeader{ ApplicationAddress: sample.AccAddress(), SessionId: "", Service: &sharedtypes.Service{}, SessionStartBlockHeight: 100, SessionEndBlockHeight: 101, }, - err: types.ErrSessionInvalidSessionId, + expectedErr: types.ErrSessionInvalidSessionId, }, { desc: "invalid - nil service", - sh: types.SessionHeader{ + sessionHeader: types.SessionHeader{ ApplicationAddress: sample.AccAddress(), SessionId: "valid_session_id", Service: nil, SessionStartBlockHeight: 100, SessionEndBlockHeight: 101, }, - err: types.ErrSessionInvalidService, + expectedErr: types.ErrSessionInvalidService, }, { desc: "invalid - start block height greater than end block height", - sh: types.SessionHeader{ + sessionHeader: types.SessionHeader{ ApplicationAddress: sample.AccAddress(), SessionId: "valid_session_id", Service: &sharedtypes.Service{}, SessionStartBlockHeight: 100, SessionEndBlockHeight: 99, }, - err: types.ErrSessionInvalidBlockHeight, + expectedErr: types.ErrSessionInvalidBlockHeight, }, { desc: "valid", - sh: types.SessionHeader{ + sessionHeader: types.SessionHeader{ ApplicationAddress: sample.AccAddress(), SessionId: "valid_session_id", Service: &sharedtypes.Service{}, SessionStartBlockHeight: 100, SessionEndBlockHeight: 101, }, - err: nil, + expectedErr: nil, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.sh.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.sessionHeader.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) } diff --git a/x/session/types/types.go b/x/session/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/session/types/types.go +++ b/x/session/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs From f82e60a04f3cdca0fb7cbd4bbc7a9b17b95c2e86 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sun, 18 Feb 2024 04:04:54 +0100 Subject: [PATCH 43/54] chore: proof module review improvements --- api/poktroll/proof/genesis.pulsar.go | 88 +++++++++--------- api/poktroll/proof/tx.pulsar.go | 1 + proto/poktroll/proof/claim.proto | 1 + proto/poktroll/proof/genesis.proto | 13 ++- proto/poktroll/proof/params.proto | 6 +- proto/poktroll/proof/proof.proto | 1 + proto/poktroll/proof/query.proto | 38 ++++---- proto/poktroll/proof/tx.proto | 31 ++++--- testutil/keeper/proof.go | 12 ++- testutil/proof/fixtures.go | 12 +-- x/proof/keeper/claim.go | 56 ++++++------ x/proof/keeper/claim_test.go | 21 ++--- x/proof/keeper/msg_server.go | 4 +- x/proof/keeper/msg_server_create_claim.go | 8 +- .../keeper/msg_server_create_claim_test.go | 21 ++--- x/proof/keeper/msg_server_submit_proof.go | 40 ++++---- x/proof/keeper/msg_server_test.go | 4 + x/proof/keeper/msg_update_params.go | 8 +- x/proof/keeper/msg_update_params_test.go | 42 ++++----- x/proof/keeper/params.go | 10 +- x/proof/keeper/proof.go | 55 +++++++---- x/proof/keeper/proof_test.go | 13 ++- x/proof/keeper/query.go | 4 +- x/proof/keeper/query_claim.go | 31 ++++--- x/proof/keeper/query_claim_test.go | 18 ++-- x/proof/keeper/query_params.go | 4 +- x/proof/keeper/query_proof.go | 17 ++-- x/proof/keeper/query_proof_test.go | 24 ++--- x/proof/keeper/session.go | 10 +- x/proof/module/autocli.go | 91 +++++++++---------- x/proof/module/genesis.go | 11 ++- x/proof/module/genesis_test.go | 6 +- x/proof/module/helpers_test.go | 54 +++++------ x/proof/module/module.go | 5 +- x/proof/module/query.go | 1 + x/proof/module/query_claim.go | 8 +- x/proof/module/query_claim_test.go | 63 +++++-------- x/proof/module/query_proof.go | 8 +- x/proof/module/query_proof_test.go | 69 +++++++------- x/proof/module/tx.go | 1 + x/proof/module/tx_create_claim.go | 3 +- x/proof/simulation/create_claim.go | 1 + x/proof/simulation/submit_proof.go | 1 + x/proof/types/errors.go | 34 ++++--- x/proof/types/expected_keepers.go | 6 -- x/proof/types/genesis.go | 21 ++--- x/proof/types/genesis_test.go | 21 ++--- x/proof/types/key_claim.go | 5 +- x/proof/types/key_proof.go | 5 +- x/proof/types/keys.go | 4 +- x/proof/types/message_create_claim.go | 6 +- x/proof/types/message_create_claim_test.go | 26 +++--- x/proof/types/message_submit_proof.go | 12 ++- x/proof/types/message_submit_proof_test.go | 12 +-- ...ate_params.go => message_update_params.go} | 2 +- x/proof/types/params.go | 4 +- x/proof/types/types.go | 2 + 57 files changed, 546 insertions(+), 529 deletions(-) rename x/proof/types/{msg_update_params.go => message_update_params.go} (91%) diff --git a/api/poktroll/proof/genesis.pulsar.go b/api/poktroll/proof/genesis.pulsar.go index ecc352c4f..fceb8f8a3 100644 --- a/api/poktroll/proof/genesis.pulsar.go +++ b/api/poktroll/proof/genesis.pulsar.go @@ -117,18 +117,18 @@ func (x *_GenesisState_3_list) IsValid() bool { } var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_claimList protoreflect.FieldDescriptor - fd_GenesisState_proofList protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_claim_list protoreflect.FieldDescriptor + fd_GenesisState_proof_list protoreflect.FieldDescriptor ) func init() { file_poktroll_proof_genesis_proto_init() md_GenesisState = File_poktroll_proof_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") - fd_GenesisState_claimList = md_GenesisState.Fields().ByName("claimList") - fd_GenesisState_proofList = md_GenesisState.Fields().ByName("proofList") + fd_GenesisState_claim_list = md_GenesisState.Fields().ByName("claim_list") + fd_GenesisState_proof_list = md_GenesisState.Fields().ByName("proof_list") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -204,13 +204,13 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, } if len(x.ClaimList) != 0 { value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.ClaimList}) - if !f(fd_GenesisState_claimList, value) { + if !f(fd_GenesisState_claim_list, value) { return } } if len(x.ProofList) != 0 { value := protoreflect.ValueOfList(&_GenesisState_3_list{list: &x.ProofList}) - if !f(fd_GenesisState_proofList, value) { + if !f(fd_GenesisState_proof_list, value) { return } } @@ -231,9 +231,9 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "poktroll.proof.GenesisState.params": return x.Params != nil - case "poktroll.proof.GenesisState.claimList": + case "poktroll.proof.GenesisState.claim_list": return len(x.ClaimList) != 0 - case "poktroll.proof.GenesisState.proofList": + case "poktroll.proof.GenesisState.proof_list": return len(x.ProofList) != 0 default: if fd.IsExtension() { @@ -253,9 +253,9 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.proof.GenesisState.params": x.Params = nil - case "poktroll.proof.GenesisState.claimList": + case "poktroll.proof.GenesisState.claim_list": x.ClaimList = nil - case "poktroll.proof.GenesisState.proofList": + case "poktroll.proof.GenesisState.proof_list": x.ProofList = nil default: if fd.IsExtension() { @@ -276,13 +276,13 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "poktroll.proof.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "poktroll.proof.GenesisState.claimList": + case "poktroll.proof.GenesisState.claim_list": if len(x.ClaimList) == 0 { return protoreflect.ValueOfList(&_GenesisState_2_list{}) } listValue := &_GenesisState_2_list{list: &x.ClaimList} return protoreflect.ValueOfList(listValue) - case "poktroll.proof.GenesisState.proofList": + case "poktroll.proof.GenesisState.proof_list": if len(x.ProofList) == 0 { return protoreflect.ValueOfList(&_GenesisState_3_list{}) } @@ -310,11 +310,11 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "poktroll.proof.GenesisState.params": x.Params = value.Message().Interface().(*Params) - case "poktroll.proof.GenesisState.claimList": + case "poktroll.proof.GenesisState.claim_list": lv := value.List() clv := lv.(*_GenesisState_2_list) x.ClaimList = *clv.list - case "poktroll.proof.GenesisState.proofList": + case "poktroll.proof.GenesisState.proof_list": lv := value.List() clv := lv.(*_GenesisState_3_list) x.ProofList = *clv.list @@ -343,13 +343,13 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "poktroll.proof.GenesisState.claimList": + case "poktroll.proof.GenesisState.claim_list": if x.ClaimList == nil { x.ClaimList = []*Claim{} } value := &_GenesisState_2_list{list: &x.ClaimList} return protoreflect.ValueOfList(value) - case "poktroll.proof.GenesisState.proofList": + case "poktroll.proof.GenesisState.proof_list": if x.ProofList == nil { x.ProofList = []*Proof{} } @@ -371,10 +371,10 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.proof.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.proof.GenesisState.claimList": + case "poktroll.proof.GenesisState.claim_list": list := []*Claim{} return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) - case "poktroll.proof.GenesisState.proofList": + case "poktroll.proof.GenesisState.proof_list": list := []*Proof{} return protoreflect.ValueOfList(&_GenesisState_3_list{list: &list}) default: @@ -746,8 +746,8 @@ type GenesisState struct { // params defines all the parameters of the module. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - ClaimList []*Claim `protobuf:"bytes,2,rep,name=claimList,proto3" json:"claimList,omitempty"` - ProofList []*Proof `protobuf:"bytes,3,rep,name=proofList,proto3" json:"proofList,omitempty"` + ClaimList []*Claim `protobuf:"bytes,2,rep,name=claim_list,json=claimList,proto3" json:"claim_list,omitempty"` + ProofList []*Proof `protobuf:"bytes,3,rep,name=proof_list,json=proofList,proto3" json:"proof_list,omitempty"` } func (x *GenesisState) Reset() { @@ -804,30 +804,30 @@ var file_poktroll_proof_genesis_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, - 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, + 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x39, 0x0a, 0x09, 0x63, 0x6c, 0x61, 0x69, - 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, 0x61, - 0x69, 0x6d, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4c, 0x69, 0x73, 0x74, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x9c, - 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, 0x0e, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, 0x02, 0x0e, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xe2, 0x02, - 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x63, 0x6c, 0x61, 0x69, + 0x6d, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x43, 0x6c, + 0x61, 0x69, 0x6d, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x61, 0x69, 0x6d, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x42, + 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x9c, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0xa2, 0x02, 0x03, 0x50, 0x50, 0x58, 0xaa, 0x02, + 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0xca, + 0x02, 0x0e, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, 0x66, + 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -851,8 +851,8 @@ var file_poktroll_proof_genesis_proto_goTypes = []interface{}{ } var file_poktroll_proof_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.proof.GenesisState.params:type_name -> poktroll.proof.Params - 2, // 1: poktroll.proof.GenesisState.claimList:type_name -> poktroll.proof.Claim - 3, // 2: poktroll.proof.GenesisState.proofList:type_name -> poktroll.proof.Proof + 2, // 1: poktroll.proof.GenesisState.claim_list:type_name -> poktroll.proof.Claim + 3, // 2: poktroll.proof.GenesisState.proof_list:type_name -> poktroll.proof.Proof 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name diff --git a/api/poktroll/proof/tx.pulsar.go b/api/poktroll/proof/tx.pulsar.go index 384f04713..b204eb808 100644 --- a/api/poktroll/proof/tx.pulsar.go +++ b/api/poktroll/proof/tx.pulsar.go @@ -2736,6 +2736,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/proof parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } diff --git a/proto/poktroll/proof/claim.proto b/proto/poktroll/proof/claim.proto index 508f88b68..b0e91d4b3 100644 --- a/proto/poktroll/proof/claim.proto +++ b/proto/poktroll/proof/claim.proto @@ -4,6 +4,7 @@ package poktroll.proof; option go_package = "github.com/pokt-network/poktroll/x/proof/types"; import "cosmos_proto/cosmos.proto"; + import "poktroll/session/session.proto"; // Claim is the serialized object stored on-chain for claims pending to be proven diff --git a/proto/poktroll/proof/genesis.proto b/proto/poktroll/proof/genesis.proto index e3741aab6..bc5dd15fc 100644 --- a/proto/poktroll/proof/genesis.proto +++ b/proto/poktroll/proof/genesis.proto @@ -1,21 +1,20 @@ syntax = "proto3"; - package poktroll.proof; +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/proof/params.proto"; import "poktroll/proof/claim.proto"; import "poktroll/proof/proof.proto"; -option go_package = "github.com/pokt-network/poktroll/x/proof/types"; - // GenesisState defines the proof module's genesis state. message GenesisState { - // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - repeated Claim claimList = 2 [(gogoproto.nullable) = false] ; - repeated Proof proofList = 3 [(gogoproto.nullable) = false] ; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Claim claim_list = 2 [(gogoproto.nullable) = false] ; + repeated Proof proof_list = 3 [(gogoproto.nullable) = false] ; } diff --git a/proto/poktroll/proof/params.proto b/proto/poktroll/proof/params.proto index 2e5ba59e3..c2aa3c52e 100644 --- a/proto/poktroll/proof/params.proto +++ b/proto/poktroll/proof/params.proto @@ -1,15 +1,13 @@ syntax = "proto3"; package poktroll.proof; +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/proof/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/proof/Params"; option (gogoproto.equal) = true; - - } \ No newline at end of file diff --git a/proto/poktroll/proof/proof.proto b/proto/poktroll/proof/proof.proto index 0f4a33c6d..83168c4cf 100644 --- a/proto/poktroll/proof/proof.proto +++ b/proto/poktroll/proof/proof.proto @@ -4,6 +4,7 @@ package poktroll.proof; option go_package = "github.com/pokt-network/poktroll/x/proof/types"; import "cosmos_proto/cosmos.proto"; + import "poktroll/session/session.proto"; message Proof { diff --git a/proto/poktroll/proof/query.proto b/proto/poktroll/proof/query.proto index c3c9724e5..9e5795188 100644 --- a/proto/poktroll/proof/query.proto +++ b/proto/poktroll/proof/query.proto @@ -1,45 +1,45 @@ syntax = "proto3"; - package poktroll.proof; +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; + import "poktroll/proof/params.proto"; import "poktroll/proof/claim.proto"; import "poktroll/proof/proof.proto"; -option go_package = "github.com/pokt-network/poktroll/x/proof/types"; - // Query defines the gRPC querier service. service Query { - + // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/pokt-network/poktroll/proof/params"; - + } - + // Queries a list of Claim items. rpc Claim (QueryGetClaimRequest ) returns (QueryGetClaimResponse ) { option (google.api.http).get = "/pokt-network/poktroll/proof/claim/{session_id}/{supplier_address}"; - + } rpc AllClaims (QueryAllClaimsRequest) returns (QueryAllClaimsResponse) { option (google.api.http).get = "/pokt-network/poktroll/proof/claim"; - + } - + // Queries a list of Proof items. rpc Proof (QueryGetProofRequest) returns (QueryGetProofResponse) { option (google.api.http).get = "/pokt-network/poktroll/proof/proof/{session_id}/{supplier_address}"; - + } rpc AllProofs (QueryAllProofsRequest) returns (QueryAllProofsResponse) { option (google.api.http).get = "/pokt-network/poktroll/proof/proof"; - + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -47,13 +47,12 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { - // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } message QueryGetClaimRequest { - string session_id = 1; + string session_id = 1; string supplier_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -65,15 +64,15 @@ message QueryAllClaimsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; oneof filter { - string supplier_address = 2; - string session_id = 3; + string supplier_address= 2; + string session_id = 3; uint64 session_end_height = 4; } } message QueryAllClaimsResponse { - repeated Claim claims = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated Claim claims = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetProofRequest { @@ -87,6 +86,7 @@ message QueryGetProofResponse { message QueryAllProofsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; + oneof filter { string supplier_address = 2; string session_id = 3; @@ -95,7 +95,7 @@ message QueryAllProofsRequest { } message QueryAllProofsResponse { - repeated Proof proofs = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated Proof proofs = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/poktroll/proof/tx.proto b/proto/poktroll/proof/tx.proto index dbc034c5a..173814baa 100644 --- a/proto/poktroll/proof/tx.proto +++ b/proto/poktroll/proof/tx.proto @@ -1,17 +1,17 @@ syntax = "proto3"; - package poktroll.proof; +option go_package = "github.com/pokt-network/poktroll/x/proof/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; + import "poktroll/proof/params.proto"; import "poktroll/session/session.proto"; import "poktroll/shared/service.proto"; -option go_package = "github.com/pokt-network/poktroll/x/proof/types"; - // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; @@ -19,19 +19,22 @@ service Msg { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); - rpc CreateClaim (MsgCreateClaim ) returns (MsgCreateClaimResponse ); - rpc SubmitProof (MsgSubmitProof ) returns (MsgSubmitProofResponse ); + rpc CreateClaim (MsgCreateClaim) returns (MsgCreateClaimResponse); + rpc SubmitProof (MsgSubmitProof) returns (MsgSubmitProofResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/proof/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/proof/MsgUpdateParams"; // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the module parameters to update. + // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the + // latest Cosmos SDK version. We should look into either improving this ourselves + // or seeing if it is on their roadmap. + // params defines the x/proof parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -42,8 +45,9 @@ message MsgUpdateParamsResponse {} message MsgCreateClaim { option (cosmos.msg.v1.signer) = "supplier_address"; - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - poktroll.session.SessionHeader session_header = 2; + + string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + poktroll.session.SessionHeader session_header = 2; // root returned from smt.SMST#Root() bytes root_hash = 3; @@ -54,10 +58,11 @@ message MsgCreateClaimResponse {} message MsgSubmitProof { option (cosmos.msg.v1.signer) = "supplier_address"; - string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - poktroll.session.SessionHeader session_header = 2; + string supplier_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + poktroll.session.SessionHeader session_header = 2; + // serialized version of *smt.SparseMerkleClosestProof - bytes proof = 3; + bytes proof = 3; } message MsgSubmitProofResponse {} diff --git a/testutil/keeper/proof.go b/testutil/keeper/proof.go index ed5c9d152..0189ccd62 100644 --- a/testutil/keeper/proof.go +++ b/testutil/keeper/proof.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" @@ -25,7 +26,10 @@ import ( sessiontypes "github.com/pokt-network/poktroll/x/session/types" ) -func ProofKeeper(t testing.TB, sessionByAppAddr proof.SessionsByAppAddress) (keeper.Keeper, sdk.Context) { +func ProofKeeper( + t testing.TB, + sessionByAppAddr proof.SessionsByAppAddress, +) (keeper.Keeper, context.Context) { t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) @@ -42,10 +46,10 @@ func ProofKeeper(t testing.TB, sessionByAppAddr proof.SessionsByAppAddress) (kee ctrl := gomock.NewController(t) mockSessionKeeper := mocks.NewMockSessionKeeper(ctrl) mockSessionKeeper.EXPECT(). - GetSession(gomock.AssignableToTypeOf(sdk.Context{}), gomock.Any()). + GetSession(gomock.Any(), gomock.Any()). DoAndReturn( func( - ctx sdk.Context, + ctx context.Context, req *sessiontypes.QueryGetSessionRequest, ) (*sessiontypes.QueryGetSessionResponse, error) { session, ok := sessionByAppAddr[req.GetApplicationAddress()] @@ -81,7 +85,7 @@ func ProofKeeper(t testing.TB, sessionByAppAddr proof.SessionsByAppAddress) (kee ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } diff --git a/testutil/proof/fixtures.go b/testutil/proof/fixtures.go index ee80568f1..c352faaea 100644 --- a/testutil/proof/fixtures.go +++ b/testutil/proof/fixtures.go @@ -45,7 +45,7 @@ func NewSessionFixturesWithPairings( // Iterate over the app and supplier address pairs (two indices at a time), // and create a session fixture for each app address. for _, appSupplierPair := range appSupplierPairs { - application := newApplication(t, appSupplierPair.AppAddr, service) + app := newApplication(t, appSupplierPair.AppAddr, service) supplier := newSupplier(t, appSupplierPair.SupplierAddr, service) if session, ok := sessionFixturesByAppAddr[appSupplierPair.AppAddr]; ok { @@ -64,7 +64,7 @@ func NewSessionFixturesWithPairings( SessionId: testSessionId, SessionNumber: testSessionNumber, NumBlocksPerSession: testBlocksPerSession, - Application: application, + Application: app, Suppliers: []*sharedtypes.Supplier{ newSupplier(t, appSupplierPair.SupplierAddr, service), }, @@ -75,7 +75,7 @@ func NewSessionFixturesWithPairings( } // newSuppliers configures a supplier for the services provided and nil endpoints. -func newSupplier(t *testing.T, addr string, services ...*sharedtypes.Service) *sharedtypes.Supplier { +func newSupplier(t *testing.T, supplierAddr string, services ...*sharedtypes.Service) *sharedtypes.Supplier { t.Helper() serviceConfigs := make([]*sharedtypes.SupplierServiceConfig, len(services)) @@ -87,14 +87,14 @@ func newSupplier(t *testing.T, addr string, services ...*sharedtypes.Service) *s } return &sharedtypes.Supplier{ - Address: addr, + Address: supplierAddr, Stake: &sdktypes.Coin{}, Services: serviceConfigs, } } // newApplication configures an application for the services provided. -func newApplication(t *testing.T, addr string, services ...*sharedtypes.Service) *apptypes.Application { +func newApplication(t *testing.T, appAddr string, services ...*sharedtypes.Service) *apptypes.Application { t.Helper() serviceConfigs := make([]*sharedtypes.ApplicationServiceConfig, len(services)) @@ -105,7 +105,7 @@ func newApplication(t *testing.T, addr string, services ...*sharedtypes.Service) } return &apptypes.Application{ - Address: addr, + Address: appAddr, Stake: &sdktypes.Coin{}, ServiceConfigs: serviceConfigs, DelegateeGatewayAddresses: nil, diff --git a/x/proof/keeper/claim.go b/x/proof/keeper/claim.go index 04ce2735c..4e37002ae 100644 --- a/x/proof/keeper/claim.go +++ b/x/proof/keeper/claim.go @@ -26,25 +26,24 @@ func (k Keeper) UpsertClaim(ctx context.Context, claim types.Claim) { logger.Info(fmt.Sprintf("upserted claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) // Update the address index: supplierAddress -> [ClaimPrimaryKey] - addressStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - addressKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) - addressStoreIndex.Set(addressKey, primaryKey) + supplierAddrStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) + supplierAddrKey := types.ClaimSupplierAddressKey(claim.SupplierAddress, primaryKey) + supplierAddrStore.Set(supplierAddrKey, primaryKey) logger.Info(fmt.Sprintf("indexed claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) // Update the session end height index: sessionEndHeight -> [ClaimPrimaryKey] - sessionHeightStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) - sessionHeightStoreIndex.Set(heightKey, primaryKey) + sessionEndHeightStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) + sessionEndHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() + sessionEndHeightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) + sessionEndHeightStore.Set(sessionEndHeightKey, primaryKey) - logger.Info(fmt.Sprintf("indexed claim for supplier %s at session ending height %d", claim.SupplierAddress, sessionEndBlockHeight)) + logger.Info(fmt.Sprintf("indexed claim for supplier %s at session ending height %d", claim.SupplierAddress, sessionEndHeight)) } // GetClaim returns a claim from its index -func (k Keeper) GetClaim(ctx context.Context, sessionId, supplierAddr string) (claim types.Claim, found bool) { - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) - return k.getClaimByPrimaryKey(ctx, primaryKey) +func (k Keeper) GetClaim(ctx context.Context, sessionId, supplierAddr string) (_ types.Claim, isClaimFound bool) { + return k.getClaimByPrimaryKey(ctx, types.ClaimPrimaryKey(sessionId, supplierAddr)) } // RemoveClaim removes a claim from the store @@ -56,24 +55,24 @@ func (k Keeper) RemoveClaim(ctx context.Context, sessionId, supplierAddr string) // Check if the claim exists primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) - claim, foundClaim := k.getClaimByPrimaryKey(ctx, primaryKey) - if !foundClaim { + foundClaim, isClaimFound := k.getClaimByPrimaryKey(ctx, primaryKey) + if !isClaimFound { logger.Error(fmt.Sprintf("trying to delete non-existent claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) return } // Prepare the indices for deletion - addressStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) - sessionHeightStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) + supplierAddrStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSupplierAddressPrefix)) + sessionEndHeightStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) - addressKey := types.ClaimSupplierAddressKey(claim.GetSupplierAddress(), primaryKey) - sessionEndBlockHeight := claim.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) + supplierAddrKey := types.ClaimSupplierAddressKey(foundClaim.GetSupplierAddress(), primaryKey) + sessionEndHeight := foundClaim.GetSessionHeader().GetSessionEndBlockHeight() + sessionEndHeightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) // Delete all the entries (primary store and secondary indices) primaryStore.Delete(primaryKey) - addressStoreIndex.Delete(addressKey) - sessionHeightStoreIndex.Delete(heightKey) + supplierAddrStore.Delete(supplierAddrKey) + sessionEndHeightStore.Delete(sessionEndHeightKey) logger.Info(fmt.Sprintf("deleted claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) } @@ -92,17 +91,20 @@ func (k Keeper) GetAllClaims(ctx context.Context) (claims []types.Claim) { claims = append(claims, claim) } - return + return claims } // getClaimByPrimaryKey is a helper that retrieves, if exists, the Claim associated with the key provided -func (k Keeper) getClaimByPrimaryKey(ctx context.Context, primaryKey []byte) (val types.Claim, found bool) { +func (k Keeper) getClaimByPrimaryKey(ctx context.Context, primaryKey []byte) (claim types.Claim, isClaimFound bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - b := primaryStore.Get(primaryKey) - if b == nil { - return val, false + claimBz := primaryStore.Get(primaryKey) + + if claimBz == nil { + return types.Claim{}, false } - k.cdc.MustUnmarshal(b, &val) - return val, true + + k.cdc.MustUnmarshal(claimBz, &claim) + + return claim, true } diff --git a/x/proof/keeper/claim_test.go b/x/proof/keeper/claim_test.go index 14c331600..9475f55c2 100644 --- a/x/proof/keeper/claim_test.go +++ b/x/proof/keeper/claim_test.go @@ -6,14 +6,14 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/proof/keeper" "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" - - "github.com/stretchr/testify/require" ) // Prevent strconv unused error @@ -21,6 +21,7 @@ var _ = strconv.IntSize func createNClaims(keeper keeper.Keeper, ctx context.Context, n int) []types.Claim { claims := make([]types.Claim, n) + for i := range claims { claims[i].SupplierAddress = sample.AccAddress() claims[i].SessionHeader = &sessiontypes.SessionHeader{ @@ -30,14 +31,17 @@ func createNClaims(keeper keeper.Keeper, ctx context.Context, n int) []types.Cla claims[i].RootHash = []byte(fmt.Sprintf("rootHash-%d", i)) keeper.UpsertClaim(ctx, claims[i]) } + return claims } func TestClaimGet(t *testing.T) { keeper, ctx := keepertest.ProofKeeper(t, nil) claims := createNClaims(keeper, ctx, 10) + for _, claim := range claims { - foundClaim, isClaimFound := keeper.GetClaim(ctx, + foundClaim, isClaimFound := keeper.GetClaim( + ctx, claim.GetSessionHeader().GetSessionId(), claim.SupplierAddress, ) @@ -51,16 +55,11 @@ func TestClaimGet(t *testing.T) { func TestClaimRemove(t *testing.T) { keeper, ctx := keepertest.ProofKeeper(t, nil) claims := createNClaims(keeper, ctx, 10) + for _, claim := range claims { sessionId := claim.GetSessionHeader().GetSessionId() - keeper.RemoveClaim(ctx, - sessionId, - claim.SupplierAddress, - ) - _, isClaimFound := keeper.GetClaim(ctx, - sessionId, - claim.SupplierAddress, - ) + keeper.RemoveClaim(ctx, sessionId, claim.SupplierAddress) + _, isClaimFound := keeper.GetClaim(ctx, sessionId, claim.SupplierAddress) require.False(t, isClaimFound) } } diff --git a/x/proof/keeper/msg_server.go b/x/proof/keeper/msg_server.go index d910bb935..37fe1b224 100644 --- a/x/proof/keeper/msg_server.go +++ b/x/proof/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/proof/types" -) +import "github.com/pokt-network/poktroll/x/proof/types" type msgServer struct { Keeper diff --git a/x/proof/keeper/msg_server_create_claim.go b/x/proof/keeper/msg_server_create_claim.go index 1eda037ac..15e7b47e9 100644 --- a/x/proof/keeper/msg_server_create_claim.go +++ b/x/proof/keeper/msg_server_create_claim.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/proof/types" ) -func (k msgServer) CreateClaim(goCtx context.Context, msg *types.MsgCreateClaim) (*types.MsgCreateClaimResponse, error) { +func (k msgServer) CreateClaim(ctx context.Context, msg *types.MsgCreateClaim) (*types.MsgCreateClaimResponse, error) { // TODO_BLOCKER: Prevent Claim upserts after the ClaimWindow is closed. // TODO_BLOCKER: Validate the signature on the Claim message corresponds to the supplier before Upserting. - ctx := sdk.UnwrapSDKContext(goCtx) logger := k.Logger().With("method", "CreateClaim") logger.Debug("creating claim") @@ -23,7 +21,7 @@ func (k msgServer) CreateClaim(goCtx context.Context, msg *types.MsgCreateClaim) } session, err := k.queryAndValidateSessionHeader( - goCtx, + ctx, msg.GetSessionHeader(), msg.GetSupplierAddress(), ) @@ -55,7 +53,7 @@ func (k msgServer) CreateClaim(goCtx context.Context, msg *types.MsgCreateClaim) claim := types.Claim{ SupplierAddress: msg.GetSupplierAddress(), SessionHeader: msg.GetSessionHeader(), - RootHash: msg.RootHash, + RootHash: msg.GetRootHash(), } // TODO_BLOCKER: check if this claim already exists and return an appropriate error diff --git a/x/proof/keeper/msg_server_create_claim_test.go b/x/proof/keeper/msg_server_create_claim_test.go index 39c2a4725..9354bced6 100644 --- a/x/proof/keeper/msg_server_create_claim_test.go +++ b/x/proof/keeper/msg_server_create_claim_test.go @@ -12,7 +12,6 @@ import ( "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/proof/keeper" "github.com/pokt-network/poktroll/x/proof/types" - prooftypes "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -25,18 +24,18 @@ func TestMsgServer_CreateClaim_Success(t *testing.T) { service := &sharedtypes.Service{Id: testServiceId} sessionFixturesByAddr := proof.NewSessionFixturesWithPairings(t, service, appSupplierPair) - proofKeeper, sdkCtx := keepertest.ProofKeeper(t, sessionFixturesByAddr) + proofKeeper, ctx := keepertest.ProofKeeper(t, sessionFixturesByAddr) srv := keeper.NewMsgServerImpl(proofKeeper) claimMsg := newTestClaimMsg(t, testSessionId) claimMsg.SupplierAddress = appSupplierPair.SupplierAddr claimMsg.SessionHeader.ApplicationAddress = appSupplierPair.AppAddr - createClaimRes, err := srv.CreateClaim(sdkCtx, claimMsg) + createClaimRes, err := srv.CreateClaim(ctx, claimMsg) require.NoError(t, err) require.NotNil(t, createClaimRes) - claimRes, err := proofKeeper.AllClaims(sdkCtx, &types.QueryAllClaimsRequest{}) + claimRes, err := proofKeeper.AllClaims(ctx, &types.QueryAllClaimsRequest{}) require.NoError(t, err) claims := claimRes.GetClaims() @@ -55,7 +54,7 @@ func TestMsgServer_CreateClaim_Error(t *testing.T) { } sessionFixturesByAppAddr := proof.NewSessionFixturesWithPairings(t, service, appSupplierPair) - proofKeeper, sdkCtx := keepertest.ProofKeeper(t, sessionFixturesByAppAddr) + proofKeeper, ctx := keepertest.ProofKeeper(t, sessionFixturesByAppAddr) srv := keeper.NewMsgServerImpl(proofKeeper) tests := []struct { @@ -96,19 +95,19 @@ func TestMsgServer_CreateClaim_Error(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - createClaimRes, err := srv.CreateClaim(sdkCtx, tt.claimMsgFn(t)) - require.ErrorContains(t, err, tt.expectedErr.Error()) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + createClaimRes, err := srv.CreateClaim(ctx, test.claimMsgFn(t)) + require.ErrorContains(t, err, test.expectedErr.Error()) require.Nil(t, createClaimRes) }) } } -func newTestClaimMsg(t *testing.T, sessionId string) *prooftypes.MsgCreateClaim { +func newTestClaimMsg(t *testing.T, sessionId string) *types.MsgCreateClaim { t.Helper() - return prooftypes.NewMsgCreateClaim( + return types.NewMsgCreateClaim( sample.AccAddress(), &sessiontypes.SessionHeader{ ApplicationAddress: sample.AccAddress(), diff --git a/x/proof/keeper/msg_server_submit_proof.go b/x/proof/keeper/msg_server_submit_proof.go index c1210b9d6..442098270 100644 --- a/x/proof/keeper/msg_server_submit_proof.go +++ b/x/proof/keeper/msg_server_submit_proof.go @@ -7,7 +7,6 @@ import ( "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/proof/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func (k msgServer) SubmitProof(ctx context.Context, msg *types.MsgSubmitProof) (*types.MsgSubmitProofResponse, error) { @@ -91,44 +90,47 @@ func (k msgServer) queryAndValidateClaimForProof(ctx context.Context, proof *typ // NB: no need to assert the testSessionId or supplier address as it is retrieved // by respective values of the given proof. I.e., if the claim exists, then these // values are guaranteed to match. - claim, found := k.GetClaim(ctx, sessionId, proof.GetSupplierAddress()) + foundClaim, found := k.GetClaim(ctx, sessionId, proof.GetSupplierAddress()) if !found { - return suppliertypes.ErrSupplierClaimNotFound.Wrapf("no claim found for session ID %q and supplier %q", sessionId, proof.GetSupplierAddress()) + return types.ErrProofClaimNotFound.Wrapf("no claim found for session ID %q and supplier %q", sessionId, proof.GetSupplierAddress()) } + claimSessionHeader := foundClaim.GetSessionHeader() + proofSessionHeader := proof.GetSessionHeader() + // Ensure session start heights match. - if claim.GetSessionHeader().GetSessionStartBlockHeight() != proof.GetSessionHeader().GetSessionStartBlockHeight() { - return suppliertypes.ErrSupplierInvalidSessionStartHeight.Wrapf( + if claimSessionHeader.GetSessionStartBlockHeight() != proofSessionHeader.GetSessionStartBlockHeight() { + return types.ErrProofInvalidSessionStartHeight.Wrapf( "claim session start height %d does not match proof session start height %d", - claim.GetSessionHeader().GetSessionStartBlockHeight(), - proof.GetSessionHeader().GetSessionStartBlockHeight(), + claimSessionHeader.GetSessionStartBlockHeight(), + proofSessionHeader.GetSessionStartBlockHeight(), ) } // Ensure session end heights match. - if claim.GetSessionHeader().GetSessionEndBlockHeight() != proof.GetSessionHeader().GetSessionEndBlockHeight() { - return suppliertypes.ErrSupplierInvalidSessionEndHeight.Wrapf( + if claimSessionHeader.GetSessionEndBlockHeight() != proofSessionHeader.GetSessionEndBlockHeight() { + return types.ErrProofInvalidSessionEndHeight.Wrapf( "claim session end height %d does not match proof session end height %d", - claim.GetSessionHeader().GetSessionEndBlockHeight(), - proof.GetSessionHeader().GetSessionEndBlockHeight(), + claimSessionHeader.GetSessionEndBlockHeight(), + proofSessionHeader.GetSessionEndBlockHeight(), ) } // Ensure application addresses match. - if claim.GetSessionHeader().GetApplicationAddress() != proof.GetSessionHeader().GetApplicationAddress() { - return suppliertypes.ErrSupplierInvalidAddress.Wrapf( + if claimSessionHeader.GetApplicationAddress() != proofSessionHeader.GetApplicationAddress() { + return types.ErrProofInvalidAddress.Wrapf( "claim application address %q does not match proof application address %q", - claim.GetSessionHeader().GetApplicationAddress(), - proof.GetSessionHeader().GetApplicationAddress(), + claimSessionHeader.GetApplicationAddress(), + proofSessionHeader.GetApplicationAddress(), ) } // Ensure service IDs match. - if claim.GetSessionHeader().GetService().GetId() != proof.GetSessionHeader().GetService().GetId() { - return suppliertypes.ErrSupplierInvalidService.Wrapf( + if claimSessionHeader.GetService().GetId() != proofSessionHeader.GetService().GetId() { + return types.ErrProofInvalidService.Wrapf( "claim service ID %q does not match proof service ID %q", - claim.GetSessionHeader().GetService().GetId(), - proof.GetSessionHeader().GetService().GetId(), + claimSessionHeader.GetService().GetId(), + proofSessionHeader.GetService().GetId(), ) } diff --git a/x/proof/keeper/msg_server_test.go b/x/proof/keeper/msg_server_test.go index a7522098a..e00f49e38 100644 --- a/x/proof/keeper/msg_server_test.go +++ b/x/proof/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.ProofKeeper(t, nil) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/proof/keeper/msg_update_params.go b/x/proof/keeper/msg_update_params.go index 53035a815..e13ee9b8a 100644 --- a/x/proof/keeper/msg_update_params.go +++ b/x/proof/keeper/msg_update_params.go @@ -3,18 +3,14 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/proof/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrProofInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } - ctx := sdk.UnwrapSDKContext(goCtx) if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index a07165f78..f485f9eaa 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/proof/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + params *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", - input: &types.MsgUpdateParams{ + desc: "invalid authority", + params: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", - input: &types.MsgUpdateParams{ + desc: "send enabled param", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", - input: &types.MsgUpdateParams{ + desc: "all good", + params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.params) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/proof/keeper/params.go b/x/proof/keeper/params.go index 97a300f21..957a7ab84 100644 --- a/x/proof/keeper/params.go +++ b/x/proof/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/proof/keeper/proof.go b/x/proof/keeper/proof.go index 1ff3405f8..2a8d2a018 100644 --- a/x/proof/keeper/proof.go +++ b/x/proof/keeper/proof.go @@ -26,35 +26,57 @@ func (k Keeper) UpsertProof(ctx context.Context, proof types.Proof) { logger.Info(fmt.Sprintf("upserted proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) // Update the address index: supplierAddress -> [ProofPrimaryKey] - addressStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSupplierAddressPrefix)) - addressKey := types.ProofSupplierAddressKey(proof.GetSupplierAddress(), primaryKey) - addressStoreIndex.Set(addressKey, primaryKey) + supplierAddrStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSupplierAddressPrefix)) + supplierAddrKey := types.ProofSupplierAddressKey(proof.GetSupplierAddress(), primaryKey) + supplierAddrStore.Set(supplierAddrKey, primaryKey) logger.Info(fmt.Sprintf("indexed Proof for supplier %s with primaryKey %s", proof.GetSupplierAddress(), primaryKey)) // Update the session end height index: sessionEndHeight -> [ProofPrimaryKey] - sessionHeightStoreIndex := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSessionEndHeightPrefix)) + sessionEndHeightStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSessionEndHeightPrefix)) sessionEndHeight := proof.GetSessionHeader().GetSessionEndBlockHeight() - heightKey := types.ProofSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) - sessionHeightStoreIndex.Set(heightKey, primaryKey) + sessionEndHeightKey := types.ProofSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) + sessionEndHeightStore.Set(sessionEndHeightKey, primaryKey) } // GetProof returns a proof from its index -func (k Keeper) GetProof(ctx context.Context, sessionId, supplierAdd string) (val types.Proof, found bool) { - primaryKey := types.ProofPrimaryKey(sessionId, supplierAdd) - return k.getProofByPrimaryKey(ctx, primaryKey) +func (k Keeper) GetProof(ctx context.Context, sessionId, supplierAddr string) (_ types.Proof, isProofFound bool) { + return k.getProofByPrimaryKey(ctx, types.ProofPrimaryKey(sessionId, supplierAddr)) } // RemoveProof removes a proof from the store func (k Keeper) RemoveProof(ctx context.Context, sessionId, supplierAddr string) { + logger := k.Logger().With("method", "RemoveClaim") + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) + + // Check if the proof exists primaryKey := types.ProofPrimaryKey(sessionId, supplierAddr) + foundProof, isProofFound := k.getProofByPrimaryKey(ctx, primaryKey) + if !isProofFound { + logger.Error(fmt.Sprintf("trying to delete non-existent proof with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) + return + } + + // Prepare the indices for deletion + supplierAddrStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSupplierAddressPrefix)) + sessionEndHeightStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofSessionEndHeightPrefix)) + + supplierAddrKey := types.ProofSupplierAddressKey(foundProof.GetSupplierAddress(), primaryKey) + sessionEndHeight := foundProof.GetSessionHeader().GetSessionEndBlockHeight() + sessionEndHeightKey := types.ProofSupplierEndSessionHeightKey(sessionEndHeight, primaryKey) + + // Delete all the entries (primary store and secondary indices) primaryStore.Delete(primaryKey) + supplierAddrStore.Delete(supplierAddrKey) + sessionEndHeightStore.Delete(sessionEndHeightKey) + + logger.Info(fmt.Sprintf("deleted proof with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) } // GetAllProofs returns all proof -func (k Keeper) GetAllProofs(ctx context.Context) (list []types.Proof) { +func (k Keeper) GetAllProofs(ctx context.Context) (proofs []types.Proof) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(primaryStore, []byte{}) @@ -62,24 +84,25 @@ func (k Keeper) GetAllProofs(ctx context.Context) (list []types.Proof) { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Proof - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) + var proof types.Proof + k.cdc.MustUnmarshal(iterator.Value(), &proof) + proofs = append(proofs, proof) } - return + return proofs } // getProofByPrimaryKey is a helper that retrieves, if exists, the Proof associated with the key provided -func (k Keeper) getProofByPrimaryKey(ctx context.Context, primaryKey []byte) (proof types.Proof, found bool) { +func (k Keeper) getProofByPrimaryKey(ctx context.Context, primaryKey []byte) (proof types.Proof, isProofFound bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) primaryStore := prefix.NewStore(storeAdapter, types.KeyPrefix(types.ProofPrimaryKeyPrefix)) proofBz := primaryStore.Get(primaryKey) if proofBz == nil { - return proof, false + return types.Proof{}, false } k.cdc.MustUnmarshal(proofBz, &proof) + return proof, true } diff --git a/x/proof/keeper/proof_test.go b/x/proof/keeper/proof_test.go index 9e8145f88..0601a3733 100644 --- a/x/proof/keeper/proof_test.go +++ b/x/proof/keeper/proof_test.go @@ -28,6 +28,7 @@ var _ = strconv.IntSize func createNProofs(keeper keeper.Keeper, ctx context.Context, n int) []types.Proof { proofs := make([]types.Proof, n) + for i := range proofs { proofs[i] = types.Proof{ SupplierAddress: sample.AccAddress(), @@ -43,22 +44,24 @@ func createNProofs(keeper keeper.Keeper, ctx context.Context, n int) []types.Pro keeper.UpsertProof(ctx, proofs[i]) } + return proofs } func TestProofGet(t *testing.T) { keeper, ctx := keepertest.ProofKeeper(t, nil) proofs := createNProofs(keeper, ctx, 10) + for _, proof := range proofs { - rst, found := keeper.GetProof( + foundProof, isProofFound := keeper.GetProof( ctx, proof.GetSessionHeader().GetSessionId(), proof.GetSupplierAddress(), ) - require.True(t, found) + require.True(t, isProofFound) require.Equal(t, nullify.Fill(&proof), - nullify.Fill(&rst), + nullify.Fill(&foundProof), ) } } @@ -68,8 +71,8 @@ func TestProofRemove(t *testing.T) { for _, proof := range proofs { sessionId := proof.GetSessionHeader().GetSessionId() keeper.RemoveProof(ctx, sessionId, proof.GetSupplierAddress()) - _, found := keeper.GetProof(ctx, sessionId, proof.GetSupplierAddress()) - require.False(t, found) + _, isProofFound := keeper.GetProof(ctx, sessionId, proof.GetSupplierAddress()) + require.False(t, isProofFound) } } diff --git a/x/proof/keeper/query.go b/x/proof/keeper/query.go index 6ac55c397..e7a6730ac 100644 --- a/x/proof/keeper/query.go +++ b/x/proof/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/proof/types" -) +import "github.com/pokt-network/poktroll/x/proof/types" var _ types.QueryServer = Keeper{} diff --git a/x/proof/keeper/query_claim.go b/x/proof/keeper/query_claim.go index 4678b01e6..f02d5d242 100644 --- a/x/proof/keeper/query_claim.go +++ b/x/proof/keeper/query_claim.go @@ -18,13 +18,15 @@ func (k Keeper) AllClaims(ctx context.Context, req *types.QueryAllClaimsRequest) return nil, status.Error(codes.InvalidArgument, "invalid request") } - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - //claimStore := prefix.NewStore(store, types.KeyPrefix(types.ClaimKeyPrefix)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) // isCustomIndex is used to determined if we'll be using the store that points // to the actual Claim values, or a secondary index that points to the primary keys. - var isCustomIndex bool - var keyPrefix []byte + var ( + isCustomIndex bool + keyPrefix []byte + ) + switch filter := req.Filter.(type) { case *types.QueryAllClaimsRequest_SupplierAddress: isCustomIndex = true @@ -35,7 +37,6 @@ func (k Keeper) AllClaims(ctx context.Context, req *types.QueryAllClaimsRequest) isCustomIndex = true heightBz := make([]byte, 8) binary.BigEndian.PutUint64(heightBz, filter.SessionEndHeight) - keyPrefix = types.KeyPrefix(types.ClaimSessionEndHeightPrefix) keyPrefix = append(keyPrefix, heightBz...) @@ -48,18 +49,20 @@ func (k Keeper) AllClaims(ctx context.Context, req *types.QueryAllClaimsRequest) isCustomIndex = false keyPrefix = types.KeyPrefix(types.ClaimPrimaryKeyPrefix) } - claimStore := prefix.NewStore(store, keyPrefix) + + claimStore := prefix.NewStore(storeAdapter, keyPrefix) var claims []types.Claim pageRes, err := query.Paginate(claimStore, req.Pagination, func(key []byte, value []byte) error { if isCustomIndex { - // We retrieve the primaryKey, and need to query the actual Claim before decoding it. - claim, claimFound := k.getClaimByPrimaryKey(ctx, value) - if claimFound { - claims = append(claims, claim) + // If a custom index is used, the value is a primaryKey. + // Then we retrieve the claim using the given primaryKey. + foundClaim, isClaimFound := k.getClaimByPrimaryKey(ctx, value) + if isClaimFound { + claims = append(claims, foundClaim) } } else { - // The value is an encoded Claim. + // The value is the encoded claim. var claim types.Claim if err := k.cdc.Unmarshal(value, &claim); err != nil { return err @@ -87,15 +90,15 @@ func (k Keeper) Claim(ctx context.Context, req *types.QueryGetClaimRequest) (*ty return nil, status.Error(codes.InvalidArgument, err.Error()) } - val, found := k.GetClaim( + foundClaim, isClaimFound := k.GetClaim( ctx, req.SessionId, req.SupplierAddress, ) - if !found { + if !isClaimFound { err := types.ErrProofClaimNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) return nil, status.Error(codes.NotFound, err.Error()) } - return &types.QueryGetClaimResponse{Claim: val}, nil + return &types.QueryGetClaimResponse{Claim: foundClaim}, nil } diff --git a/x/proof/keeper/query_claim_test.go b/x/proof/keeper/query_claim_test.go index 8d5620636..b202956d9 100644 --- a/x/proof/keeper/query_claim_test.go +++ b/x/proof/keeper/query_claim_test.go @@ -91,7 +91,7 @@ func TestClaimQuerySingle(t *testing.T) { { desc: "InvalidRequest - Missing SessionId", request: &types.QueryGetClaimRequest{ - // SessionId: Intentionally Omitted + // SessionId explicitly omitted SupplierAddress: claims[0].GetSupplierAddress(), }, @@ -107,7 +107,7 @@ func TestClaimQuerySingle(t *testing.T) { desc: "InvalidRequest - Missing SupplierAddress", request: &types.QueryGetClaimRequest{ SessionId: claims[0].GetSessionHeader().GetSessionId(), - // SupplierAddress: Intentionally Omitted, + // SupplierAddress explicitly omitted }, expectedErr: status.Error( @@ -129,19 +129,19 @@ func TestClaimQuerySingle(t *testing.T) { ), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Claim(ctx, tc.request) - if tc.expectedErr != nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Claim(ctx, test.request) + if test.expectedErr != nil { actualStatus, ok := status.FromError(err) require.True(t, ok) - require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) - require.ErrorContains(t, err, tc.expectedErr.Error()) + require.ErrorIs(t, actualStatus.Err(), test.expectedErr) + require.ErrorContains(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } diff --git a/x/proof/keeper/query_params.go b/x/proof/keeper/query_params.go index b30236464..0dc9ee490 100644 --- a/x/proof/keeper/query_params.go +++ b/x/proof/keeper/query_params.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/proof/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/proof/keeper/query_proof.go b/x/proof/keeper/query_proof.go index 6e8a9d585..bc34456f3 100644 --- a/x/proof/keeper/query_proof.go +++ b/x/proof/keeper/query_proof.go @@ -53,13 +53,14 @@ func (k Keeper) AllProofs(ctx context.Context, req *types.QueryAllProofsRequest) var proofs []types.Proof pageRes, err := query.Paginate(proofStore, req.Pagination, func(key []byte, value []byte) error { if isCustomIndex { - // We retrieve the primaryKey, and need to query the actual proof before decoding it. - proof, proofFound := k.getProofByPrimaryKey(ctx, value) - if proofFound { - proofs = append(proofs, proof) + // If a custom index is used, the value is a primaryKey. + // Then we retrieve the proof using the given primaryKey. + foundProof, isProofFound := k.getProofByPrimaryKey(ctx, value) + if isProofFound { + proofs = append(proofs, foundProof) } } else { - // The value is an encoded proof. + // The value is the encoded proof. var proof types.Proof if err := k.cdc.Unmarshal(value, &proof); err != nil { return err @@ -88,11 +89,11 @@ func (k Keeper) Proof(ctx context.Context, req *types.QueryGetProofRequest) (*ty return nil, status.Error(codes.InvalidArgument, err.Error()) } - val, found := k.GetProof(ctx, req.GetSessionId(), req.GetSupplierAddress()) - if !found { + foundProof, isProofFound := k.GetProof(ctx, req.GetSessionId(), req.GetSupplierAddress()) + if !isProofFound { err := types.ErrProofProofNotFound.Wrapf("session ID %q and supplier %q", req.SessionId, req.SupplierAddress) return nil, status.Error(codes.NotFound, err.Error()) } - return &types.QueryGetProofResponse{Proof: val}, nil + return &types.QueryGetProofResponse{Proof: foundProof}, nil } diff --git a/x/proof/keeper/query_proof_test.go b/x/proof/keeper/query_proof_test.go index e99c83169..090788933 100644 --- a/x/proof/keeper/query_proof_test.go +++ b/x/proof/keeper/query_proof_test.go @@ -79,7 +79,7 @@ func TestProofQuerySingle(t *testing.T) { { desc: "InvalidRequest - Missing SessionId", request: &types.QueryGetProofRequest{ - // SessionId: Intentionally Omitted + // SessionId explicitly omitted SupplierAddress: proofs[0].GetSupplierAddress(), }, expectedErr: status.Error( @@ -94,7 +94,7 @@ func TestProofQuerySingle(t *testing.T) { desc: "InvalidRequest - Missing SupplierAddress", request: &types.QueryGetProofRequest{ SessionId: proofs[0].GetSessionHeader().GetSessionId(), - // SupplierAddress: Intentionally Omitted, + // SupplierAddress explicitly omitted }, expectedErr: status.Error( codes.InvalidArgument, @@ -108,25 +108,23 @@ func TestProofQuerySingle(t *testing.T) { request: nil, expectedErr: status.Error( codes.InvalidArgument, - types.ErrProofInvalidQueryRequest.Wrap( - "request cannot be nil", - ).Error(), + types.ErrProofInvalidQueryRequest.Wrap("request cannot be nil").Error(), ), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Proof(ctx, tc.request) - if tc.expectedErr != nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Proof(ctx, test.request) + if test.expectedErr != nil { actualStatus, ok := status.FromError(err) require.True(t, ok) - require.ErrorIs(t, actualStatus.Err(), tc.expectedErr) - require.ErrorContains(t, err, tc.expectedErr.Error()) + require.ErrorIs(t, actualStatus.Err(), test.expectedErr) + require.ErrorContains(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } @@ -148,6 +146,7 @@ func TestProofQueryPaginated(t *testing.T) { }, } } + t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(proofs); i += step { @@ -160,6 +159,7 @@ func TestProofQueryPaginated(t *testing.T) { ) } }) + t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte diff --git a/x/proof/keeper/session.go b/x/proof/keeper/session.go index 160c590c2..dc3a60fdd 100644 --- a/x/proof/keeper/session.go +++ b/x/proof/keeper/session.go @@ -3,9 +3,9 @@ package keeper import ( "context" + "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" - suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) // queryAndValidateSessionHeader ensures that a session with the sessionID of the given session @@ -41,7 +41,7 @@ func (k msgServer) queryAndValidateSessionHeader( // Ensure that the given session header's session ID matches the on-chain onChainSession ID. if sessionHeader.GetSessionId() != onChainSession.GetSessionId() { - return nil, suppliertypes.ErrSupplierInvalidSessionId.Wrapf( + return nil, types.ErrProofInvalidSessionId.Wrapf( "session ID does not match on-chain session ID; expected %q, got %q", onChainSession.GetSessionId(), sessionHeader.GetSessionId(), @@ -55,11 +55,11 @@ func (k msgServer) queryAndValidateSessionHeader( // pair exists for the given service ID or not, respectively. // Ensure the given supplier is in the onChainSession supplier list. - if found := foundSupplier( + if isSupplerFound := foundSupplier( sessionRes.GetSession().GetSuppliers(), supplierAddr, - ); !found { - return nil, suppliertypes.ErrSupplierNotFound.Wrapf( + ); !isSupplerFound { + return nil, types.ErrProofNotFound.Wrapf( "supplier address %q not found in session ID %q", supplierAddr, sessionHeader.GetSessionId(), diff --git a/x/proof/module/autocli.go b/x/proof/module/autocli.go index 73da757e1..43d5c801e 100644 --- a/x/proof/module/autocli.go +++ b/x/proof/module/autocli.go @@ -10,59 +10,58 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - }, - { - RpcMethod: "AllClaims", - Use: "list-claim", - Short: "List all claim", - }, - { - RpcMethod: "Claim", - Use: "show-claim [id]", - Short: "Shows a claim", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, - }, - { - RpcMethod: "AllProofs", - Use: "list-proof", - Short: "List all proof", - }, - { - RpcMethod: "Proof", - Use: "show-proof [id]", - Short: "Shows a proof", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, - }, + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "AllClaims", + // Use: "list-claim", + // Short: "List all claim", + // }, + // { + // RpcMethod: "Claim", + // Use: "show-claim [id]", + // Short: "Shows a claim", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + // }, + // { + // RpcMethod: "AllProofs", + // Use: "list-proof", + // Short: "List all proof", + // }, + // { + // RpcMethod: "Proof", + // Use: "show-proof [id]", + // Short: "Shows a proof", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "index"}}, + // }, // this line is used by ignite scaffolding # autocli/query }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, - // TODO_TECHDEBT(#370): Integrate with AutoCLI - //{ - // RpcMethod: "CreateClaim", - // Use: "create-claim [session-header] [root-hash]", - // Short: "Send a create-claim tx", - // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "sessionHeader"}, {ProtoField: "rootHash"}}, - //}, - //{ - // RpcMethod: "SubmitProof", - // Use: "submit-proof [session-header] [proof]", - // Short: "Send a submit-proof tx", - // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "sessionHeader"}, {ProtoField: "proof"}}, - //}, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "CreateClaim", + // Use: "create-claim [session-header] [root-hash]", + // Short: "Send a create-claim tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "sessionHeader"}, {ProtoField: "rootHash"}}, + // }, + // { + // RpcMethod: "SubmitProof", + // Use: "submit-proof [session-header] [proof]", + // Short: "Send a submit-proof tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "sessionHeader"}, {ProtoField: "proof"}}, + // }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/proof/module/genesis.go b/x/proof/module/genesis.go index ee0e3a7fe..db137654b 100644 --- a/x/proof/module/genesis.go +++ b/x/proof/module/genesis.go @@ -1,14 +1,15 @@ package proof import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/proof/keeper" "github.com/pokt-network/poktroll/x/proof/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +// TODO_TECHDEBT(@Olshansk): Remove existing claims from genesis. +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // Set all the claim for _, claim := range genState.ClaimList { k.UpsertClaim(ctx, claim) @@ -18,11 +19,13 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) k.UpsertProof(ctx, proof) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) diff --git a/x/proof/module/genesis_test.go b/x/proof/module/genesis_test.go index 1169893c0..488c0e113 100644 --- a/x/proof/module/genesis_test.go +++ b/x/proof/module/genesis_test.go @@ -3,14 +3,14 @@ package proof_test import ( "testing" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/proof/module" + proof "github.com/pokt-network/poktroll/x/proof/module" "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" - - "github.com/stretchr/testify/require" ) func TestGenesis(t *testing.T) { diff --git a/x/proof/module/helpers_test.go b/x/proof/module/helpers_test.go index 2a7eec325..e613322a7 100644 --- a/x/proof/module/helpers_test.go +++ b/x/proof/module/helpers_test.go @@ -18,7 +18,6 @@ import ( sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/network" "github.com/pokt-network/poktroll/testutil/testkeyring" apptypes "github.com/pokt-network/poktroll/x/application/types" @@ -38,11 +37,6 @@ const ( // Dummy variable to avoid unused import error. var _ = strconv.IntSize -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - // TODO_CONSIDERATION: perhaps this (and/or other similar helpers) can be refactored // into something more generic and moved into a shared testutil package. // TODO_TECHDEBT: refactor; this function has more than a single responsibility, @@ -50,9 +44,9 @@ func init() { // accounts, and claims set up logic can probably be factored out and/or reduced. func networkWithClaimObjects( t *testing.T, - sessionCount int, - supplierCount int, - appCount int, + numSessions int, + numSuppliers int, + numApps int, ) (net *network.Network, claims []types.Claim) { t.Helper() @@ -63,8 +57,8 @@ func networkWithClaimObjects( // to network start. kr := keyring.NewInMemory(cfg.Codec) // Populate the in-memmory keyring with as many pre-generated accounts as - // we expect to need for the test (i.e. appCount + supplierCount). - testkeyring.CreatePreGeneratedKeyringAccounts(t, kr, supplierCount+appCount) + // we expect to need for the test (i.e. numApps + numSuppliers). + testkeyring.CreatePreGeneratedKeyringAccounts(t, kr, numSuppliers+numApps) // Use the pre-generated accounts iterator to populate the supplier and // application accounts and addresses lists for use in genesis state construction. @@ -72,19 +66,21 @@ func networkWithClaimObjects( // Create a supplier for each session in numClaimsSessions and an app for each // claim in numClaimsPerSession. - supplierAccts := make([]*testkeyring.PreGeneratedAccount, supplierCount) - supplierAddrs := make([]string, supplierCount) + supplierAccts := make([]*testkeyring.PreGeneratedAccount, numSuppliers) + supplierAddrs := make([]string, numSuppliers) for i := range supplierAccts { account, ok := preGeneratedAccts.Next() require.True(t, ok) + supplierAccts[i] = account supplierAddrs[i] = account.Address.String() } - appAccts := make([]*testkeyring.PreGeneratedAccount, appCount) - appAddrs := make([]string, appCount) + appAccts := make([]*testkeyring.PreGeneratedAccount, numApps) + appAddrs := make([]string, numApps) for i := range appAccts { account, ok := preGeneratedAccts.Next() require.True(t, ok) + appAccts[i] = account appAddrs[i] = account.Address.String() } @@ -93,6 +89,7 @@ func networkWithClaimObjects( supplierGenesisState := network.SupplierModuleGenesisStateWithAddresses(t, supplierAddrs) supplierGenesisBuffer, err := cfg.Codec.MarshalJSON(supplierGenesisState) require.NoError(t, err) + appGenesisState := network.ApplicationModuleGenesisStateWithAddresses(t, appAddrs) appGenesisBuffer, err := cfg.Codec.MarshalJSON(appGenesisState) require.NoError(t, err) @@ -123,9 +120,9 @@ func networkWithClaimObjects( // need to wait for the account to be initialized in the next block require.NoError(t, net.WaitForNextBlock()) - // Create sessionCount * numClaimsPerSession claims for the supplier + // Create numSessions * numClaimsPerSession claims for the supplier sessionEndHeight := int64(1) - for sessionIdx := 0; sessionIdx < sessionCount; sessionIdx++ { + for sessionIdx := 0; sessionIdx < numSessions; sessionIdx++ { sessionEndHeight += numBlocksPerSession for _, appAcct := range appAccts { for _, supplierAcct := range supplierAccts { @@ -155,7 +152,7 @@ func encodeSessionHeader( ) string { t.Helper() - argSessionHeader := &sessiontypes.SessionHeader{ + sessionHeader := &sessiontypes.SessionHeader{ ApplicationAddress: appAddr, SessionStartBlockHeight: sessionStartHeight, SessionId: sessionId, @@ -163,7 +160,7 @@ func encodeSessionHeader( Service: &sharedtypes.Service{Id: testServiceId}, } cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) - sessionHeaderBz := cdc.MustMarshalJSON(argSessionHeader) + sessionHeaderBz := cdc.MustMarshalJSON(sessionHeader) return base64.StdEncoding.EncodeToString(sessionHeaderBz) } @@ -174,14 +171,14 @@ func createClaim( ctx client.Context, supplierAddr string, sessionEndHeight int64, - appAddress string, + appAddr string, ) *types.Claim { t.Helper() rootHash := []byte("root_hash") sessionStartHeight := sessionEndHeight - numBlocksPerSession - sessionId := getSessionId(t, net, appAddress, supplierAddr, sessionStartHeight) - sessionHeaderEncoded := encodeSessionHeader(t, appAddress, sessionId, sessionStartHeight) + sessionId := getSessionId(t, net, appAddr, supplierAddr, sessionStartHeight) + sessionHeaderEncoded := encodeSessionHeader(t, appAddr, sessionId, sessionStartHeight) rootHashEncoded := base64.StdEncoding.EncodeToString(rootHash) args := []string{ @@ -195,6 +192,9 @@ func createClaim( responseRaw, err := testcli.ExecTestCLICmd(ctx, proof.CmdCreateClaim(), args) require.NoError(t, err) + + // Check the response, this test only asserts CLI command success and not + // the actual proof module state. var responseJson map[string]interface{} err = json.Unmarshal(responseRaw.Bytes(), &responseJson) require.NoError(t, err) @@ -204,7 +204,7 @@ func createClaim( return &types.Claim{ SupplierAddress: supplierAddr, SessionHeader: &sessiontypes.SessionHeader{ - ApplicationAddress: appAddress, + ApplicationAddress: appAddr, Service: &sharedtypes.Service{Id: testServiceId}, SessionId: sessionId, SessionStartBlockHeight: sessionStartHeight, @@ -225,7 +225,7 @@ func getSessionId( sessionStartHeight int64, ) string { t.Helper() - ctx := context.TODO() + ctx := context.Background() sessionQueryClient := sessiontypes.NewQueryClient(net.Validators[0].ClientCtx) res, err := sessionQueryClient.GetSession(ctx, &sessiontypes.QueryGetSessionRequest{ @@ -235,14 +235,14 @@ func getSessionId( }) require.NoError(t, err) - var found bool + var isSupplierFound bool for _, supplier := range res.GetSession().GetSuppliers() { if supplier.GetAddress() == supplierAddr { - found = true + isSupplierFound = true break } } - require.Truef(t, found, "supplier address %s not found in session", supplierAddr) + require.Truef(t, isSupplierFound, "supplier address %s not found in session", supplierAddr) return res.Session.SessionId } diff --git a/x/proof/module/module.go b/x/proof/module/module.go index 44e4154aa..8eb8cacde 100644 --- a/x/proof/module/module.go +++ b/x/proof/module/module.go @@ -166,10 +166,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/proof/module/query.go b/x/proof/module/query.go index 5d4cae772..750df66a8 100644 --- a/x/proof/module/query.go +++ b/x/proof/module/query.go @@ -10,6 +10,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetQueryCmd() *cobra.Command { // Group supplier queries under a subcommand cmd := &cobra.Command{ diff --git a/x/proof/module/query_claim.go b/x/proof/module/query_claim.go index 0e423dbc2..e96861133 100644 --- a/x/proof/module/query_claim.go +++ b/x/proof/module/query_claim.go @@ -26,10 +26,10 @@ func CmdListClaims() *cobra.Command { The claims can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags Example: -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-id --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --session-end-height --node $(POCKET_NODE) -$ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --supplier-address --node $(POCKET_NODE)`, +$ poktrolld q claim list-claims --node $(POCKET_NODE) --home $(POKTROLLD_HOME) +$ poktrolld q claim list-claims --session-id --node $(POCKET_NODE) --home $(POKTROLLD_HOME) +$ poktrolld q claim list-claims --session-end-height --node $(POCKET_NODE) --home $(POKTROLLD_HOME) +$ poktrolld q claim list-claims --supplier-address --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/proof/module/query_claim_test.go b/x/proof/module/query_claim_test.go index 1e8c12130..a1f4513b9 100644 --- a/x/proof/module/query_claim_test.go +++ b/x/proof/module/query_claim_test.go @@ -19,18 +19,14 @@ import ( ) func TestClaim_Show(t *testing.T) { - sessionCount := 1 - supplierCount := 3 - appCount := 3 + numSessions := 1 + numSuppliers := 3 + numApps := 3 - net, claims := networkWithClaimObjects( - t, sessionCount, - appCount, - supplierCount, - ) + net, claims := networkWithClaimObjects(t, numSessions, numApps, numSuppliers) ctx := net.Validators[0].ClientCtx - common := []string{ + commonArgs := []string{ fmt.Sprintf("--%s=json", tmcli.OutputFlag), } @@ -40,16 +36,14 @@ func TestClaim_Show(t *testing.T) { sessionId string supplierAddr string - args []string - expectedErr error claim types.Claim + expectedErr error }{ { desc: "claim found", sessionId: claims[0].GetSessionHeader().GetSessionId(), supplierAddr: claims[0].GetSupplierAddress(), - args: common, claim: claims[0], }, { @@ -57,8 +51,6 @@ func TestClaim_Show(t *testing.T) { sessionId: "wrong_session_id", supplierAddr: claims[0].GetSupplierAddress(), - args: common, - expectedErr: status.Error( codes.NotFound, types.ErrProofClaimNotFound.Wrapf( @@ -73,7 +65,6 @@ func TestClaim_Show(t *testing.T) { sessionId: claims[0].GetSessionHeader().GetSessionId(), supplierAddr: "invalid_bech32_supplier_address", - args: common, // NB: this is *NOT* a gRPC status error because the bech32 parse // error occurs during request validation (i.e. client-side). expectedErr: types.ErrProofInvalidAddress.Wrapf( @@ -88,7 +79,6 @@ func TestClaim_Show(t *testing.T) { sessionId: claims[0].GetSessionHeader().GetSessionId(), supplierAddr: wrongSupplierAddr, - args: common, expectedErr: status.Error( codes.NotFound, types.ErrProofClaimNotFound.Wrapf( @@ -99,25 +89,26 @@ func TestClaim_Show(t *testing.T) { ), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { args := []string{ - tc.sessionId, - tc.supplierAddr, + test.sessionId, + test.supplierAddr, } - args = append(args, tc.args...) + args = append(args, commonArgs...) out, err := clitestutil.ExecTestCLICmd(ctx, proof.CmdShowClaim(), args) - if tc.expectedErr != nil { - require.ErrorContains(t, err, tc.expectedErr.Error()) + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) + var resp types.QueryGetClaimResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NotNil(t, resp.Claim) - require.Equal(t, tc.claim.GetSupplierAddress(), resp.Claim.GetSupplierAddress()) - require.Equal(t, tc.claim.GetRootHash(), resp.Claim.GetRootHash()) - require.Equal(t, tc.claim.GetSessionHeader(), resp.Claim.GetSessionHeader()) + require.Equal(t, test.claim.GetSupplierAddress(), resp.Claim.GetSupplierAddress()) + require.Equal(t, test.claim.GetRootHash(), resp.Claim.GetRootHash()) + require.Equal(t, test.claim.GetSessionHeader(), resp.Claim.GetSessionHeader()) } }) } @@ -125,18 +116,14 @@ func TestClaim_Show(t *testing.T) { func TestClaim_List(t *testing.T) { sessionCount := 2 - supplierCount := 4 - appCount := 3 - serviceCount := 1 + numSuppliers := 4 + numApps := 3 + numServices := 1 // Each supplier will submit a claim for each app x service combination (per session). - numClaimsPerSession := supplierCount * appCount * serviceCount + numClaimsPerSession := numSuppliers * numApps * numServices totalClaims := sessionCount * numClaimsPerSession - net, claims := networkWithClaimObjects( - t, sessionCount, - supplierCount, - appCount, - ) + net, claims := networkWithClaimObjects(t, sessionCount, numSuppliers, numApps) ctx := net.Validators[0].ClientCtx prepareArgs := func(next []byte, offset, limit uint64, total bool) []string { @@ -193,7 +180,7 @@ func TestClaim_List(t *testing.T) { } }) - t.Run("ByAddress", func(t *testing.T) { + t.Run("BySupplierAddress", func(t *testing.T) { supplierAddr := claims[0].SupplierAddress args := prepareArgs(nil, 0, uint64(totalClaims), true) args = append(args, fmt.Sprintf("--%s=%s", proof.FlagSupplierAddress, supplierAddr)) @@ -215,7 +202,7 @@ func TestClaim_List(t *testing.T) { nullify.Fill(expectedClaims), nullify.Fill(resp.Claims), ) - require.Equal(t, sessionCount*appCount, int(resp.Pagination.Total)) + require.Equal(t, sessionCount*numApps, int(resp.Pagination.Total)) }) t.Run("BySession", func(t *testing.T) { @@ -240,7 +227,7 @@ func TestClaim_List(t *testing.T) { nullify.Fill(expectedClaims), nullify.Fill(resp.Claims), ) - require.Equal(t, supplierCount, int(resp.Pagination.Total)) + require.Equal(t, numSuppliers, int(resp.Pagination.Total)) }) t.Run("ByHeight", func(t *testing.T) { diff --git a/x/proof/module/query_proof.go b/x/proof/module/query_proof.go index e3771f865..d3e115d15 100644 --- a/x/proof/module/query_proof.go +++ b/x/proof/module/query_proof.go @@ -26,10 +26,10 @@ func CmdListProof() *cobra.Command { The proofs can be optionally filtered by one of --session-end-height --session-id or --supplier-address flags Example: -$ poktrolld q proof list-proofs --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --session-id --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --session-end-height --node $(POCKET_NODE) --home=$(POKTROLLD_HOME) -$ poktrolld q proof list-proofs --supplier-address --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld q proof list-proofs --node $(POCKET_NODE) --home $(POKTROLLD_HOME) +$ poktrolld q proof list-proofs --session-id --node $(POCKET_NODE) --home $(POKTROLLD_HOME) +$ poktrolld q proof list-proofs --session-end-height --node $(POCKET_NODE) --home $(POKTROLLD_HOME) +$ poktrolld q proof list-proofs --supplier-address --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { pageReq, err := client.ReadPageRequest(cmd.Flags()) diff --git a/x/proof/module/query_proof_test.go b/x/proof/module/query_proof_test.go index ea348519e..cd3c7a1b4 100644 --- a/x/proof/module/query_proof_test.go +++ b/x/proof/module/query_proof_test.go @@ -3,7 +3,7 @@ package proof_test // TODO_UPNEXT(@Olshansk): Add these tests back in after merging on-chain Proof persistence. // Prevent strconv unused error // var _ = strconv.IntSize - +// // func networkWithProofObjects(t *testing.T, n int) (*network.Network, []types.Proof) { // t.Helper() // cfg := network.DefaultConfig() @@ -11,7 +11,7 @@ package proof_test // for i := 0; i < n; i++ { // proof := types.Proof{ // Index: strconv.Itoa(i), - +// // } // nullify.Fill(&proof) // state.ProofList = append(state.ProofList, proof) @@ -21,10 +21,10 @@ package proof_test // cfg.GenesisState[types.ModuleName] = buf // return network.New(t, cfg), state.ProofList // } - +// // func TestShowProof(t *testing.T) { -// net, objs := networkWithProofObjects(t, 2) - +// net, proofs := networkWithProofObjects(t, 2) +// // ctx := net.Validators[0].ClientCtx // common := []string{ // fmt.Sprintf("--%s=json", tmcli.OutputFlag), @@ -32,55 +32,55 @@ package proof_test // tests := []struct { // desc string // idIndex string - +// // args []string -// err error -// obj types.Proof +// expectedErr error +// proof types.Proof // }{ // { // desc: "found", -// idIndex: objs[0].Index, - +// idIndex: proofs[0].Index, +// // args: common, -// obj: objs[0], +// proof: proofs[0], // }, // { // desc: "not found", // idIndex: strconv.Itoa(100000), - +// // args: common, -// err: status.Error(codes.NotFound, "not found"), +// expectedErr: status.Error(codes.NotFound, "not found"), // }, // } -// for _, tc := range tests { -// t.Run(tc.desc, func(t *testing.T) { +// for _, test := range tests { +// t.Run(test.desc, func(t *testing.T) { // args := []string{ -// tc.idIndex, - +// test.idIndex, +// // } -// args = append(args, tc.args...) +// args = append(args, test.args...) // out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowProof(), args) -// if tc.err != nil { -// stat, ok := status.FromError(tc.err) +// if test.expectedErr != nil { +// stat, ok := status.FromError(test.expectedErr) // require.True(t, ok) -// require.ErrorIs(t, stat.Err(), tc.err) +// require.ErrorIs(t, stat.Err(), test.expectedErr) // } else { // require.NoError(t, err) // var resp types.QueryGetProofResponse // require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) // require.NotNil(t, resp.Proof) // require.Equal(t, -// nullify.Fill(&tc.obj), +// nullify.Fill(&test.proof), // nullify.Fill(&resp.Proof), // ) // } // }) // } // } - +// // func TestListProof(t *testing.T) { -// net, objs := networkWithProofObjects(t, 5) - +// net, proofs := networkWithProofObjects(t, 5) +// // ctx := net.Validators[0].ClientCtx // request := func(next []byte, offset, limit uint64, total bool) []string { // args := []string{ @@ -97,9 +97,10 @@ package proof_test // } // return args // } +// // t.Run("ByOffset", func(t *testing.T) { // step := 2 -// for i := 0; i < len(objs); i += step { +// for i := 0; i < len(proofs); i += step { // args := request(nil, uint64(i), uint64(step), false) // out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) // require.NoError(t, err) @@ -107,15 +108,16 @@ package proof_test // require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) // require.LessOrEqual(t, len(resp.Proof), step) // require.Subset(t, -// nullify.Fill(objs), +// nullify.Fill(proofs), // nullify.Fill(resp.Proof), // ) // } // }) +// // t.Run("ByKey", func(t *testing.T) { // step := 2 // var next []byte -// for i := 0; i < len(objs); i += step { +// for i := 0; i < len(proofs); i += step { // args := request(next, 0, uint64(step), false) // out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) // require.NoError(t, err) @@ -123,22 +125,25 @@ package proof_test // require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) // require.LessOrEqual(t, len(resp.Proof), step) // require.Subset(t, -// nullify.Fill(objs), +// nullify.Fill(proofs), // nullify.Fill(resp.Proof), // ) // next = resp.Pagination.NextKey // } // }) +// +// TODO_BLOCKER: add "BySupplierAddress", "BySession", "ByHeight" tests. +// // t.Run("Total", func(t *testing.T) { -// args := request(nil, 0, uint64(len(objs)), true) +// args := request(nil, 0, uint64(len(proofs)), true) // out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListProof(), args) // require.NoError(t, err) // var resp types.QueryAllProofsResponse // require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) // require.NoError(t, err) -// require.Equal(t, len(objs), int(resp.Pagination.Total)) +// require.Equal(t, len(proofs), int(resp.Pagination.Total)) // require.ElementsMatch(t, -// nullify.Fill(objs), +// nullify.Fill(proofs), // nullify.Fill(resp.Proof), // ) // }) diff --git a/x/proof/module/tx.go b/x/proof/module/tx.go index fcda0cb76..161864cf9 100644 --- a/x/proof/module/tx.go +++ b/x/proof/module/tx.go @@ -10,6 +10,7 @@ import ( ) // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/proof/module/tx_create_claim.go b/x/proof/module/tx_create_claim.go index 11963fad7..b2d57615c 100644 --- a/x/proof/module/tx_create_claim.go +++ b/x/proof/module/tx_create_claim.go @@ -44,10 +44,9 @@ func CmdCreateClaim() *cobra.Command { if err != nil { return err } - supplierAddress := clientCtx.GetFromAddress().String() msg := types.NewMsgCreateClaim( - supplierAddress, + clientCtx.GetFromAddress().String(), &sessionHeader, rootHash, ) diff --git a/x/proof/simulation/create_claim.go b/x/proof/simulation/create_claim.go index 99cc17228..4abeddc02 100644 --- a/x/proof/simulation/create_claim.go +++ b/x/proof/simulation/create_claim.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/proof/keeper" "github.com/pokt-network/poktroll/x/proof/types" ) diff --git a/x/proof/simulation/submit_proof.go b/x/proof/simulation/submit_proof.go index d30c988de..4b0fa83c6 100644 --- a/x/proof/simulation/submit_proof.go +++ b/x/proof/simulation/submit_proof.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/proof/keeper" "github.com/pokt-network/poktroll/x/proof/types" ) diff --git a/x/proof/types/errors.go b/x/proof/types/errors.go index 65cb135a3..6f686ed68 100644 --- a/x/proof/types/errors.go +++ b/x/proof/types/errors.go @@ -2,25 +2,23 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/proof module sentinel errors var ( - ErrProofInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address") - //ErrProofUnauthorized = sdkerrors.Register(ModuleName, 3, "unauthorized supplier signer") - ErrProofNotFound = sdkerrors.Register(ModuleName, 4, "supplier not found") - //ErrProofInvalidServiceConfig = sdkerrors.Register(ModuleName, 5, "invalid service config") - ErrProofInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 6, "invalid session start height") - ErrProofInvalidSessionId = sdkerrors.Register(ModuleName, 7, "invalid session ID") - ErrProofInvalidService = sdkerrors.Register(ModuleName, 8, "invalid service in supplier") - ErrProofInvalidClaimRootHash = sdkerrors.Register(ModuleName, 9, "invalid root hash") - ErrProofInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 10, "invalid session ending height") - ErrProofInvalidQueryRequest = sdkerrors.Register(ModuleName, 11, "invalid query request") - ErrProofClaimNotFound = sdkerrors.Register(ModuleName, 12, "claim not found") - ErrProofProofNotFound = sdkerrors.Register(ModuleName, 13, "proof not found") - ErrProofInvalidProof = sdkerrors.Register(ModuleName, 14, "invalid proof") - //ErrProofInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 15, "invalid closest merkle proof") - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrProofInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrProofInvalidAddress = sdkerrors.Register(ModuleName, 1101, "invalid address") + ErrProofNotFound = sdkerrors.Register(ModuleName, 1102, "supplier not found") + ErrProofInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 1103, "invalid session start height") + ErrProofInvalidSessionId = sdkerrors.Register(ModuleName, 1104, "invalid session ID") + ErrProofInvalidService = sdkerrors.Register(ModuleName, 1105, "invalid service in supplier") + ErrProofInvalidClaimRootHash = sdkerrors.Register(ModuleName, 1106, "invalid root hash") + ErrProofInvalidSessionEndHeight = sdkerrors.Register(ModuleName, 1107, "invalid session ending height") + ErrProofInvalidQueryRequest = sdkerrors.Register(ModuleName, 1108, "invalid query request") + ErrProofClaimNotFound = sdkerrors.Register(ModuleName, 1109, "claim not found") + ErrProofProofNotFound = sdkerrors.Register(ModuleName, 1110, "proof not found") + ErrProofInvalidProof = sdkerrors.Register(ModuleName, 1111, "invalid proof") + //ErrProofUnauthorized = sdkerrors.Register(ModuleName, 1112, "unauthorized supplier signer") + //ErrProofInvalidServiceConfig = sdkerrors.Register(ModuleName, 1113, "invalid service config") + //ErrProofInvalidClosestMerkleProof = sdkerrors.Register(ModuleName, 1114, "invalid closest merkle proof") ) diff --git a/x/proof/types/expected_keepers.go b/x/proof/types/expected_keepers.go index aa5987481..a9d8eaf71 100644 --- a/x/proof/types/expected_keepers.go +++ b/x/proof/types/expected_keepers.go @@ -25,9 +25,3 @@ type BankKeeper interface { SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins // Methods imported from bank should be defined here } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/proof/types/genesis.go b/x/proof/types/genesis.go index 5b43877a4..c2e53457d 100644 --- a/x/proof/types/genesis.go +++ b/x/proof/types/genesis.go @@ -1,11 +1,6 @@ package types -import ( - "fmt" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 +import "fmt" // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { @@ -21,7 +16,7 @@ func DefaultGenesis() *GenesisState { // failure. func (gs GenesisState) Validate() error { // Check for duplicated index in claim - claimIndexMap := make(map[string]struct{}) + claimPrimaryKeyMap := make(map[string]struct{}) // Ensure claims are unique with respect to a given session ID and supplier address. for _, claim := range gs.ClaimList { @@ -37,23 +32,23 @@ func (gs GenesisState) Validate() error { sessionId := claim.GetSessionHeader().GetSessionId() primaryKey := string(ClaimPrimaryKey(sessionId, claim.SupplierAddress)) - if _, ok := claimIndexMap[primaryKey]; ok { + if _, ok := claimPrimaryKeyMap[primaryKey]; ok { return fmt.Errorf("duplicated supplierAddr for claim") } - claimIndexMap[primaryKey] = struct{}{} + claimPrimaryKeyMap[primaryKey] = struct{}{} } // Check for duplicated index in proof - proofIndexMap := make(map[string]struct{}) + proofPrimaryKeyMap := make(map[string]struct{}) for _, proof := range gs.ProofList { - primaryKey := string(ProofPrimaryKey( + proofPrimaryKey := string(ProofPrimaryKey( proof.GetSessionHeader().GetSessionId(), proof.GetSupplierAddress(), )) - if _, ok := proofIndexMap[primaryKey]; ok { + if _, ok := proofPrimaryKeyMap[proofPrimaryKey]; ok { return fmt.Errorf("duplicated primaryKey for proof") } - proofIndexMap[primaryKey] = struct{}{} + proofPrimaryKeyMap[proofPrimaryKey] = struct{}{} } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/proof/types/genesis_test.go b/x/proof/types/genesis_test.go index 14171bd92..64fd235a6 100644 --- a/x/proof/types/genesis_test.go +++ b/x/proof/types/genesis_test.go @@ -17,17 +17,16 @@ func TestGenesisState_Validate(t *testing.T) { tests := []struct { desc string genState *types.GenesisState - valid bool + isValid bool }{ { desc: "default is valid", genState: types.DefaultGenesis(), - valid: true, + isValid: true, }, { desc: "valid genesis state", genState: &types.GenesisState{ - ClaimList: []types.Claim{ { SupplierAddress: sample.AccAddress(), @@ -51,7 +50,7 @@ func TestGenesisState_Validate(t *testing.T) { //}, // this line is used by starport scaffolding # types/genesis/validField }, - valid: true, + isValid: true, }, { desc: "duplicated claim", @@ -75,7 +74,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "empty root hash", @@ -91,7 +90,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, { desc: "nil root hash", @@ -107,7 +106,7 @@ func TestGenesisState_Validate(t *testing.T) { }, }, }, - valid: false, + isValid: false, }, // TODO_BLOCKER: finish genesis proof list validation. //{ @@ -126,10 +125,10 @@ func TestGenesisState_Validate(t *testing.T) { //}, // this line is used by starport scaffolding # types/genesis/testcase } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.isValid { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/proof/types/key_claim.go b/x/proof/types/key_claim.go index ea1284870..d7a7d37ac 100644 --- a/x/proof/types/key_claim.go +++ b/x/proof/types/key_claim.go @@ -6,7 +6,8 @@ var _ binary.ByteOrder const ( // ClaimPrimaryKeyPrefix is the prefix to retrieve the entire Claim object (the primary store) - ClaimPrimaryKeyPrefix = "Claim/value/" + // TODO_TECHDEBT: consider renaming to ClaimSessionIDPrefix. + ClaimPrimaryKeyPrefix = "Claim/primary_key/" // ClaimSupplierAddressPrefix is the key to retrieve a Claim's Primary Key from the Address index ClaimSupplierAddressPrefix = "Claim/address/" @@ -34,3 +35,5 @@ func ClaimSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) return KeyComposite(heightBz, primaryKey) } + +// TODO_TECHDEBT(@olshanks): add helpers for composing query-side key prefixes & document key/value prefix design. diff --git a/x/proof/types/key_proof.go b/x/proof/types/key_proof.go index f74bb7fa9..5c136466a 100644 --- a/x/proof/types/key_proof.go +++ b/x/proof/types/key_proof.go @@ -6,7 +6,8 @@ var _ binary.ByteOrder const ( // ProofPrimaryKeyPrefix is the prefix to retrieve the entire Proof object (the primary store) - ProofPrimaryKeyPrefix = "Proof/value/" + // TODO_TECHDEBT: consider renaming to ProofSessionIDPrefix. + ProofPrimaryKeyPrefix = "Proof/primary_key/" // ProofSupplierAddressPrefix is the key to retrieve a Proof's Primary Key from the Address index ProofSupplierAddressPrefix = "Proof/address/" @@ -34,3 +35,5 @@ func ProofSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) return KeyComposite(heightBz, primaryKey) } + +// TODO_TECHDEBT(@olshanks): add helpers for composing query-side key prefixes & document key/value prefix design. diff --git a/x/proof/types/keys.go b/x/proof/types/keys.go index 71b5cd1ef..58a35b40d 100644 --- a/x/proof/types/keys.go +++ b/x/proof/types/keys.go @@ -19,9 +19,7 @@ var ( KeyDelimiter = []byte("/") ) -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } // KeyComposite combines the given keys into a single key for use with KVStore. func KeyComposite(keys ...[]byte) []byte { diff --git a/x/proof/types/message_create_claim.go b/x/proof/types/message_create_claim.go index beb5b9c07..a7bf0f61f 100644 --- a/x/proof/types/message_create_claim.go +++ b/x/proof/types/message_create_claim.go @@ -9,15 +9,15 @@ import ( const TypeMsgCreateClaim = "create_claim" -var _ sdk.Msg = &MsgCreateClaim{} +var _ sdk.Msg = (*MsgCreateClaim)(nil) func NewMsgCreateClaim( - supplierAddress string, + supplierAddr string, sessionHeader *sessiontypes.SessionHeader, rootHash []byte, ) *MsgCreateClaim { return &MsgCreateClaim{ - SupplierAddress: supplierAddress, + SupplierAddress: supplierAddr, SessionHeader: sessionHeader, RootHash: rootHash, } diff --git a/x/proof/types/message_create_claim_test.go b/x/proof/types/message_create_claim_test.go index 9ab74aa5c..5c1572866 100644 --- a/x/proof/types/message_create_claim_test.go +++ b/x/proof/types/message_create_claim_test.go @@ -14,8 +14,8 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { tests := []struct { desc string - msg MsgCreateClaim - err error + msg MsgCreateClaim + expectedErr error }{ { desc: "invalid address", @@ -23,7 +23,7 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { msg: MsgCreateClaim{ SupplierAddress: "invalid_address", }, - err: ErrProofInvalidAddress, + expectedErr: ErrProofInvalidAddress, }, { desc: "valid address but invalid session start height", @@ -34,7 +34,7 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { SessionStartBlockHeight: -1, // Invalid start height }, }, - err: ErrProofInvalidSessionStartHeight, + expectedErr: ErrProofInvalidSessionStartHeight, }, { desc: "valid address and session start height but invalid session ID", @@ -46,7 +46,7 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { SessionId: "", // Invalid session ID }, }, - err: ErrProofInvalidSessionId, + expectedErr: ErrProofInvalidSessionId, }, { desc: "valid address, session start height, session ID but invalid service", @@ -61,7 +61,7 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { }, // Should trigger error }, }, - err: ErrProofInvalidService, + expectedErr: ErrProofInvalidService, }, { desc: "valid address, session start height, session ID, service but invalid root hash", @@ -77,7 +77,7 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { }, RootHash: []byte(""), // Invalid root hash }, - err: ErrProofInvalidClaimRootHash, + expectedErr: ErrProofInvalidClaimRootHash, }, { desc: "all valid inputs", @@ -93,14 +93,14 @@ func TestMsgCreateClaim_ValidateBasic(t *testing.T) { }, RootHash: []byte("valid_root_hash"), // Assuming this is valid }, - err: nil, + expectedErr: nil, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) } diff --git a/x/proof/types/message_submit_proof.go b/x/proof/types/message_submit_proof.go index 6e587293c..4e720b5cd 100644 --- a/x/proof/types/message_submit_proof.go +++ b/x/proof/types/message_submit_proof.go @@ -7,7 +7,7 @@ import ( sessiontypes "github.com/pokt-network/poktroll/x/session/types" ) -var _ sdk.Msg = &MsgSubmitProof{} +var _ sdk.Msg = (*MsgSubmitProof)(nil) func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.SessionHeader, proof []byte) *MsgSubmitProof { return &MsgSubmitProof{ @@ -17,9 +17,12 @@ func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.Sessi } } +// ValidateBasic ensures that the bech32 address strings for the supplier and +// application addresses are valid and that the proof and service ID are not empty. +// +// TODO_TECHDEBT: Call `msg.GetSessionHeader().ValidateBasic()` once its implemented func (msg *MsgSubmitProof) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.GetSupplierAddress()) - if err != nil { + if _, err := sdk.AccAddressFromBech32(msg.GetSupplierAddress()); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf( "supplier address %q, error: %s", msg.GetSupplierAddress(), @@ -27,8 +30,7 @@ func (msg *MsgSubmitProof) ValidateBasic() error { ) } - _, err = sdk.AccAddressFromBech32(msg.GetSessionHeader().GetApplicationAddress()) - if err != nil { + if _, err := sdk.AccAddressFromBech32(msg.GetSessionHeader().GetApplicationAddress()); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf( "application address: %q, error: %s", msg.GetSessionHeader().GetApplicationAddress(), diff --git a/x/proof/types/message_submit_proof_test.go b/x/proof/types/message_submit_proof_test.go index af803155c..9ad93c91b 100644 --- a/x/proof/types/message_submit_proof_test.go +++ b/x/proof/types/message_submit_proof_test.go @@ -89,12 +89,12 @@ func TestMsgSubmitProof_ValidateBasic(t *testing.T) { }, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) - require.ErrorContains(t, err, tt.expectedErr.Error()) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) + require.ErrorContains(t, err, test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/proof/types/msg_update_params.go b/x/proof/types/message_update_params.go similarity index 91% rename from x/proof/types/msg_update_params.go rename to x/proof/types/message_update_params.go index e36d023de..aeed4a633 100644 --- a/x/proof/types/msg_update_params.go +++ b/x/proof/types/message_update_params.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUpdateParams{} +var _ sdk.Msg = (*MsgUpdateParams)(nil) // ValidateBasic does a sanity check on the provided data. func (m *MsgUpdateParams) ValidateBasic() error { diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 4f3215e35..95b0cf8a2 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -1,8 +1,6 @@ package types -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" var _ paramtypes.ParamSet = (*Params)(nil) diff --git a/x/proof/types/types.go b/x/proof/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/proof/types/types.go +++ b/x/proof/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs From d008f572457cc976d9604e6ee490fcc6dcdec550 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Tue, 20 Feb 2024 10:18:55 +0100 Subject: [PATCH 44/54] chore: tokenomics module review improvements --- api/poktroll/tokenomics/query.pulsar.go | 66 ++++++----- proto/poktroll/tokenomics/genesis.proto | 10 +- proto/poktroll/tokenomics/params.proto | 4 +- proto/poktroll/tokenomics/query.proto | 11 +- proto/poktroll/tokenomics/tx.proto | 10 +- testutil/keeper/tokenomics.go | 35 ++++-- x/tokenomics/keeper/keeper.go | 6 +- x/tokenomics/keeper/msg_server.go | 4 +- x/tokenomics/keeper/msg_server_test.go | 4 + x/tokenomics/keeper/msg_update_params.go | 16 +-- x/tokenomics/keeper/msg_update_params_test.go | 59 ++++------ x/tokenomics/keeper/params.go | 10 +- x/tokenomics/keeper/query.go | 4 +- x/tokenomics/keeper/query_params.go | 7 +- x/tokenomics/keeper/query_params_test.go | 4 +- .../keeper/settle_session_accounting.go | 104 +++++++++++------- .../keeper/settle_session_accounting_test.go | 22 ++-- x/tokenomics/module/autocli.go | 30 ++--- x/tokenomics/module/genesis.go | 10 +- x/tokenomics/module/genesis_test.go | 3 +- x/tokenomics/module/helpers_test.go | 6 - x/tokenomics/module/module.go | 5 +- x/tokenomics/module/query.go | 1 + x/tokenomics/module/tx.go | 1 + x/tokenomics/module/tx_update_params_test.go | 14 +-- x/tokenomics/types/errors.go | 36 +++--- x/tokenomics/types/expected_keepers.go | 31 ++++-- x/tokenomics/types/genesis.go | 5 - x/tokenomics/types/genesis_test.go | 16 +-- x/tokenomics/types/keys.go | 8 +- x/tokenomics/types/message_update_params.go | 19 ++-- .../types/message_update_params_test.go | 28 ++--- x/tokenomics/types/params.go | 15 ++- x/tokenomics/types/types.go | 2 + 34 files changed, 313 insertions(+), 293 deletions(-) diff --git a/api/poktroll/tokenomics/query.pulsar.go b/api/poktroll/tokenomics/query.pulsar.go index cdb9d88ac..e55219bc1 100644 --- a/api/poktroll/tokenomics/query.pulsar.go +++ b/api/poktroll/tokenomics/query.pulsar.go @@ -3,7 +3,6 @@ package tokenomics import ( _ "cosmossdk.io/api/amino" - _ "cosmossdk.io/api/cosmos/base/query/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -894,41 +893,38 @@ var file_poktroll_tokenomics_query_proto_rawDesc = []byte{ 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x97, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x27, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, - 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x42, 0x0a, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, - 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xca, 0x02, - 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, - 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x55, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x97, 0x01, 0x0a, + 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x8d, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x27, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x70, + 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x2f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb8, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xa2, 0x02, 0x03, 0x50, 0x54, 0x58, 0xaa, 0x02, 0x13, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, + 0x63, 0x73, 0xca, 0x02, 0x13, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0xe2, 0x02, 0x1f, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, 0x73, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x6f, 0x6d, 0x69, 0x63, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/poktroll/tokenomics/genesis.proto b/proto/poktroll/tokenomics/genesis.proto index 00410f82a..03f190e28 100644 --- a/proto/poktroll/tokenomics/genesis.proto +++ b/proto/poktroll/tokenomics/genesis.proto @@ -1,17 +1,15 @@ syntax = "proto3"; package poktroll.tokenomics; +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -import "poktroll/tokenomics/params.proto"; -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; +import "poktroll/tokenomics/params.proto"; // GenesisState defines the tokenomics module's genesis state. message GenesisState { // params defines all the parameters of the module. - Params params = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/proto/poktroll/tokenomics/params.proto b/proto/poktroll/tokenomics/params.proto index a5e09eaf7..3be3b1d5f 100644 --- a/proto/poktroll/tokenomics/params.proto +++ b/proto/poktroll/tokenomics/params.proto @@ -1,11 +1,11 @@ syntax = "proto3"; package poktroll.tokenomics; +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; - // TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. // Params defines the parameters for the tokenomics module. message Params { diff --git a/proto/poktroll/tokenomics/query.proto b/proto/poktroll/tokenomics/query.proto index 8109ab945..9c3df7a62 100644 --- a/proto/poktroll/tokenomics/query.proto +++ b/proto/poktroll/tokenomics/query.proto @@ -1,13 +1,13 @@ syntax = "proto3"; package poktroll.tokenomics; +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "poktroll/tokenomics/params.proto"; -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; +import "poktroll/tokenomics/params.proto"; // Query defines the gRPC querier service. service Query { @@ -23,8 +23,5 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { // params holds all the parameters of this module. - Params params = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } \ No newline at end of file diff --git a/proto/poktroll/tokenomics/tx.proto b/proto/poktroll/tokenomics/tx.proto index 8874cde46..454b9b39c 100644 --- a/proto/poktroll/tokenomics/tx.proto +++ b/proto/poktroll/tokenomics/tx.proto @@ -1,13 +1,14 @@ syntax = "proto3"; package poktroll.tokenomics; +option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "poktroll/tokenomics/params.proto"; -option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types"; +import "poktroll/tokenomics/params.proto"; // Msg defines the Msg service. service Msg { @@ -32,10 +33,7 @@ message MsgUpdateParams { // params defines the x/tokenomics parameters to update. // NOTE: All parameters must be supplied. - Params params = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index c7e68ee64..db7e0d517 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" @@ -32,59 +33,69 @@ import ( // mature to be explicit about the number of expected tests. func TokenomicsKeeper(t testing.TB) ( - k keeper.Keeper, s sdk.Context, - appAddr, supplierAddr string, + k keeper.Keeper, + ttx context.Context, + appAddr string, + supplierAddr string, ) { + t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) - // Initialize the in-memory database + // Initialize the in-memory database. db := dbm.NewMemDB() stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) require.NoError(t, stateStore.LoadLatestVersion()) - // Initialize the codec and other necessary components + // Initialize the codec and other necessary components. registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - ctrl := gomock.NewController(t) - // The on-chain governance address + // The on-chain governance address. authority := authtypes.NewModuleAddress(govtypes.ModuleName) - // Prepare the test application + // Prepare the test application. application := apptypes.Application{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100000)}, } - // Prepare the test supplier + // Prepare the test supplier. supplier := sharedtypes.Supplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100000)}, } - // Mock the application keeper + ctrl := gomock.NewController(t) + + // Mock the application keeper. mockApplicationKeeper := mocks.NewMockApplicationKeeper(ctrl) + + // Get test application if the address matches. mockApplicationKeeper.EXPECT(). GetApplication(gomock.Any(), gomock.Eq(application.Address)). Return(application, true). AnyTimes() + + // Get zero-value application if the address does not match. mockApplicationKeeper.EXPECT(). GetApplication(gomock.Any(), gomock.Not(application.Address)). Return(apptypes.Application{}, false). AnyTimes() + + // Mock SetApplication. mockApplicationKeeper.EXPECT(). SetApplication(gomock.Any(), gomock.Any()). AnyTimes() - // Mock the supplier keeper + // Get test supplier if the address matches. mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) mockSupplierKeeper.EXPECT(). GetSupplier(gomock.Any(), supplier.Address). Return(supplier, true). AnyTimes() - // Mock the bank keeper + // Mock the bank keeper. mockBankKeeper := mocks.NewMockBankKeeper(ctrl) mockBankKeeper.EXPECT(). MintCoins(gomock.Any(), gomock.Any(), gomock.Any()). @@ -120,7 +131,7 @@ func TokenomicsKeeper(t testing.TB) ( ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - tokenomicsKeeper.SetParams(ctx, types.DefaultParams()) + require.NoError(t, tokenomicsKeeper.SetParams(ctx, types.DefaultParams())) return tokenomicsKeeper, ctx, application.Address, supplier.Address } diff --git a/x/tokenomics/keeper/keeper.go b/x/tokenomics/keeper/keeper.go index caa9f572b..03bc1c80a 100644 --- a/x/tokenomics/keeper/keeper.go +++ b/x/tokenomics/keeper/keeper.go @@ -29,7 +29,11 @@ type ( bankKeeper types.BankKeeper accountKeeper types.AccountKeeper applicationKeeper types.ApplicationKeeper - supplierKeeper types.SupplierKeeper + + // TODO_DISCUSS: The supplier keeper is not used in the tokenomics module, + // the bank keeper is the one that is used to handle the supplier rewards. + // Make sure to remove it from the expected keepers if removed from here. + supplierKeeper types.SupplierKeeper } ) diff --git a/x/tokenomics/keeper/msg_server.go b/x/tokenomics/keeper/msg_server.go index ab7353c82..08e08e871 100644 --- a/x/tokenomics/keeper/msg_server.go +++ b/x/tokenomics/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/tokenomics/types" -) +import "github.com/pokt-network/poktroll/x/tokenomics/types" type msgServer struct { Keeper diff --git a/x/tokenomics/keeper/msg_server_test.go b/x/tokenomics/keeper/msg_server_test.go index 0a6b2a26d..2990f89d1 100644 --- a/x/tokenomics/keeper/msg_server_test.go +++ b/x/tokenomics/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/tokenomics/keeper/msg_update_params.go b/x/tokenomics/keeper/msg_update_params.go index 3133d83f1..4d61bef87 100644 --- a/x/tokenomics/keeper/msg_update_params.go +++ b/x/tokenomics/keeper/msg_update_params.go @@ -3,13 +3,10 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/tokenomics/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { logger := k.Logger() if err := msg.ValidateBasic(); err != nil { @@ -21,11 +18,14 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParam // does the `cosmos.msg.v1.signer` tag in the protobuf definition enforce // this somewhere in the Cosmos SDK? if msg.Authority != k.GetAuthority() { - return nil, types.ErrTokenomicsAuthorityAddressMismatch + return nil, types.ErrTokenomicsInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), + msg.Authority, + ) } - prevParams := k.GetParams(ctx) - logger.Info("About to update params from [%v] to [%v]", prevParams, msg.Params) + logger.Info("About to update params from [%v] to [%v]", k.GetParams(ctx), msg.Params) if err := k.SetParams(ctx, msg.Params); err != nil { return nil, err @@ -37,6 +37,6 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParam } // ComputeUnitsToTokensMultiplier returns the ComputeUnitsToTokensMultiplier param -func (k Keeper) ComputeUnitsToTokensMultiplier(ctx context.Context) (param uint64) { +func (k Keeper) ComputeUnitsToTokensMultiplier(ctx context.Context) uint64 { return k.GetParams(ctx).ComputeUnitsToTokensMultiplier } diff --git a/x/tokenomics/keeper/msg_update_params_test.go b/x/tokenomics/keeper/msg_update_params_test.go index d1a334cc1..c1b53c902 100644 --- a/x/tokenomics/keeper/msg_update_params_test.go +++ b/x/tokenomics/keeper/msg_update_params_test.go @@ -13,17 +13,15 @@ import ( func TestMsgUpdateParams(t *testing.T) { tokenomicsKeeper, srv, ctx := setupMsgServer(t) - params := types.DefaultParams() - require.NoError(t, tokenomicsKeeper.SetParams(ctx, params)) + require.NoError(t, tokenomicsKeeper.SetParams(ctx, types.DefaultParams())) tests := []struct { desc string req *types.MsgUpdateParams - expectErr bool - expectedPanic bool - expErrMsg string + shouldError bool + expectedErrMsg string }{ { desc: "invalid authority address", @@ -35,9 +33,8 @@ func TestMsgUpdateParams(t *testing.T) { }, }, - expectErr: true, - expectedPanic: false, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { desc: "incorrect authority address", @@ -49,9 +46,8 @@ func TestMsgUpdateParams(t *testing.T) { }, }, - expectErr: true, - expectedPanic: false, - expErrMsg: "the provided authority address does not match the on-chain governance address", + shouldError: true, + expectedErrMsg: "the provided authority address does not match the on-chain governance address", }, { desc: "invalid ComputeUnitsToTokensMultiplier", @@ -64,9 +60,8 @@ func TestMsgUpdateParams(t *testing.T) { }, }, - expectErr: true, - expectedPanic: true, - expErrMsg: "invalid compute to tokens multiplier", + shouldError: true, + expectedErrMsg: "invalid ComputeUnitsToTokensMultiplier", }, { desc: "successful param update", @@ -79,26 +74,16 @@ func TestMsgUpdateParams(t *testing.T) { }, }, - expectedPanic: false, - expectErr: false, + shouldError: false, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - if tt.expectedPanic { - defer func() { - if r := recover(); r != nil { - _, err := srv.UpdateParams(ctx, tt.req) - require.Error(t, err) - } - }() - return - } - _, err := srv.UpdateParams(ctx, tt.req) - if tt.expectErr { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := srv.UpdateParams(ctx, test.req) + if test.shouldError { require.Error(t, err) - require.ErrorContains(t, err, tt.expErrMsg) + require.ErrorContains(t, err, test.expectedErrMsg) } else { require.Nil(t, err) } @@ -113,11 +98,15 @@ func TestUpdateParams_ComputeUnitsToTokensMultiplier(t *testing.T) { // Set the default params tokenomicsKeeper.SetParams(ctx, types.DefaultParams()) - // Verify the default value for ComputeUnitsToTokensMultiplier getParamsReq := &types.QueryParamsRequest{} + + // Verify the default value for ComputeUnitsToTokensMultiplier getParamsRes, err := tokenomicsKeeper.Params(ctx, getParamsReq) - require.Nil(t, err) - require.Equal(t, uint64(42), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) + require.NoError(t, err) + require.Equal(t, + types.DefaultComputeUnitsToTokensMultiplier, + getParamsRes.Params.GetComputeUnitsToTokensMultiplier(), + ) // Update the value for ComputeUnitsToTokensMultiplier updateParamsReq := &types.MsgUpdateParams{ @@ -127,10 +116,10 @@ func TestUpdateParams_ComputeUnitsToTokensMultiplier(t *testing.T) { }, } _, err = srv.UpdateParams(ctx, updateParamsReq) - require.Nil(t, err) + require.NoError(t, err) // Verify that ComputeUnitsToTokensMultiplier was updated getParamsRes, err = tokenomicsKeeper.Params(ctx, getParamsReq) - require.Nil(t, err) + require.NoError(t, err) require.Equal(t, uint64(69), getParamsRes.Params.GetComputeUnitsToTokensMultiplier()) } diff --git a/x/tokenomics/keeper/params.go b/x/tokenomics/keeper/params.go index 5b900da9f..830994059 100644 --- a/x/tokenomics/keeper/params.go +++ b/x/tokenomics/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/tokenomics/keeper/query.go b/x/tokenomics/keeper/query.go index bb812a52f..ce8112a3b 100644 --- a/x/tokenomics/keeper/query.go +++ b/x/tokenomics/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/tokenomics/types" -) +import "github.com/pokt-network/poktroll/x/tokenomics/types" var _ types.QueryServer = Keeper{} diff --git a/x/tokenomics/keeper/query_params.go b/x/tokenomics/keeper/query_params.go index f8a4d0dc4..6e07a57ad 100644 --- a/x/tokenomics/keeper/query_params.go +++ b/x/tokenomics/keeper/query_params.go @@ -3,18 +3,19 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/tokenomics/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params( + ctx context.Context, + req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/tokenomics/keeper/query_params_test.go b/x/tokenomics/keeper/query_params_test.go index d10caf4f5..9d4daf427 100644 --- a/x/tokenomics/keeper/query_params_test.go +++ b/x/tokenomics/keeper/query_params_test.go @@ -11,10 +11,10 @@ import ( func TestGetParams(t *testing.T) { k, ctx, _, _ := testkeeper.TokenomicsKeeper(t) + // TODO_INVESTIGATE(#394): Params tests don't assert initial state. params := types.DefaultParams() - k.SetParams(ctx, params) - + require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) require.EqualValues(t, params.ComputeUnitsToTokensMultiplier, k.ComputeUnitsToTokensMultiplier(ctx)) } diff --git a/x/tokenomics/keeper/settle_session_accounting.go b/x/tokenomics/keeper/settle_session_accounting.go index e80fed043..00f94d343 100644 --- a/x/tokenomics/keeper/settle_session_accounting.go +++ b/x/tokenomics/keeper/settle_session_accounting.go @@ -31,12 +31,8 @@ const ( // against a proof BEFORE calling this function. // // TODO_BLOCKER(@Olshansk): Is there a way to limit who can call this function? -func (k Keeper) SettleSessionAccounting( - goCtx context.Context, - claim *prooftypes.Claim, -) error { +func (k Keeper) SettleSessionAccounting(ctx context.Context, claim *prooftypes.Claim) error { // Parse the context - ctx := sdk.UnwrapSDKContext(goCtx) logger := k.Logger().With("method", "SettleSessionAccounting") if claim == nil { @@ -44,8 +40,9 @@ func (k Keeper) SettleSessionAccounting( return types.ErrTokenomicsClaimNil } + sessionHeader := claim.GetSessionHeader() + // Make sure the session header is not nil - sessionHeader := claim.SessionHeader if sessionHeader == nil { logger.Error("received a nil session header") return types.ErrTokenomicsSessionHeaderNil @@ -58,20 +55,15 @@ func (k Keeper) SettleSessionAccounting( } // Decompose the claim into its constituent parts for readability - supplierAddress, err := sdk.AccAddressFromBech32(claim.SupplierAddress) + supplierAddr, err := sdk.AccAddressFromBech32(claim.GetSupplierAddress()) if err != nil { return types.ErrTokenomicsSupplierAddressInvalid } - applicationAddress, err := sdk.AccAddressFromBech32(claim.SessionHeader.ApplicationAddress) + + applicationAddress, err := sdk.AccAddressFromBech32(sessionHeader.GetApplicationAddress()) if err != nil { return types.ErrTokenomicsApplicationAddressInvalid } - root := (smt.MerkleRoot)(claim.RootHash) - - if len(root) != smstRootSize { - logger.Error(fmt.Sprintf("received an invalid root hash of size: %d", len(root))) - return types.ErrTokenomicsRootHashInvalid - } // Retrieve the application application, found := k.applicationKeeper.GetApplication(ctx, applicationAddress.String()) @@ -80,20 +72,30 @@ func (k Keeper) SettleSessionAccounting( return types.ErrTokenomicsApplicationNotFound } + root := (smt.MerkleRoot)(claim.GetRootHash()) + + // TODO_DISCUSS: This check should be the responsibility of the SMST package + // since it's used to get compute units from the root hash. + if len(root) != smstRootSize { + logger.Error(fmt.Sprintf("received an invalid root hash of size: %d", len(root))) + return types.ErrTokenomicsRootHashInvalid + } + // Retrieve the sum of the root as a proxy into the amount of work done claimComputeUnits := root.Sum() logger.Info(fmt.Sprintf("About to start settling claim for %d compute units", claimComputeUnits)) - // Retrieve the existing tokenomics params - params := k.GetParams(ctx) - // Calculate the amount of tokens to mint & burn - upokt := math.NewInt(int64(claimComputeUnits * params.ComputeUnitsToTokensMultiplier)) - upoktCoin := sdk.NewCoin("upokt", upokt) - upoktCoins := sdk.NewCoins(upoktCoin) + settlementAmt := k.getCoinFromComputeUnits(ctx, root) + settlementAmtCoins := sdk.NewCoins(settlementAmt) - logger.Info(fmt.Sprintf("%d compute units equate to %d uPOKT for session %s", claimComputeUnits, upokt, sessionHeader.SessionId)) + logger.Info(fmt.Sprintf( + "%d compute units equate to %s for session %s", + claimComputeUnits, + settlementAmt, + sessionHeader.SessionId, + )) // NB: We are doing a mint & burn + transfer, instead of a simple transfer // of funds from the supplier to the application in order to enable second @@ -101,60 +103,86 @@ func (k Keeper) SettleSessionAccounting( // going to pnf, delegators, enabling bonuses/rebates, etc... // Mint uPOKT to the supplier module account - if err := k.bankKeeper.MintCoins(ctx, suppliertypes.ModuleName, upoktCoins); err != nil { - return types.ErrTokenomicsApplicationModuleFeeFailed + if err := k.bankKeeper.MintCoins(ctx, suppliertypes.ModuleName, settlementAmtCoins); err != nil { + return types.ErrTokenomicsSupplierModuleMintFailed.Wrapf( + "minting %s to the supplier module account: %v", + settlementAmt, + err, + ) } - logger.Info(fmt.Sprintf("minted %d uPOKT in the supplier module", upokt)) + logger.Info(fmt.Sprintf("minted %s in the supplier module", settlementAmt)) // Sent the minted coins to the supplier if err := k.bankKeeper.SendCoinsFromModuleToAccount( - ctx, suppliertypes.ModuleName, supplierAddress, upoktCoins, + ctx, suppliertypes.ModuleName, supplierAddr, settlementAmtCoins, ); err != nil { - return types.ErrTokenomicsApplicationModuleFeeFailed + return types.ErrTokenomicsSupplierModuleMintFailed.Wrapf( + "sending %s to supplier with address %s: %v", + settlementAmt, + supplierAddr, + err, + ) } - logger.Info(fmt.Sprintf("sent %d uPOKT to supplier with address %s", upokt, supplierAddress)) + logger.Info(fmt.Sprintf("sent %s to supplier with address %s", settlementAmt, supplierAddr)) // Verify that the application has enough uPOKT to pay for the services it consumed - if application.Stake.IsLT(upoktCoin) { - logger.Error(fmt.Sprintf("THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", applicationAddress, upoktCoins, application.Stake)) + if application.Stake.IsLT(settlementAmt) { + logger.Error(fmt.Sprintf( + "THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", + applicationAddress, + settlementAmtCoins, + application.Stake, + )) // TODO_BLOCKER(@Olshansk, @RawthiL): The application was over-serviced in the last session so it basically // goes "into debt". Need to design a way to handle this when we implement // probabilistic proofs and add all the parameter logic. Do we touch the application balance? // Do we just let it go into debt? Do we penalize the application? Do we unstake it? Etc... - upoktCoins = sdk.NewCoins(*application.Stake) + settlementAmtCoins = sdk.NewCoins(*application.Stake) } // Undelegate the amount of coins that need to be burnt from the application stake. // Since the application commits a certain amount of stake to the network to be able // to pay for relay mining, this stake is taken from the funds "in escrow" rather // than its balance. - if err := k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, apptypes.ModuleName, applicationAddress, upoktCoins); err != nil { - logger.Error(fmt.Sprintf("THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", applicationAddress, upoktCoins, application.Stake)) - + if err := k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, apptypes.ModuleName, applicationAddress, settlementAmtCoins); err != nil { + logger.Error(fmt.Sprintf( + "THIS SHOULD NOT HAPPEN. Application with address %s needs to be charged more than it has staked: %v > %v", + applicationAddress, + settlementAmtCoins, + application.Stake, + )) } // Send coins from the application to the application module account if err := k.bankKeeper.SendCoinsFromAccountToModule( - ctx, applicationAddress, apptypes.ModuleName, upoktCoins, + ctx, applicationAddress, apptypes.ModuleName, settlementAmtCoins, ); err != nil { return types.ErrTokenomicsApplicationModuleFeeFailed } - logger.Info(fmt.Sprintf("took %d uPOKT from application with address %s", upokt, applicationAddress)) + logger.Info(fmt.Sprintf("took %s from application with address %s", settlementAmt, applicationAddress)) // Burn uPOKT from the application module account - if err := k.bankKeeper.BurnCoins(ctx, apptypes.ModuleName, upoktCoins); err != nil { + if err := k.bankKeeper.BurnCoins(ctx, apptypes.ModuleName, settlementAmtCoins); err != nil { return types.ErrTokenomicsApplicationModuleBurn } - logger.Info(fmt.Sprintf("burned %d uPOKT in the application module", upokt)) + logger.Info(fmt.Sprintf("burned %s in the application module", settlementAmt)) // Update the application's on-chain stake - newAppStake := (*application.Stake).Sub(upoktCoin) + newAppStake := (*application.Stake).Sub(settlementAmt) application.Stake = &newAppStake k.applicationKeeper.SetApplication(ctx, application) return nil } + +func (k Keeper) getCoinFromComputeUnits(ctx context.Context, root smt.MerkleRoot) sdk.Coin { + // Retrieve the existing tokenomics params + params := k.GetParams(ctx) + + upokt := math.NewInt(int64(root.Sum() * params.ComputeUnitsToTokensMultiplier)) + return sdk.NewCoin("upokt", upokt) +} diff --git a/x/tokenomics/keeper/settle_session_accounting_test.go b/x/tokenomics/keeper/settle_session_accounting_test.go index 368c7cba5..ec7f75360 100644 --- a/x/tokenomics/keeper/settle_session_accounting_test.go +++ b/x/tokenomics/keeper/settle_session_accounting_test.go @@ -64,7 +64,7 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeper(t) // Define test cases - testCases := []struct { + tests := []struct { desc string root []byte // smst.MerkleRoot errExpected bool @@ -112,8 +112,8 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { } // Iterate over each test case - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Use defer-recover to catch any panic defer func() { if r := recover(); r != nil { @@ -123,7 +123,7 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { // Setup claim by copying the baseClaim and updating the root claim := baseClaim(appAddr, supplierAddr, 0) - claim.RootHash = smt.MerkleRoot(tc.root[:]) + claim.RootHash = smt.MerkleRoot(test.root[:]) // Execute test function err := func() (err error) { @@ -136,7 +136,7 @@ func TestSettleSessionAccounting_InvalidRoot(t *testing.T) { }() // Assert the error - if tc.errExpected { + if test.errExpected { require.Error(t, err) } else { require.NoError(t, err) @@ -149,7 +149,7 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { keeper, ctx, appAddr, supplierAddr := testkeeper.TokenomicsKeeper(t) // Define test cases - testCases := []struct { + tests := []struct { desc string claim *prooftypes.Claim errExpected bool @@ -213,8 +213,8 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { } // Iterate over each test case - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Use defer-recover to catch any panic defer func() { if r := recover(); r != nil { @@ -229,13 +229,13 @@ func TestSettleSessionAccounting_InvalidClaim(t *testing.T) { err = fmt.Errorf("panic occurred: %v", r) } }() - return keeper.SettleSessionAccounting(ctx, tc.claim) + return keeper.SettleSessionAccounting(ctx, test.claim) }() // Assert the error - if tc.errExpected { + if test.errExpected { require.Error(t, err) - require.ErrorIs(t, err, tc.expectErr) + require.ErrorIs(t, err, test.expectErr) } else { require.NoError(t, err) } diff --git a/x/tokenomics/module/autocli.go b/x/tokenomics/module/autocli.go index 62c6428a6..8187209cc 100644 --- a/x/tokenomics/module/autocli.go +++ b/x/tokenomics/module/autocli.go @@ -10,28 +10,28 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - Long: `Shows all the parameters related to the tokenomics module. - -Example: -$ poktrolld q tokenomics params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, - }, + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // Long: `Shows all the parameters related to the tokenomics module. + // + // Example: + // $ poktrolld q tokenomics params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, + // }, // this line is used by ignite scaffolding # autocli/query }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/tokenomics/module/genesis.go b/x/tokenomics/module/genesis.go index 54e5be9cd..c877263d1 100644 --- a/x/tokenomics/module/genesis.go +++ b/x/tokenomics/module/genesis.go @@ -1,20 +1,22 @@ package tokenomics import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/tokenomics/keeper" "github.com/pokt-network/poktroll/x/tokenomics/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) diff --git a/x/tokenomics/module/genesis_test.go b/x/tokenomics/module/genesis_test.go index 16db5e9da..60f0b969f 100644 --- a/x/tokenomics/module/genesis_test.go +++ b/x/tokenomics/module/genesis_test.go @@ -3,11 +3,12 @@ package tokenomics_test import ( "testing" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" tokenomics "github.com/pokt-network/poktroll/x/tokenomics/module" "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" ) func TestGenesis(t *testing.T) { diff --git a/x/tokenomics/module/helpers_test.go b/x/tokenomics/module/helpers_test.go index 66df2797b..c1b9a7179 100644 --- a/x/tokenomics/module/helpers_test.go +++ b/x/tokenomics/module/helpers_test.go @@ -5,7 +5,6 @@ import ( "strconv" "testing" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/network" "github.com/pokt-network/poktroll/x/tokenomics/types" "github.com/stretchr/testify/require" @@ -14,11 +13,6 @@ import ( // Dummy variable to avoid unused import error. var _ = strconv.IntSize -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - // networkWithDefaultConfig is a helper function to create a network for testing // with a default tokenomics genesis state. func networkWithDefaultConfig(t *testing.T) *network.Network { diff --git a/x/tokenomics/module/module.go b/x/tokenomics/module/module.go index 597d97eb4..4beeea0ea 100644 --- a/x/tokenomics/module/module.go +++ b/x/tokenomics/module/module.go @@ -166,10 +166,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/tokenomics/module/query.go b/x/tokenomics/module/query.go index b4c8ae79b..a06b54166 100644 --- a/x/tokenomics/module/query.go +++ b/x/tokenomics/module/query.go @@ -11,6 +11,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetQueryCmd() *cobra.Command { // Group tokenomics queries under a subcommand cmd := &cobra.Command{ diff --git a/x/tokenomics/module/tx.go b/x/tokenomics/module/tx.go index 8e3ccc2b0..b407bafa0 100644 --- a/x/tokenomics/module/tx.go +++ b/x/tokenomics/module/tx.go @@ -10,6 +10,7 @@ import ( ) // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/tokenomics/module/tx_update_params_test.go b/x/tokenomics/module/tx_update_params_test.go index 0efd17413..022af8460 100644 --- a/x/tokenomics/module/tx_update_params_test.go +++ b/x/tokenomics/module/tx_update_params_test.go @@ -46,15 +46,15 @@ func TestCLI_UpdateParams(t *testing.T) { }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - args := append(common, tc.args...) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + args := append(common, test.args...) out, err := clitestutil.ExecTestCLICmd(ctx, tokenomics.CmdUpdateParams(), args) - if tc.expectedErr != nil { - _, ok := status.FromError(tc.expectedErr) + if test.expectedErr != nil { + _, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.ErrorIs(t, err, tc.expectedErr) - require.Contains(t, err.Error(), tc.expectedExtraErrMsg) + require.ErrorIs(t, err, test.expectedErr) + require.Contains(t, err.Error(), test.expectedExtraErrMsg) } else { require.NoError(t, err) var resp sdk.TxResponse diff --git a/x/tokenomics/types/errors.go b/x/tokenomics/types/errors.go index ec63e3c08..7328652af 100644 --- a/x/tokenomics/types/errors.go +++ b/x/tokenomics/types/errors.go @@ -2,27 +2,23 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/tokenomics module sentinel errors var ( - ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrTokenomicsSample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrTokenomicsAuthorityAddressInvalid = sdkerrors.Register(ModuleName, 1102, "the provided authority address is not a valid bech32 address") - ErrTokenomicsAuthorityAddressMismatch = sdkerrors.Register(ModuleName, 1103, "the provided authority address does not match the on-chain governance address") - ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1104, "provided claim is nil") - ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1105, "provided claim's session header is nil") - ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1106, "provided claim's session header is invalid") - ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1107, "failed to mint uPOKT to supplier module account") - ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 1108, "failed to send uPOKT from supplier module account to supplier") - ErrTokenomicsSupplierAddressInvalid = sdkerrors.Register(ModuleName, 1109, "the supplier address in the claim is not a valid bech32 address") - ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1110, "application not found") - ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1111, "failed to burn uPOKT from application module account") - ErrTokenomicsApplicationModuleFeeFailed = sdkerrors.Register(ModuleName, 1112, "failed to send uPOKT from application module account to application") - ErrTokenomicsApplicationUndelegationFailed = sdkerrors.Register(ModuleName, 1113, "failed to undelegate uPOKT from the application module to the application account") - ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1114, "the application address in the claim is not a valid bech32 address") - ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1115, "provided params are invalid") - ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1116, "the root hash in the claim is invalid") + ErrTokenomicsInvalidSigner = sdkerrors.Register(ModuleName, 1100, "the provided authority address does not match the on-chain governance address") + ErrTokenomicsAddressInvalid = sdkerrors.Register(ModuleName, 1101, "the provided authority address is not a valid bech32 address") + ErrTokenomicsClaimNil = sdkerrors.Register(ModuleName, 1102, "provided claim is nil") + ErrTokenomicsSessionHeaderNil = sdkerrors.Register(ModuleName, 1103, "provided claim's session header is nil") + ErrTokenomicsSessionHeaderInvalid = sdkerrors.Register(ModuleName, 1104, "provided claim's session header is invalid") + ErrTokenomicsSupplierModuleMintFailed = sdkerrors.Register(ModuleName, 1105, "failed to mint uPOKT to supplier module account") + ErrTokenomicsSupplierRewardFailed = sdkerrors.Register(ModuleName, 1106, "failed to send uPOKT from supplier module account to supplier") + ErrTokenomicsSupplierAddressInvalid = sdkerrors.Register(ModuleName, 1107, "the supplier address in the claim is not a valid bech32 address") + ErrTokenomicsApplicationNotFound = sdkerrors.Register(ModuleName, 1108, "application not found") + ErrTokenomicsApplicationModuleBurn = sdkerrors.Register(ModuleName, 1109, "failed to burn uPOKT from application module account") + ErrTokenomicsApplicationModuleFeeFailed = sdkerrors.Register(ModuleName, 1110, "failed to send uPOKT from application module account to application") + ErrTokenomicsApplicationUndelegationFailed = sdkerrors.Register(ModuleName, 1111, "failed to undelegate uPOKT from the application module to the application account") + ErrTokenomicsApplicationAddressInvalid = sdkerrors.Register(ModuleName, 1112, "the application address in the claim is not a valid bech32 address") + ErrTokenomicsParamsInvalid = sdkerrors.Register(ModuleName, 1113, "provided params are invalid") + ErrTokenomicsRootHashInvalid = sdkerrors.Register(ModuleName, 1114, "the root hash in the claim is invalid") ) diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go index e67c4ef41..6d4edf39c 100644 --- a/x/tokenomics/types/expected_keepers.go +++ b/x/tokenomics/types/expected_keepers.go @@ -1,7 +1,7 @@ -package types - //go:generate mockgen -destination ../../../testutil/tokenomics/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper,ApplicationKeeper,SupplierKeeper +package types + import ( "context" @@ -21,9 +21,24 @@ type AccountKeeper interface { type BankKeeper interface { MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount( + ctx context.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error + SendCoinsFromAccountToModule( + ctx context.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error + UndelegateCoinsFromModuleToAccount( + ctx context.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error } type ApplicationKeeper interface { @@ -34,9 +49,3 @@ type ApplicationKeeper interface { type SupplierKeeper interface { GetSupplier(ctx context.Context, suppAddr string) (supplier sharedtypes.Supplier, found bool) } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/tokenomics/types/genesis.go b/x/tokenomics/types/genesis.go index 0af9b4416..a88ab1682 100644 --- a/x/tokenomics/types/genesis.go +++ b/x/tokenomics/types/genesis.go @@ -1,11 +1,6 @@ package types -import ( // this line is used by starport scaffolding # genesis/types/import -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go index ad3aaa914..5994a3b52 100644 --- a/x/tokenomics/types/genesis_test.go +++ b/x/tokenomics/types/genesis_test.go @@ -11,12 +11,12 @@ func TestGenesisState_Validate(t *testing.T) { tests := []struct { desc string genState *types.GenesisState - valid bool + isValid bool }{ { desc: "default is valid", genState: types.DefaultGenesis(), - valid: true, + isValid: true, }, { desc: "valid genesis state", @@ -26,7 +26,7 @@ func TestGenesisState_Validate(t *testing.T) { }, // this line is used by starport scaffolding # types/genesis/validField }, - valid: true, + isValid: true, }, { desc: "invalid genesis state - ComputeUnitsToTokensMultiplier is 0", @@ -36,14 +36,14 @@ func TestGenesisState_Validate(t *testing.T) { }, // this line is used by starport scaffolding # types/genesis/validField }, - valid: false, + isValid: false, }, // this line is used by starport scaffolding # types/genesis/testcase } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.isValid { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/tokenomics/types/keys.go b/x/tokenomics/types/keys.go index 0b22810d7..8e555bd4b 100644 --- a/x/tokenomics/types/keys.go +++ b/x/tokenomics/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_tokenomics" ) -var ( - ParamsKey = []byte("p_tokenomics") -) +var ParamsKey = []byte("p_tokenomics") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/tokenomics/types/message_update_params.go b/x/tokenomics/types/message_update_params.go index f82f1d44d..e44bae2e8 100644 --- a/x/tokenomics/types/message_update_params.go +++ b/x/tokenomics/types/message_update_params.go @@ -1,20 +1,17 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgUpdateParams)(nil) func NewMsgUpdateParams( authority string, - compute_units_to_tokens_multiplier uint64, + computeUnitsToTokensMultiplier uint64, ) *MsgUpdateParams { return &MsgUpdateParams{ Authority: authority, Params: Params{ - ComputeUnitsToTokensMultiplier: compute_units_to_tokens_multiplier, + ComputeUnitsToTokensMultiplier: computeUnitsToTokensMultiplier, }, } } @@ -22,9 +19,8 @@ func NewMsgUpdateParams( // ValidateBasic does a sanity check on the provided data. func (msg *MsgUpdateParams) ValidateBasic() error { // Validate the address - _, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - return sdkerrors.Wrapf(ErrTokenomicsAuthorityAddressInvalid, "invalid authority address %s; (%v)", msg.Authority, err) + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return ErrTokenomicsAddressInvalid.Wrapf("invalid authority address %s; (%v)", msg.Authority, err) } // Validate the params @@ -38,7 +34,10 @@ func (msg *MsgUpdateParams) ValidateBasic() error { func (params *Params) ValidateBasic() error { // Validate the ComputeUnitsToTokensMultiplier if params.ComputeUnitsToTokensMultiplier == 0 { - return sdkerrors.Wrapf(ErrTokenomicsParamsInvalid, "invalid ComputeUnitsToTokensMultiplier; (%v)", params.ComputeUnitsToTokensMultiplier) + return ErrTokenomicsParamsInvalid.Wrapf( + "invalid ComputeUnitsToTokensMultiplier; (%v)", + params.ComputeUnitsToTokensMultiplier, + ) } return nil } diff --git a/x/tokenomics/types/message_update_params_test.go b/x/tokenomics/types/message_update_params_test.go index 0ac9863b7..bc85ec072 100644 --- a/x/tokenomics/types/message_update_params_test.go +++ b/x/tokenomics/types/message_update_params_test.go @@ -3,16 +3,15 @@ package types import ( "testing" - "github.com/pokt-network/poktroll/testutil/sample" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgUpdateParams_ValidateBasic(t *testing.T) { tests := []struct { - desc string - - msg MsgUpdateParams - + desc string + msg MsgUpdateParams expectedErr error }{ { @@ -23,8 +22,9 @@ func TestMsgUpdateParams_ValidateBasic(t *testing.T) { ComputeUnitsToTokensMultiplier: 1, }, }, - expectedErr: ErrTokenomicsAuthorityAddressInvalid, - }, { + expectedErr: ErrTokenomicsAddressInvalid, + }, + { desc: "valid address", msg: MsgUpdateParams{ Authority: sample.AccAddress(), @@ -32,7 +32,8 @@ func TestMsgUpdateParams_ValidateBasic(t *testing.T) { ComputeUnitsToTokensMultiplier: 1, }, }, - }, { + }, + { desc: "invalid ComputeUnitsToTokensMultiplier", msg: MsgUpdateParams{ Authority: sample.AccAddress(), @@ -43,11 +44,12 @@ func TestMsgUpdateParams_ValidateBasic(t *testing.T) { expectedErr: ErrTokenomicsParamsInvalid, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/tokenomics/types/params.go b/x/tokenomics/types/params.go index e8b7b6c98..9227fb76f 100644 --- a/x/tokenomics/types/params.go +++ b/x/tokenomics/types/params.go @@ -6,9 +6,9 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -var _ paramtypes.ParamSet = (*Params)(nil) - var ( + _ paramtypes.ParamSet = (*Params)(nil) + KeyComputeUnitsToTokensMultiplier = []byte("ComputeUnitsToTokensMultiplier") // TODO: Determine the default value DefaultComputeUnitsToTokensMultiplier uint64 = 42 @@ -20,9 +20,7 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams( - computeUnitsToTokensMultiplier uint64, -) Params { +func NewParams(computeUnitsToTokensMultiplier uint64) Params { return Params{ ComputeUnitsToTokensMultiplier: computeUnitsToTokensMultiplier, } @@ -38,7 +36,11 @@ func DefaultParams() Params { // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyComputeUnitsToTokensMultiplier, &p.ComputeUnitsToTokensMultiplier, validateComputeUnitsToTokensMultiplier), + paramtypes.NewParamSetPair( + KeyComputeUnitsToTokensMultiplier, + &p.ComputeUnitsToTokensMultiplier, + validateComputeUnitsToTokensMultiplier, + ), } } @@ -52,6 +54,7 @@ func (p Params) Validate() error { } // validateComputeUnitsToTokensMultiplier validates the ComputeUnitsToTokensMultiplier param +// NB: The argument is an interface type to satisfy the ParamSetPair function signature. func validateComputeUnitsToTokensMultiplier(v interface{}) error { computeUnitsToTokensMultiplier, ok := v.(uint64) if !ok { diff --git a/x/tokenomics/types/types.go b/x/tokenomics/types/types.go index ab1254f4c..78d9ec9f9 100644 --- a/x/tokenomics/types/types.go +++ b/x/tokenomics/types/types.go @@ -1 +1,3 @@ package types + +// This file is in place to declare the package for dynamically generated protobufs From d20affba2bbf40f1e2445c57c4f0e1d9456450e0 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Tue, 20 Feb 2024 10:19:45 +0100 Subject: [PATCH 45/54] chore: off-chain review improvements --- .../config/appgate_configs_reader_test.go | 44 ++++----- pkg/appgateserver/config/errors.go | 12 +-- pkg/appgateserver/options.go | 4 +- pkg/client/block/client_test.go | 6 +- pkg/client/delegation/client_test.go | 6 +- pkg/client/events/errors.go | 4 +- pkg/client/events/websocket/errors.go | 4 +- pkg/client/query/appquerier.go | 6 +- pkg/client/query/errors.go | 4 +- pkg/client/query/types/context.go | 4 +- pkg/client/supplier/client_test.go | 10 +- pkg/client/supplier/options.go | 4 +- pkg/client/tx/client_test.go | 8 +- pkg/client/tx/options.go | 4 +- pkg/client/tx/types/context.go | 4 +- pkg/crypto/rings/errors.go | 4 +- pkg/observable/channel/map_test.go | 14 +-- pkg/observable/channel/observable_test.go | 22 ++--- pkg/observable/channel/replay_test.go | 10 +- pkg/partials/errors.go | 4 +- pkg/relayer/config/errors.go | 14 +-- .../config/relayminer_configs_reader_test.go | 96 +++++++++---------- pkg/relayer/protocol/difficulty.go | 4 +- pkg/relayer/protocol/difficulty_test.go | 8 +- pkg/relayer/proxy/errors.go | 4 +- pkg/relayer/proxy/proxy_test.go | 14 +-- pkg/relayer/proxy/relay_signer.go | 6 +- pkg/relayer/proxy/relay_verifier.go | 2 +- pkg/relayer/session/options.go | 4 +- pkg/retry/retry_test.go | 16 ++-- pkg/sdk/application.go | 2 +- pkg/sdk/errors.go | 4 +- proto/poktroll/service/relay.proto | 4 +- testutil/testkeyring/gen_accounts/gen.go | 2 + 34 files changed, 165 insertions(+), 193 deletions(-) diff --git a/pkg/appgateserver/config/appgate_configs_reader_test.go b/pkg/appgateserver/config/appgate_configs_reader_test.go index 82ee6e53f..bc2c88472 100644 --- a/pkg/appgateserver/config/appgate_configs_reader_test.go +++ b/pkg/appgateserver/config/appgate_configs_reader_test.go @@ -18,7 +18,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { inputConfigYAML string - expectedError *sdkerrors.Error + expectedErr *sdkerrors.Error expectedConfig *config.AppGateServerConfig }{ // Valid Configs @@ -33,7 +33,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.AppGateServerConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, @@ -52,7 +52,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.AppGateServerConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, QueryNodeGRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36658"}, @@ -67,7 +67,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { inputConfigYAML: ``, - expectedError: config.ErrAppGateConfigEmpty, + expectedErr: config.ErrAppGateConfigEmpty, }, { desc: "invalid: no signing key", @@ -80,7 +80,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: config.ErrAppGateConfigEmptySigningKey, + expectedErr: config.ErrAppGateConfigEmptySigningKey, }, { desc: "invalid: invalid listening endpoint", @@ -93,7 +93,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: l&ocalhost:42069 `, - expectedError: config.ErrAppGateConfigInvalidListeningEndpoint, + expectedErr: config.ErrAppGateConfigInvalidListeningEndpoint, }, { desc: "invalid: invalid query node grpc url", @@ -106,7 +106,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, + expectedErr: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, }, { desc: "invalid: missing query node grpc url", @@ -119,7 +119,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, + expectedErr: config.ErrAppGateConfigInvalidQueryNodeGRPCUrl, }, { desc: "invalid: invalid query node rpc url", @@ -132,7 +132,7 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, + expectedErr: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, }, { desc: "invalid: missing query node rpc url", @@ -145,32 +145,32 @@ func Test_ParseAppGateConfigs(t *testing.T) { listening_endpoint: http://localhost:42069 `, - expectedError: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, + expectedErr: config.ErrAppGateConfigInvalidQueryNodeRPCUrl, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(test.inputConfigYAML) config, err := config.ParseAppGateServerConfigs([]byte(normalizedConfig)) - if tt.expectedError != nil { - require.ErrorIs(t, err, tt.expectedError) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) require.Nil(t, config) - stat, ok := status.FromError(tt.expectedError) + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) require.Nil(t, config) return } require.NoError(t, err) - require.Equal(t, tt.expectedConfig.SelfSigning, config.SelfSigning) - require.Equal(t, tt.expectedConfig.SigningKey, config.SigningKey) - require.Equal(t, tt.expectedConfig.ListeningEndpoint.String(), config.ListeningEndpoint.String()) - require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) - require.Equal(t, tt.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) + require.Equal(t, test.expectedConfig.SelfSigning, config.SelfSigning) + require.Equal(t, test.expectedConfig.SigningKey, config.SigningKey) + require.Equal(t, test.expectedConfig.ListeningEndpoint.String(), config.ListeningEndpoint.String()) + require.Equal(t, test.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) + require.Equal(t, test.expectedConfig.QueryNodeGRPCUrl.String(), config.QueryNodeGRPCUrl.String()) }) } } diff --git a/pkg/appgateserver/config/errors.go b/pkg/appgateserver/config/errors.go index 450c75378..882c70a18 100644 --- a/pkg/appgateserver/config/errors.go +++ b/pkg/appgateserver/config/errors.go @@ -4,10 +4,10 @@ import sdkerrors "cosmossdk.io/errors" var ( codespace = "appgate_config" - ErrAppGateConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrAppGateConfigEmptySigningKey = sdkerrors.Register(codespace, 2, "empty signing key in AppGateServer config") - ErrAppGateConfigInvalidListeningEndpoint = sdkerrors.Register(codespace, 3, "invalid listening endpoint in AppGateServer config") - ErrAppGateConfigInvalidQueryNodeGRPCUrl = sdkerrors.Register(codespace, 4, "invalid query node grpc url in AppGateServer config") - ErrAppGateConfigInvalidQueryNodeRPCUrl = sdkerrors.Register(codespace, 5, "invalid query node rpc url in AppGateServer config") - ErrAppGateConfigEmpty = sdkerrors.Register(codespace, 6, "empty AppGateServer config") + ErrAppGateConfigUnmarshalYAML = sdkerrors.Register(codespace, 2100, "config reader cannot unmarshal yaml content") + ErrAppGateConfigEmptySigningKey = sdkerrors.Register(codespace, 2101, "empty signing key in AppGateServer config") + ErrAppGateConfigInvalidListeningEndpoint = sdkerrors.Register(codespace, 2102, "invalid listening endpoint in AppGateServer config") + ErrAppGateConfigInvalidQueryNodeGRPCUrl = sdkerrors.Register(codespace, 2103, "invalid query node grpc url in AppGateServer config") + ErrAppGateConfigInvalidQueryNodeRPCUrl = sdkerrors.Register(codespace, 2104, "invalid query node rpc url in AppGateServer config") + ErrAppGateConfigEmpty = sdkerrors.Register(codespace, 2105, "empty AppGateServer config") ) diff --git a/pkg/appgateserver/options.go b/pkg/appgateserver/options.go index fb164029b..890e6c5bf 100644 --- a/pkg/appgateserver/options.go +++ b/pkg/appgateserver/options.go @@ -1,8 +1,6 @@ package appgateserver -import ( - "net/url" -) +import "net/url" // WithSigningInformation sets the signing information for the appgate server. func WithSigningInformation(signingInfo *SigningInformation) appGateServerOption { diff --git a/pkg/client/block/client_test.go b/pkg/client/block/client_test.go index 862bed75e..b50dd05b8 100644 --- a/pkg/client/block/client_test.go +++ b/pkg/client/block/client_test.go @@ -92,8 +92,8 @@ func TestBlockClient(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { actualBlockCh := make(chan client.Block, 10) // Run test functions asynchronously because they can block, leading @@ -102,7 +102,7 @@ func TestBlockClient(t *testing.T) { go func(fn func() client.Block) { actualBlockCh <- fn() close(actualBlockCh) - }(tt.fn) + }(test.fn) select { case actualBlock := <-actualBlockCh: diff --git a/pkg/client/delegation/client_test.go b/pkg/client/delegation/client_test.go index f9b82ffb5..d34f53118 100644 --- a/pkg/client/delegation/client_test.go +++ b/pkg/client/delegation/client_test.go @@ -74,8 +74,8 @@ func TestDelegationClient(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { actualRedelegationCh := make(chan client.Redelegation, 10) // Run test functions asynchronously because they can block, leading @@ -84,7 +84,7 @@ func TestDelegationClient(t *testing.T) { go func(fn func() client.Redelegation) { actualRedelegationCh <- fn() close(actualRedelegationCh) - }(tt.fn) + }(test.fn) select { case actualRedelegation := <-actualRedelegationCh: diff --git a/pkg/client/events/errors.go b/pkg/client/events/errors.go index 838b9dbec..abca55a84 100644 --- a/pkg/client/events/errors.go +++ b/pkg/client/events/errors.go @@ -1,8 +1,6 @@ package events -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" var ( codespace = "events" diff --git a/pkg/client/events/websocket/errors.go b/pkg/client/events/websocket/errors.go index 85f8953fd..710f25fd0 100644 --- a/pkg/client/events/websocket/errors.go +++ b/pkg/client/events/websocket/errors.go @@ -1,8 +1,6 @@ package websocket -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" var ( codespace = "events_query_client_websocket_connection" diff --git a/pkg/client/query/appquerier.go b/pkg/client/query/appquerier.go index 9998a64f7..9477c35f9 100644 --- a/pkg/client/query/appquerier.go +++ b/pkg/client/query/appquerier.go @@ -55,10 +55,10 @@ func (aq *appQuerier) GetApplication( // GetAllApplications returns all staked applications func (aq *appQuerier) GetAllApplications(ctx context.Context) ([]apptypes.Application, error) { - req := apptypes.QueryAllApplicationRequest{} - res, err := aq.applicationQuerier.ApplicationAll(ctx, &req) + req := apptypes.QueryAllApplicationsRequest{} + res, err := aq.applicationQuerier.AllApplications(ctx, &req) if err != nil { return []apptypes.Application{}, err } - return res.Application, nil + return res.Applications, nil } diff --git a/pkg/client/query/errors.go b/pkg/client/query/errors.go index f395a9997..7d28cff84 100644 --- a/pkg/client/query/errors.go +++ b/pkg/client/query/errors.go @@ -1,8 +1,6 @@ package query -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" var ( codespace = "query" diff --git a/pkg/client/query/types/context.go b/pkg/client/query/types/context.go index d0f56fe6f..1af9d02c7 100644 --- a/pkg/client/query/types/context.go +++ b/pkg/client/query/types/context.go @@ -1,8 +1,6 @@ package types -import ( - cosmosclient "github.com/cosmos/cosmos-sdk/client" -) +import cosmosclient "github.com/cosmos/cosmos-sdk/client" // Context is used to distinguish a cosmosclient.Context intended for use in // queries from others. This is because the same cosmosclient.Context can be diff --git a/pkg/client/supplier/client_test.go b/pkg/client/supplier/client_test.go index b40fc3430..03fc27567 100644 --- a/pkg/client/supplier/client_test.go +++ b/pkg/client/supplier/client_test.go @@ -60,13 +60,13 @@ func TestNewSupplierClient(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - signingKeyOpt := supplier.WithSigningKeyName(tt.signingKeyName) + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + signingKeyOpt := supplier.WithSigningKeyName(test.signingKeyName) supplierClient, err := supplier.NewSupplierClient(deps, signingKeyOpt) - if tt.expectedErr != nil { - require.ErrorIs(t, err, tt.expectedErr) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) require.Nil(t, supplierClient) } else { require.NoError(t, err) diff --git a/pkg/client/supplier/options.go b/pkg/client/supplier/options.go index f4460c8c9..424cf7420 100644 --- a/pkg/client/supplier/options.go +++ b/pkg/client/supplier/options.go @@ -1,8 +1,6 @@ package supplier -import ( - "github.com/pokt-network/poktroll/pkg/client" -) +import "github.com/pokt-network/poktroll/pkg/client" // WithSigningKeyName sets the name of the key which the supplier client should // retrieve from the keyring to use for authoring and signing CreateClaim and diff --git a/pkg/client/tx/client_test.go b/pkg/client/tx/client_test.go index bfefbc3a6..86e7de0a2 100644 --- a/pkg/client/tx/client_test.go +++ b/pkg/client/tx/client_test.go @@ -165,8 +165,8 @@ func TestTxClient_NewTxClient_Error(t *testing.T) { // }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { var ( ctrl = gomock.NewController(t) ctx = context.Background() @@ -192,11 +192,11 @@ func TestTxClient_NewTxClient_Error(t *testing.T) { ) // Construct a signing key option using the test signing key name. - signingKeyOpt := tx.WithSigningKeyName(tt.signingKeyName) + signingKeyOpt := tx.WithSigningKeyName(test.signingKeyName) // Attempt to create the transactions client. txClient, err := tx.NewTxClient(ctx, txClientDeps, signingKeyOpt) - require.ErrorIs(t, err, tt.expectedErr) + require.ErrorIs(t, err, test.expectedErr) require.Nil(t, txClient) }) } diff --git a/pkg/client/tx/options.go b/pkg/client/tx/options.go index 34e782b6d..5364008a5 100644 --- a/pkg/client/tx/options.go +++ b/pkg/client/tx/options.go @@ -1,8 +1,6 @@ package tx -import ( - "github.com/pokt-network/poktroll/pkg/client" -) +import "github.com/pokt-network/poktroll/pkg/client" // WithCommitTimeoutBlocks sets the timeout duration in terms of number of blocks // for the client to wait for broadcast transactions to be committed before diff --git a/pkg/client/tx/types/context.go b/pkg/client/tx/types/context.go index 7dd15cd7f..73723b011 100644 --- a/pkg/client/tx/types/context.go +++ b/pkg/client/tx/types/context.go @@ -1,8 +1,6 @@ package types -import ( - cosmosclient "github.com/cosmos/cosmos-sdk/client" -) +import cosmosclient "github.com/cosmos/cosmos-sdk/client" // Context is used to distinguish a cosmosclient.Context intended for use in // transactions from others. This is because the same cosmosclient.Context can diff --git a/pkg/crypto/rings/errors.go b/pkg/crypto/rings/errors.go index 8aae1ad9d..cd85b519b 100644 --- a/pkg/crypto/rings/errors.go +++ b/pkg/crypto/rings/errors.go @@ -1,8 +1,6 @@ package rings -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" var ( codespace = "rings" diff --git a/pkg/observable/channel/map_test.go b/pkg/observable/channel/map_test.go index aa7507a71..e12c3f9c7 100644 --- a/pkg/observable/channel/map_test.go +++ b/pkg/observable/channel/map_test.go @@ -29,8 +29,8 @@ func TestMap_Word_BytesToPalindrome(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { var ( wordCounter int32 ctx, cancel = context.WithCancel(context.Background()) @@ -45,7 +45,7 @@ func TestMap_Word_BytesToPalindrome(t *testing.T) { palindromeObserver := palindromeObservable.Subscribe(ctx) // publish a word in bytes - bzPublishCh <- tt.wordBz + bzPublishCh <- test.wordBz // concurrently consume the palindrome observer's channel go func() { @@ -53,13 +53,13 @@ func TestMap_Word_BytesToPalindrome(t *testing.T) { atomic.AddInt32(&wordCounter, 1) // word.forwards should always match the original word - require.Equal(t, string(tt.wordBz), word.forwards) + require.Equal(t, string(test.wordBz), word.forwards) - if tt.isValid { - require.Equal(t, string(tt.wordBz), word.backwards) + if test.isValid { + require.Equal(t, string(test.wordBz), word.backwards) require.Truef(t, word.IsValid(), "palindrome should be valid") } else { - require.NotEmptyf(t, string(tt.wordBz), word.backwards) + require.NotEmptyf(t, string(test.wordBz), word.backwards) require.Falsef(t, word.IsValid(), "palindrome should be invalid") } } diff --git a/pkg/observable/channel/observable_test.go b/pkg/observable/channel/observable_test.go index b278546fc..0f017ae83 100644 --- a/pkg/observable/channel/observable_test.go +++ b/pkg/observable/channel/observable_test.go @@ -92,17 +92,17 @@ func TestChannelObservable_NotifyObservers(t *testing.T) { // }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.setupFn != nil { - tt.setupFn(tt) + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if test.setupFn != nil { + test.setupFn(test) } ctx, cancel := context.WithCancel(context.Background()) t.Cleanup(cancel) obsvbl, publishCh := channel.NewObservable[int]( - channel.WithPublisher(tt.publishCh), + channel.WithPublisher(test.publishCh), ) require.NotNil(t, obsvbl) require.NotNil(t, publishCh) @@ -121,7 +121,7 @@ func TestChannelObservable_NotifyObservers(t *testing.T) { onNext := func(outputIndex int, output int) error { // obsvr channel should receive notified input if !assert.Equalf( - t, tt.expectedOutputs[outputIndex], + t, test.expectedOutputs[outputIndex], output, "obsvr Idx: %d", obsvrIdx, ) { @@ -133,7 +133,7 @@ func TestChannelObservable_NotifyObservers(t *testing.T) { // onDone is called when the observer channel closes onDone := func(outputs []int) error { if !assert.ElementsMatch( - t, tt.expectedOutputs, outputs, + t, test.expectedOutputs, outputs, "obsvr addr: %p", obsvr, ) { return testerrors.ErrAsync @@ -148,7 +148,7 @@ func TestChannelObservable_NotifyObservers(t *testing.T) { // notify with test input publish := delayedPublishFactory(publishCh, publishDelay) - for _, input := range tt.inputs { + for _, input := range test.inputs { // simulating IO delay in sequential message publishing publish(input) } @@ -234,9 +234,9 @@ func TestChannelObservable_UnsubscribeObservers(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - observer := tt.lifecycleFn() + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + observer := test.lifecycleFn() select { case value, ok := <-observer.Ch(): diff --git a/pkg/observable/channel/replay_test.go b/pkg/observable/channel/replay_test.go index 6e01f123e..8a06b9161 100644 --- a/pkg/observable/channel/replay_test.go +++ b/pkg/observable/channel/replay_test.go @@ -127,20 +127,20 @@ func TestReplayObservable_Last_Full_ReplayBuffer(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { var ctx = context.Background() replayObsvbl, publishCh := - channel.NewReplayObservable[int](ctx, tt.replayBufferSize) + channel.NewReplayObservable[int](ctx, test.replayBufferSize) for _, value := range values { publishCh <- value time.Sleep(time.Millisecond) } - actualValues := replayObsvbl.Last(ctx, tt.lastN) - require.ElementsMatch(t, tt.expectedValues, actualValues) + actualValues := replayObsvbl.Last(ctx, test.lastN) + require.ElementsMatch(t, test.expectedValues, actualValues) }) } } diff --git a/pkg/partials/errors.go b/pkg/partials/errors.go index 8f3d84885..887a3f34c 100644 --- a/pkg/partials/errors.go +++ b/pkg/partials/errors.go @@ -1,8 +1,6 @@ package partials -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" var ( codespace = "partial" diff --git a/pkg/relayer/config/errors.go b/pkg/relayer/config/errors.go index eace596e3..16544e209 100644 --- a/pkg/relayer/config/errors.go +++ b/pkg/relayer/config/errors.go @@ -4,11 +4,11 @@ import sdkerrors "cosmossdk.io/errors" var ( codespace = "relayminer_config" - ErrRelayMinerConfigUnmarshalYAML = sdkerrors.Register(codespace, 1, "config reader cannot unmarshal yaml content") - ErrRelayMinerConfigInvalidNodeUrl = sdkerrors.Register(codespace, 2, "invalid node url in RelayMiner config") - ErrRelayMinerConfigInvalidSigningKeyName = sdkerrors.Register(codespace, 3, "invalid signing key name in RelayMiner config") - ErrRelayMinerConfigInvalidSmtStorePath = sdkerrors.Register(codespace, 4, "invalid smt store path in RelayMiner config") - ErrRelayMinerConfigEmpty = sdkerrors.Register(codespace, 5, "empty RelayMiner config") - ErrRelayMinerConfigInvalidSupplier = sdkerrors.Register(codespace, 6, "invalid supplier in RelayMiner config") - ErrRelayMinerConfigInvalidProxy = sdkerrors.Register(codespace, 7, "invalid proxy in RelayMiner config") + ErrRelayMinerConfigUnmarshalYAML = sdkerrors.Register(codespace, 2100, "config reader cannot unmarshal yaml content") + ErrRelayMinerConfigInvalidNodeUrl = sdkerrors.Register(codespace, 2101, "invalid node url in RelayMiner config") + ErrRelayMinerConfigInvalidSigningKeyName = sdkerrors.Register(codespace, 2102, "invalid signing key name in RelayMiner config") + ErrRelayMinerConfigInvalidSmtStorePath = sdkerrors.Register(codespace, 2103, "invalid smt store path in RelayMiner config") + ErrRelayMinerConfigEmpty = sdkerrors.Register(codespace, 2104, "empty RelayMiner config") + ErrRelayMinerConfigInvalidSupplier = sdkerrors.Register(codespace, 2105, "invalid supplier in RelayMiner config") + ErrRelayMinerConfigInvalidProxy = sdkerrors.Register(codespace, 2106, "invalid proxy in RelayMiner config") ) diff --git a/pkg/relayer/config/relayminer_configs_reader_test.go b/pkg/relayer/config/relayminer_configs_reader_test.go index 6b8bc3c60..777e908da 100644 --- a/pkg/relayer/config/relayminer_configs_reader_test.go +++ b/pkg/relayer/config/relayminer_configs_reader_test.go @@ -18,7 +18,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { inputConfigYAML string - expectedError *sdkerrors.Error + expectedErr *sdkerrors.Error expectedConfig *config.RelayMinerConfig }{ // Valid Configs @@ -52,7 +52,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.RelayMinerConfig{ PocketNode: &config.RelayMinerPocketNodeConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, @@ -127,7 +127,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.RelayMinerConfig{ PocketNode: &config.RelayMinerPocketNodeConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, @@ -204,7 +204,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - second-proxy `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.RelayMinerConfig{ PocketNode: &config.RelayMinerPocketNodeConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, @@ -278,7 +278,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.RelayMinerConfig{ PocketNode: &config.RelayMinerPocketNodeConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36659"}, @@ -337,7 +337,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.RelayMinerConfig{ PocketNode: &config.RelayMinerPocketNodeConfig{ QueryNodeRPCUrl: &url.URL{Scheme: "tcp", Host: "127.0.0.1:36657"}, @@ -395,7 +395,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + expectedErr: config.ErrRelayMinerConfigInvalidNodeUrl, }, { desc: "invalid: missing tx node grpc url", @@ -422,7 +422,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + expectedErr: config.ErrRelayMinerConfigInvalidNodeUrl, }, { desc: "invalid: invalid query node grpc url", @@ -449,7 +449,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + expectedErr: config.ErrRelayMinerConfigInvalidNodeUrl, }, { desc: "invalid: invalid query node rpc url", @@ -476,7 +476,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + expectedErr: config.ErrRelayMinerConfigInvalidNodeUrl, }, { desc: "invalid: missing query node grpc url", @@ -503,7 +503,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidNodeUrl, + expectedErr: config.ErrRelayMinerConfigInvalidNodeUrl, }, { desc: "invalid: missing signing key name", @@ -530,7 +530,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSigningKeyName, + expectedErr: config.ErrRelayMinerConfigInvalidSigningKeyName, }, { desc: "invalid: missing smt store path", @@ -557,7 +557,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSmtStorePath, + expectedErr: config.ErrRelayMinerConfigInvalidSmtStorePath, }, { desc: "invalid: missing proxies section", @@ -581,7 +581,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: empty proxies section", @@ -605,7 +605,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: omitted proxy name", @@ -632,7 +632,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: empty proxy name", @@ -659,7 +659,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: missing http proxy host", @@ -686,7 +686,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: empty http proxy host", @@ -713,7 +713,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: missing proxy type", @@ -740,7 +740,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: empty proxy type", @@ -767,7 +767,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: unsupported proxy type", @@ -794,7 +794,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: missing supplier name", @@ -821,7 +821,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: empty supplier name", @@ -848,7 +848,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: unsupported supplier type", @@ -875,7 +875,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: missing supplier type", @@ -902,7 +902,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: empty supplier type", @@ -929,7 +929,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: bad supplier service config url", @@ -956,7 +956,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: empty supplier service config url", @@ -983,7 +983,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: missing supplier service config url", @@ -1010,7 +1010,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: bad supplier host", @@ -1037,7 +1037,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: blank supplier host", @@ -1064,7 +1064,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: empty supplier proxy references", @@ -1091,7 +1091,7 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - bad-proxy-name `, - expectedError: config.ErrRelayMinerConfigInvalidSupplier, + expectedErr: config.ErrRelayMinerConfigInvalidSupplier, }, { desc: "invalid: empty supplier proxy references", @@ -1126,30 +1126,30 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { - http-example `, - expectedError: config.ErrRelayMinerConfigInvalidProxy, + expectedErr: config.ErrRelayMinerConfigInvalidProxy, }, { desc: "invalid: empty RelayMiner config file", inputConfigYAML: ``, - expectedError: config.ErrRelayMinerConfigEmpty, + expectedErr: config.ErrRelayMinerConfigEmpty, }, // TODO_NB: Test for supplier and proxy types mismatch once we have more // than one proxy type. } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfigYAML) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(test.inputConfigYAML) config, err := config.ParseRelayMinerConfigs([]byte(normalizedConfig)) - if tt.expectedError != nil { - require.ErrorIs(t, err, tt.expectedError) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) require.Nil(t, config) - stat, ok := status.FromError(tt.expectedError) + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) require.Nil(t, config) return } @@ -1158,35 +1158,35 @@ func Test_ParseRelayMinerConfigs(t *testing.T) { require.Equal( t, - tt.expectedConfig.SigningKeyName, + test.expectedConfig.SigningKeyName, config.SigningKeyName, ) require.Equal( t, - tt.expectedConfig.SmtStorePath, + test.expectedConfig.SmtStorePath, config.SmtStorePath, ) require.Equal( t, - tt.expectedConfig.PocketNode.QueryNodeGRPCUrl.String(), + test.expectedConfig.PocketNode.QueryNodeGRPCUrl.String(), config.PocketNode.QueryNodeGRPCUrl.String(), ) require.Equal( t, - tt.expectedConfig.PocketNode.QueryNodeRPCUrl.String(), + test.expectedConfig.PocketNode.QueryNodeRPCUrl.String(), config.PocketNode.QueryNodeRPCUrl.String(), ) require.Equal( t, - tt.expectedConfig.PocketNode.TxNodeRPCUrl.String(), + test.expectedConfig.PocketNode.TxNodeRPCUrl.String(), config.PocketNode.TxNodeRPCUrl.String(), ) - for proxyName, proxy := range tt.expectedConfig.Proxies { + for proxyName, proxy := range test.expectedConfig.Proxies { require.Equal( t, proxy.ProxyName, diff --git a/pkg/relayer/protocol/difficulty.go b/pkg/relayer/protocol/difficulty.go index a33c4bac6..0d57c9158 100644 --- a/pkg/relayer/protocol/difficulty.go +++ b/pkg/relayer/protocol/difficulty.go @@ -1,8 +1,6 @@ package protocol -import ( - "math/bits" -) +import "math/bits" // TODO_BLOCKER: Revisit this part of the algorithm after initial TestNet Launch. // TODO_TEST: Add extensive tests for the core relay mining business logic. diff --git a/pkg/relayer/protocol/difficulty_test.go b/pkg/relayer/protocol/difficulty_test.go index ae5548634..8b5aad2d5 100644 --- a/pkg/relayer/protocol/difficulty_test.go +++ b/pkg/relayer/protocol/difficulty_test.go @@ -40,11 +40,11 @@ func TestCountDifficultyBits(t *testing.T) { }, } - for _, tt := range tests { - t.Run(fmt.Sprintf("difficulty_%d_zero_bits", tt.difficulty), func(t *testing.T) { - actualDifficulty, err := protocol.CountDifficultyBits(tt.bz) + for _, test := range tests { + t.Run(fmt.Sprintf("difficulty_%d_zero_bits", test.difficulty), func(t *testing.T) { + actualDifficulty, err := protocol.CountDifficultyBits(test.bz) require.NoError(t, err) - require.Equal(t, tt.difficulty, actualDifficulty) + require.Equal(t, test.difficulty, actualDifficulty) }) } } diff --git a/pkg/relayer/proxy/errors.go b/pkg/relayer/proxy/errors.go index 84604e836..5a4d81af7 100644 --- a/pkg/relayer/proxy/errors.go +++ b/pkg/relayer/proxy/errors.go @@ -1,8 +1,6 @@ package proxy -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" var ( codespace = "relayer_proxy" diff --git a/pkg/relayer/proxy/proxy_test.go b/pkg/relayer/proxy/proxy_test.go index 58ca8e3cc..5ddba5d5f 100644 --- a/pkg/relayer/proxy/proxy_test.go +++ b/pkg/relayer/proxy/proxy_test.go @@ -529,13 +529,13 @@ func TestRelayerProxy_Relays(t *testing.T) { } ctx := context.TODO() - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { ctx, cancel := context.WithCancel(ctx) - test := testproxy.NewRelayerProxyTestBehavior(ctx, t, tt.relayerProxyBehavior...) + testBehavior := testproxy.NewRelayerProxyTestBehavior(ctx, t, test.relayerProxyBehavior...) rp, err := proxy.NewRelayerProxy( - test.Deps, + testBehavior.Deps, proxy.WithSigningKeyName(supplierKeyName), proxy.WithProxiedServicesEndpoints(proxiedServices), ) @@ -545,9 +545,9 @@ func TestRelayerProxy_Relays(t *testing.T) { // Block so relayerProxy has sufficient time to start time.Sleep(100 * time.Millisecond) - errCode, errMsg := tt.inputScenario(t, test) - require.Equal(t, tt.expectedErrCode, errCode) - require.True(t, strings.HasPrefix(errMsg, tt.expectedErrMsg)) + errCode, errMsg := test.inputScenario(t, testBehavior) + require.Equal(t, test.expectedErrCode, errCode) + require.True(t, strings.HasPrefix(errMsg, test.expectedErrMsg)) cancel() }) diff --git a/pkg/relayer/proxy/relay_signer.go b/pkg/relayer/proxy/relay_signer.go index 347bf6228..96b8f0b96 100644 --- a/pkg/relayer/proxy/relay_signer.go +++ b/pkg/relayer/proxy/relay_signer.go @@ -1,8 +1,6 @@ package proxy import ( - sdkerrors "cosmossdk.io/errors" - "github.com/pokt-network/poktroll/pkg/signer" "github.com/pokt-network/poktroll/x/service/types" ) @@ -19,13 +17,13 @@ func (rp *relayerProxy) SignRelayResponse(relayResponse *types.RelayResponse) er // extract and hash the relay response's signable bytes signableBz, err := relayResponse.GetSignableBytesHash() if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error getting signable bytes: %v", err) + return ErrRelayerProxyInvalidRelayResponse.Wrapf("error getting signable bytes: %v", err) } // sign the relay response responseSig, err := signer.Sign(signableBz) if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayResponse, "error signing relay response: %v", err) + return ErrRelayerProxyInvalidRelayResponse.Wrapf("error signing relay response: %v", err) } // set the relay response's signature diff --git a/pkg/relayer/proxy/relay_verifier.go b/pkg/relayer/proxy/relay_verifier.go index 60c1458e0..29924ee13 100644 --- a/pkg/relayer/proxy/relay_verifier.go +++ b/pkg/relayer/proxy/relay_verifier.go @@ -76,7 +76,7 @@ func (rp *relayerProxy) VerifyRelayRequest( // get and hash the signable bytes of the relay request requestSignableBz, err := relayRequest.GetSignableBytesHash() if err != nil { - return sdkerrors.Wrapf(ErrRelayerProxyInvalidRelayRequest, "error getting signable bytes: %v", err) + return ErrRelayerProxyInvalidRelayRequest.Wrapf("error getting signable bytes: %v", err) } // verify the relay request's signature diff --git a/pkg/relayer/session/options.go b/pkg/relayer/session/options.go index 1edadc132..b171a2e74 100644 --- a/pkg/relayer/session/options.go +++ b/pkg/relayer/session/options.go @@ -1,8 +1,6 @@ package session -import ( - "github.com/pokt-network/poktroll/pkg/relayer" -) +import "github.com/pokt-network/poktroll/pkg/relayer" // WithStoresDirectory sets the path on disk where KVStore data files used to store // SMST of work sessions are created. diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go index d328bda73..c9dab961c 100644 --- a/pkg/retry/retry_test.go +++ b/pkg/retry/retry_test.go @@ -118,12 +118,12 @@ func TestOnError(t *testing.T) { } // Verify the error messages logged during the retries. - expectedErrorLine := "ERROR: retrying TestOnError after error: test error" + expectedErrLine := "ERROR: retrying TestOnError after error: test error" trimmedLogOutput := strings.Trim(logOutput.String(), "\n") logOutputLines := strings.Split(trimmedLogOutput, "\n") require.Lenf(t, logOutputLines, expectedRetryLimit, "unexpected number of log lines") for _, line := range logOutputLines { - require.Contains(t, line, expectedErrorLine, "log line does not contain the expected prefix") + require.Contains(t, line, expectedErrLine, "log line does not contain the expected prefix") } } @@ -213,11 +213,11 @@ func TestOnError_ExitsWhenErrChCloses(t *testing.T) { // Verify the logged error messages var ( - logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") - errorLines = logOutputLines[:len(logOutputLines)-1] - warnLine = logOutputLines[len(logOutputLines)-1] - expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses closed, will no longer retry on error" - expectedErrorMsg = "ERROR: retrying TestOnError_ExitsWhenErrChCloses after error: test error" + logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") + errorLines = logOutputLines[:len(logOutputLines)-1] + warnLine = logOutputLines[len(logOutputLines)-1] + expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses closed, will no longer retry on error" + expectedErrMsg = "ERROR: retrying TestOnError_ExitsWhenErrChCloses after error: test error" ) require.Lenf( @@ -227,7 +227,7 @@ func TestOnError_ExitsWhenErrChCloses(t *testing.T) { expectedRetryLimit, len(logOutputLines), ) for _, line := range errorLines { - require.Contains(t, line, expectedErrorMsg) + require.Contains(t, line, expectedErrMsg) } require.Contains(t, warnLine, expectedWarnMsg) } diff --git a/pkg/sdk/application.go b/pkg/sdk/application.go index 9509e02dc..226e0fecb 100644 --- a/pkg/sdk/application.go +++ b/pkg/sdk/application.go @@ -26,7 +26,7 @@ func (sdk *poktrollSDK) GetApplications(ctx context.Context, options GetApplicat return applications, nil } - // TODO_CONSIDERATION: Look into updating the on-chain `QueryAllApplicationRequest` for filtering + // TODO_CONSIDERATION: Look into updating the on-chain `QueryAllApplicationsRequest` for filtering // options to avoid needing to do it on the client side. for _, app := range applications { for _, delegatedGatewayAddress := range app.DelegateeGatewayAddresses { diff --git a/pkg/sdk/errors.go b/pkg/sdk/errors.go index fa42d684a..774fdf2f0 100644 --- a/pkg/sdk/errors.go +++ b/pkg/sdk/errors.go @@ -1,8 +1,6 @@ package sdk -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // TODO_TECHDEBT: Do a source code wise find-replace using regex pattern match // of `sdkerrors\.Wrapf\(([a-zA-Z]+), ` with `$1.Wrapf(` diff --git a/proto/poktroll/service/relay.proto b/proto/poktroll/service/relay.proto index 37ca25e2f..9b94a4d91 100644 --- a/proto/poktroll/service/relay.proto +++ b/proto/poktroll/service/relay.proto @@ -1,10 +1,10 @@ syntax = "proto3"; package poktroll.service; -import "poktroll/session/session.proto"; - option go_package = "github.com/pokt-network/poktroll/x/service/types"; +import "poktroll/session/session.proto"; + // Relay contains both the RelayRequest (signed by the Application) and the RelayResponse (signed by the Supplier). // The serialized tuple is inserted into the SMST leaves as values in the Claim/Proof lifecycle. message Relay { diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go index 56b047fec..b4e6c5466 100644 --- a/testutil/testkeyring/gen_accounts/gen.go +++ b/testutil/testkeyring/gen_accounts/gen.go @@ -1,3 +1,5 @@ +//go:build ignore + package main import ( From 4cc23fe21376c55aedf94430c358614647514899 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Tue, 20 Feb 2024 15:53:54 +0100 Subject: [PATCH 46/54] chore: base review improvements --- app/genesis.go | 4 +--- e2e/tests/init_test.go | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/genesis.go b/app/genesis.go index e4e849fc2..a3b05bf0c 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -1,8 +1,6 @@ package app -import ( - "encoding/json" -) +import "encoding/json" // GenesisState of the blockchain is represented here as a map of raw json // messages key'd by a identifier string. diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 6d98d1a2c..f1bcb422d 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -378,10 +378,10 @@ func (s *suite) buildAppMap() { s.Fatalf("error getting application list: %s", err) } s.pocketd.result = res - var resp apptypes.QueryAllApplicationResponse + var resp apptypes.QueryAllApplicationsResponse responseBz := []byte(strings.TrimSpace(res.Stdout)) s.cdc.MustUnmarshalJSON(responseBz, &resp) - for _, app := range resp.Application { + for _, app := range resp.Applications { accNameToAppMap[accAddrToNameMap[app.Address]] = app } } From 689123bd61e72ec6034d0acd9d5295ca1ff39044 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 21 Feb 2024 23:38:18 +0100 Subject: [PATCH 47/54] trigger CI Co-authored-by: Daniel Olshansky Co-authored-by: Redouane Lakrache Co-authored-by: h5law <53987565+h5law@users.noreply.github.com> Co-authored-by: Dima Kniazev From 2b6672e59c3fae35971b98c09db718a77e2e4623 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Feb 2024 17:33:11 -0800 Subject: [PATCH 48/54] `make go_test` works but a few TODOs: 1. Look at the new TODO_IN_THIS_PR added 2. Need to prevent endless creation of new `-E` files on macOS by filtering for `*.go` in proto_fix_self_import 3. Requires running `gco api/poktroll/application/genesis.pulsar.go api/poktroll/application/query.pulsar.go api/poktroll/session/query.pulsar.go` after `make proto_regen` 4. Need to make sure `make go_develop_and_test` works --- .gitignore | 4 ++++ Makefile | 46 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 9c6d636a9..98d96a18d 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,10 @@ localnet_config.yaml # `docusaurus/docs/infrastructure/localnet.md`, please do! # Ref: https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux localnet_config.yaml-e +# These are needed to ignore byproducts of `make proto_fix_self_import` +# Since sed functions different on macOS and Linux, we need to implement +# some workarounds by always using "sed -i'' -e" instead of just "sed -i -e". +api/poktroll/**/*.go-E # Relase artifacts produced by `ignite chain build --release` release diff --git a/Makefile b/Makefile index 5a700cfb6..6cf8777dd 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,15 @@ check_go_version: exit 1; \ fi +.PHONY: check_ignite_version +# Internal helper target - check ignite version +check_ignite_version: + @version=$$(ignite version 2>/dev/null | grep 'Ignite CLI version:' | awk '{print $$4}') ; \ + if [ "$$(printf "v28\n$$version" | sort -V | head -n1)" != "v28" ]; then \ + echo "Error: Version $$version is less than v28. Exiting with error." ; \ + exit 1 ; \ + fi + .PHONY: check_act # Internal helper target - check if `act` is installed check_act: @@ -139,30 +148,38 @@ warn_destructive: ## Print WARNING to the user ### Proto Helpers #### ####################### -.PHONY: proto_regen -proto_regen: ## Delete existing protobuf artifacts and regenerate them - find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm +.PHONY: proto_ignite_gen +proto_ignite_gen: ## Generate protobuf artifacts using ignite ignite generate proto-go --yes - $(MAKE) proto_fix_self_import +# TODO_IN_THIS_PR: Understand why Olshansky needs to run `gco api/poktroll/application/genesis.pulsar.go api/poktroll/application/query.pulsar.go api/poktroll/session/query.pulsar.go` +# TODO_IN_THIS_PR: Filter for `*.go` files .PHONY: proto_fix_self_import -proto_fix_self_import: ## TODO: explain +proto_fix_self_import: ## TODO_IN_THIS_PR: explain @for dir in $(wildcard ./api/poktroll/*/); do \ module=$$(basename $$dir); \ echo "Processing module $$module"; \ - grep -lRP '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ - echo "Modifying file: $$file"; \ - sed -i -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ - sed -i 's,'$$module'\.,,g' "$$file"; \ + grep -lER '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ + echo "Modifying file: $$file"; \ + sed -i'' -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ + sed -i'' -E 's,'$$module'\.,,g' "$$file"; \ done; \ done +.PHONY: proto_clean +proto_clean: ## Delete existing .pb.go or .pb.gw.go files + find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm + .PHONY: proto_clean_pulsar -proto_clean_pulsar: ## TODO: explain... - @find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' - find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm +proto_clean_pulsar: ## TODO_IN_THIS_PR: explain... + @find ./ -name "*.go" | xargs --no-run-if-empty sed -i'' -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' + find ./ -name "*.pulsar.go*" | xargs --no-run-if-empty rm $(MAKE) proto_regen - find ./ -name "*.go" | xargs --no-run-if-empty sed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + find ./ -name "*.go" | xargs --no-run-if-empty sed -i'' -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + +# TODO_IN_THIS_PR: Unclear where/when we shold be calling `proto_clean_pulsar` +.PHONY: proto_regen +proto_regen: proto_clean proto_ignite_gen proto_fix_self_import ## Regenerate protobuf artifacts ####################### ### Docker Helpers ### @@ -286,8 +303,9 @@ go_testgen_accounts: ## Generate test accounts for usage in test environments go generate ./testutil/testkeyring/keyring.go .PHONY: go_develop -go_develop: proto_regen go_mockgen ## Generate protos and mocks +go_develop: check_ignite_version proto_regen go_mockgen ## Generate protos and mocks +## TODO_IN_THIS_PR: Make this work again .PHONY: go_develop_and_test go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests From be076a9e06a6dac8c52b2bc9272421ec2e294f9c Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Feb 2024 17:56:16 -0800 Subject: [PATCH 49/54] Trying to get tilt running (not yet). Two frequent commands I need to re-run $ gco api/poktroll/application/genesis.pulsar.go api/poktroll/application/query.pulsar.go api/poktroll/session/query.pulsar.go $ find . -name "*.go-E*" | xargs rm --- Makefile | 19 +++++++++++++------ docusaurus/docs/infrastructure/localnet.md | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6cf8777dd..56d4238a1 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,6 @@ check_gh: fi; \ } - .PHONY: check_docker # Internal helper target - check if docker is installed check_docker: @@ -128,6 +127,15 @@ check_jq: fi; \ } +.PHONY: check_yq +# Internal helper target - check if `yq` is installed +check_yq: + { \ + if ( ! ( command -v yq >/dev/null )); then \ + echo "Seems like you don't have `yq` installed. Make sure you install it before continuing"; \ + exit 1; \ + fi; \ + } .PHONY: check_node # Internal helper target - check if node is installed @@ -170,6 +178,7 @@ proto_fix_self_import: ## TODO_IN_THIS_PR: explain proto_clean: ## Delete existing .pb.go or .pb.gw.go files find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm +# TODO_IN_THIS_PR: Can we consolidate this with `proto_clean` and use proper make targets instead of $(MAKE)? .PHONY: proto_clean_pulsar proto_clean_pulsar: ## TODO_IN_THIS_PR: explain... @find ./ -name "*.go" | xargs --no-run-if-empty sed -i'' -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' @@ -197,9 +206,7 @@ docker_wipe: check_docker warn_destructive prompt_user ## [WARNING] Remove all t ######################## .PHONY: localnet_up -localnet_up: ## Starts localnet - make proto_regen - make localnet_regenesis +localnet_up: proto_regen localnet_regenesis## Starts localnet tilt up .PHONY: localnet_down @@ -207,7 +214,7 @@ localnet_down: ## Delete resources created by localnet tilt down .PHONY: localnet_regenesis -localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file +localnet_regenesis: check_yq acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring # TODO_TECHDEBT: Currently the stake => power calculation is constant; however, cosmos-sdk # intends to make this parameterizable in the future. @@ -600,7 +607,7 @@ acc_initialize_pubkeys: ## Make sure the account keeper has public keys for all .PHONY: acc_initialize_pubkeys_warn_message acc_initialize_pubkeys_warn_message: ## Print a warning message about the need to run `make acc_initialize_pubkeys` - @printf "!!! YOU MUST RUN THE FOLLOWING COMMAND ONCE FOR E2E TESTS TO WORK AFTER THE NETWORK HAS STARTED!!!\n"\ + @printf "!!!!!!!!! YOU MUST RUN THE FOLLOWING COMMAND ONCE FOR E2E TESTS TO WORK AFTER THE NETWORK HAS STARTED !!!!!!!!!\n"\ "\t\tmake acc_initialize_pubkeys\n" ############## diff --git a/docusaurus/docs/infrastructure/localnet.md b/docusaurus/docs/infrastructure/localnet.md index 3883dface..4de4f5b18 100644 --- a/docusaurus/docs/infrastructure/localnet.md +++ b/docusaurus/docs/infrastructure/localnet.md @@ -85,7 +85,7 @@ If you need to modify Kubernetes resources in your local setup, follow these ste Clone the helm charts locally: ```bash -cd .. && git@github.com:pokt-network/helm-charts.git +cd .. && git clone git@github.com:pokt-network/helm-charts.git cd - ``` From a07fcc6247da6df2818378c9518eb1d06ba184eb Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Feb 2024 18:13:42 -0800 Subject: [PATCH 50/54] Got `tilt up` working with a few hacky workaroudns: - Needed to use a local `helm-charts` repo - Helm charts repo needed to be on branch `chore/v0.50-migration-celestia-da` --- docusaurus/docs/infrastructure/localnet.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docusaurus/docs/infrastructure/localnet.md b/docusaurus/docs/infrastructure/localnet.md index 4de4f5b18..4beaa6271 100644 --- a/docusaurus/docs/infrastructure/localnet.md +++ b/docusaurus/docs/infrastructure/localnet.md @@ -84,6 +84,9 @@ If you need to modify Kubernetes resources in your local setup, follow these ste Clone the helm charts locally: +TODO_TECHDEBT(@okdas): Embed `helm-charts` in this repo so we are always using a +local version. + ```bash cd .. && git clone git@github.com:pokt-network/helm-charts.git cd - From c806df38ede19792a9a25551a49464f4beafef25 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Feb 2024 19:10:32 -0800 Subject: [PATCH 51/54] E2E test functioning --- Makefile | 10 +++++----- config.yml | 8 ++++---- pkg/client/tx/client.go | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 56d4238a1..784d62966 100644 --- a/Makefile +++ b/Makefile @@ -167,10 +167,10 @@ proto_fix_self_import: ## TODO_IN_THIS_PR: explain @for dir in $(wildcard ./api/poktroll/*/); do \ module=$$(basename $$dir); \ echo "Processing module $$module"; \ - grep -lER '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ + ggrep -lRP '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ echo "Modifying file: $$file"; \ - sed -i'' -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ - sed -i'' -E 's,'$$module'\.,,g' "$$file"; \ + gsed -i'' -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ + gsed -i 's,'$$module'\.,,g' "$$file"; \ done; \ done @@ -181,10 +181,10 @@ proto_clean: ## Delete existing .pb.go or .pb.gw.go files # TODO_IN_THIS_PR: Can we consolidate this with `proto_clean` and use proper make targets instead of $(MAKE)? .PHONY: proto_clean_pulsar proto_clean_pulsar: ## TODO_IN_THIS_PR: explain... - @find ./ -name "*.go" | xargs --no-run-if-empty sed -i'' -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' + @find ./ -name "*.go" | xargs --no-run-if-empty gsed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' find ./ -name "*.pulsar.go*" | xargs --no-run-if-empty rm $(MAKE) proto_regen - find ./ -name "*.go" | xargs --no-run-if-empty sed -i'' -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + find ./ -name "*.go" | xargs --no-run-if-empty gsed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' # TODO_IN_THIS_PR: Unclear where/when we shold be calling `proto_clean_pulsar` .PHONY: proto_regen diff --git a/config.yml b/config.yml index 0165a4ea0..5e603e59b 100644 --- a/config.yml +++ b/config.yml @@ -88,11 +88,11 @@ genesis: denom: upokt application: params: - maxDelegatedGateways: 7 + max_delegated_gateways: "7" applicationList: - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 - delegateeGatewayAddresses: [] - serviceConfigs: + delegatee_gateway_addresses: [] + service_configs: - service: id: anvil name: "" @@ -115,4 +115,4 @@ genesis: denom: upokt service: params: - addServiceFee: 1000000000 + add_service_fee: "1000000000" diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go index f359ff14d..7564ddfbe 100644 --- a/pkg/client/tx/client.go +++ b/pkg/client/tx/client.go @@ -367,6 +367,7 @@ func (tClient *txClient) goSubscribeToOwnTxs(ctx context.Context) { tClient.txsMutex.Lock() // Check for a corresponding error channel in the map. + // TODO_IN_THIS_PR: This panic is caused when we run the following command: `make acc_initialize_pubkeys` txErrCh, ok := tClient.txErrorChans[txHashHex] if !ok { panic("Received tx event without an associated error channel.") From c2a0f123d1272f6e8ee53b41a1bc25b76c556b56 Mon Sep 17 00:00:00 2001 From: Dima Kniazev Date: Thu, 22 Feb 2024 19:25:05 -0800 Subject: [PATCH 52/54] [Makefile] Check if gnu grep and sed needs to be installed on MacOS (#397) --- Makefile | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 784d62966..208a14187 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,32 @@ APPGATE_SERVER ?= http://localhost:42069 POCKET_ADDR_PREFIX = pokt CHAIN_ID = poktroll +# Detect operating system +OS := $(shell uname -s) + +# Set default commands, will potentially be overridden on macOS +SED := sed +GREP := grep + +# macOS-specific adjustments +ifeq ($(OS),Darwin) + # Check for gsed and ggrep, suggest installation with Homebrew if not found + FOUND_GSED := $(shell command -v gsed) + FOUND_GGREP := $(shell command -v ggrep) + ifeq ($(FOUND_GSED),) + $(warning GNU sed (gsed) is not installed. Please install it using Homebrew by running: brew install gnu-sed) + SED := gsed # Assuming the user will install it, setting the variable in advance + else + SED := gsed + endif + ifeq ($(FOUND_GGREP),) + $(warning GNU grep (ggrep) is not installed. Please install it using Homebrew by running: brew install grep) + GREP := ggrep # Assuming the user will install it, setting the variable in advance + else + GREP := ggrep + endif +endif + #################### ### Dependencies ### #################### @@ -167,10 +193,10 @@ proto_fix_self_import: ## TODO_IN_THIS_PR: explain @for dir in $(wildcard ./api/poktroll/*/); do \ module=$$(basename $$dir); \ echo "Processing module $$module"; \ - ggrep -lRP '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ - echo "Modifying file: $$file"; \ - gsed -i'' -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ - gsed -i 's,'$$module'\.,,g' "$$file"; \ + $(GREP) -lRP '\s+'$$module' "github.com/pokt-network/poktroll/api/poktroll/'$$module'"' ./api/poktroll/$$module | while read -r file; do \ + echo "Modifying file: $$file"; \ + $(SED) -i -E 's,^[[:space:]]+'$$module'[[:space:]]+"github.com/pokt-network/poktroll/api/poktroll/'$$module'",,' "$$file"; \ + $(SED) -i 's,'$$module'\.,,g' "$$file"; \ done; \ done @@ -181,10 +207,10 @@ proto_clean: ## Delete existing .pb.go or .pb.gw.go files # TODO_IN_THIS_PR: Can we consolidate this with `proto_clean` and use proper make targets instead of $(MAKE)? .PHONY: proto_clean_pulsar proto_clean_pulsar: ## TODO_IN_THIS_PR: explain... - @find ./ -name "*.go" | xargs --no-run-if-empty gsed -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' - find ./ -name "*.pulsar.go*" | xargs --no-run-if-empty rm + @find ./ -name "*.go" | xargs --no-run-if-empty $(SED) -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' + find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm $(MAKE) proto_regen - find ./ -name "*.go" | xargs --no-run-if-empty gsed -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' + find ./ -name "*.go" | xargs --no-run-if-empty $(SED) -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' # TODO_IN_THIS_PR: Unclear where/when we shold be calling `proto_clean_pulsar` .PHONY: proto_regen From 0482dc96a26f0fd8f69f9a49133d370e86928cd1 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Feb 2024 21:10:07 -0800 Subject: [PATCH 53/54] Removed outdated doc files --- Makefile | 5 +- .../pkg/appgate_server/_category_.json | 8 - .../docs/packages/pkg/appgate_server/main.md | 193 --------- .../docs/packages/pkg/sdk/_category_.json | 8 - docusaurus/docs/packages/pkg/sdk/sdk.md | 365 ------------------ x/tokenomics/module/helpers_test.go | 3 +- 6 files changed, 4 insertions(+), 578 deletions(-) delete mode 100644 docusaurus/docs/packages/pkg/appgate_server/_category_.json delete mode 100644 docusaurus/docs/packages/pkg/appgate_server/main.md delete mode 100644 docusaurus/docs/packages/pkg/sdk/_category_.json delete mode 100644 docusaurus/docs/packages/pkg/sdk/sdk.md diff --git a/Makefile b/Makefile index 208a14187..725d54456 100644 --- a/Makefile +++ b/Makefile @@ -186,8 +186,6 @@ warn_destructive: ## Print WARNING to the user proto_ignite_gen: ## Generate protobuf artifacts using ignite ignite generate proto-go --yes -# TODO_IN_THIS_PR: Understand why Olshansky needs to run `gco api/poktroll/application/genesis.pulsar.go api/poktroll/application/query.pulsar.go api/poktroll/session/query.pulsar.go` -# TODO_IN_THIS_PR: Filter for `*.go` files .PHONY: proto_fix_self_import proto_fix_self_import: ## TODO_IN_THIS_PR: explain @for dir in $(wildcard ./api/poktroll/*/); do \ @@ -616,7 +614,8 @@ acc_balance_total_supply: ## Query the total supply of the network # transaction for its public key to be populated in the account keeper. As such, # the solution is to send funds from every account in genesis to some address # (PNF was selected ambigously) to make sure their public keys are populated. - +# TODO_TECHDEBT: One of the accounts involved in this command always errors +# so we need to understand why and fix it. .PHONY: acc_initialize_pubkeys acc_initialize_pubkeys: ## Make sure the account keeper has public keys for all available accounts $(eval ADDRESSES=$(shell make -s ignite_acc_list | grep pokt | awk '{printf "%s ", $$2}' | sed 's/.$$//')) diff --git a/docusaurus/docs/packages/pkg/appgate_server/_category_.json b/docusaurus/docs/packages/pkg/appgate_server/_category_.json deleted file mode 100644 index aeee27a8d..000000000 --- a/docusaurus/docs/packages/pkg/appgate_server/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "appgate-server", - "position": 3, - "link": { - "type": "generated-index", - "description": "AppGateServer Documentation" - } -} diff --git a/docusaurus/docs/packages/pkg/appgate_server/main.md b/docusaurus/docs/packages/pkg/appgate_server/main.md deleted file mode 100644 index a103e0c74..000000000 --- a/docusaurus/docs/packages/pkg/appgate_server/main.md +++ /dev/null @@ -1,193 +0,0 @@ ---- -title: AppGate Server -sidebar_position: 1 ---- - -# AppGate Server - -- [What is AppGate Server?](#what-is-appgate-server) -- [Architecture Overview](#architecture-overview) - - [Starting the AppGate Server](#starting-the-appgate-server) -- [Application Mode (self\_signing = true)](#application-mode-self_signing--true) - - [Application RPC Request Schema](#application-rpc-request-schema) -- [Gateway Mode (self\_signing = false)](#gateway-mode-self_signing--false) - - [Gateway RPC Request Schema](#gateway-rpc-request-schema) -- [POKTRollSDK integration](#poktrollsdk-integration) - -## What is AppGate Server? - -`AppGate Server` is a ready to use component that allows `Application`s and -`Gateway`s to relay RPC requests to the Pocket Network `Supplier`s without having -to manage the underlying logic of the protocol. - -An operator only needs to specify a single [configuration file](configs/appgate_server_config.md), -in order to run a sovereign `Application` or a `Gateway` via an `AppGate Server`. - -## Architecture Overview - -The following diagram captures a high-level overview of the `AppGate Server`'s message flow. - -```mermaid -flowchart TB - Client([Client]) - AGS(AppGate Server) - SDK[[POKTRollSDK]] - FN[Full Node] - S[Supplier] - - Client -- RPC Request --> AGS - AGS -- RPC Response --> Client - - AGS -..-> |Check Config| Mode{self_signing?} - Mode -. true .-> ApplicationMode(Application Mode) - Mode -. false .-> GatewayMode(Gateway Mode) - - ApplicationMode -- (AppPrivKey, AppAddr, ServiceId) --> SDK - GatewayMode -- (GatewayPrivKey, AppAddr, ServiceId) --> SDK - - SDK <-. Query \n Supplier list .-> FN - SDK <-- RelayRequest \n RelayResponse --> S - SDK -- RPC Response \n (After Signature Verification) --> AGS -``` - -### Starting the AppGate Server - -The `AppGate Server` could be configured to act as a `Gateway` or as a `Application`. - -It can be started by running the following command: - -```bash -poktrolld appgate-server \ - --config \ - --keyring-backend -``` - -Where `` is the path to the `.yaml` [appgate server config file](configs/appgate_server_config.md) -and `` is the backend to use for the keying. See the [cosmos documentation](https://docs.cosmos.network/v0.46/run-node/keyring.html) -for the full available set. - -Launching the `AppGate Server` starts an HTTP server that listens for incoming -RPC requests, and forwards them to the appropriate Pocket Network `Supplier`s. - -It takes care of things such as: - -- Querying and updating the list of `Supplier`s that are allowed to serve the - `Application` for given a `serviceId` during a given `session`. -- Selecting a `Supplier` to send the RPC request to. -- Appending the `Application`/`Gateway` ring-signature to the `RelayRequest` - before sending it to the `Supplier`. -- Sending the `RelayRequest` to the `Supplier`. -- Verifying the `Supplier`'s signature. -- Returning the `RelayResponse` to the requesting client - -## Application Mode (self_signing = true) - -If the [`self_signing`](configs/appgate_server_config.md#self_signing) field is -set to `true`, the `AppGate Server` will act as an `Application`. It will -only serve the address derived from the [`signing_key`](configs/appgate_server_config.md#signing_key). - -`RelayRequests` sent to the `AppGate Server` will be signed with the `signing_key` -resulting in a ring-signature that is only associated with the `Application`'s address. - -:::warning - -The `Application` MUST be sufficiently staked for the service being used as a -pre-requisite for the `AppGate Server` to properly service these requests. - -::: - -### Application RPC Request Schema - -When acting as an `Application`, the `AppGate Server` expects: - -- The `serviceId` to be part of the URL path -- The payload to be the body of the POST request -- The request should be sent to the [`listening_endpoint`](configs/appgate_server_config.md#listening_endpoint) specified in the config file - -The following `curl` command demonstrates how to send a JSON-RPC type request -to the `AppGate Server`: - -```bash -curl -X POST \ - http://:/ \ - -H 'Content-Type: application/json' \ - -d '{ - "jsonrpc": "2.0", - "method": "", - "params": [], - "id": 1 - }' -``` - -## Gateway Mode (self_signing = false) - -If the [`self_signing`](configs/appgate_server_config.md#self_signing) field -is set to `false`, then the `AppGate Server` will act as a `Gateway`, serving -`Application`s that delegated to the `Gateway` address represented by the -[`signing_key`](configs/appgate_server_config.md#signing_key). - -The `AppGate Server` will determine the `Application` address to use by extracting -it from the `senderAddr` query parameter and use it along with the `signing_key` to -generate a ring-signature associated with the `Application`'s and `Gateway`'s address. - -:::warning - -The `Gateway` and `Application` MUST be appropriately staked for this to work -with the `Application` also have sufficient stake to pay for the service in -order for this to work. - -::: - -### Gateway RPC Request Schema - -When acting as an `Gateway`, the `AppGate Server` expects: - -- The `serviceId` to be part of the URL path -- The `payload` to be the body of the POST request -- The `Application` address as a query parameter in the request URL -- The request should be sent to the [`listening_endpoint`](configs/appgate_server_config.md#listening_endpoint) specified in the config file - -The following `curl` command demonstrates how to send a JSON-RPC type request -to the `AppGate Server`: - -```bash -curl -X POST \ - http://:/?senderAddr= \ - -H 'Content-Type: application/json' \ - -d '{ - "jsonrpc": "2.0", - "method": "", - "params": [], - "id": 1 - }' -``` - -## POKTRollSDK integration - -The `AppGate Server` implementation uses the [POKTRollSDK](packages/pkg/sdk/sdk.md) to -interact with the Pocket Network. It can either be used directly or referenced on how -the `POKTRollSDK` can be used with a custom build `Application` / `Gateway`. -RPC requests to the Pocket Network. - -The `AppGate Server`'s own logic is responsible for: - -- Exposing the HTTP server that listens for incoming RPC requests. -- Extracting the `serviceId` and `Application` address from the RPC request. -- Calling `POKTRollSDK.GetSessionSupplierEndpoints` to get the list of `Supplier`s - that are allowed to serve the `Application` at a specific point in time. -- Selecting a `Supplier` to send the RPC request to. -- Calling the `POKTRollSDK.SendRelay` to send the `RelayRequest` to the selected - `Supplier`. -- Verifying and returning the `RelayResponse` to the RPC request sender. - -While `POKTRollSDK` manages: - -- Being up-to-date with the latest `Session`. -- Maintaining the list of `Supplier`s that are allowed to serve the `Application`. -- Forming the `RelayRequest` object. -- Creating the ring-signature for the `RelayRequest`. -- Sending the `RelayRequest` to the `Supplier`. -- Verifying the `Supplier`'s signature. - -A sequence diagram demonstrating the interaction between the `AppGate Server` and -the `POKTRollSDK` can be found in the [POKTRollSDK documentation](packages/pkg/sdk/sdk.md#poktrollsdk-sequence-diagram). diff --git a/docusaurus/docs/packages/pkg/sdk/_category_.json b/docusaurus/docs/packages/pkg/sdk/_category_.json deleted file mode 100644 index 4d762f5e6..000000000 --- a/docusaurus/docs/packages/pkg/sdk/_category_.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "label": "sdk", - "position": 3, - "link": { - "type": "generated-index", - "description": "PoktrollSDK General Documentation" - } -} diff --git a/docusaurus/docs/packages/pkg/sdk/sdk.md b/docusaurus/docs/packages/pkg/sdk/sdk.md deleted file mode 100644 index e2cf4e1bf..000000000 --- a/docusaurus/docs/packages/pkg/sdk/sdk.md +++ /dev/null @@ -1,365 +0,0 @@ ---- -title: POKTRollSDK -sidebar_position: 1 ---- - -# POKTRollSDK - -:::warning - -The `POKTRollSDK` is still in its early stages and it is subject to change. We -will try to keep the changes to a minimum and to keep the community informed of -any changes that could affect the `POKTRollSDK` consumers. - -::: - -- [What is the POKTRollSDK?](#what-is-the-poktrollsdk) -- [Target audience](#target-audience) - - [Applications](#applications) - - [Gateways](#gateways) -- [POKTRollSDK API](#poktrollsdk-api) - - [GetSessionSupplierEndpoints](#getsessionsupplierendpoints) - - [SendRelay](#sendrelay) - - [NewPOKTRollSDK](#newpoktrollsdk) - - [POKTRollSDKConfig](#poktrollsdkconfig) -- [POKTRollSDK usage](#poktrollsdk-usage) - - [Example usage](#example-usage) -- [POKTRollSDK sequence diagram](#poktrollsdk-sequence-diagram) -- [How to contribute](#how-to-contribute) -- [Where to get help](#where-to-get-help) - -## What is the POKTRollSDK? - -`POKTRollSDK` is a package that provides the necessary functionality and tools -to interact with Pocket Network's on-chain actors. Specifically, it provides the -libraries for `Gateway`s and `Application`s to interact with the `Supplier`s of -the Pocket Network that complies with the on-chain protocol specifications. - -Some examples of functionality the `POKTRollSDK` provides is: - -- Maintaining `Application` state and session metadata based on network height. -- Querying and updating the list of `Supplier`s that are allowed to serve the - `Application` based on the service requested. -- Sending relay requests to the selected `Supplier`. -- Appending `Application` signature to the relay requests and verifying `Supplier` - signature on relay responses. - -It lets `Application` and `Gateway` developers easily integrate the Pocket -relaying mechanism into their workflow while leaving room for customization of the -different aspects of the relay request and response lifecycle. - -## Target audience - -`POKTRollSDK` is intended to be used by `Gateway` and `Application` developers -who want to interact with the Pocket Network in a way that complies with the -Pocket Network's protocol. - -### Applications - -`Application`s that want to use the Pocket Network to **permissionlessly** query -the services provided by the network's `Supplier`s. - -Provided that the `Application` is appropriately staked, the `POKTRollSDK` enables -them to directly, without the use of a Gateway `Gateway`s, to query the `Supplier`s. - -The `POKTRollSDK` takes care of the following: - -- Query and maintain the `Application`s latest session based on network height. -- Provides a list of `Supplier`s that are allowed to serve the `Application`. -- Handle signing of `RelayRequest`s. -- Sending the `RelayRequest` to the selected `Supplier`. -- Verifying the `RelayResponse` signature. - -:::note -It is currently up to the `Application` to implement the desired strategy of -selecting the `Supplier` that will be serving them. -::: - -The following diagram shows the different components involved in the case of an -`Application` integrating the `POKTRollSDK` into their workflow. - -```mermaid -flowchart RL - SDK(POKTRollSDK) - App([Application logic]) - Sup[Supplier] - Node[PocketNode] - - subgraph Application runtime - SDK -. Suppliers list .-> App - App <-- Relay Req/Res
(selected Supplier)--> SDK - end - - SDK -. Txs .-> Node - Node -. Session .-> SDK - Node <-. websocket subscription .-> SDK - - SDK <-- Relay Req/Res --> Sup -``` - -### Gateways - -`Gateway`s are services that forward relay requests to `Supplier`s on behalf of -`Application`s. End-users that do not want or cannot run their own `Application` -logic, such as wallets, can use `Gateway`s to interact with the Pocket Network. - -By integrating the `POKTRollSDK` into their workflow, operators can permissionlessly -setup a `Gateway` that complies with the Pocket Network's protocol. - -Provided that a `Gateway` has staked the necessary amount of `POKT`, and that -a staked `Application` has delegated trust to them on-chain, the `Gateway` -can provide the `Application` with additional off-chain services. These can -include but are not limited to: - -- User Authentication -- Off-chain API charges in addition to the on-chain POKT cost for service -- Performance and Quality-of-Service logic to select the best `Supplier` - -The following diagram shows the different components involved in the case of a -`Gateway` integrating the `POKTRollSDK` into their workflow. - -```mermaid -flowchart RL - SDK(POKTRollSDK) - Gate[Gateway] - Sup[Supplier] - Network((Pocket Network)) - Node[PocketNode] - - subgraph Gateway infra - subgraph Gateway runtime - SDK -. Suppliers list .-> Gate - Gate <-- Relay Req/Res --> SDK - end - Node <-. websocket subscription .-> SDK - Node -. Session .-> SDK - end - - Network <-.-> Node - SDK <-- Relay Req/Res --> Sup - -``` - -## POKTRollSDK API - -:::tip -Visit `pkg/sdk/interface.go` for the latest version of the `POKTRollSDK` interface -as documentation can get out of date. -::: - -`POKTRollSDK` consists of an interface that exposes the following methods: - -```go -type POKTRollSDK interface { - GetSessionSupplierEndpoints( - ctx context.Context, - appAddress string, - serviceId string, - ) (session *SessionSuppliers, err error) - - SendRelay( - ctx context.Context, - sessionSupplierEndpoint *SingleSupplierEndpoint, - request *http.Request, - ) (response *servicetypes.RelayResponse, err error) -} -``` - -The interface, its implementation and the relevant types involved could be found -at the following directory [pkg/sdk/](https://github.com/pokt-network/poktroll/blob/main/pkg/sdk) - -```bash -pkg/sdk/ -├── deps_builder.go # Logic for auto-building the dependencies of the SDK -├── errors.go # Errors returned by the SDK -├── interface.go # POKTRollSDK interface -├── relay_verifier.go # Logic to verify relay responses -├── sdk.go # POKTRollSDK implementation and initialization function -├── send_relay.go # Logic to send relay requests -├── session.go # Logic to handle sessions and retrieve the suppliers list -└── urls.go # Helpers to parse the urls used by the SDK to interact with the Pocket Network -``` - -### GetSessionSupplierEndpoints - -_tl;dr Which Supplier can service my application in this session?_ - -`GetSessionSupplierEndpoints` returns a `SessionSuppliers` struct that contains -the fully-hydrated session corresponding to the `appAddress` and `serviceId` -provided and a list of `SingleSupplierEndpoint`s, where each `SingleSupplierEndpoint` -contains the necessary information to send a relay request to the `Supplier` it represents. - -The `POKTRollSDK` consumer is free to run any strategy to select a `Supplier` from -the list returned by the `GetSessionSupplierEndpoints` method. - -### SendRelay - -_tl;dr Send a relay request to a specific Supplier._ - -Once a `Supplier` is selected, the `POKTRollSDK` consumer can then pass the corresponding -`SingleSupplierEndpoint` to the `SendRelay` method which will take care of constructing -the `RelayRequest`, sending it to the `Supplier` and verifying the response signature. - -Once the `RelayRequest` is sent, the `SendRelay` method will wait for the `RelayResponse` -and verify its signature before returning it to the `POKTRollSDK` consumer. - -:::warning - -The error returned by the `SendRelay` only indicates that an error occurred during -the process of sending the `RelayRequest` or verifying the `RelayResponse` signature -and does not indicate errors returned by the `Supplier` or the requested service. -These ones should be available in the `RelayResponse` returned by the `SendRelay` -and the `POKTRollSDK` considers them as valid responses. - -::: - -### NewPOKTRollSDK - -_tl;dr Start a new stateful POKTRollSDK instance._ - -`NewPOKTRollSDK` is the initializing function that returns a fully functional -`POKTRollSDK` implementation given it's provided a valid `POKTRollSDKConfig` -struct which contains the necessary information to build the dependencies of the -`POKTRollSDK` implementation. - -```go -func NewPOKTRollSDK( - ctx context.Context, - config *POKTRollSDKConfig, -) (POKTRollSDK, error) -``` - -### POKTRollSDKConfig - -`POKTRollSDKConfig` is a struct that contains the necessary information to build -the dependencies needed by the `POKTRollSDK` implementation. - -```go -type POKTRollSDKConfig struct { - QueryNodeGRPCUrl *url.URL - QueryNodeUrl *url.URL - PrivateKey cryptotypes.PrivKey - Deps depinject.Config -} -``` - -It consists of the following fields: - -- `QueryNodeGRPCUrl` is the url of the Pocket Node's gRPC endpoint, used to query - the Pocket Network's state for sessions, account information, delegations, etc. -- `QueryNodeUrl` is the url of the Pocket Node's websocket endpoint, used to - subscribe to the Pocket Network's new block events needed to keep the - `POKTRollSDK` session information up to date. -- `PrivateKey` is the private key used to sign the relay requests. It could be - either the `Gateway` or the `Application` private key depending on the use case. -- `Deps` is a `depinject.Config` struct that contains the dependencies needed by - the `POKTRollSDK` implementation. It is used to inject the dependencies into the - `POKTRollSDK` implementation. This field is optional and if not provided, the - `POKTRollSDK` implementation will use the default dependencies. - -## POKTRollSDK usage - -In order to use the `POKTRollSDK` the consumer needs to: - -1. Import the `POKTRollSDK` package -2. Initialize a new `POKTRollSDK` instance by calling the `NewPOKTRollSDK` function - and providing an adequate `POKTRollSDKConfig` struct. -3. Call the `GetSessionSupplierEndpoints` method to get the `SessionSuppliers`. -4. Select a `Supplier` from the list of `SingleSupplierEndpoint`s returned. -5. Call the `SendRelay` method providing the selected `SingleSupplierEndpoint` and - the request to send. - -### Example usage - -:::warning - -The code below is for illustrative purposes only. It shows how `GetSessionSupplierEndpoints` -and `SendRelay` could be used in a simple scenario. It does not show how to handle -errors or how to select a `Supplier` from the list of `SingleSupplierEndpoint`s - -::: - -:::tip - -For a complete integration example, please refer to the [AppGateServer](https://github.com/pokt-network/poktroll/blob/main/pkg/appgateserver) package. - -::: - -```go -package main - -import sdk "github.com/pokt-network/poktroll/pkg/sdk" - -func main() { - - // Build the POKTRollSDKConfig struct - sdkConfig := sdk.POKTRollSDKConfig{ - QueryNodeGRPCUrl grpcURL, - QueryNodeUrl rpcURL - PrivateKey: privateKey, - // Deps are omitted and the default dependencies will be used - } - - // Initialize a new POKTRollSDK instance - poktrollSDK, err := sdk.NewPOKTRollSDK(ctx, &sdkConfig) - - // Get the session and the corresponding list of suppliers - sessionSuppliers, err := poktrollSDK.GetSessionSupplierEndpoints( - ctx, - appAddress, - serviceId, - ) - - // Naively select the first supplier from the list of SingleSupplierEndpoints - selectedSupplier := sessionSuppliers.SuppliersEndpoints[0] - - // Send the request to the selected supplier and wait for the response - response, err := poktrollSDK.SendRelay(ctx, selectedSupplier, httpRequest) -} -``` - -## POKTRollSDK sequence diagram - -The following diagram shows the sequence of events that take place when an `Application` -or a `Gateway` uses the `POKTRollSDK` to interact with the Pocket Network. - -```mermaid -sequenceDiagram - participant GA as Gateway/Application - participant SDK as POKTRollSDK - participant Node as PocketNode - participant Network as PocketNetwork - participant S as Supplier - - loop async network communication - Network -->> Node: Blocks subscription - Node -->> SDK: Event subscription - end - - %% Session Suppliers Retrieval - GA ->> +SDK: GetSessionSupplierEndpoints - SDK ->> +Node: GetSession - Node ->> -SDK: Session - SDK ->> -GA: SessionSuppliers - - %% Relay Propagation - GA ->> +SDK: SendRelay - SDK ->> +S: RelayRequest - S ->> -SDK: RelayResponse - SDK ->> -GA: RelayResponse -``` - -## How to contribute - -If you want to contribute to the `POKTRollSDK` you can take a look at the -[current issues](https://github.com/pokt-network/poktroll/labels/sdk) -and the project's [roadmap](https://github.com/orgs/pokt-network/projects/144) - -Feel free to open a new ticket and add the `sdk` label to it if you find a bug or -have a feature request. - -You can also open a PR if you want to contribute with a new feature or a bug fix. - -## Where to get help - -If you want to discuss the `POKTRollSDK`, you can join the [Pocket Network Discord](https://discord.gg/build-with-grove) server and head to the `#protocol-public` channel. diff --git a/x/tokenomics/module/helpers_test.go b/x/tokenomics/module/helpers_test.go index c1b9a7179..63545283c 100644 --- a/x/tokenomics/module/helpers_test.go +++ b/x/tokenomics/module/helpers_test.go @@ -5,9 +5,10 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/network" "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" ) // Dummy variable to avoid unused import error. From e637451ca3b10145e89e37f91df166febe6ced27 Mon Sep 17 00:00:00 2001 From: Daniel Olshansky Date: Thu, 22 Feb 2024 21:24:41 -0800 Subject: [PATCH 54/54] Remove TODO_IN_THIS_PR after running through reviewer.py a few times --- Makefile | 8 +++----- pkg/client/tx/client.go | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 725d54456..bfa7f0207 100644 --- a/Makefile +++ b/Makefile @@ -187,7 +187,7 @@ proto_ignite_gen: ## Generate protobuf artifacts using ignite ignite generate proto-go --yes .PHONY: proto_fix_self_import -proto_fix_self_import: ## TODO_IN_THIS_PR: explain +proto_fix_self_import: ## TODO_TECHDEBT(@bryanchriswhite): Add a proper explanation for this make target explaining why it's necessary @for dir in $(wildcard ./api/poktroll/*/); do \ module=$$(basename $$dir); \ echo "Processing module $$module"; \ @@ -202,15 +202,14 @@ proto_fix_self_import: ## TODO_IN_THIS_PR: explain proto_clean: ## Delete existing .pb.go or .pb.gw.go files find . \( -name "*.pb.go" -o -name "*.pb.gw.go" \) | xargs --no-run-if-empty rm -# TODO_IN_THIS_PR: Can we consolidate this with `proto_clean` and use proper make targets instead of $(MAKE)? +## TODO_TECHDEBT(@bryanchriswhite): Investigate if / how this can be integrated with `proto_regen` .PHONY: proto_clean_pulsar -proto_clean_pulsar: ## TODO_IN_THIS_PR: explain... +proto_clean_pulsar: ## TODO_TECHDEBT(@bryanchriswhite): Add a proper explanation for this make target explaining why it's necessary @find ./ -name "*.go" | xargs --no-run-if-empty $(SED) -i -E 's,(^[[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),///\1,' find ./ -name "*.pulsar.go" | xargs --no-run-if-empty rm $(MAKE) proto_regen find ./ -name "*.go" | xargs --no-run-if-empty $(SED) -i -E 's,^///([[:space:]_[:alnum:]]+"github.com/pokt-network/poktroll/api.+"),\1,' -# TODO_IN_THIS_PR: Unclear where/when we shold be calling `proto_clean_pulsar` .PHONY: proto_regen proto_regen: proto_clean proto_ignite_gen proto_fix_self_import ## Regenerate protobuf artifacts @@ -336,7 +335,6 @@ go_testgen_accounts: ## Generate test accounts for usage in test environments .PHONY: go_develop go_develop: check_ignite_version proto_regen go_mockgen ## Generate protos and mocks -## TODO_IN_THIS_PR: Make this work again .PHONY: go_develop_and_test go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests diff --git a/pkg/client/tx/client.go b/pkg/client/tx/client.go index 7564ddfbe..caf82ae69 100644 --- a/pkg/client/tx/client.go +++ b/pkg/client/tx/client.go @@ -367,7 +367,8 @@ func (tClient *txClient) goSubscribeToOwnTxs(ctx context.Context) { tClient.txsMutex.Lock() // Check for a corresponding error channel in the map. - // TODO_IN_THIS_PR: This panic is caused when we run the following command: `make acc_initialize_pubkeys` + // TODO_TECHDEBT(@bryanchriswhite): This panic is caused when we run the following command: `make acc_initialize_pubkeys` + // Need to understand why and resolve it. txErrCh, ok := tClient.txErrorChans[txHashHex] if !ok { panic("Received tx event without an associated error channel.")